coding
This commit is contained in:
parent
1ce6f2140f
commit
7d0214645b
|
@ -1,5 +1,5 @@
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
VUE_APP_PREVIEW=true
|
VUE_APP_PREVIEW=true
|
||||||
VUE_APP_API_BASE_URL=/api
|
VUE_APP_API_BASE_URL=/api
|
||||||
VUE_APP_API_URL=http://127.0.0.1:8099
|
VUE_APP_API_URL=http://192.168.0.189:8099
|
||||||
VUE_APP_WEBSOCKET_URL=ws://127.0.0.1:9001
|
VUE_APP_WEBSOCKET_URL=ws://192.168.0.96:9001
|
|
@ -3,7 +3,7 @@
|
||||||
<img style="position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover" :src="bg" alt="" />
|
<img style="position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover" :src="bg" alt="" />
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="user-layout-lang">
|
<div class="user-layout-lang">
|
||||||
<select-lang class="select-lang-trigger" />
|
<!-- <select-lang class="select-lang-trigger" /> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="user-layout-content">
|
<div class="user-layout-content">
|
||||||
<router-view />
|
<router-view />
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { deviceMixin } from '@/store/device-mixin'
|
import { deviceMixin } from '@/store/device-mixin'
|
||||||
import SelectLang from '@/components/SelectLang'
|
// import SelectLang from '@/components/SelectLang'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UserLayout',
|
name: 'UserLayout',
|
||||||
components: {
|
// components: {
|
||||||
SelectLang,
|
// SelectLang,
|
||||||
},
|
// },
|
||||||
mixins: [deviceMixin],
|
mixins: [deviceMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -291,7 +291,7 @@ export default {
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
// this.$router.push({ path: '/' })
|
// this.$router.push({ path: '/' })
|
||||||
this.$router.push({ path: '/user/thirdLogin?logged=1' })
|
this.$router.push({ path: '/user/thirdLogin' })
|
||||||
// 延迟 1 秒显示欢迎信息
|
// 延迟 1 秒显示欢迎信息
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
|
|
|
@ -8,11 +8,15 @@
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
<div class="btn-wrapper">
|
<div class="btn-wrapper">
|
||||||
<div v-if="!isTrainer" class="btn" @click="click">
|
<div v-if="controlPermission" class="btn" @click="openControlSystem">
|
||||||
<img src="~@/assets/images/user/btn-login.png" alt="" />
|
<img src="~@/assets/images/user/btn-login.png" alt="" />
|
||||||
<span class="text">进入控制系统</span>
|
<span class="text">进入控制系统</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn" @click="click">
|
<div v-if="instructorPermission" class="btn" @click="openInstructorSystem">
|
||||||
|
<img src="~@/assets/images/user/btn-login.png" alt="" />
|
||||||
|
<span class="text">进入教员系统</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="trainerPermission" class="btn" @click="openTrainerSystem">
|
||||||
<img src="~@/assets/images/user/btn-login.png" alt="" />
|
<img src="~@/assets/images/user/btn-login.png" alt="" />
|
||||||
<span class="text">进入训练员系统</span>
|
<span class="text">进入训练员系统</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,6 +28,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { Modal } from 'ant-design-vue'
|
||||||
import openThirdLogin from '@/utils/openThirdLogin'
|
import openThirdLogin from '@/utils/openThirdLogin'
|
||||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import storage from 'store'
|
import storage from 'store'
|
||||||
|
@ -46,32 +51,20 @@ export default {
|
||||||
return !this.isAdmin && this.roleNameArr.includes('教员')
|
return !this.isAdmin && this.roleNameArr.includes('教员')
|
||||||
},
|
},
|
||||||
isTrainer() {
|
isTrainer() {
|
||||||
return !this.isInstructor && this.roleNameArr.includes('训练员')
|
return !this.isAdmin && !this.isInstructor && this.roleNameArr.includes('训练员')
|
||||||
|
},
|
||||||
|
controlPermission() {
|
||||||
|
return this.isAdmin
|
||||||
|
},
|
||||||
|
instructorPermission() {
|
||||||
|
return this.isAdmin || this.isInstructor
|
||||||
|
},
|
||||||
|
trainerPermission() {
|
||||||
|
return this.isAdmin || this.isInstructor || this.isTrainer
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
const searchParams = new URLSearchParams(window.location.search)
|
const searchParams = new URLSearchParams(window.location.search)
|
||||||
const searchLogged = searchParams.get('logged')
|
|
||||||
const localLogged = window.localStorage.getItem('logged')
|
|
||||||
if (searchLogged) {
|
|
||||||
window.localStorage.setItem('logged', searchLogged)
|
|
||||||
window.location.href = window.location.origin + window.location.pathname
|
|
||||||
return
|
|
||||||
} else if (localLogged) {
|
|
||||||
try {
|
|
||||||
const res = await this.$http({
|
|
||||||
url: '/auth/userInfo',
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
this.userName = res.data.nickName || res.data.userName
|
|
||||||
this.roleName = res.data.roleName
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
} finally {
|
|
||||||
window.localStorage.removeItem('logged')
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const searchCode = searchParams.get('code')
|
const searchCode = searchParams.get('code')
|
||||||
const localCode = window.localStorage.getItem('code')
|
const localCode = window.localStorage.getItem('code')
|
||||||
if (searchCode) {
|
if (searchCode) {
|
||||||
|
@ -99,20 +92,48 @@ export default {
|
||||||
window.localStorage.removeItem('code')
|
window.localStorage.removeItem('code')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
openThirdLogin()
|
try {
|
||||||
|
const res = await this.$http({
|
||||||
|
url: '/auth/userInfo',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
this.userName = res.data.nickName || res.data.userName
|
||||||
|
this.roleName = res.data.roleName
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click() {
|
openControlSystem() {
|
||||||
if (this.roleName === '管理员') {
|
this.$router.push({ name: 'SimulationSceneCentralControl' })
|
||||||
}
|
|
||||||
if (this.roleName === '教员') {
|
|
||||||
}
|
|
||||||
if (this.roleName === '训练员') {
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleQuit () {
|
openInstructorSystem() {
|
||||||
console.log(process.env)
|
this.$router.push({ name: 'SimulationSceneCentralControl' })
|
||||||
|
},
|
||||||
|
openTrainerSystem() {
|
||||||
|
this.$router.push({ name: 'SimulationSceneSystemSelect' })
|
||||||
|
},
|
||||||
|
handleQuit() {
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
Modal.confirm({
|
||||||
|
title: this.$t('layouts.usermenu.dialog.title'),
|
||||||
|
content: this.$t('layouts.usermenu.dialog.content'),
|
||||||
|
okText: '确定退出',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return this.$store.dispatch('Logout').then(() => {
|
||||||
|
this.$router.push({ name: 'login' })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
this.$store.dispatch('Logout').then(() => {
|
||||||
|
openThirdLogin()
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user