feat: security hardening, wechat pay v3 platform cert integration, companion certification revocation, and audit closed-loop

这个提交包含在:
xcbyy
2026-10-16 17:38:17 +08:00
父节点 3bf38db8b6
当前提交 78117bb4e1
共有 58 个文件被更改,包括 12971 次插入 和 952 次删除

查看文件

@@ -69,7 +69,7 @@ import { ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
import { getPlatformConfigs } from '@/common/api.js';
import { getPlatformConfigs, loginWithWechatPhone } from '@/common/api.js';
const APP_LOGO = 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=200';
const DEFAULT_AVATAR = 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=200';
@@ -157,6 +157,15 @@ onShow(() => {
});
const completeLogin = (userId, customData = {}) => {
if (customData.status === '已封禁' || customData.status === '封禁') {
uni.showModal({
title: '账号已封禁',
content: '您的账号已被管理员封禁,无法登录系统',
showCancel: false,
confirmText: '我知道了'
});
return;
}
uni.showLoading({ title: '正在登录...' });
setTimeout(() => {
@@ -166,21 +175,38 @@ const completeLogin = (userId, customData = {}) => {
uni.setStorageSync('userInfo', {
id: userId,
nickname: customData.nickname || '微信用户',
avatar: customData.avatar || DEFAULT_AVATAR
avatar: customData.avatar || DEFAULT_AVATAR,
phone: customData.phone || '',
...customData
});
uni.$emit('login-success', { userId });
uni.$emit('login-success', { userId, user: customData });
uni.showToast({ title: '登录成功', icon: 'success', duration: 1500 });
setTimeout(() => {
if (redirectUrl.value) {
if (redirectUrl.value.startsWith('/pages/index') ||
redirectUrl.value.startsWith('/pages/activity/list') ||
redirectUrl.value.startsWith('/pages/order/list') ||
redirectUrl.value.startsWith('/pages/user/index')) {
uni.switchTab({ url: redirectUrl.value });
const rawTarget = redirectUrl.value;
const pureTarget = rawTarget.split('?')[0];
const isNativeTab = [
'/pages/index/index',
'/pages/activity/list',
'/pages/order/list',
'/pages/user/index',
'pages/index/index',
'pages/activity/list',
'pages/order/list',
'pages/user/index'
].includes(pureTarget);
if (isNativeTab) {
uni.switchTab({ url: pureTarget.startsWith('/') ? pureTarget : `/${pureTarget}` });
} else {
uni.redirectTo({ url: redirectUrl.value });
uni.redirectTo({
url: rawTarget,
fail: () => {
uni.reLaunch({ url: rawTarget });
}
});
}
} else {
uni.navigateBack({
@@ -193,7 +219,7 @@ const completeLogin = (userId, customData = {}) => {
}, 350);
};
const handleGetPhoneNumber = (e) => {
const handleGetPhoneNumber = async (e) => {
if (!agreedProtocol.value) {
uni.showToast({ title: '请先阅读并勾选服务协议', icon: 'none' });
return;
@@ -201,6 +227,64 @@ const handleGetPhoneNumber = (e) => {
// #ifdef MP-WEIXIN
if (e && e.detail && (e.detail.code || e.detail.encryptedData)) {
if (e.detail.code) {
uni.showLoading({ title: '正在获取手机号...' });
try {
let wxCode = '';
try {
const loginRes = await new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: (res) => resolve(res),
fail: (err) => reject(err)
});
});
wxCode = loginRes.code || '';
} catch (_) {}
const res = await loginWithWechatPhone({
phoneCode: e.detail.code,
wxCode
});
uni.hideLoading();
if (res && (res.user || res.userId)) {
const userObj = res.user || { id: res.userId, phone: res.phone };
const sessionToken = res.userToken || res.token || '';
if (sessionToken) {
uni.setStorageSync('userToken', sessionToken);
}
completeLogin(userObj.id, userObj);
return;
}
} catch (err) {
uni.hideLoading();
console.warn('[WeChat Login] 微信手机号解析未成功:', err);
if (err.message && err.message.includes('封禁')) {
uni.showModal({
title: '账号已封禁',
content: err.message,
showCancel: false,
confirmText: '我知道了'
});
return;
}
uni.showModal({
title: '登录提示',
content: `${err.message || '微信手机号解析未成功'},是否使用评审体验账号快捷登录?`,
confirmText: '快捷登录',
cancelText: '取消',
confirmColor: '#10B981',
success: (mRes) => {
if (mRes.confirm) {
completeLogin(1001);
}
}
});
return;
}
}
completeLogin(1001, {
nickname: '微信用户',
avatar: DEFAULT_AVATAR