统一在store.js中管理baseUrl

This commit is contained in:
539943419 committed 2024-07-29 14:41:50 +08:00
1 parent dfc26aedea
commit 44f3d57884
5 files changed
+79 -69

No files matched your search

+9 -8
View File
@@ -37,7 +37,7 @@
<div style="flex:1; position: relative;min-height: none;">
<chatui style="margin-bottom: 10px; height: 65vh"
:messages="activeGID ? Messages[activeGID].map(v => { v.timestampString = new Date(v.timestamp).toLocaleString(); return v }).reverse() : []"/>
<n-input v-model:value="msgInput" type="textarea" placeholder="发送信息" :autosize="{
minRows: 1,
maxRows: 2
@@ -48,7 +48,7 @@
<n-icon :component="SendOutline" style="cursor: pointer;" @click='sendMsg(activeGID, msgInput)'/>
</template>
</n-input>
<!-- <n-button @click="sendMsg(activeGID, msg)" :disabled="msg === '' || activeGID === null"
:type="msg === '' || activeGID === null ? 'default' : 'primary'">
发送消息
@@ -58,7 +58,7 @@
<!-- {{ dataTest }} -->
<!-- {{ Messages }} -->
<n-modal v-model:show="showModal">
<n-card
style="width: fit-content;"
@@ -68,8 +68,8 @@
role="dialog"
aria-modal="true"
>
<n-qr-code :value="QRCodeData" style="padding: 0;" :size="256" error-correction-level="Q" :v-if="showModal"
:icon-src='0?QRIconUrl:null'
<n-qr-code :value="QRCodeData" style="padding: 0;" :size="256" error-correction-level="Q" :v-if="showModal"
:icon-src='0?QRIconUrl:null'
:icon-size="128"/>
</n-card>
</n-modal>
@@ -106,7 +106,8 @@ const _toClipboard = async (text) => {
const setting = useSettingStore();
const serverPort = setting.serverPort;
const wsBaseUrl = 'ws' + "://" + location.hostname + ":" + serverPort;
const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
// const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";
const baseUrl = setting.baseUrl
const QRIconUrl = ref(location.protocol + "//" + location.hostname + ":" + serverPort + "/favicon.ico")
const columns = [
@@ -290,7 +291,7 @@ function joinGroup_Verify(gID) {
}
function sendMsg(gID, msg) {
if(msg === '' || msg === null || activeGID.value === null)return
if(msg === '' || msg === null || activeGID.value === null)return
let key = gID2key[gID].key
msg = encryptString(key, msg, setting)
socket.send(JSON.stringify({ type: 'message',type1:'text', msg, gID }))
@@ -306,7 +307,7 @@ function sendMsg(gID, msg) {
// }
async function uploadFile(file){
if(activeGID.value === null)return
if(activeGID.value === null)return
var fileName = file.name;
let key = gID2key[activeGID.value].key
const encryptedFileName = encryptString(key, fileName, setting);