index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view>
  3. <!-- <button @click="zhuce">注册ylht</button>
  4. <button @click="success">成功</button>
  5. <button @click="fail">失败</button>
  6. <button @click="huidiao">回调</button> -->
  7. <web-view src="https://test-api-open.chinaums.com/v1/visual-ai/face/garden-collect?authorization=OPEN-FORM-PARAM&appId=10037e6f6394f6e70163a6782676007d&timestamp=20240327172152&nonce=fd86f7c639f1485d9fc4331ba7e44b1e&content=%7B%22bizData%22%3A%224786A5744684ED70944768AF26F617BF56FDAE71B75AFDB562520EAB03FA6629AB14FAEF395F2DDA1A38341F9072DCFE8B270CECFE9A0298C6C8202233000EC2CB528048547DB2F0%22%2C%22notifyUrl%22%3A%22http%3A%2F%2F121.36.73.159%2Flnst%2Flrxx%2Freturn%22%2C%22redirectUrl%22%3A%22https%3A%2F%2Fwww.ccsckj.com%2F%22%2C%22type%22%3A%22action%22%2C%22usrId%22%3A%2212003170800100000019%22%7D&signature=pki99Qs5X0fRq0Bn5eitJ1TkIFx2v3wvDU0D8ptFYG0%3D"></web-view>
  8. </view>
  9. </template>
  10. <script>
  11. import jsTools from "uni_modules/leven-js-tools/index.js"
  12. export default {
  13. name: "my-file",
  14. data() {
  15. return {
  16. zczm: [],
  17. zczmList: [],
  18. limit: 5,
  19. };
  20. },
  21. watch: {
  22. },
  23. mounted() {
  24. },
  25. methods: {
  26. huidiao() {
  27. let url = "https://test-api-open.chinaums.com/v1/visual-ai/faceliveness/detect"
  28. let appKey = '5a735c9a42d1401da0e39516f2b3bef7'
  29. let desKey = 'A5D37C3D8502D503CC7B1EB62CEF4B79'
  30. let authorization = "OPEN-FORM-PARAM"
  31. let appId = "10037e6f6394f6e70163a6782676007d"
  32. let timestamp = '20240325153744'
  33. // let nonce = new Date().getTime()
  34. let nonce = '20240325153744'
  35. let content = ''
  36. // {
  37. // returnUrl: 'https://www.ccsckj.com/',
  38. // type: 'action'
  39. // }
  40. // Base64_Encode(HmacSHA256(appId + timestamp + nonce + SHA256_HEX(content), AppKey))
  41. let signature = uni.$lv.encrypt.base64Encode(uni.$lv.encrypt.hmacSha256(appId + timestamp + nonce + uni.$lv
  42. .encrypt.sha256(content), appKey))
  43. uni.request({
  44. url: url + '?authorization=' + authorization + "&appId=" + appId + "&timestamp=" + timestamp +
  45. "&nonce=" + nonce + "&content=" + content + "&signature=" + signature,
  46. method: 'GET',
  47. }).then(res => {
  48. console.log(res);
  49. })
  50. },
  51. zhuce() {
  52. // todo 3DES
  53. let result = uni.$lv.encrypt.hmacSha256("abcdefg123456这是一条加密字符串7892345",
  54. "u$DCc!tjdYn%wP!hE3Ya%qVCWKUX9p4N");
  55. result = uni.$lv.encrypt.sha256("abcdefg123456这是一条加密字符串7892345");
  56. result = uni.$lv.encrypt.base64Encode("KNGT^$Sat#je5VX9Hdp3Y@kLUTegwg82这是一条加密字符串");
  57. result = uni.$lv.validate.isWechat();
  58. uni.$lv.func.toast(result);
  59. },
  60. success() {
  61. uni.navigateTo({
  62. url: '/pages/living/success'
  63. })
  64. },
  65. fail() {
  66. uni.navigateTo({
  67. url: '/pages/living/fail'
  68. })
  69. },
  70. }
  71. }
  72. </script>
  73. <style>
  74. </style>