diff --git a/web/src/components/ConfigDialog.vue b/web/src/components/ConfigDialog.vue
index c8b16514..93d94638 100644
--- a/web/src/components/ConfigDialog.vue
+++ b/web/src/components/ConfigDialog.vue
@@ -8,14 +8,14 @@
title="聊天配置"
>
-
+
API KEY
@@ -125,8 +125,7 @@ import {
UserFilled,
Histogram
} from '@element-plus/icons-vue'
-import {getLoginUser} from "@/utils/storage";
-import {dateFormat} from "@/utils/libs";
+import {isMobile} from "@/utils/libs";
export default defineComponent({
name: 'ConfigDialog',
@@ -135,11 +134,16 @@ export default defineComponent({
show: {
type: Boolean,
default: true
+ },
+ user: {
+ type: Object,
+ default() {
+ return {}
+ },
}
},
data() {
return {
- user: {},
wechatGroup: "https://img.r9it.com/chatgpt/wechat-group.jpeg",
wechatCard: "https://img.r9it.com/chatgpt/wechat-card.jpeg"
}
@@ -151,16 +155,14 @@ export default defineComponent({
} else {
return '15vh';
}
+ },
+
+ col: function () {
+ return isMobile() ? 1 : 2;
}
},
mounted() {
- // 获取用户信息
- const data = getLoginUser();
- if (data !== null) {
- this.user = data["user"];
- this.user['active_time'] = dateFormat(this.user['active_time']);
- this.user['expired_time'] = dateFormat(this.user['expired_time']);
- }
+
},
methods: {
save: function () {
diff --git a/web/src/utils/storage.js b/web/src/utils/storage.js
index b0f749df..64963557 100644
--- a/web/src/utils/storage.js
+++ b/web/src/utils/storage.js
@@ -1,4 +1,6 @@
/* eslint-disable no-constant-condition */
+import {dateFormat} from "@/utils/libs";
+
/**
* storage handler
*/
@@ -22,4 +24,15 @@ export function getLoginUser() {
export function setLoginUser(user) {
sessionStorage.setItem(SessionUserKey, JSON.stringify(user))
+}
+
+export function getUserInfo() {
+ const data = getLoginUser();
+ if (data !== null) {
+ const user = data["user"];
+ user['active_time'] = dateFormat(user['active_time']);
+ user['expired_time'] = dateFormat(user['expired_time']);
+ return user;
+ }
+ return {}
}
\ No newline at end of file
diff --git a/web/src/views/Chat.vue b/web/src/views/Chat.vue
index 9f9d4320..61bb4e5b 100644
--- a/web/src/views/Chat.vue
+++ b/web/src/views/Chat.vue
@@ -21,7 +21,7 @@
-
+
@@ -65,7 +65,7 @@
-
+
{
// 自动重新连接
this.connect();
- // if (this.connectingMessageBox === null) {
- // this.connectingMessageBox = ElMessageBox.confirm(
- // '^_^ 会话发生异常,您已经从服务器断开连接!',
- // '注意:',
- // {
- // confirmButtonText: '重连会话',
- // cancelButtonText: '不聊了',
- // type: 'warning',
- // showClose: false,
- // closeOnClickModal: false
- // }
- // ).then(() => {
- // this.connect();
- // }).catch(() => {
- // ElMessage({
- // type: 'info',
- // message: '您关闭了会话',
- // })
- // })
- // }
}).catch((res) => {
if (res.code === 400) {
this.showLoginDialog = true;
diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue
index 9df39251..20a343f0 100644
--- a/web/src/views/ChatPlus.vue
+++ b/web/src/views/ChatPlus.vue
@@ -19,7 +19,7 @@
-
+
@@ -135,7 +135,7 @@
-
+