diff --git a/common/http.api.js b/common/http.api.js index 1ee929a..f2a2df9 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -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) }; } diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 144db35..3c9fb4f 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -27,10 +27,12 @@ const install = (Vue, vm) => { // config.header.token = getApp().globalData.username; // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 - const token = uni.getStorageSync('token'); - config.header.Authorization = 'Bearer '+token; - - return config; + const authorization = uni.getStorageSync('authorizationSft'); + if (authorization) { + config.header.authorization = authorization; + } + + return config; } // 响应拦截,判断状态码是否通过 Vue.prototype.$u.http.interceptor.response = (res) => { diff --git a/manifest.json b/manifest.json index aef23a3..8f4be57 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "学法送演唱会门票", + "name" : "“法润三湘”全民学法答题活动", "appid" : "__UNI__5E36099", "description" : "", "versionName" : "1.0.0", @@ -71,7 +71,7 @@ "vueVersion" : "2", "h5" : { "router" : { - "base" : "/llpreheat/" + "base" : "/xfhm/" } } } diff --git a/pages.json b/pages.json index 13247bd..0a7cb4d 100644 --- a/pages.json +++ b/pages.json @@ -3,6 +3,12 @@ "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" }, "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/home/home", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/index/index", "style": { @@ -39,12 +45,6 @@ "navigationStyle": "custom" } }, -{ - "path": "pages/record-detail/record-detail", - "style": { - "navigationStyle": "custom" - } - }, { "path": "pages/rules/rules", "style": { @@ -56,11 +56,53 @@ "style": { "navigationStyle": "custom" } + }, + { + "path": "pages/study/preview", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/win-records/win-records", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/profile/profile", + "style": { + "navigationStyle": "custom" + } } ], + "tabBar": { + "backgroundColor": "#FFEBBC", + "borderStyle": "white", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/shouye.png", + "selectedIconPath": "static/shouye_select.png", + "text": "首页" + }, + { + "pagePath": "pages/win-records/win-records", + "iconPath": "static/zhongjiangjilu.png", + "selectedIconPath": "static/zhongjiangjilu_select.png", + "text": "中奖记录" + }, + { + "pagePath": "pages/profile/profile", + "iconPath": "static/wode.png", + "selectedIconPath": "static/wode_select.png", + "text": "我的" + } + ] + }, "globalStyle": { "navigationBarTextStyle": "black", - "navigationBarTitleText": "学法送演唱会门票", + "navigationBarTitleText": "“法润三湘”全民学法答题活动", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" }, diff --git a/pages/answer/answer.vue b/pages/answer/answer.vue index 4f25081..bb892a2 100644 --- a/pages/answer/answer.vue +++ b/pages/answer/answer.vue @@ -10,7 +10,7 @@ + + \ No newline at end of file diff --git a/pages/win-records/win-records.vue b/pages/win-records/win-records.vue new file mode 100644 index 0000000..d20dbdf --- /dev/null +++ b/pages/win-records/win-records.vue @@ -0,0 +1,446 @@ + + + + + \ No newline at end of file diff --git a/static/shouye.png b/static/shouye.png new file mode 100644 index 0000000..2fe28db Binary files /dev/null and b/static/shouye.png differ diff --git a/static/shouye_select.png b/static/shouye_select.png new file mode 100644 index 0000000..6f88cd0 Binary files /dev/null and b/static/shouye_select.png differ diff --git a/static/wode.png b/static/wode.png new file mode 100644 index 0000000..6167289 Binary files /dev/null and b/static/wode.png differ diff --git a/static/wode_select.png b/static/wode_select.png new file mode 100644 index 0000000..fbb869a Binary files /dev/null and b/static/wode_select.png differ diff --git a/static/zhongjiangjilu.png b/static/zhongjiangjilu.png new file mode 100644 index 0000000..381e50d Binary files /dev/null and b/static/zhongjiangjilu.png differ diff --git a/static/zhongjiangjilu_select.png b/static/zhongjiangjilu_select.png new file mode 100644 index 0000000..55ace72 Binary files /dev/null and b/static/zhongjiangjilu_select.png differ