Merge remote-tracking branch 'origin/main' into bin
This commit is contained in:
12
App.vue
12
App.vue
@@ -9,8 +9,7 @@ import config from '@/config.js';
|
||||
onLaunch((options) => {
|
||||
useUserStore().initSeesionId(); //更新
|
||||
useDictStore().getDictData();
|
||||
// uni.hideTabBar();
|
||||
|
||||
uni.hideTabBar();
|
||||
// 登录
|
||||
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
|
||||
if (token) {
|
||||
@@ -26,14 +25,7 @@ onLaunch((options) => {
|
||||
}
|
||||
});
|
||||
|
||||
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');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import useUserStore from "../stores/useUserStore";
|
||||
import {
|
||||
request,
|
||||
createRequest,
|
||||
uploadFile
|
||||
} from "../utils/request";
|
||||
@@ -8,6 +7,9 @@ import streamRequest, {
|
||||
chatRequest
|
||||
} from "../utils/streamRequest.js";
|
||||
|
||||
const sm4 = typeof window.sm4 !== 'undefined' ? window.sm4 :
|
||||
(typeof window.smCrypto !== 'undefined' ? window.smCrypto.sm4 : null);
|
||||
|
||||
export const CloneDeep = (props) => {
|
||||
if (typeof props !== 'object' || props === null) {
|
||||
return props
|
||||
@@ -67,14 +69,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 +96,7 @@ export const navTo = function(url, {
|
||||
uni.navigateTo({
|
||||
url: finalUrl
|
||||
});
|
||||
isJumping=false
|
||||
isJumping = false
|
||||
}, 170);
|
||||
};
|
||||
|
||||
@@ -553,11 +555,51 @@ function isEmptyObject(obj) {
|
||||
}
|
||||
|
||||
|
||||
export function sm4Decrypt(key, value, mode = "hex") {
|
||||
try {
|
||||
if (key.length !== 32) {
|
||||
alert('密钥必须是32位16进制字符串(128位)');
|
||||
return;
|
||||
}
|
||||
const decrypted = sm4.decrypt(value, key, {
|
||||
mode: 'ecb',
|
||||
cipherType: mode === 'hex' ? 'hex' : 'base64',
|
||||
padding: 'pkcs#5'
|
||||
});
|
||||
|
||||
return decrypted
|
||||
|
||||
} catch (e) {
|
||||
console.log('解密失败')
|
||||
}
|
||||
}
|
||||
|
||||
export function sm4Encrypt(key, value, mode = "hex") {
|
||||
try {
|
||||
|
||||
if (key.length !== 32) {
|
||||
alert('密钥必须是32位16进制字符串(128位)');
|
||||
return;
|
||||
}
|
||||
|
||||
const encrypted = sm4.encrypt(value, key, {
|
||||
mode: 'ecb',
|
||||
cipherType: mode === 'hex' ? 'hex' : 'base64',
|
||||
padding: 'pkcs#5'
|
||||
});
|
||||
|
||||
return encrypted
|
||||
|
||||
} catch (e) {
|
||||
console.log('加密失败')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const $api = {
|
||||
msg,
|
||||
prePage,
|
||||
sleep,
|
||||
request,
|
||||
createRequest,
|
||||
streamRequest,
|
||||
chatRequest,
|
||||
@@ -595,4 +637,5 @@ export default {
|
||||
insertSortData,
|
||||
isInWechatMiniProgramWebview,
|
||||
isEmptyObject,
|
||||
sm4Decrypt,
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, onMounted, computed } from 'vue';
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { useReadMsg } from '@/stores/useReadMsg';
|
||||
const props = defineProps({
|
||||
currentpage: {
|
||||
|
||||
11
config.js
11
config.js
@@ -1,6 +1,9 @@
|
||||
export default {
|
||||
// baseUrl: 'http://39.98.44.136:8080', // 测试
|
||||
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
|
||||
// baseUrl: 'http://10.133.17.161:8080/api', // 测试
|
||||
// baseUrl: 'http://192.168.3.19:8080', // 测试
|
||||
// baseUrl: 'http://39.98.44.136:6009', // 测试
|
||||
// sseAI+
|
||||
// StreamBaseURl: 'http://39.98.44.136:8000',
|
||||
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',
|
||||
@@ -13,7 +16,7 @@ export default {
|
||||
// indexedDB
|
||||
DBversion: 2,
|
||||
// 只使用本地缓寸的数据
|
||||
OnlyUseCachedDB: true,
|
||||
OnlyUseCachedDB: false,
|
||||
// 使用模拟定位
|
||||
UsingSimulatedPositioning: true,
|
||||
// 应用信息
|
||||
@@ -69,5 +72,11 @@ export default {
|
||||
title: '找工作,用 AI 更高效|青岛市智能求职平台',
|
||||
desc: '融合海量岗位、智能简历匹配、竞争力分析,助你精准锁定理想职位!',
|
||||
imgUrl: 'https://qd.zhaopinzao8dian.com/file/csn/qd_shareLogo.jpg',
|
||||
},
|
||||
sm4Config: {
|
||||
key: '86C63180C1306ABC4D8F989E0A0BC9F3',
|
||||
mode: 'ECB', // default
|
||||
iv: 'UISwD9fW6cFh9SNS', // default is null
|
||||
cipherType: 'base64' // default is base64
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,9 @@
|
||||
vConsole.destroy();
|
||||
</script> -->
|
||||
<!-- 爱山东jssdk -->
|
||||
<script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script>
|
||||
<!-- <script type="text/javascript" src="https://isdapp.shandong.gov.cn/jmopen/jssdk/index.js"></script> -->
|
||||
|
||||
<script type="module" src="./static/js/sm4.min.js"></script>
|
||||
</head>
|
||||
<!-- <body> -->
|
||||
<div id="app"><!--app-html--></div>
|
||||
|
||||
12
pages.json
12
pages.json
@@ -68,11 +68,9 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"subpackages": [
|
||||
{
|
||||
"subpackages": [{
|
||||
"root": "packageA",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pages/choiceness/choiceness",
|
||||
"style": {
|
||||
"navigationBarTitleText": "精选",
|
||||
@@ -227,8 +225,7 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}],
|
||||
"tabBar": {
|
||||
"custom": true,
|
||||
"display": "none",
|
||||
@@ -241,8 +238,7 @@
|
||||
"height": "50px",
|
||||
"backgroundImage": "static/tabbar/logo2copy.png"
|
||||
},
|
||||
"list": [
|
||||
{
|
||||
"list": [{
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/tabbar/calendar.png",
|
||||
"selectedIconPath": "static/tabbar/calendared.png",
|
||||
|
||||
@@ -250,8 +250,6 @@ import {
|
||||
ref,
|
||||
inject,
|
||||
nextTick,
|
||||
defineProps,
|
||||
defineEmits,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
toRaw,
|
||||
@@ -448,7 +446,7 @@ const scrollToBottom = throttle(function () {
|
||||
}, 500);
|
||||
|
||||
function getGuess() {
|
||||
$api.chatRequest('/guest', { sessionId: chatSessionID.value }, 'POST').then((res) => {
|
||||
$api.chatRequest('/app/chat/guest', { sessionId: chatSessionID.value }, 'POST').then((res) => {
|
||||
guessList.value = res.data;
|
||||
showGuess.value = true;
|
||||
nextTick(() => {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, inject, defineEmits } from 'vue';
|
||||
import { ref, inject } from 'vue';
|
||||
const emit = defineEmits(['onSend']);
|
||||
const { $api } = inject('globalFunction');
|
||||
const popup = ref(null);
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
</template>
|
||||
</tabcontrolVue>
|
||||
<SelectJobs ref="selectJobsModel"></SelectJobs>
|
||||
<view class="backdoor" @click="loginbackdoor">后门</view>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
@@ -149,7 +150,7 @@ const fromValue = reactive({
|
||||
});
|
||||
|
||||
onLoad((parmas) => {
|
||||
getTreeselect();
|
||||
// getTreeselect();
|
||||
});
|
||||
|
||||
onMounted(() => {});
|
||||
@@ -243,6 +244,23 @@ function getTreeselect() {
|
||||
});
|
||||
}
|
||||
|
||||
function loginbackdoor() {
|
||||
$api.createRequest('/app/mock/login', {}, 'post').then((resData) => {
|
||||
$api.msg('模拟帐号密码测试登录成功');
|
||||
loginSetToken(resData.token).then((resume) => {
|
||||
if (resume.data.jobTitleId) {
|
||||
// 设置推荐列表,每次退出登录都需要更新
|
||||
useUserStore().initSeesionId();
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
});
|
||||
} else {
|
||||
nextStep();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 登录
|
||||
function loginTest() {
|
||||
// uni.share({
|
||||
@@ -289,6 +307,12 @@ function complete() {
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.backdoor{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 500rpx;
|
||||
background: red
|
||||
}
|
||||
.input-nx
|
||||
position: relative
|
||||
border-bottom: 2rpx solid #EBEBEB
|
||||
|
||||
@@ -45,9 +45,7 @@
|
||||
<text v-if="userInfo.jobTitle.length - 1 !== index">|</text>
|
||||
</text>
|
||||
</view>
|
||||
<view class="top-btn button-click" >
|
||||
电子名片
|
||||
</view>
|
||||
<view class="top-btn button-click">电子名片</view>
|
||||
</view>
|
||||
<view class="card-main">
|
||||
<view class="main-title">服务专区</view>
|
||||
@@ -132,7 +130,6 @@ const isAbove90 = (percent) => parseFloat(percent) < 90;
|
||||
|
||||
function getUserstatistics() {
|
||||
$api.createRequest('/app/user/statistics').then((resData) => {
|
||||
console.log(resData);
|
||||
counts.value = resData.data;
|
||||
});
|
||||
}
|
||||
|
||||
7
static/js/sm4.min.js
vendored
Normal file
7
static/js/sm4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -180,7 +180,7 @@ const useChatGroupDBStore = defineStore("messageGroup", () => {
|
||||
resolve();
|
||||
}
|
||||
|
||||
$api.streamRequest('/chat', params, onDataReceived, onError, onComplete);
|
||||
$api.streamRequest('/app/chat/chat', params, onDataReceived, onError, onComplete);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
reject(err);
|
||||
@@ -230,7 +230,7 @@ const useChatGroupDBStore = defineStore("messageGroup", () => {
|
||||
|
||||
// 云端数据
|
||||
function getHistory() {
|
||||
$api.chatRequest('/getHistory').then((res) => {
|
||||
$api.chatRequest('/app/chat/getHistory').then((res) => {
|
||||
if (!res.data.list.length) return
|
||||
let tabel = parseHistory(res.data.list)
|
||||
if (tabel && tabel.length) {
|
||||
@@ -250,7 +250,7 @@ const useChatGroupDBStore = defineStore("messageGroup", () => {
|
||||
const params = {
|
||||
sessionId: chatSessionID.value
|
||||
}
|
||||
$api.chatRequest('/detail', params, 'GET', loading).then((res) => {
|
||||
$api.chatRequest('/app/chat/detail', params, 'GET', loading).then((res) => {
|
||||
let list = parseHistoryDetail(res.data.list, chatSessionID.value)
|
||||
if (list.length) {
|
||||
baseDB.db.add(massageName.value, list).then((ids) => {
|
||||
|
||||
106
utils/request.js
106
utils/request.js
@@ -1,69 +1,20 @@
|
||||
import config from "@/config.js"
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
export function request({
|
||||
url,
|
||||
method = 'GET',
|
||||
data = {},
|
||||
load = false,
|
||||
header = {}
|
||||
} = {}) {
|
||||
import {
|
||||
sm4Decrypt,
|
||||
sm4Encrypt
|
||||
} from '../common/globalFunction';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (load) {
|
||||
uni.showLoading({
|
||||
title: '请稍候',
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
let Authorization = ''
|
||||
if (useUserStore().token) {
|
||||
Authorization = `${useUserStore().userInfo.token}${useUserStore().token}`
|
||||
}
|
||||
uni.request({
|
||||
url: config.baseUrl + url,
|
||||
method,
|
||||
data: data,
|
||||
header: {
|
||||
'Authorization': Authorization || '',
|
||||
},
|
||||
success: resData => {
|
||||
// 响应拦截
|
||||
if (resData.statusCode === 200) {
|
||||
const {
|
||||
code,
|
||||
msg
|
||||
} = resData.data
|
||||
if (code === 200) {
|
||||
resolve(resData.data)
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
if (resData.data?.code === 401 || resData.data?.code === 402) {
|
||||
useUserStore().logOut()
|
||||
uni.showToast({
|
||||
title: '登录过期,请重新登录',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
const err = new Error('请求出现异常,请联系工作人员')
|
||||
err.error = resData
|
||||
reject(err)
|
||||
},
|
||||
fail: err => reject(err),
|
||||
complete() {
|
||||
if (load) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const needToEncrypt = [
|
||||
["post", "/app/login"],
|
||||
["get", "/app/user/resume"],
|
||||
["post", "/app/user/resume"],
|
||||
["post", "/app/user/experience/edit"],
|
||||
["post", "/app/user/experience/delete"],
|
||||
["get", "/app/user/experience/getSingle/{value}"],
|
||||
["get", "/app/user/experience/list"]
|
||||
]
|
||||
|
||||
/**
|
||||
* @param url String,请求的地址,默认:none
|
||||
@@ -87,15 +38,44 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h
|
||||
|
||||
const header = headers || {};
|
||||
header["Authorization"] = encodeURIComponent(Authorization);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// 检查当前请求是否需要加密
|
||||
const isEncrypt = needToEncrypt.some(item => {
|
||||
const matchMethod = item[0].toLowerCase() === method.toLowerCase();
|
||||
const matchUrl = item[1].includes('{') ?
|
||||
url.startsWith(item[1].split('/{')[0]) // 检查动态路径的前缀
|
||||
:
|
||||
item[1] === url; // 检查静态路径
|
||||
return matchMethod && matchUrl;
|
||||
});
|
||||
|
||||
let requestData = data;
|
||||
|
||||
if (isEncrypt) {
|
||||
const jsonData = JSON.stringify(data);
|
||||
const encryptedBody = sm4Encrypt(config.sm4Config.key, jsonData);
|
||||
requestData = {
|
||||
encrypted: true,
|
||||
encryptedData: encryptedBody,
|
||||
timestamp: Date.now()
|
||||
};
|
||||
}
|
||||
// ------------------------------------------------------------------
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: config.baseUrl + url,
|
||||
method: method,
|
||||
data: data,
|
||||
data: requestData,
|
||||
header,
|
||||
success: resData => {
|
||||
// 响应拦截
|
||||
if (resData.statusCode === 200) {
|
||||
if (resData.data.encrypted) {
|
||||
const decryptedData = sm4Decrypt(config
|
||||
.sm4Config.key, resData.data.encryptedData)
|
||||
resData.data = JSON.parse(decryptedData)
|
||||
}
|
||||
const {
|
||||
code,
|
||||
msg
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function StreamRequest(url, data = {}, onDataReceived, onError, o
|
||||
};
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const response = await fetch(config.StreamBaseURl + url, {
|
||||
const response = await fetch(config.baseUrl + url, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify(data)
|
||||
@@ -46,6 +46,7 @@ export default function StreamRequest(url, data = {}, onDataReceived, onError, o
|
||||
let lines = buffer.split("\n");
|
||||
buffer = lines.pop(); // 可能是不完整的 JSON 片段,留待下次解析
|
||||
for (let line of lines) {
|
||||
line = line.slice(5).trim()
|
||||
if (line.startsWith("data: ")) {
|
||||
const jsonData = line.slice(6).trim();
|
||||
if (jsonData === "[DONE]") {
|
||||
@@ -104,7 +105,7 @@ export function chatRequest(url, data = {}, method = 'GET', loading = false, hea
|
||||
header["Authorization"] = encodeURIComponent(Authorization);
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: config.StreamBaseURl + url,
|
||||
url: config.baseUrl + url,
|
||||
method: method,
|
||||
data: data,
|
||||
header,
|
||||
|
||||
Reference in New Issue
Block a user