5 Commits

Author SHA1 Message Date
Apcallover
3f49c11caf flat: 暂存 2025-11-19 16:44:47 +08:00
Apcallover
044b88dbf7 flat: 登陆对接,等待加密 2025-11-18 21:55:38 +08:00
Apcallover
ca4b038e14 flat: 登陆对接 2025-11-18 20:38:05 +08:00
Apcallover
d2e77e66fc flat: 暂存 2025-11-18 17:25:39 +08:00
Apcallover
ab3d9985c8 flat: 部署 2025-11-18 13:57:07 +08:00
13 changed files with 1682 additions and 39 deletions

122
App.vue
View File

@@ -3,37 +3,32 @@ 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) => {
useUserStore().initSeesionId(); //更新
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(() => {
// #ifndef MP-WEIXIN
appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => {
console.log('✅ 微信 JSSDK 加载完成');
// signatureFn();
});
// #endif
});
onMounted(() => {});
onShow(() => {
console.log('App Show');
@@ -42,6 +37,87 @@ onShow(() => {
onHide(() => {
console.log('App Hide');
});
function getUserInfo() {
lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({
appId: 'qdsrgznrgpp', // 接入方在成功创建应用后自动生成
success: function (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 params = {
username: 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 {
uni.redirectTo({
url: '/pages/login/login',
});
}
});
});
}
</script>
<style>

View File

@@ -67,14 +67,14 @@ export const navTo = function(url, {
onBack = null
} = {}) {
const userStore = useUserStore();
if(isJumping) return
isJumping=true
if (isJumping) return
isJumping = true
if (needLogin && !userStore.hasLogin) {
setTimeout(() => {
uni.navigateTo({
url: '/pages/login/login'
});
isJumping=false
isJumping = false
}, 170);
return;
}
@@ -94,7 +94,7 @@ export const navTo = function(url, {
uni.navigateTo({
url: finalUrl
});
isJumping=false
isJumping = false
}, 170);
};
@@ -552,6 +552,25 @@ function isEmptyObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj) && Object.keys(obj).length === 0;
}
function aes_Decrypt(word, key) {
var key = CryptoJS.enc.Utf8.parse(key) //转为128bit
var srcs = CryptoJS.enc.Hex.parse(word) //转为16进制
var str = CryptoJS.enc.Base64.stringify(srcs) //变为Base64编码的字符串
var decrypt = CryptoJS.AES.decrypt(str, key, {
mode: CryptoJS.mode.ECB,
spadding: CryptoJS.pad.Pkcs7
})
return decrypt.toString(CryptoJS.enc.Utf8)
}
export function sm2_Decrypt(word, key) {
return SM.decrypt(word, key);
}
export function sm2_Encrypt(word, key) {
return SM.encrypt(word, key);
}
export const $api = {
msg,
@@ -565,7 +584,8 @@ export const $api = {
uploadFile,
formatFileSize,
sendingMiniProgramMessage,
copyText
copyText,
aes_Decrypt,
}
@@ -595,4 +615,7 @@ export default {
insertSortData,
isInWechatMiniProgramWebview,
isEmptyObject,
aes_Decrypt,
sm2_Decrypt,
sm2_Encrypt
}

View File

@@ -32,7 +32,7 @@
</template>
<script setup>
import { ref, reactive, computed, inject, nextTick, defineExpose, onMounted } from 'vue';
import { ref, reactive, computed, inject, nextTick, onMounted } from 'vue';
const { $api, navTo, setCheckedNodes, cloneDeep } = inject('globalFunction');
import useUserStore from '@/stores/useUserStore';
import { storeToRefs } from 'pinia';

View File

@@ -1,6 +1,8 @@
export default {
// baseUrl: 'http://39.98.44.136:8080', // 测试
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
// baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
// baseUrl: "http://192.168.98.110:18181",
// baseUrl: "http://192.168.3.19:8080",
// sseAI+
// StreamBaseURl: 'http://39.98.44.136:8000',
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',
@@ -13,9 +15,13 @@ export default {
// indexedDB
DBversion: 2,
// 只使用本地缓寸的数据
OnlyUseCachedDB: true,
OnlyUseCachedDB: false,
// 使用模拟定位
UsingSimulatedPositioning: true,
// 私钥
pubilcKey: '',
// 公钥
privateKey: '',
// 应用信息
appInfo: {
// 应用名称

View File

@@ -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) {

View File

@@ -18,13 +18,17 @@
</script>
<title></title>
<!-- vconsole -->
<!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
var vConsole = new window.VConsole();
vConsole.destroy();
</script> -->
</script>
<!-- 爱山东jssdk -->
<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>
<script type="text/javascript" src="./static/encryption/aes.js"></script>
<script type="text/javascript" src="./static/encryption/SM.js"></script>
</head>
<!-- <body> -->
<div id="app"><!--app-html--></div>

View File

@@ -80,7 +80,7 @@
"locale": "zh-Hans",
"h5": {
"router": {
"base": "/app/",
"base": "./",
"mode": "hash"
},
"title": "青岛智慧就业服务",
@@ -97,6 +97,9 @@
"serviceHost": ""
}
}
},
"devServer": {
"https": false
}
}
}

View File

@@ -37,8 +37,8 @@
</view>
<view class="des-card" style="margin-top: 24rpx">
<view class="fl_box fl_justbet">
<view style="white-space:nowrap">求职意向岗位</view>
<view class="line_1" style="padding-left:40rpx" >{{ userInfo.jobIntention || userInfo.jobTitle?.join(',') || '-' }}</view>
<view>求职意向岗位</view>
<view>{{ userInfo.jobIntention || "-" }}</view>
</view>
<view class="fl_box fl_justbet">
<view>毕业学校</view>

View File

@@ -67,7 +67,7 @@ onLoad(() => {
onShow(() => {
// 获取消息列表
useReadMsg().fetchMessages();
// useReadMsg().fetchMessages();
});
const state = reactive({

View File

@@ -125,7 +125,7 @@ const { getDictSelectOption, oneDictData } = useDictStore();
const openSelectPopup = inject('openSelectPopup');
// status
const selectJobsModel = ref();
const tabCurrent = ref(0);
const tabCurrent = ref(1);
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const state = reactive({
station: [],
@@ -149,6 +149,7 @@ const fromValue = reactive({
});
onLoad((parmas) => {
console.log(parmas);
getTreeselect();
});

168
static/encryption/SM.js Normal file

File diff suppressed because one or more lines are too long

1354
static/encryption/aes.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,12 @@
import config from "@/config.js"
import {
sm2_Decrypt,
sm2_Encrypt
} from '@/common/globalFunction';
import useUserStore from '@/stores/useUserStore';
export function request({
url,
method = 'GET',