From ab3d9985c81834c8fac2fbcfd531010aa906126a Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Tue, 18 Nov 2025 13:57:07 +0800 Subject: [PATCH 1/5] =?UTF-8?q?flat:=20=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 20 +++++++++++++++----- config.js | 2 +- hook/useSystemPlayer.js | 1 + index.html | 4 ++-- manifest.json | 5 ++++- pages/login/login.vue | 1 + 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/App.vue b/App.vue index 87487b0..696a37e 100644 --- a/App.vue +++ b/App.vue @@ -7,10 +7,20 @@ const { $api, navTo, appendScriptTagElement } = inject('globalFunction'); import config from '@/config.js'; onLaunch((options) => { + if (lightAppJssdk.user) { + lightAppJssdk.user.getTicket({ + success: function (data) { + //成功回调 + console.log(data); + }, + fail: function (data) { + $api.msg('获取用户信息失败'); + }, + }); + } useUserStore().initSeesionId(); //更新 useDictStore().getDictData(); // uni.hideTabBar(); - // 登录 let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息 if (token) { @@ -28,10 +38,10 @@ onLaunch((options) => { onMounted(() => { // #ifndef MP-WEIXIN - appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => { - console.log('✅ 微信 JSSDK 加载完成'); - // signatureFn(); - }); + // appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => { + // console.log('✅ 微信 JSSDK 加载完成'); + // // signatureFn(); + // }); // #endif }); diff --git a/config.js b/config.js index 729ec75..2af79c7 100644 --- a/config.js +++ b/config.js @@ -13,7 +13,7 @@ export default { // indexedDB DBversion: 2, // 只使用本地缓寸的数据 - OnlyUseCachedDB: true, + OnlyUseCachedDB: false, // 使用模拟定位 UsingSimulatedPositioning: true, // 应用信息 diff --git a/hook/useSystemPlayer.js b/hook/useSystemPlayer.js index a3cac95..ee164c2 100644 --- a/hook/useSystemPlayer.js +++ b/hook/useSystemPlayer.js @@ -49,6 +49,7 @@ export function useTTSPlayer() { const newUtterance = new SpeechSynthesisUtterance(filteredText); // Use filtered text utteranceRef.value = newUtterance; + newUtterance.lang = 'zh-CN'; newUtterance.rate = options.rate || 1; newUtterance.pitch = options.pitch || 1; if (options.voice) { diff --git a/index.html b/index.html index f200838..7f5e093 100644 --- a/index.html +++ b/index.html @@ -18,11 +18,11 @@ - + diff --git a/manifest.json b/manifest.json index e1b22f3..e4373ed 100644 --- a/manifest.json +++ b/manifest.json @@ -80,7 +80,7 @@ "locale": "zh-Hans", "h5": { "router": { - "base": "/app/", + "base": "./", "mode": "hash" }, "title": "青岛智慧就业服务", @@ -97,6 +97,9 @@ "serviceHost": "" } } + }, + "devServer": { + "https": false } } } \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index f418acc..c8583cd 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -149,6 +149,7 @@ const fromValue = reactive({ }); onLoad((parmas) => { + console.log(parmas); getTreeselect(); }); From d2e77e66fc33875245bb33be89c891405a873049 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Tue, 18 Nov 2025 17:25:39 +0800 Subject: [PATCH 2/5] =?UTF-8?q?flat:=20=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 120 +++- common/globalFunction.js | 33 +- config.js | 7 +- index.html | 4 + lib/encryption/SM.js | 168 +++++ lib/encryption/aes.js | 1354 ++++++++++++++++++++++++++++++++++++++ utils/request.js | 7 + 7 files changed, 1663 insertions(+), 30 deletions(-) create mode 100644 lib/encryption/SM.js create mode 100644 lib/encryption/aes.js diff --git a/App.vue b/App.vue index 696a37e..5a82140 100644 --- a/App.vue +++ b/App.vue @@ -3,37 +3,29 @@ import { reactive, inject, onMounted } from 'vue'; import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'; import useUserStore from './stores/useUserStore'; import useDictStore from './stores/useDictStore'; -const { $api, navTo, appendScriptTagElement } = inject('globalFunction'); +const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt } = inject('globalFunction'); import config from '@/config.js'; +const appword = 'aKd20dbGdFvmuwrt'; // 固定值 + onLaunch((options) => { - if (lightAppJssdk.user) { - lightAppJssdk.user.getTicket({ - success: function (data) { - //成功回调 - console.log(data); - }, - fail: function (data) { - $api.msg('获取用户信息失败'); - }, - }); - } + getUserInfo(); useUserStore().initSeesionId(); //更新 useDictStore().getDictData(); // uni.hideTabBar(); // 登录 - let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息 - if (token) { - useUserStore() - .loginSetToken(token) - .then(() => { - $api.msg('登录成功'); - }); - } else { - uni.redirectTo({ - url: '/pages/login/login', - }); - } + // let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息 + // if (token) { + // useUserStore() + // .loginSetToken(token) + // .then(() => { + // $api.msg('登录成功'); + // }); + // } else { + // uni.redirectTo({ + // url: '/pages/login/login', + // }); + // } }); onMounted(() => { @@ -52,6 +44,86 @@ onShow(() => { onHide(() => { console.log('App Hide'); }); + +function getUserInfo() { + lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({ + appId: 'qdsrgznrgpp', // 接入方在成功创建应用后自动生成 + success: function (data) { + console.log('res', data); + if (data == '未登录') onLoginApp(); + else { + if (typeof data == 'string') data = JSON.parse(data); + + const sm2_privateKey = '7e14966df4ecd4241ed082ef716d82b52113cb5899ebdc704a98844d0a32b0dc'; + let sm2_encrypt_result = data.data; + let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, sm2_privateKey); + + if (typeof sm2_decrypt_result == 'string') sm2_decrypt_result = JSON.parse(sm2_decrypt_result); + + // 其次,对sm2解密后的结果进行 aes解密 + // aes解密需要用到 appword , 为固定值,使用示例代码中的即可 + let aes_encrypt_result = sm2_decrypt_result.data; + let aes_decrypt_result = aes_Decrypt(aes_encrypt_result, appword); + + // 加密 + loginCallback(aes_decrypt_result); + } + }, + fail: function (data) { + console.log('err', data); + }, + }); +} + +/** + * 使用jssdk调用登录页面 + */ +function onLoginApp() { + lightAppJssdk.user.loginapp({ + success: function (data) { + if (data == '未登录') { + //取消登录或登录失败,关闭页面 + oncloseWindow(); + } else { + getUserInfo(); + } + }, + fail: function (data) { + //关闭页面 + oncloseWindow(); + }, + }); +} + +/** + * 关闭容器 + */ +function oncloseWindow() { + lightAppJssdk.navigation.close({ + success: function (data) {}, + fail: function (data) {}, + }); +} + +function loginCallback(userInfo) { + let pramams = { + token: userInfo, + }; + $api.createRequest('/app/login', params, 'post').then((resData) => { + useUserStore() + .loginSetToken(resData.token) + .then((resume) => { + if (resume.data.jobTitleId) { + useUserStore().initSeesionId(); + uni.reLaunch({ + url: '/pages/index/index', + }); + } else { + nextStep(); + } + }); + }); +} + \ No newline at end of file diff --git a/components/selectJobs/selectJobs.vue b/components/selectJobs/selectJobs.vue index 22c6aac..09cc886 100644 --- a/components/selectJobs/selectJobs.vue +++ b/components/selectJobs/selectJobs.vue @@ -32,7 +32,7 @@ - - - + + +
diff --git a/lib/encryption/SM.js b/static/encryption/SM.js similarity index 100% rename from lib/encryption/SM.js rename to static/encryption/SM.js diff --git a/lib/encryption/aes.js b/static/encryption/aes.js similarity index 100% rename from lib/encryption/aes.js rename to static/encryption/aes.js