From b5792a5c688d42211000df548e76de0f41789088 Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 8 Apr 2025 15:07:38 +0800 Subject: [PATCH] 321 --- common/request.js | 19 ++- pages/infinite/reward_records.vue | 259 +++++++++++++++++------------- pages/user/login.vue | 15 -- 3 files changed, 158 insertions(+), 135 deletions(-) diff --git a/common/request.js b/common/request.js index 8e747e8..ce3b835 100644 --- a/common/request.js +++ b/common/request.js @@ -21,6 +21,7 @@ class RequestManager { * @returns {Promise} 返回请求Promise */ static request(param, backpage, backtype) { + return new Promise((resolve, reject) => { // 参数检查 if (!param || typeof param !== 'object') { @@ -86,19 +87,19 @@ class RequestManager { if (data) { // 添加时间戳参数 data.timestamp = Math.floor(Date.now() / 1000); - + // 按照键名对参数进行排序 const sortedParams = {}; Object.keys(data).sort().forEach(key => { sortedParams[key] = data[key]; }); - + // 组合参数为字符串 let signStr = ''; for (const key in sortedParams) { signStr += key + '=' + sortedParams[key] + '&'; } - + // 获取当前请求的域名和时间戳,组合为密钥 // 使用正则表达式从URL中提取主机名 const hostRegex = /^(?:https?:\/\/)?([^\/]+)/i; @@ -106,18 +107,18 @@ class RequestManager { const host = matches && matches[1] ? matches[1] : 'localhost'; const timestamp = data.timestamp; const appSecret = host + timestamp; - + // 添加密钥并去除最后的& signStr = signStr.substring(0, signStr.length - 1) + appSecret; console.log(signStr); - + // 使用MD5生成签名 const sign = md5(signStr); - + // 添加签名到请求参数 data.sign = sign; } - + header = { 'content-type': 'application/json', token: token, @@ -194,7 +195,9 @@ class RequestManager { }) }, 100) uni.redirectTo({ - url: '/pages/user/login' + url: '/pages/user/login', + // animationType: 'pop-in', + // animationDuration: 500 }) reject(res.data) } else { diff --git a/pages/infinite/reward_records.vue b/pages/infinite/reward_records.vue index 5f7e8cb..a706f9c 100644 --- a/pages/infinite/reward_records.vue +++ b/pages/infinite/reward_records.vue @@ -1,137 +1,172 @@ \ No newline at end of file diff --git a/pages/user/login.vue b/pages/user/login.vue index c77fc4d..86ac9fb 100644 --- a/pages/user/login.vue +++ b/pages/user/login.vue @@ -44,15 +44,6 @@ 授权登录 - - @@ -209,13 +200,7 @@ h5UserProfile() { var that = this; console.log('进入h5') - //http://api.zpc-xy.com/login.html - //http://192.168.195.30:8080/#/pages/user/login?code=021gjuFa1F8OOH0uLeJa1T5fMh4gjuFA&state=STATE - //http://192.168.195.30:8080/pages/user/login pages/user/wxlogin - - // var redirect_uri = escape(this.$loginPage); window.location.href = this.$wxloginPage; - // `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0e33d80d35e4a3b1&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`; }, getdata() { let that = this