feat: 接入三tab导航(首页/中奖记录/我的)、活动规则静态页、奖品详情弹窗;接口切换hnlylaw并透传authorization;缓存键统一Sft后缀;问卷ID切1005;注册增加收货地址;答题计时精确到0.01s及交互优化
This commit is contained in:
+38
-20
@@ -1,28 +1,46 @@
|
||||
import { Encrypt, Decrypt } from '@/js_sdk/cainiao-crypto/cainiao-crypto.js'
|
||||
|
||||
const install = (Vue, vm) => {
|
||||
const lylawPost = (url, params = {}) => Vue.prototype.$u.post(url, { request: Encrypt(JSON.stringify(params)) }).then(res => {
|
||||
if (res && res.Data) {
|
||||
if (res.Data === 'VFXeGhPbmE9mfQeg2iiwdA==') {
|
||||
res.Data = null
|
||||
} else {
|
||||
try { res.Data = JSON.parse(Decrypt(res.Data)) } catch (e) {}
|
||||
const LYLAW_BASE = '/lylaw/api/hnlylaw'
|
||||
const lylawPost = (url, params = {}) => {
|
||||
console.log('[原始参数]', url, JSON.stringify(params));
|
||||
return Vue.prototype.$u.post(url, { request: Encrypt(JSON.stringify(params)) }).then(res => {
|
||||
if (res && res.Data) {
|
||||
if (res.Data === 'VFXeGhPbmE9mfQeg2iiwdA==') {
|
||||
res.Data = null
|
||||
} else {
|
||||
try { res.Data = JSON.parse(Decrypt(res.Data)) } catch (e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
})
|
||||
if (url.indexOf('wxOpenidLogin') > -1 && res) {
|
||||
const pickAuth = obj => {
|
||||
if (!obj || typeof obj !== 'object') return ''
|
||||
const k = Object.keys(obj).find(x => x.toLowerCase() === 'authorization')
|
||||
return k ? obj[k] : ''
|
||||
}
|
||||
const auth = pickAuth(res.Data) || pickAuth(res)
|
||||
if (auth) {
|
||||
uni.setStorageSync('authorizationSft', auth)
|
||||
console.log('[authorization已缓存]', auth)
|
||||
}
|
||||
}
|
||||
console.log('[解密返回]', url, JSON.stringify(res));
|
||||
return res
|
||||
})
|
||||
}
|
||||
Vue.prototype.$u.api = {
|
||||
getWxOpenId: (code) => lylawPost('/lylaw/api/lylaw/getWxOpenId', { code }),
|
||||
wxOpenidLogin: (data) => lylawPost('/lylaw/api/lylaw/wxOpenidLogin', data),
|
||||
sendSms: (phone) => lylawPost('/lylaw/api/lylaw/sendAliSms', { phone }),
|
||||
userRegist: (data) => lylawPost('/lylaw/api/lylaw/userRegist', data),
|
||||
queryWenjuanQA: (data) => lylawPost('/lylaw/api/lylaw/queryWenjuanQA', data),
|
||||
submitQA: (data) => lylawPost('/lylaw/api/lylaw/submitQA', data),
|
||||
getWenjuanPhb: (data) => lylawPost('/lylaw/api/lylaw/getWenjuanPhb', data),
|
||||
getChouJiangResult: (data) => lylawPost('/lylaw/api/lylaw/getChouJiangResult', data),
|
||||
addScore: (data) => lylawPost('/lylaw/api/lylaw/addScore', data),
|
||||
getUserHisResultList: (data) => lylawPost('/lylaw/api/lylaw/getUserHisResultList', data),
|
||||
getUserHisResultDetail: (data) => lylawPost('/lylaw/api/lylaw/getUserHisResultDetail', data)
|
||||
getWxOpenId: (code) => lylawPost(`${LYLAW_BASE}/getWxOpenId`, { code }),
|
||||
wxOpenidLogin: (data) => lylawPost(`${LYLAW_BASE}/wxOpenidLogin`, data),
|
||||
sendSms: (phone) => lylawPost(`${LYLAW_BASE}/sendAliSms`, { phone }),
|
||||
userRegist: (data) => lylawPost(`${LYLAW_BASE}/userRegist`, data),
|
||||
queryWenjuanQA: (data) => lylawPost(`${LYLAW_BASE}/queryWenjuanQA`, data),
|
||||
submitQA: (data) => lylawPost(`${LYLAW_BASE}/submitQA`, data),
|
||||
getWenjuanPhb: (data) => lylawPost(`${LYLAW_BASE}/getWenjuanPhb`, data),
|
||||
getChouJiangResult: (data) => lylawPost(`${LYLAW_BASE}/getChouJiangResult`, data),
|
||||
addScore: (data) => lylawPost(`${LYLAW_BASE}/addScore`, data),
|
||||
getUserHisResultList: (data) => lylawPost(`${LYLAW_BASE}/getUserHisResultList`, data),
|
||||
getUserHisResultDetail: (data) => lylawPost(`${LYLAW_BASE}/getUserHisResultDetail`, data),
|
||||
getWenjuanWinDetailList: (data) => lylawPost(`${LYLAW_BASE}/getWenjuanWinDetailList`, data)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user