Merge pull request 'master' (#80) from master into dm

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/80
This commit is contained in:
clay
2024-04-01 02:00:42 +00:00
5 changed files with 83 additions and 12 deletions

1
src/assets/svg/sso.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -27,8 +27,10 @@ import Hamburger from './Hamburger.vue';
import {useAuthStore} from '@/stores/userstore.js' import {useAuthStore} from '@/stores/userstore.js'
import BellSocket from "./BellSocket.vue"; import BellSocket from "./BellSocket.vue";
import {getUserInfo} from "../../api/login"; import {getUserInfo} from "../../api/login";
import {usePermisstionStroe} from '@/stores/permisstion'
const authStore = useAuthStore() const authStore = useAuthStore()
const permisstionStore = usePermisstionStroe()
const userInfo = ref({}) const userInfo = ref({})
const visitedP = ref(false) const visitedP = ref(false)
const router = useRouter() const router = useRouter()
@@ -58,6 +60,7 @@ const handleToAuth = () => {
const handleLogout = () => { const handleLogout = () => {
visitedP.value = !visitedP.value visitedP.value = !visitedP.value
authStore.userLogout() authStore.userLogout()
permisstionStore.removeMenu()
router.push('/login') router.push('/login')
} }
</script> </script>

View File

@@ -96,12 +96,18 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
} }
} }
const removeMenu = () => {
menuList.value.length = 0
asyncRouters.value.length = 0
}
return { return {
asyncRouters, asyncRouters,
menuList, menuList,
isLoadRoutes, isLoadRoutes,
setAsyncRouters, setAsyncRouters,
setIsLoadRoutes setIsLoadRoutes,
removeMenu
} }
}) })

View File

@@ -4,14 +4,14 @@
:model="loginForm" :model="loginForm"
ref="formInstance" ref="formInstance"
:rules="rules" :rules="rules"
label-width="65px" label-width="70px"
> >
<h3>科研管理平台</h3> <h2>科研管理平台</h2>
<el-form-item prop="username" label="账号"> <el-form-item prop="username" label="账号">
<el-input v-model="loginForm.username" :prefix-icon="User"></el-input> <el-input v-model="loginForm.username" :prefix-icon="User"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password" label="密码"> <el-form-item prop="password" label="密码">
<el-input v-model="loginForm.password" type="password" :prefix-icon="Lock"></el-input> <el-input v-model="loginForm.password" type="password" :prefix-icon="Lock" :show-password="true"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code" label="验证码"> <el-form-item prop="code" label="验证码">
<div class="code"> <div class="code">
@@ -20,6 +20,12 @@
<img :src="codeImg" alt="" @click="getCode"> <img :src="codeImg" alt="" @click="getCode">
</div> </div>
</el-form-item> </el-form-item>
<div class="sso">
<a href="/api/auth/cas/login">
<svg-icon name="sso"/>
<span>统一身份认证</span>
</a>
</div>
<el-form-item> <el-form-item>
<el-button @click="handleLogin(formInstance)" type="primary">登录</el-button> <el-button @click="handleLogin(formInstance)" type="primary">登录</el-button>
</el-form-item> </el-form-item>
@@ -98,26 +104,77 @@ onBeforeUnmount(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.login-box { .login-box {
height: 100%; height: 100%;
background-color: #4158D0; background-color: #F3F3F3;
background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%); //background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.sso {
display: flex;
justify-content: center;
align-items: center;
margin-top: -5px;
margin-bottom: 10px;
a {
font-size: 16px;
color: #BEA266;
&:hover {
text-decoration: underline;
}
}
}
.el-form { .el-form {
padding: 12px 15px; padding: 12px 15px;
border-radius: 12px; border-radius: 12px;
width: 25%; width: 560px;
background-color: #fff; background-color: #fff;
h3 { .el-form-item {
margin-bottom: 25px;
:deep(.el-form-item__label) {
font-size: 15px;
}
.el-input {
height: 40px;
:deep(.el-input__inner) {
font-size: 18px;
}
:deep(.el-input__suffix) {
.el-input__password {
font-size: 20px;
}
}
:deep(.el-input__prefix ) {
.el-input__prefix-inner {
.el-icon {
font-size: 20px;
}
}
}
}
}
h2 {
width: 100%; width: 100%;
text-align: center; text-align: center;
margin-bottom: 15px; margin-bottom: 25px;
} }
.el-button { .el-button {
width: 100%; width: 100%;
background-color: #BEA266;
border-color: #BEA266;
font-size: 17px;
} }
} }
} }
@@ -134,7 +191,7 @@ onBeforeUnmount(() => {
} }
img { img {
height: 32px; height: 40px;
flex: 1; flex: 1;
} }
} }

View File

@@ -11,7 +11,7 @@
:data="localData.menuData" :data="localData.menuData"
:filter-node-method="filterMenu" :filter-node-method="filterMenu"
:props="localData.menuTreeProps" :props="localData.menuTreeProps"
:check-strictly="localData.checkStrictly" :check-strictly="!localData.checkStrictly"
show-checkbox show-checkbox
node-key="menuId" node-key="menuId"
@check-change="checkChange" @check-change="checkChange"
@@ -50,7 +50,7 @@ const localData = reactive({
label: 'menuName', label: 'menuName',
children: 'children' children: 'children'
}, },
checkStrictly: false, checkStrictly: true,
checkList: ['3'], checkList: ['3'],
checkOptions: [ checkOptions: [
{ {
@@ -161,8 +161,12 @@ const checkChange = (data) => {
return [...checkedKeys, ...halfCheckedKeys] return [...checkedKeys, ...halfCheckedKeys]
} }
console.log(localData.checkList, 'localData.checkList');
const checkBoxChange = (val) => { const checkBoxChange = (val) => {
console.log(val, 'val');
console.log(val.includes('3'), 'val.includes');
localData.checkStrictly = val.includes('3') localData.checkStrictly = val.includes('3')
console.log(localData.checkStrictly, 'localData.checkStrictly');
let nodes = menuTree.value.store.nodesMap let nodes = menuTree.value.store.nodesMap
if (val.includes('1')) { if (val.includes('1')) {
for (const node in nodes) { for (const node in nodes) {