@@ -29,7 +20,7 @@ const props = defineProps({
},
gap: {
type: Number,
- default: 12
+ default: 10
},
width: {
type: Number,
@@ -37,45 +28,35 @@ const props = defineProps({
}
});
-const container = ref(null)
-const itemWidth = ref(props.width)
+const containerRef = ref(null)
+const span = ref(12)
onMounted(() => {
- computeSize()
+ calcSpan()
})
-const computeSize = () => {
- const w = container.value.offsetWidth - 10 // 减去滚动条的宽度
- let cols = Math.floor(w / props.width)
- itemWidth.value = Math.floor(w / cols)
-}
-
-window.onresize = () => {
- computeSize()
+const calcSpan = () => {
+ let cols = Math.floor(containerRef.value.offsetWidth / props.width)
+ if (cols >= 12) {
+ span.value = 1
+ return
+ }
+ console.log(cols)
+ while (cols > 1) {
+ if (24 % cols === 0) {
+ span.value = 24 / cols
+ return
+ }
+ cols -= 1
+ }
+ span.value = 12
}
+window.onresize = () => calcSpan()
\ No newline at end of file
diff --git a/web/src/views/ChatApps.vue b/web/src/views/ChatApps.vue
index fc7c7c93..360742b6 100644
--- a/web/src/views/ChatApps.vue
+++ b/web/src/views/ChatApps.vue
@@ -2,15 +2,21 @@
-
+
-
-
-
-
{{ scope.item.name }}
-
+
+
+
+
+
+
+
+
{{ scope.item.name }}
+
{{ scope.item.hello_msg }}
+
+
-
{{ scope.item.intro }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
@@ -39,18 +64,18 @@
import {onMounted, ref} from "vue"
import {ElMessage} from "element-plus";
import {httpGet, httpPost} from "@/utils/http";
-import ItemList from "@/components/ItemList.vue";
-import {Plus} from "@element-plus/icons-vue";
-import LoginDialog from "@/components/LoginDialog.vue";
import {checkSession} from "@/action/session";
import {arrayContains, removeArrayItem, substr} from "@/utils/libs";
import {useRouter} from "vue-router";
+import {useSharedStore} from "@/store/sharedata";
+import ItemList from "@/components/ItemList.vue";
+import {Plus} from "@element-plus/icons-vue";
-const listBoxHeight = window.innerHeight - 147
+const listBoxHeight = window.innerHeight - 87
const list = ref([])
-const showLoginDialog = ref(false)
const roles = ref([])
-const elements = ref(null)
+const store = useSharedStore();
+
onMounted(() => {
httpGet("/api/role/list?all=true").then((res) => {
const items = res.data
@@ -67,7 +92,6 @@ onMounted(() => {
})
const getRoles = () => {
- showLoginDialog.value = false
checkSession().then(user => {
roles.value = user.chat_roles
}).catch(() => {
@@ -98,7 +122,7 @@ const updateRole = (row, opt) => {
ElMessage.error(title.value + "失败:" + e.message)
})
}).catch(() => {
- showLoginDialog.value = true
+ store.setShowLoginDialog(true)
})
}
diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue
index 9e7bf80b..61545fa7 100644
--- a/web/src/views/ChatPlus.vue
+++ b/web/src/views/ChatPlus.vue
@@ -99,7 +99,7 @@
-
-
-
+
@@ -378,6 +378,11 @@ const resizeElement = function () {
leftBoxHeight.value = window.innerHeight - 90 - 45 - 82;
};
+const _newChat = () => {
+ if (isLogin.value) {
+ newChat()
+ }
+}
const disableModel = ref(false)
// 新建会话
const newChat = () => {
diff --git a/web/src/views/Dalle.vue b/web/src/views/Dalle.vue
index 375d407f..b7cd9867 100644
--- a/web/src/views/Dalle.vue
+++ b/web/src/views/Dalle.vue
@@ -221,7 +221,6 @@
-
{ previewURL = '' }" v-if="previewURL !== ''" :url-list="[previewURL]"/>
@@ -233,16 +232,16 @@ import {httpGet, httpPost} from "@/utils/http";
import {ElMessage, ElMessageBox, ElNotification} from "element-plus";
import Clipboard from "clipboard";
import {checkSession} from "@/action/session";
-import LoginDialog from "@/components/LoginDialog.vue";
+import {useSharedStore} from "@/store/sharedata";
const listBoxHeight = ref(0)
const paramBoxHeight = ref(0)
-const showLoginDialog = ref(false)
const isLogin = ref(false)
const loading = ref(true)
-const colWidth = ref(240)
+const colWidth = ref(220)
const isOver = ref(false)
const previewURL = ref("")
+const store = useSharedStore();
const resizeElement = function () {
listBoxHeight.value = window.innerHeight - 90
@@ -438,7 +437,7 @@ const generate = () => {
}
if (!isLogin.value) {
- showLoginDialog.value = true
+ store.setShowLoginDialog(true)
return
}
httpPost("/api/dall/image", params.value).then(() => {
diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue
index e9cac3cb..4f73d940 100644
--- a/web/src/views/Home.vue
+++ b/web/src/views/Home.vue
@@ -14,7 +14,7 @@
@@ -24,7 +24,7 @@
@@ -68,7 +68,7 @@
- 登录
+ 登录
注册
@@ -113,7 +113,7 @@
+
@@ -220,5 +220,6 @@ const loginCallback = () => {
diff --git a/web/src/views/ImageMj.vue b/web/src/views/ImageMj.vue
index b29d087e..453db3ca 100644
--- a/web/src/views/ImageMj.vue
+++ b/web/src/views/ImageMj.vue
@@ -600,8 +600,6 @@
{ previewURL = '' }" v-if="previewURL !== ''" :url-list="[previewURL]"/>
-
-
@@ -616,14 +614,14 @@ import {checkSession} from "@/action/session";
import {useRouter} from "vue-router";
import {getSessionId} from "@/store/session";
import {copyObj, removeArrayItem} from "@/utils/libs";
-import LoginDialog from "@/components/LoginDialog.vue";
+import {useSharedStore} from "@/store/sharedata";
const listBoxHeight = ref(0)
const paramBoxHeight = ref(0)
-const showLoginDialog = ref(false)
const loading = ref(true)
-const colWidth = ref(240)
+const colWidth = ref(220)
const previewURL = ref("")
+const store = useSharedStore();
const resizeElement = function () {
listBoxHeight.value = window.innerHeight - 80
@@ -903,7 +901,7 @@ const beforeUpload = (key) => {
// 图片上传
const uploadImg = (file) => {
if (!isLogin.value) {
- showLoginDialog.value = true
+ store.setShowLoginDialog(true)
return
}
@@ -936,7 +934,7 @@ const uploadImg = (file) => {
const promptRef = ref(null)
const generate = () => {
if (!isLogin.value) {
- showLoginDialog.value = true
+ store.setShowLoginDialog(true)
return
}
diff --git a/web/src/views/ImageSd.vue b/web/src/views/ImageSd.vue
index 86b274d6..a65486e5 100644
--- a/web/src/views/ImageSd.vue
+++ b/web/src/views/ImageSd.vue
@@ -497,8 +497,6 @@