index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. console.log("url:", url);
  44. console.log("appKey:", appKey);
  45. console.log("desKey:", desKey);
  46. console.log("authorization:", authorization);
  47. console.log("appId:", appId);
  48. console.log("timestamp:", timestamp);
  49. console.log("nonce:", nonce);
  50. console.log("content:", content);
  51. console.log("content111:", uni.$lv.encrypt.sha256(content));
  52. console.log("signature:", signature);
  53. uni.request({
  54. url: url + '?authorization=' + authorization + "&appId=" + appId + "&timestamp=" + timestamp +
  55. "&nonce=" + nonce + "&content=" + content + "&signature=" + signature,
  56. method: 'GET',
  57. }).then(res => {
  58. console.log(res);
  59. })
  60. },
  61. zhuce() {
  62. // todo 3DES
  63. let result = uni.$lv.encrypt.hmacSha256("abcdefg123456这是一条加密字符串7892345",
  64. "u$DCc!tjdYn%wP!hE3Ya%qVCWKUX9p4N");
  65. console.log("HmacSHA256:", result);
  66. result = uni.$lv.encrypt.sha256("abcdefg123456这是一条加密字符串7892345");
  67. console.log("SHA256_HEX:", result);
  68. result = uni.$lv.encrypt.base64Encode("KNGT^$Sat#je5VX9Hdp3Y@kLUTegwg82这是一条加密字符串");
  69. console.log("Base64_Encode:", result);
  70. result = uni.$lv.validate.isWechat();
  71. uni.$lv.func.toast(result);
  72. console.log("微信:", result);
  73. },
  74. success() {
  75. uni.navigateTo({
  76. url: '/pages/living/success'
  77. })
  78. },
  79. fail() {
  80. uni.navigateTo({
  81. url: '/pages/living/fail'
  82. })
  83. },
  84. }
  85. }
  86. </script>
  87. <style>
  88. </style>