1 parent
f137d59c72
commit
b1926807f2
5 files changed
+206
-43
No files matched your search
+3
-1
@@ -5,9 +5,11 @@ import HomeAside from '@/components/HomeAside.vue';
|
||||
import {ref, watch} from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const pageName = ref(route.name)
|
||||
|
||||
|
||||
|
||||
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div id="header_main">
|
||||
<div id="logo">
|
||||
<router-link to="/" style="text-underline: none">
|
||||
<el-text :line-clamp="1" size="large"><h1>Pmail</h1></el-text>
|
||||
<router-link to="/" style="text-decoration: none">
|
||||
<el-text :line-clamp="1" size="large"><h1>PMail</h1></el-text>
|
||||
</router-link>
|
||||
</div>
|
||||
<div id="settings" @click="settings" v-if="isLogin">
|
||||
@@ -41,14 +41,12 @@
|
||||
<script setup>
|
||||
import {TbSettings} from "vue-icons-plus/tb";
|
||||
import {ref} from 'vue'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import SecuritySettings from '@/components/SecuritySettings.vue'
|
||||
import lang from '../i18n/i18n';
|
||||
import GroupSettings from './GroupSettings.vue';
|
||||
import RuleSettings from './RuleSettings.vue';
|
||||
import UserManagement from './UserManagement.vue';
|
||||
import PluginSettings from './PluginSettings.vue';
|
||||
import {http} from "@/utils/axios";
|
||||
import {useGlobalStatusStore} from "@/stores/useGlobalStatusStore";
|
||||
|
||||
const globalStatus = useGlobalStatusStore();
|
||||
@@ -59,16 +57,9 @@ const userInfos = globalStatus.userInfos;
|
||||
const openSettings = ref(false)
|
||||
const settings = function () {
|
||||
if (Object.keys(userInfos).length === 0) {
|
||||
http.post("/api/user/info", {}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
userInfos.value = res.data
|
||||
openSettings.value = true;
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.errorMsg,
|
||||
})
|
||||
}
|
||||
globalStatus.init(()=>{
|
||||
Object.assign(userInfos,globalStatus.userInfos)
|
||||
openSettings.value = true;
|
||||
})
|
||||
} else {
|
||||
openSettings.value = true;
|
||||
|
||||
@@ -1,14 +1,29 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {http} from "@/utils/axios";
|
||||
|
||||
const useGlobalStatusStore = defineStore('useGlobalStatusStore', {
|
||||
state() {
|
||||
return {
|
||||
isLogin: true,
|
||||
userInfos:{}
|
||||
userInfos: {}
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
actions: {}
|
||||
getters: {
|
||||
isLogin(state) {
|
||||
return Object.keys(state.userInfos) !== 0
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
init(callback) {
|
||||
let that = this
|
||||
http.post("/api/user/info", {}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
Object.assign(that.userInfos, res.data)
|
||||
console.log("userInfos")
|
||||
callback()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
+15
-24
@@ -15,7 +15,7 @@
|
||||
<div style="display: flex; flex-direction:column;">
|
||||
<div style=" margin-bottom: 10px;">
|
||||
<el-form-item :label="lang.sender" prop="sender">
|
||||
<el-input style="max-width: 200px" :disabled="!userInfos.is_admin"
|
||||
<el-input style="max-width: 200px" :disabled="!(globalStatus.userInfos.is_admin)"
|
||||
v-model="ruleForm.sender" :placeholder="lang.sender_desc"/>
|
||||
<div>@</div>
|
||||
<el-select v-model="ruleForm.pickDomain">
|
||||
@@ -124,7 +124,6 @@ const router = useRouter();
|
||||
const groupStore = useGroupStore()
|
||||
|
||||
const globalStatus = useGlobalStatusStore();
|
||||
const userInfos = globalStatus.userInfos
|
||||
|
||||
if (lang.lang === "zhCn") {
|
||||
i18nChangeLanguage('zh-CN')
|
||||
@@ -162,28 +161,20 @@ const fileList = reactive([]);
|
||||
|
||||
|
||||
const init = function () {
|
||||
if (Object.keys(userInfos.value).length === 0) {
|
||||
http.post("/api/user/info", {}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
userInfos.value = res.data
|
||||
ruleForm.sender = res.data.account
|
||||
ruleForm.domains = res.data.domains
|
||||
ruleForm.pickDomain = res.data.domains[0]
|
||||
ruleForm.nickName = res.data.name
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.errorMsg,
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ruleForm.sender = userInfos.value.account
|
||||
ruleForm.domains = userInfos.value.domains
|
||||
ruleForm.pickDomain = userInfos.value.domains[0]
|
||||
ruleForm.nickName = userInfos.value.name
|
||||
}
|
||||
|
||||
if ( Object.keys(globalStatus.userInfos)==0 || globalStatus.userInfos === null || globalStatus.userInfos == undefined ){
|
||||
globalStatus.init(()=>{
|
||||
ruleForm.sender = globalStatus.userInfos.account
|
||||
ruleForm.domains = globalStatus.userInfos.domains
|
||||
ruleForm.pickDomain = globalStatus.userInfos.domains[0]
|
||||
ruleForm.nickName = globalStatus.userInfos.name
|
||||
})
|
||||
}else{
|
||||
console.log(globalStatus.userInfos)
|
||||
ruleForm.sender = globalStatus.userInfos.account
|
||||
ruleForm.domains = globalStatus.userInfos.domains
|
||||
ruleForm.pickDomain = globalStatus.userInfos.domains[0]
|
||||
ruleForm.nickName = globalStatus.userInfos.name
|
||||
}
|
||||
}
|
||||
init()
|
||||
|
||||
|
||||
Reference in new issue
Block a user