From 133d0b7844be3607093f718a596b69ba3a3894a8 Mon Sep 17 00:00:00 2001
From: Miao_Spring <539943419@qq.com>
Date: Tue, 23 Apr 2024 20:18:45 +0800
Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E9=9D=9E=E5=BC=80=E5=8F=91?=
=?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=8Bweb=E7=AB=AF=E8=A7=86=E4=B8=BA?=
=?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=AB=AF=E5=8F=A3=E4=B8=8E=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E7=AB=AF=E5=8F=A3=E4=B8=80=E8=87=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
miaoShareConfig.json | 3 ++-
server.js | 4 ++++
src/App.vue | 2 ++
src/pinia/store.js | 12 ++++++++++--
src/views/login.vue | 2 +-
6 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
index 20d47b9..e70f3b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ coverage
temp
miaoShare.db
addUser.js
+removeUser.js
# JWT SK
*.key
\ No newline at end of file
diff --git a/miaoShareConfig.json b/miaoShareConfig.json
index 2c993b2..4e96ab4 100644
--- a/miaoShareConfig.json
+++ b/miaoShareConfig.json
@@ -7,5 +7,6 @@
"guest":{
"cloudCapacity":2147483648
}
- }
+ },
+ "enableGuest":false
}
\ No newline at end of file
diff --git a/server.js b/server.js
index dccb573..35139f7 100644
--- a/server.js
+++ b/server.js
@@ -1,3 +1,7 @@
+/*
+ 仅作为临时测试使用
+ 后续对这个进行拆分
+*/
import express from "express";
import cors from "cors";
import Database from "better-sqlite3";
diff --git a/src/App.vue b/src/App.vue
index 59676bf..702ba8e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -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')
diff --git a/src/pinia/store.js b/src/pinia/store.js
index f103246..bde6aab 100644
--- a/src/pinia/store.js
+++ b/src/pinia/store.js
@@ -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
diff --git a/src/views/login.vue b/src/views/login.vue
index 4d430b4..69c1a9d 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -18,7 +18,7 @@
- 使用访客账号登录
+ 使用访客账号登录
登录