From a79ef58513794e60fd48b56c5b68f66cfb489ce1 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 10 Jul 2025 20:19:31 +0800 Subject: [PATCH] 222 --- common/system/request.js | 6 +- common/utils.js | 11 +- pages/me/account-login.vue | 499 +++++++++++++++++++------------------ 3 files changed, 261 insertions(+), 255 deletions(-) diff --git a/common/system/request.js b/common/system/request.js index 83489e2..6e31fb0 100644 --- a/common/system/request.js +++ b/common/system/request.js @@ -9,6 +9,7 @@ import { normalizeResponseKeys, getRouteMap } from '@/common/system/routeMap.js' import { platform } from '@/common/platform/PlatformFactory'; import { getLocalStorage, setLocalStorage } from './cacheService'; import qs from 'qs'; +import { getOS } from '@/common/utils' class HttpRequest { /** * 生成唯一的nonce值 @@ -121,12 +122,13 @@ class HttpRequest { // 创建签名并准备请求数据和头信息 const { data: signedData } = HttpRequest._createSignature(data, host); data = signedData; - + let os = getOS(); // 根据请求方法设置不同的headers const header = { platform: client, token: token, version: platform.getVersion(), + os: os, 'content-type': requestMethod === 'POST' ? 'application/x-www-form-urlencoded' : 'application/json' @@ -203,7 +205,7 @@ class HttpRequest { console.log('getOrCache', cacheKey, '缓存命中'); return cacheData; } - + const res = await HttpRequest.request(url, data, 'GET', showLoading); setLocalStorage(cacheKey, res, time); return res; diff --git a/common/utils.js b/common/utils.js index dce3f49..7380b7a 100644 --- a/common/utils.js +++ b/common/utils.js @@ -123,7 +123,7 @@ export function wxAppLogin() { uni.login({ provider: 'weixin', onlyAuthorize: true, - success: async function(loginRes) { + success: async function (loginRes) { console.log("loginResloginResloginRes", loginRes); if (loginRes.code) { const userInfo = await getUserWxInfo(loginRes.code); @@ -145,23 +145,26 @@ export function wxAppLogin() { } return; }, - fail: function(e) { + fail: function (e) { console.log(e); uni.hideLoading(); } }); }); } - +let os = ''; /** * */ export function getOS() { + if (os != '') { + return os; + } // #ifdef APP-PLUS const systemInfo = uni.getSystemInfoSync(); return systemInfo.platform === 'ios' ? 'ios' : 'android'; // #endif // 非 App 环境返回 undefined 或其他值 - return undefined; + return 'web'; } \ No newline at end of file diff --git a/pages/me/account-login.vue b/pages/me/account-login.vue index 80f37cd..7435a61 100644 --- a/pages/me/account-login.vue +++ b/pages/me/account-login.vue @@ -46,283 +46,284 @@ \ No newline at end of file