chore: set app list page as the index page

This commit is contained in:
RockYang 2023-10-16 14:20:44 +08:00
parent 61488e840d
commit 99ede83bdc
2 changed files with 10 additions and 5 deletions

View File

@ -4,7 +4,7 @@ const routes = [
{ {
name: 'home', name: 'home',
path: '/', path: '/',
redirect: '/chat', redirect: '/apps',
meta: {title: '首页'}, meta: {title: '首页'},
component: () => import('@/views/Home.vue'), component: () => import('@/views/Home.vue'),
children: [ children: [

View File

@ -35,7 +35,7 @@
</ItemList> </ItemList>
</div> </div>
<login-dialog :show="showLoginDialog" @hide="showLoginDialog = false"/> <login-dialog :show="showLoginDialog" @hide="getRoles"/>
</div> </div>
</template> </template>
@ -48,6 +48,7 @@ import {Delete, Plus} from "@element-plus/icons-vue";
import LoginDialog from "@/components/LoginDialog.vue"; import LoginDialog from "@/components/LoginDialog.vue";
import {checkSession} from "@/action/session"; import {checkSession} from "@/action/session";
import {arrayContains, removeArrayItem, substr} from "@/utils/libs"; import {arrayContains, removeArrayItem, substr} from "@/utils/libs";
import router from "@/router";
const listBoxHeight = window.innerHeight - 97 const listBoxHeight = window.innerHeight - 97
const list = ref([]) const list = ref([])
@ -66,12 +67,16 @@ onMounted(() => {
ElMessage.error("获取应用失败:" + e.message) ElMessage.error("获取应用失败:" + e.message)
}) })
getRoles()
})
const getRoles = () => {
checkSession().then(user => { checkSession().then(user => {
showLoginDialog.value = false
roles.value = user.chat_roles roles.value = user.chat_roles
}).catch(() => { }).catch(() => {
}) })
}
})
const updateRole = (row, opt) => { const updateRole = (row, opt) => {
checkSession().then(() => { checkSession().then(() => {
@ -92,7 +97,7 @@ const updateRole = (row, opt) => {
roles.value = removeArrayItem(roles.value, row.key) roles.value = removeArrayItem(roles.value, row.key)
} }
httpPost("/api/role/update", {keys: roles.value}).then(() => { httpPost("/api/role/update", {keys: roles.value}).then(() => {
ElMessage.success(title.value + "成功!") ElMessage.success({message: title.value + "成功!", duration: 1000})
}).catch(e => { }).catch(e => {
ElMessage.error(title.value + "失败:" + e.message) ElMessage.error(title.value + "失败:" + e.message)
}) })