|
@@ -4,8 +4,8 @@
|
|
|
<BaseLayout>
|
|
|
<!-- 头部右侧个人中心部分 -->
|
|
|
<div class="header-right-box fl-around" slot="header-content">
|
|
|
- <Icon style="display:block" custom="iconfont icon-home" :color="routerName == 'homePage' ? '#1CC0F3':'#d0d0d0'" @click="toHome" :title="$t('system.goHome')" />
|
|
|
- <Icon type="md-open" @click="changePlatform" :title="$t('system.changePlat')" v-if="hasArea" />
|
|
|
+ <Icon style="display:block" custom="iconfont icon-home" :color="routerName == 'homePage' ? '#1CC0F3':'#d0d0d0'" @click="toHome" :title="$t('system.goHome')"/>
|
|
|
+ <Icon type="md-open" @click="changePlatform" :title="$t('system.changePlat')" v-if="hasArea"/>
|
|
|
<BaseNotification :msgs="msgs"></BaseNotification>
|
|
|
<span class="header-split"></span>
|
|
|
<!-- <Icon type="ios-settings" :color="routerName == 'settings' ? '#1CC0F3':'#d0d0d0'" @click="toSettings" /> -->
|
|
@@ -14,9 +14,9 @@
|
|
|
<BaseUserPoptip @logout="basicMenu('quit')"></BaseUserPoptip>
|
|
|
</div>
|
|
|
<div id="content" class="custom-scroll-bar" slot="content">
|
|
|
- <router-view v-if="!$route.meta.isKeep" :key="this.$route.name"></router-view>
|
|
|
+ <router-view v-if="!$route.meta.isKeep && isRouterAlive" :key="this.$route.name"></router-view>
|
|
|
<keep-alive>
|
|
|
- <router-view v-if="$route.meta.isKeep" :key="this.$route.name"></router-view>
|
|
|
+ <router-view v-if="$route.meta.isKeep && isRouterAlive" :key="this.$route.name"></router-view>
|
|
|
</keep-alive>
|
|
|
</div>
|
|
|
</BaseLayout>
|
|
@@ -28,39 +28,27 @@ export default {
|
|
|
name: 'headers',
|
|
|
props: ['parentToChild', 'identityselect'],
|
|
|
components: {},
|
|
|
+ provide(){
|
|
|
+ return {
|
|
|
+ reload:this.reload
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ isRouterAlive:true,
|
|
|
msgs: [],
|
|
|
isShowMock: false,
|
|
|
isOpenDrawer: false,
|
|
|
routerName: '',
|
|
|
isLoading: false,
|
|
|
- curPlatform: '',
|
|
|
- location: ''
|
|
|
+ curPlatform:'',
|
|
|
+ location:''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- console.log('刷新页面')
|
|
|
- // 检查超时操作页面,清空缓存数据
|
|
|
- let webEndTime = localStorage.getItem('webEndTime')
|
|
|
- let time_now = new Date().getTime()
|
|
|
- if (webEndTime && time_now > webEndTime) {
|
|
|
- console.log('长时间未操作,清空storage,重新登录')
|
|
|
- loginOut()
|
|
|
- }
|
|
|
- this.$store.dispatch('user/checkSchoolCode');// 設定登入成功的學校簡碼
|
|
|
- this.$store.dispatch('user/checkUserProfile');// 檢查使用者個人詳細資訊
|
|
|
- this.$store.dispatch('user/checkStudentProfile');// 檢查學生的詳細資訊
|
|
|
- this.$store.dispatch('config/checkSrvAdr');// 檢查現在站的位置
|
|
|
- this.$store.dispatch('user/checkSchoolProfile').then(res => {
|
|
|
- if (res) {
|
|
|
- this.$User.freshLogin()
|
|
|
- }
|
|
|
- });// 檢查使用者在學校的詳細資訊
|
|
|
-
|
|
|
let user = JSON.parse(decodeURIComponent(localStorage.userInfo, "utf-8"))
|
|
|
let user_profile = JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8"))
|
|
|
- this.location = user_profile.location
|
|
|
+ this.location = user_profile.location
|
|
|
console.log(user_profile)
|
|
|
if (user_profile.schools) {
|
|
|
user_profile.schools = user_profile.schools.filter((item) => {
|
|
@@ -84,26 +72,25 @@ export default {
|
|
|
}
|
|
|
this.$store.commit('setPrivateSpace', user_profile.total || 0)
|
|
|
this.getAllNotice(user_profile, user.id)
|
|
|
- this.curPlatform = localStorage.getItem('platform') || 'school'
|
|
|
+ this.curPlatform = localStorage.getItem('platform') || 'school'
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- loginOut() {
|
|
|
- let login_schoolCode = localStorage.getItem('login_schoolCode')
|
|
|
- let srvAdr = localStorage.getItem('srvAdr')
|
|
|
- localStorage.clear()
|
|
|
- localStorage.setItem('srvAdr', srvAdr)
|
|
|
- localStorage.setItem('login_schoolCode', login_schoolCode)
|
|
|
- window.location.href = window.location.origin + '/login'
|
|
|
- },
|
|
|
- changePlatform() {
|
|
|
- let goPlatform = this.curPlatform === 'area' ? 'school' : 'area'
|
|
|
- this.$router.push({
|
|
|
- name: goPlatform === 'area' ? 'area' : 'home'
|
|
|
- })
|
|
|
- localStorage.setItem('platform', this.curPlatform === 'area' ? 'school' : 'area')
|
|
|
- this.curPlatform = goPlatform
|
|
|
- },
|
|
|
+ reload(){
|
|
|
+ console.error('reload==============================')
|
|
|
+ this.isRouterAlive = false
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isRouterAlive = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changePlatform(){
|
|
|
+ let goPlatform = this.curPlatform === 'area' ? 'school' : 'area'
|
|
|
+ this.$router.push({
|
|
|
+ name: goPlatform === 'area' ? 'area' : 'home'
|
|
|
+ })
|
|
|
+ localStorage.setItem('platform',this.curPlatform === 'area' ? 'school' : 'area')
|
|
|
+ this.curPlatform = goPlatform
|
|
|
+ },
|
|
|
async getAllNotice(user_profile, userId) {
|
|
|
let schoolNotice = await this.getSchoolNotice(user_profile, userId)
|
|
|
let privateNotice = await this.getPrivateNotice(userId)
|
|
@@ -127,7 +114,7 @@ export default {
|
|
|
getPrivateNotice(userId) {
|
|
|
return new Promise((r, j) => {
|
|
|
this.$api.service.getNotification({
|
|
|
- "from": "ies5:" + this.location + ":private",
|
|
|
+ "from": "ies5:" + this.location + ":private",
|
|
|
"receiver": userId
|
|
|
}).then(res => {
|
|
|
r(res.msgs)
|
|
@@ -164,10 +151,11 @@ export default {
|
|
|
localStorage.setItem('noSave', '[]')
|
|
|
}
|
|
|
|
|
|
- this.$EventBus.$off('onGlobalLoading')
|
|
|
- this.$EventBus.$on('onGlobalLoading', val => {
|
|
|
- this.isLoading = val
|
|
|
- })
|
|
|
+ // this.$EventBus.$off('onGlobalLoading')
|
|
|
+ // this.$EventBus.$on('onGlobalLoading', val => {
|
|
|
+ // console.error('HOMT',val)
|
|
|
+ // this.isLoading = val
|
|
|
+ // })
|
|
|
|
|
|
this.$EventBus.$off('noSave')
|
|
|
this.$EventBus.$on('noSave', val => {
|
|
@@ -181,9 +169,9 @@ export default {
|
|
|
hasSchool() {
|
|
|
return this.$store.state.userInfo.hasSchool;
|
|
|
},
|
|
|
- hasArea() {
|
|
|
- return this.$store.state.user.userProfile.areas.length > 0
|
|
|
- }
|
|
|
+ hasArea(){
|
|
|
+ return this.$store.state.user.userProfile.areas.length > 0
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
$route: {
|