feat: 新增sw(税务)与hj(生态环境)专区模块;自制hj/sw-tabbar底栏;hj-web内嵌阅读(双指缩放);hnlylaw三活动authorization隔离(Sft/Sw/Hj);缓存键Hj后缀;问卷1006/1007;home专区入口接线;sw/hj规则与隐私文案、学习清单及链接校修复

This commit is contained in:
lcj
2026-11-11 15:20:20 +08:00
parent ead48745c2
commit 8a1ff90d6b
30 changed files with 6365 additions and 40 deletions
+19 -6
View File
@@ -3,8 +3,21 @@ import { Encrypt, Decrypt } from '@/js_sdk/cainiao-crypto/cainiao-crypto.js'
const install = (Vue, vm) => {
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 => {
const payload = Object.assign({}, params)
const forceSw = payload.__sw === true
const forceHj = payload.__hj === true
delete payload.__sw
delete payload.__hj
let authKey = 'authorizationSft'
if (forceSw || payload.wenjuan_id == 1006 || payload.wenjuanId == 1006) {
authKey = 'authorizationSw'
} else if (forceHj || payload.wenjuan_id == 1007 || payload.wenjuanId == 1007) {
authKey = 'authorizationHj'
}
const auth = uni.getStorageSync(authKey)
const header = auth ? { authorization: auth } : {}
console.log('[原始参数]', url, JSON.stringify(payload));
return Vue.prototype.$u.post(url, { request: Encrypt(JSON.stringify(payload)) }, header).then(res => {
if (res && res.Data) {
if (res.Data === 'VFXeGhPbmE9mfQeg2iiwdA==') {
res.Data = null
@@ -18,10 +31,10 @@ const install = (Vue, vm) => {
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)
const a = pickAuth(res.Data) || pickAuth(res)
if (a) {
uni.setStorageSync(authKey, a)
console.log('[authorization已缓存]', authKey, a)
}
}
console.log('[解密返回]', url, JSON.stringify(res));
+2 -18
View File
@@ -15,24 +15,8 @@ const install = (Vue, vm) => {
});
// 请求拦截,配置Token等参数
Vue.prototype.$u.http.interceptor.request = (config) => {
// config.header.Token = 'xxxxxx';
// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
// config.header.token = vm.token;
// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
// config.header.token = vm.$store.state.token;
// 方式三,如果token放在了globalData,通过getApp().globalData获取
// config.header.token = getApp().globalData.username;
// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
const authorization = uni.getStorageSync('authorizationSft');
if (authorization) {
config.header.authorization = authorization;
}
return config;
// authorization 由 http.api.js 中 lylawPost 按活动(wenjuan_id)逐请求注入,此处不再全局设置
return config;
}
// 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = (res) => {