现在非开发环境下web端视为服务器端口与页面端口一致

This commit is contained in:
539943419 committed 2024-04-23 20:18:45 +08:00
1 parent 5ca7125328
commit 133d0b7844
6 files changed
+20 -4

No files matched your search

+1
View File
@@ -33,6 +33,7 @@ coverage
temp
miaoShare.db
addUser.js
removeUser.js
# JWT SK
*.key
+2 -1
View File
@@ -7,5 +7,6 @@
"guest":{
"cloudCapacity":2147483648
}
}
},
"enableGuest":false
}
+4
View File
@@ -1,3 +1,7 @@
/*
仅作为临时测试使用
后续对这个进行拆分
*/
import express from "express";
import cors from "cors";
import Database from "better-sqlite3";
+2
View File
@@ -20,6 +20,8 @@ import {
} from '@vicons/ionicons5'
import { useSettingStore } from "@/pinia/store";
// console.log(process.env.NODE_ENV)
const settingData = useSettingStore();
const activePage = ref('upload')
+10 -2
View File
@@ -19,12 +19,20 @@ if (activeKeyMap == null ){
activeKeyMap = JSON.stringify(['A-Z','0-9'])
localStorage.setItem('activeKeyMap',activeKeyMap)
}
// 开发环境下服务器端口使用设置的端口,否则使用与页面相同的端口
const serverPort = process.env.NODE_ENV === 'development' ? config.PORT : location.port
// console.log(process.env.NODE_ENV,config.DEVPORT,location.port,serverPort)
export const useSettingStore = defineStore("setting", {
state: () => ({
activeFuction: activeFuctionLocal,
activeKeyMap:JSON.parse(activeKeyMap),
serverPort:config.PORT,
token,userID,userGroup
enableGuest:config.enableGuest,
serverPort,
token,
userID,
userGroup
}),
getters: {
// double: state => state.count * 2
+1 -1
View File
@@ -18,7 +18,7 @@
<n-checkbox size="large" label="保持登录状态" v-model:checked="keepTokenLocal" />
</n-flex>
<n-flex justify="end">
<n-button @click="useGuestAccount">使用访客账号登录</n-button>
<n-button @click="useGuestAccount" v-if="settingData.enableGuest">使用访客账号登录</n-button>
<n-button @click="login">登录</n-button>
</n-flex>
</n-flex>