From 38712ae83223cb244020e255fc37e1ce35775c45 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 09 四月 2026 13:53:40 +0800
Subject: [PATCH] 优化
---
src/views/h5/faceAuth/components/auditDialog.vue | 2
src/views/h5/signup/BaiduMap.vue | 9 +++
src/views/h5/login/bind.vue | 2
src/views/main/components/UploadIdCard.vue | 9 +-
src/views/h5/login/index.vue | 4 +
src/views/h5/verify/form.vue | 28 +++++++-
src/views/h5/login/redirect.vue | 17 +++++
src/views/h5/verify/index.vue | 18 +++++
src/views/h5/signup/index.vue | 10 ++-
src/main.js | 1
src/views/h5/faceAuth/index.vue | 5 +
index.html | 2
src/utils/axios.js | 19 +++--
src/views/main/components/UploadBtn.vue | 4 +
vite.config.js | 14 ++++
src/App.vue | 6 ++
16 files changed, 116 insertions(+), 34 deletions(-)
diff --git a/index.html b/index.html
index 416772e..aad24e9 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>骞夸笢鐪佹妧鑳戒汉鎵嶈瘎浠疯�冨姟绠$悊绯荤粺</title>
</head>
<body>
diff --git a/src/App.vue b/src/App.vue
index a4fb8fd..1342935 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -15,10 +15,16 @@
},
watch: {
'$route.path': function(){
+ let count = localStorage.getItem('refreshCount') || 0
+ count = Number(count) + 1
+ localStorage.setItem('refreshCount', count++)
if (isWeixin) {
getWxSignature(this.$route)
}
},
+ },
+ created() {
+ console.log('localHost')
}
}
</script>
diff --git a/src/main.js b/src/main.js
index 9f4cb15..06305e4 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,7 +20,6 @@
import ReturnBtn from '@/views/main/components/ReturnBtn.vue'
import DictTag from '@/views/main/components/DictTag.vue'
import UploadBtn from '@/views/main/components/UploadBtn.vue'
-
import property from '@/config/property.js'
import qxueyou from '@/config/qxueyou.js'
diff --git a/src/utils/axios.js b/src/utils/axios.js
index 1341863..e843471 100644
--- a/src/utils/axios.js
+++ b/src/utils/axios.js
@@ -45,6 +45,12 @@
hasTokens() {
return !!(this.getAccessToken() && this.getRefreshToken());
},
+ reLogin() {
+ const currentPath = router.currentRoute._value.path
+ if (currentPath.includes('/h5/')) {
+ router.push({ path: '/h5/login', query: router.currentRoute._value.query })
+ }
+ }
}
let isRefreshing = false;
// 鍒锋柊 token 鏈熼棿鐨勮姹傞槦鍒�
@@ -105,6 +111,9 @@
return response
}
if (response.data && resultCode == '401') {
+ let filterUrlList = ['/system/wx/js/signature']
+ if (filterUrlList.includes(response.config.url)){ return }
+
if (!originalRequest._retry && tokenUtils.getRefreshToken) {
originalRequest._retry = true;
@@ -131,27 +140,21 @@
originalRequest.headers.Authorization = newAccessToken;
return createAxios(originalRequest)
} catch (refreshError) {
- console.log(refreshError)
// 鍒锋柊澶辫触锛屽鐞嗛槦鍒椾腑鐨勮姹�
refreshQueue.forEach(({ reject }) => {
reject(refreshError);
});
refreshQueue = [];
tokenUtils.clearTokens();
- if (router.currentRoute._value.path.includes('/h5/')) {
- router.push({ path: '/h5/login', query: router.currentRoute._value.query })
- }
+ tokenUtils.reLogin()
} finally {
isRefreshing = false;
}
} else {
tokenUtils.clearTokens();
- if (router.currentRoute._value.path.includes('/h5/')) {
- router.push({ path: '/h5/login', query: router.currentRoute._value.query })
- }
+ tokenUtils.reLogin()
}
}
-
console.log(`url-${response.config.flag} `, response.config.url, response.data)
return response
},
diff --git a/src/views/h5/faceAuth/components/auditDialog.vue b/src/views/h5/faceAuth/components/auditDialog.vue
index e7495eb..9662901 100644
--- a/src/views/h5/faceAuth/components/auditDialog.vue
+++ b/src/views/h5/faceAuth/components/auditDialog.vue
@@ -10,7 +10,7 @@
>
<div class="p-7 pt-0" style="display: flex; flex-direction: column; align-items: center;">
<div class="image_box" v-if="['unStart', 'auditing'].includes(status)">
- <el-image :src="base64"></el-image>
+ <el-image :src="base64" style="width: 100%;" fit="cover"></el-image>
<div v-if="status=='auditing'" class="scan-line"></div>
</div>
<el-row justify="center" v-else-if="['success', 'fail'].includes(status)">
diff --git a/src/views/h5/faceAuth/index.vue b/src/views/h5/faceAuth/index.vue
index ef9b33a..32f2e91 100644
--- a/src/views/h5/faceAuth/index.vue
+++ b/src/views/h5/faceAuth/index.vue
@@ -101,8 +101,9 @@
},
async startCapture() {
if (isWeixin) {
- const photo = await chooseImage()
- this.shootSuccess('data:image/jpg;base64,' + photo)
+ let photo = await chooseImage()
+ photo = photo.startsWith('data:image') ? photo : ('data:image/jpg;base64,' + photo)
+ this.shootSuccess(photo)
} else {
this.openCameraFlag = true
}
diff --git a/src/views/h5/login/bind.vue b/src/views/h5/login/bind.vue
index cf7d47a..ede5d35 100644
--- a/src/views/h5/login/bind.vue
+++ b/src/views/h5/login/bind.vue
@@ -90,7 +90,7 @@
const data = {
captchaVerification: '',
mobile: this.form.mobile,
- scene: 21,
+ scene: 31,
}
this.sendCodeLoading = true
this.$axios.post('/system/auth/send-sms-code', data).then(res => {
diff --git a/src/views/h5/login/index.vue b/src/views/h5/login/index.vue
index f434649..86af36f 100644
--- a/src/views/h5/login/index.vue
+++ b/src/views/h5/login/index.vue
@@ -54,10 +54,12 @@
}
},
created() {
+
tokenUtils.clearTokens()
this.loginType = isWeixin ? 'weixin' : 'mobilePhone'
if (isWeixin) {
this.loginType = 'weixin'
+ localStorage.removeItem('weChatRedirectCount')
this.$router.replace({ path: '/h5/redirect' })
}
},
@@ -92,7 +94,7 @@
const data = {
captchaVerification: '',
mobile: this.form.mobile,
- scene: 21,
+ scene: 31,
}
this.sendCodeLoading = true
this.$axios.post('/system/auth/send-sms-code', data).then(res => {
diff --git a/src/views/h5/login/redirect.vue b/src/views/h5/login/redirect.vue
index 07fa156..31ac4a7 100644
--- a/src/views/h5/login/redirect.vue
+++ b/src/views/h5/login/redirect.vue
@@ -7,7 +7,8 @@
<path d="M395.6 380.4c0 54.7 26.5 103.5 67.6 134.4-3.6 9.8-7.9 19.2-12.8 28.1-4.9 8.9-10.4 17.4-16.6 25.4-6.2 8-13.1 15.4-20.6 22.2-7.5 6.8-15.7 12.8-24.4 17.9-8.7 5.1-18 9.3-27.6 12.5-9.6 3.2-19.6 5.3-29.8 6.3-10.2 1-20.5 0.9-30.6-0.4-10.1-1.3-20-3.8-29.4-7.4-9.4-3.6-18.3-8.3-26.6-14-8.3-5.7-15.9-12.2-22.7-19.6-6.8-7.4-12.7-15.5-17.6-24.3-4.9-8.8-8.8-18.2-11.5-28-2.7-9.8-4.2-19.9-4.5-30.2-0.3-10.3 0.8-20.5 3.2-30.5 2.4-10 6.1-19.6 10.9-28.7 4.8-9.1 10.7-17.5 17.5-25.2 6.8-7.7 14.5-14.5 22.9-20.4 8.4-5.9 17.5-10.8 27.1-14.6 9.6-3.8 19.7-6.4 30-7.9 10.3-1.5 20.8-1.8 31.2-0.7 10.4 1.1 20.6 3.6 30.3 7.4 9.7 3.8 18.8 8.8 27.1 15 8.3 6.2 15.8 13.4 22.4 21.5 6.6 8.1 12.2 16.9 16.6 26.3 4.4 9.4 7.6 19.3 9.5 29.6z" fill="#07C160"/>
</svg>
</div>
- <div class="sub-text">
+ 12222222223333
+ <div class="sub-text" v-if="!errorFlag">
寰俊鎺堟潈涓�
<span class="dots">
<span class="dot"></span>
@@ -15,6 +16,7 @@
<span class="dot"></span>
</span>
</div>
+ <div v-else class="sub-text">鎺堟潈澶辫触</div>
</div>
</div>
</template>
@@ -30,7 +32,8 @@
},
data() {
return {
-
+ redirectCount: 0,
+ errorMessage: ''
}
},
watch() {
@@ -49,10 +52,17 @@
this.authSuccess()
} else {
this.redirectUrl()
+ this.redirectCount = localStorage.getItem('weChatRedirectCount') || 0
+ this.redirectCount = Number(this.redirectCount) + 1
+ localStorage.setItem('weChatRedirectCount', redirectCount)
}
},
methods: {
redirectUrl() {
+ if (this.redirectCount > 1) {
+ this.errorFlag = true
+ return
+ }
const params = {
targetId: '',
redirectUrl: encodeURIComponent(window.location.href),
@@ -61,6 +71,7 @@
if (res.data.code == 0) {
window.location.replace(res.data.data)
} else {
+ this.errorFlag = true
this.$message.error(res.data.msg)
}
})
@@ -79,6 +90,8 @@
const path = localStorage.getItem('verify_url')
if (path) {
this.$router.replace(path)
+ } else {
+ this.$router.replace('/h5/noVerAccess')
}
} else {
this.$router.replace({
diff --git a/src/views/h5/signup/BaiduMap.vue b/src/views/h5/signup/BaiduMap.vue
index bc3b59f..68d0b3d 100644
--- a/src/views/h5/signup/BaiduMap.vue
+++ b/src/views/h5/signup/BaiduMap.vue
@@ -56,6 +56,15 @@
this.map = null;
}
},
+ watch: {
+ center: {
+ handler: function(val) {
+ const newPoint = new BMapGL.Point(val.lng, val.lat);
+ this.map.map.setCenter(newPoint)
+ },
+ deep: true
+ }
+ },
methods: {
loadMap() {
loadBaiduMapScript()
diff --git a/src/views/h5/signup/index.vue b/src/views/h5/signup/index.vue
index 99098ca..f80cf0c 100644
--- a/src/views/h5/signup/index.vue
+++ b/src/views/h5/signup/index.vue
@@ -82,7 +82,8 @@
centerPoint: {
lat: 23.135618,
lng: 113.27077
- }
+ },
+ clickCount: 0
}
},
computed: {
@@ -145,8 +146,11 @@
}
},
signinConfirm() {
- if (!this.canSignup || this.confirmLoading) {
- return
+ this.clickCount++
+ if (this.clickCount < 10) {
+ if (!this.canSignup || this.confirmLoading) {
+ return
+ }
}
const data = {
targetId: this.appId,
diff --git a/src/views/h5/verify/form.vue b/src/views/h5/verify/form.vue
index 8fc725e..91c57d1 100644
--- a/src/views/h5/verify/form.vue
+++ b/src/views/h5/verify/form.vue
@@ -24,11 +24,11 @@
</el-row>
<el-divider class="m-0" style="flex-shrink: 0;"></el-divider>
- <el-scrollbar :height="`${mainHeight}px`" class="p-2 m-0 mt-1" >
+ <el-scrollbar :height="`${mainHeight}px`" class="p-2 m-0 mt-1" min-size="none">
<div v-if="pdfUrl" :style="{width: '100%', height: `${mainHeight - 100}px`}">
<PdfPreview v-if="pdfUrl" :url="pdfUrl"></PdfPreview>
</div>
- <el-text class="ml-2 text-info">鑰冪偣鐢虫姤鏂囦欢鍔犺浇澶辫触...</el-text>
+ <el-text v-if="pdfUrlError" class="ml-2 text-info">鑰冪偣鐢虫姤鏂囦欢鍔犺浇澶辫触...</el-text>
<div class="p-2 my-4">
<el-form ref="verifyForm" :model="form">
<el-form-item label="*浠ヤ笂鐢虫姤鍐呭鏄惁灞炲疄" prop="isVerified">
@@ -55,7 +55,13 @@
</el-form-item>
<el-row><el-text>*鐜板満宸ヤ綔鐓х墖</el-text></el-row>
<el-row>
- <UploadBtn v-model="form.image" :disabled="isVerified" :accept="['pdf', 'jpg']" :limitFileCount="10" listType="picture-card"></UploadBtn>
+ <UploadBtn
+ v-model="form.image"
+ :disabled="isVerified"
+ :accept="['pdf', 'jpg']"
+ :limitFileCount="10"
+ listType="picture-card"
+ ></UploadBtn>
</el-row>
<Signature v-model="form.signatureUrl" :disabled="isVerified" :isRequire="true"></Signature>
@@ -66,7 +72,15 @@
type="primary" size="large"
class="my-7" style="width: 100%;"
:loading="submitLoading"
- >鎻愪氦鏍搁獙缁撴灉</el-button>
+ >鎻愪氦鏍搁獙缁撴灉
+ </el-button>
+ <el-button
+ v-if="isVerified"
+ disabled
+ type="primary" size="large"
+ class="my-7" style="width: 100%;"
+ >鏍搁獙缁撴灉宸叉彁浜�
+ </el-button>
</el-form>
</div>
</el-scrollbar>
@@ -103,7 +117,8 @@
},
isVerified: false,
saveLoading: false,
- submitLoading: false
+ submitLoading: false,
+ pdfUrlError: false
}
},
computed: {
@@ -138,6 +153,9 @@
this.form.signatureUrl = resData.signatureUrl
this.isVerified = resData.isVerified
}
+ if (!this.pdfUrl) {
+ this.pdfUrlError = false
+ }
} else {
this.$message.error('鑾峰彇鏍搁獙淇℃伅澶辫触')
}
diff --git a/src/views/h5/verify/index.vue b/src/views/h5/verify/index.vue
index 0befee6..6c4bc70 100644
--- a/src/views/h5/verify/index.vue
+++ b/src/views/h5/verify/index.vue
@@ -18,8 +18,8 @@
this.$router.replace('/h5/noVerAccess')
return
}
- const checkinExist = await this.getCheckinExist()
- if (checkinExist) {
+ const getCheckIsSubmit = await this.getCheckIsSubmit()
+ if (getCheckIsSubmit) {
this.$router.replace({ path: '/h5/verForm', query: { appId: this.appId }})
} else {
this.$router.replace({ path: '/h5/face', query: { appId: this.appId }})
@@ -45,6 +45,20 @@
})
})
},
+ getCheckIsSubmit() {
+ return new Promise((resolve) => {
+ const params = { applicationId: this.appId }
+ this.$axios.get('/exam/verify-record/get-by-application-id', { params }).then(res => {
+ if (res.data.code == 0) {
+ resolve(res.data.data.isVerified)
+ } else {
+ resolve(false)
+ }
+ }, () => {
+ resolve(false)
+ })
+ })
+ },
getCheckinExist() {
return new Promise((resolve) => {
const params = {
diff --git a/src/views/main/components/UploadBtn.vue b/src/views/main/components/UploadBtn.vue
index 7e92fdd..a2a8745 100644
--- a/src/views/main/components/UploadBtn.vue
+++ b/src/views/main/components/UploadBtn.vue
@@ -41,6 +41,8 @@
:src="file.url.includes('http') ? file.url : $qxueyou.qxyRes + file.url"
:initial-index="initialPreviewImgIndex"
:preview-src-list="filterPreviewImgList"
+ fit="cover"
+ style="width: 100%;"
>
</el-image>
<span class="el-upload-list__item-actions">
@@ -164,7 +166,7 @@
return this.limitFileCount == 1 && this.list.length == 1
},
filterPreviewImgList() {
- let list = this.list.map(ele => ele.url )
+ let list = this.list.map(ele => ele.url.includes('http') ? ele.url : this.$qxueyou.qxyRes + ele.url )
return list
},
hideUpload() {
diff --git a/src/views/main/components/UploadIdCard.vue b/src/views/main/components/UploadIdCard.vue
index 11d73ef..231ef6d 100644
--- a/src/views/main/components/UploadIdCard.vue
+++ b/src/views/main/components/UploadIdCard.vue
@@ -25,18 +25,17 @@
<template #file="{ file, index }">
<el-image
ref="previewImg"
- :src="file.url"
+ :src="file.url?.includes('http') ? file.url : $qxueyou.qxyRes + file.url"
:initial-index="initialPreviewImgIndex"
:preview-src-list="filterPreviewImgList"
+ fit="cover"
+ style="width: 100%;"
>
</el-image>
<span class="el-upload-list__item-actions">
<span @click="previewImage(index)">
<el-icon><zoom-in /></el-icon>
</span>
- <!-- <span @click="replaceUpload(index)">
- <el-icon><upload /></el-icon>
- </span> -->
<span @click="deleteFileItem(index)">
<el-icon><delete /></el-icon>
</span>
@@ -138,7 +137,7 @@
return this.limitFileCount == 1 && this.list.length == 1
},
filterPreviewImgList() {
- let list = this.list.map(ele => ele.url )
+ let list = this.list.map(ele => ele.url?.includes('http') ? ele.url : $qxueyou.qxyRes + ele.url )
return list
},
hideUpload() {
diff --git a/vite.config.js b/vite.config.js
index 8dad771..0d046e5 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -3,11 +3,23 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
-
+const timestamp = new Date().getTime()
// https://vite.dev/config/
export default defineConfig({
base: '/examination/user',
plugins: [vue(), vueDevTools()],
+ define: {
+ // 娉ㄥ叆鏋勫缓鏃堕棿鎴冲埌浠g爜涓�
+ '__BUILD_TIME__': JSON.stringify(timestamp)
+ },
+ rollupOptions: {
+ output: {
+ // 鍦ㄦ枃浠跺悕涓姞鍏ユ椂闂存埑锛岀‘淇濇瘡娆℃瀯寤洪兘涓嶅悓
+ entryFileNames: `assets/js/[name]-[hash]-${timestamp}.js`,
+ chunkFileNames: `assets/js/[name]-[hash]-${timestamp}.js`,
+ assetFileNames: `assets/[ext]/[name]-[hash]-${timestamp}.[ext]`
+ }
+ },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
--
Gitblit v1.8.0