update web

This commit is contained in:
全栈小学生 2024-05-18 17:34:05 +08:00
parent 7f59b963b5
commit 9c0d879ca7
9 changed files with 30 additions and 19 deletions

0
web/addon/.gitignore vendored Normal file
View File

View File

@ -32,7 +32,7 @@ const configStore = useConfigStore()
configStore.getLoginConfig() configStore.getLoginConfig()
// //
systemStore.getSitenfo() systemStore.getSiteInfoFn()
// //
getToken() && useMemberStore().setToken(getToken()) getToken() && useMemberStore().setToken(getToken())

6
web/env/.env.dev vendored
View File

@ -1,11 +1,11 @@
# api请求地址 # api请求地址
VITE_APP_BASE_URL='' VITE_APP_BASE_URL=''
# 图片服务器地址 # 图片服务器地址
VITE_IMG_DOMAIN='' VITE_IMG_DOMAIN=''
# 本地开发时站点id # 本地开发时站点id
VITE_SITE_ID = 100000 VITE_SITE_ID = ''
# 本地存储时token的参数名 # 本地存储时token的参数名
VITE_REQUEST_STORAGE_TOKEN_KEY='webToken' VITE_REQUEST_STORAGE_TOKEN_KEY='webToken'
@ -17,4 +17,4 @@ VITE_REQUEST_HEADER_TOKEN_KEY='token'
VITE_REQUEST_HEADER_SITEID_KEY='site-id' VITE_REQUEST_HEADER_SITEID_KEY='site-id'
# 请求时header中来源场景的参数名 # 请求时header中来源场景的参数名
VITE_REQUEST_HEADER_CHANNEL_KEY='channel' VITE_REQUEST_HEADER_CHANNEL_KEY='channel'

View File

@ -1,11 +1,11 @@
# api请求地址 # api请求地址
VITE_APP_BASE_URL='' VITE_APP_BASE_URL=''
# 图片服务器地址 # 图片服务器地址
VITE_IMG_DOMAIN='' VITE_IMG_DOMAIN=''
# 本地开发时站点id # 本地开发时站点id
VITE_SITE_ID = 100000 VITE_SITE_ID = ''
# 本地存储时token的参数名 # 本地存储时token的参数名
VITE_REQUEST_STORAGE_TOKEN_KEY='webToken' VITE_REQUEST_STORAGE_TOKEN_KEY='webToken'
@ -17,4 +17,4 @@ VITE_REQUEST_HEADER_TOKEN_KEY='token'
VITE_REQUEST_HEADER_SITEID_KEY='site-id' VITE_REQUEST_HEADER_SITEID_KEY='site-id'
# 请求时header中来源场景的参数名 # 请求时header中来源场景的参数名
VITE_REQUEST_HEADER_CHANNEL_KEY='channel' VITE_REQUEST_HEADER_CHANNEL_KEY='channel'

10
web/package-lock.json generated
View File

@ -20,6 +20,7 @@
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"nuxt": "^3.4.1", "nuxt": "^3.4.1",
"nuxt-windicss": "^2.6.0", "nuxt-windicss": "^2.6.0",
"qs": "6.7.0",
"sass": "^1.60.0", "sass": "^1.60.0",
"vite-plugin-top-level-await": "^1.3.1", "vite-plugin-top-level-await": "^1.3.1",
"vue-i18n": "^9.2.2" "vue-i18n": "^9.2.2"
@ -6887,6 +6888,15 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/qs": {
"version": "6.7.0",
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
"dev": true,
"engines": {
"node": ">=0.6"
}
},
"node_modules/queue-microtask": { "node_modules/queue-microtask": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz",

View File

@ -16,7 +16,8 @@
"nuxt-windicss": "^2.6.0", "nuxt-windicss": "^2.6.0",
"sass": "^1.60.0", "sass": "^1.60.0",
"vue-i18n": "^9.2.2", "vue-i18n": "^9.2.2",
"vite-plugin-top-level-await": "^1.3.1" "vite-plugin-top-level-await": "^1.3.1",
"qs": "6.7.0"
}, },
"dependencies": { "dependencies": {
"@vueuse/core": "^9.13.0", "@vueuse/core": "^9.13.0",

View File

@ -18,15 +18,13 @@ const useSystemStore = defineStore('system', {
} }
}, },
actions: { actions: {
async getSitenfo() { async getSiteInfoFn() {
await getSiteInfo() await getSiteInfo().then((res: any) => {
.then((res: any) => { this.site = res.data
this.site = res.data if (this.site.status == 3) navigateTo('/site/close', {replace: true})
if (this.site.status == 3) navigateTo('/site/close', { replace: true }) }).catch((err) => {
}) navigateTo('/site/nosite', {replace: true})
.catch((err) => { })
navigateTo('/site/nosite', { replace: true })
})
} }
} }
}) })

View File

@ -1,6 +1,7 @@
import { breakpointsTailwind } from '@vueuse/core' import { breakpointsTailwind } from '@vueuse/core'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import useMemberStore from '@/stores/member' import useMemberStore from '@/stores/member'
import qs from 'qs'
interface ConfigOption { interface ConfigOption {
showErrorMessage?: boolean showErrorMessage?: boolean
@ -60,7 +61,8 @@ class Http {
} }
public get(url: string, query = {}, config: ConfigOption = {}) { public get(url: string, query = {}, config: ConfigOption = {}) {
return this.request(url, 'GET', { query }, config) url += '?' + qs.stringify(query)
return this.request(url, 'GET', {}, config)
} }
public post(url: string, body = {}, config: ConfigOption = {}) { public post(url: string, body = {}, config: ConfigOption = {}) {

View File

@ -209,7 +209,7 @@ const test = {
*/ */
image(value: string) { image(value: string) {
const newValue = value.split('?')[0] const newValue = value.split('?')[0]
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|jfif|bmp|dpg)/i // todo 暂不支持webp格式
return IMAGE_REGEXP.test(newValue) return IMAGE_REGEXP.test(newValue)
}, },
/** /**