diff --git a/App.vue b/App.vue index eebadb1..8baccb7 100644 --- a/App.vue +++ b/App.vue @@ -222,4 +222,19 @@ button.hide { .uni-tabbar__icon { height: 50px !important; } + +@keyframes m-zoom { + 0% { + transform: scale(1); + } + + 50% { + transform: scale(0.9); + } + + 100% { + transform: scale(1); + } +} + diff --git a/common/request.js b/common/request.js index 63a7bc3..26e256f 100644 --- a/common/request.js +++ b/common/request.js @@ -25,6 +25,14 @@ class RequestManager { return whitelistUrls.some(whiteItem => url.indexOf(whiteItem) > -1) } + /** + * 生成唯一的nonce值 + * @returns {String} nonce值 + */ + static generateNonce() { + return md5(Date.now() + Math.random().toString(36).substring(2, 15)); + } + /** * 发送网络请求 * @param {Object} param 请求参数 @@ -43,7 +51,7 @@ class RequestManager { return new Promise((resolve, reject) => { // 参数检查 if (!param || typeof param !== 'object') { - reject(new Error('请求参数错误11')) + reject(new Error('请求参数错误')) return } @@ -90,9 +98,48 @@ class RequestManager { console.log('请求URL:', requestUrl) + // 使用正则表达式从URL中提取主机名 + const hostRegex = /^(?:https?:\/\/)?([^\/]+)/i + const matches = requestUrl.match(hostRegex) + const host = matches && matches[1] ? matches[1] : 'localhost' + let header = {} + // 添加签名和防重放攻击参数 + // 1. 添加时间戳 + data.timestamp = Math.floor(Date.now() / 1000) + // 2. 添加nonce随机字符串 + data.nonce = RequestManager.generateNonce() + if (method.toUpperCase() == 'POST') { + // 按照键名对参数进行排序 + const sortedParams = {} + Object.keys(data).sort().forEach(key => { + sortedParams[key] = data[key] + }) + + // 组合参数为字符串 + let signStr = '' + for (const key in sortedParams) { + if (typeof sortedParams[key] === 'object') { + signStr += key + '=' + JSON.stringify(sortedParams[key]) + '&' + } else { + signStr += key + '=' + sortedParams[key] + '&' + } + } + + // 获取时间戳,组合为密钥 + 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/x-www-form-urlencoded', client: client, @@ -102,41 +149,32 @@ class RequestManager { } } else { // GET请求,添加签名 - if (data) { - // 添加时间戳参数 - data.timestamp = Math.floor(Date.now() / 1000); + // 按照键名对参数进行排序 + const sortedParams = {} + Object.keys(data).sort().forEach(key => { + sortedParams[key] = data[key] + }) - // 按照键名对参数进行排序 - 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; - const matches = requestUrl.match(hostRegex); - 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; + // 组合参数为字符串 + let signStr = '' + for (const key in sortedParams) { + signStr += key + '=' + sortedParams[key] + '&' } + // 获取时间戳,组合为密钥 + 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, diff --git a/components/banner/banner.vue b/components/banner/banner.vue index 0cc54f1..0a27dfd 100644 --- a/components/banner/banner.vue +++ b/components/banner/banner.vue @@ -4,17 +4,17 @@ - - + + - + - + - + @@ -37,7 +37,12 @@ export default { height: { type: [Number, String], default: 465 - } + }, + // 图片自定义样式 + imgWidth: { + type: Number, + default: 92 + }, }, data() { return { @@ -63,55 +68,17 @@ export default { } }); }, - + // 轮播切换事件 swChange(e) { this.swCur = e.detail.current; }, - + // 点击轮播图跳转 navTo(item) { - /* 领券中心 */ - if (item.ttype == 1) { - this.$c.to({ - url: '/package/index/coupon-center', - query: { - coupon_id: item.coupon_id - } - }) - } + this.$c.navTo(item); - if (item.goods_id > 0) { - if (item.ttype == 2) { - /* 一番赏 */ - this.$c.to({ - url: '/pages/shouye/detail', - query: { - goods_id: item.goods_id - } - }) - } - /* 无限赏 */ - if (item.ttype == 3) { - this.$c.to({ - url: '/pages/shouye/detail_wuxian', - query: { - goods_id: item.goods_id - } - }) - } - - /* 连击赏 */ - if (item.ttype == 4) { - this.$c.to({ - url: '/package/index/lian-ji', - query: { - goods_id: item.goods_id - } - }) - } - } } } } @@ -133,7 +100,7 @@ export default { } /* 允许插槽内的元素可以被点击 */ -.banner-slot-container > * { +.banner-slot-container>* { pointer-events: auto; } @@ -157,7 +124,7 @@ export default { position: absolute; bottom: 20rpx; width: 100%; - + &-item { width: 12rpx; height: 12rpx; @@ -165,7 +132,7 @@ export default { background-color: rgba(255, 255, 255, 0.5); margin: 0 5rpx; transition: all 0.3s; - + &.act { width: 24rpx; border-radius: 6rpx; @@ -173,4 +140,4 @@ export default { } } } - \ No newline at end of file + \ No newline at end of file diff --git a/components/float-ball/FloatBall.vue b/components/float-ball/FloatBall.vue new file mode 100644 index 0000000..a2ef2c3 --- /dev/null +++ b/components/float-ball/FloatBall.vue @@ -0,0 +1,146 @@ + + + + + \ No newline at end of file diff --git a/components/rule-pop/rule-pop.vue b/components/rule-pop/rule-pop.vue index 5186e3a..a5828eb 100644 --- a/components/rule-pop/rule-pop.vue +++ b/components/rule-pop/rule-pop.vue @@ -6,8 +6,11 @@ {{ ruleData.title }} - - + + + + + @@ -28,116 +31,137 @@ \ No newline at end of file diff --git a/pages/mall/index.vue b/pages/mall/index.vue index 586b14b..85aebc8 100644 --- a/pages/mall/index.vue +++ b/pages/mall/index.vue @@ -1,87 +1,81 @@ @@ -252,7 +248,7 @@ export default { if (this.zhifu == 1) { } - + }, confirmSubmit(type) { diff --git a/pages/shouye/index.vue b/pages/shouye/index.vue index 83e6267..7a57c26 100644 --- a/pages/shouye/index.vue +++ b/pages/shouye/index.vue @@ -7,24 +7,16 @@ - - - - - - - - - - + + + - - - - - - - 添加客服领优惠 - 识别图中二维码 - - - - - - - + @@ -159,30 +133,12 @@ - - - - - - - - - - - - - + + @@ -191,535 +147,758 @@ \ No newline at end of file diff --git a/pages/user/index.vue b/pages/user/index.vue index 047be42..46fd4ba 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -4,7 +4,7 @@ :fixed="false"> -