diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue index a172f68..ee6acdf 100644 --- a/src/views/Home/Home.vue +++ b/src/views/Home/Home.vue @@ -3,13 +3,16 @@
- +
-
{{nicknameUser}} -
{{schoolNamesChoose.schoolName}}
+
+ {{ nicknameUser }} +
+ {{ schoolNamesChoose.schoolName }} +
-

{{userInfo.phone}}

+

{{ userInfo.phone }}

@@ -24,20 +27,20 @@
- +
长辈版

- {{isElder?'已开启':'未开启'}} + {{ isElder ? '已开启' : '未开启' }}

@@ -59,7 +62,7 @@ import HomeOrder from '@/views/Home/component/HomeOrder' import HomeScan from '@/views/Home/component/HomeScan' import Tabbar4 from '@/component/Tabbar4' export default { - data () { + data() { return { centerNo: '', userInfo: { @@ -80,11 +83,11 @@ export default { isElder: false, showChildList: false, showSchool: false, - schoolNamesChoose: '' + schoolNamesChoose: '', } }, - mounted () { + mounted() { const isElder = localStorage.getItem('isElder') if (isElder) { this.isElder = true @@ -94,51 +97,51 @@ export default { if (schoolNamesChoose) { this.schoolNamesChoose = JSON.parse(schoolNamesChoose) } - this.centerNo = localStorage.getItem('centerNo'); + this.centerNo = localStorage.getItem('centerNo') this.getUserInfo() this.againRZ() - }, computed: { - schoolNames () { + schoolNames() { return this.$store.state.schoolName - } + }, }, methods: { // 研学码 - handleYanxue () { + handleYanxue() { this.$router.push({ name: 'YanxueCode' }) }, // 我的订单 - handleOrder () { + handleOrder() { this.$router.push({ name: 'ServiceOrderXST' }) }, // 集团认证 - handleGroup () { - this.$toast('暂未开放,敬请期待!'); + handleGroup() { + this.$toast('暂未开放,敬请期待!') }, // 我的优惠券 - handleMyCard () { + handleMyCard() { this.$router.push({ name: 'CardBoxXST' }) }, // 个人信息 - handleMyInfo () { + handleMyInfo() { this.$router.push({ name: 'HomeUserInfo' }) }, // 合伙人中心 - handlePartner () { - this.$toast('暂未开放,敬请期待!'); + handlePartner() { + this.$toast('暂未开放,敬请期待!') // this.$router.push({ name: 'Partner' }) }, // 点击长辈版 - handelElder () { + handelElder() { if (this.isElder) { - this.$dialog.confirm({ - title: '长辈版', - message: '超大字号,看的更清楚,长辈版,专为长辈设计', - confirmButtonColor: '#ee0a24', - confirmButtonText: '关闭长辈版模式' - }) + this.$dialog + .confirm({ + title: '长辈版', + message: '超大字号,看的更清楚,长辈版,专为长辈设计', + confirmButtonColor: '#ee0a24', + confirmButtonText: '关闭长辈版模式', + }) .then(() => { // on confirm this.isElder = false @@ -147,14 +150,15 @@ export default { }) .catch(() => { // on cancel - }); + }) } else { - this.$dialog.confirm({ - title: '长辈版', - message: '超大字号,看的更清楚,长辈版,专为长辈设计', - confirmButtonColor: '#3385FF', - confirmButtonText: '开启长辈版模式' - }) + this.$dialog + .confirm({ + title: '长辈版', + message: '超大字号,看的更清楚,长辈版,专为长辈设计', + confirmButtonColor: '#3385FF', + confirmButtonText: '开启长辈版模式', + }) .then(() => { // on confirm this.isElder = true @@ -163,11 +167,25 @@ export default { }) .catch(() => { // on cancel - }); + }) } }, + // 清除缓存 + handleClearCache() { + this.$toast.loading({ + message: '正在清除', + duration: 1000, + forbidClick: true, + }) + setTimeout(() => { + this.$toast('清除成功') + localStorage.removeItem('schoolNamesChoose') + localStorage.removeItem('schoolNames') + this.getUserInfo() + }, 1000) + }, // 获取用户信息 - getUserInfo () { + getUserInfo() { this.mgop({ api: 'mgop.sz.hswsy.getPortalUserByNum', // 必须 host: 'https://mapi.zjzwfw.gov.cn/', @@ -178,18 +196,19 @@ export default { // 'isTestUrl': '1' }, data: { - "userNum": this.centerNo + userNum: this.centerNo, }, - onSuccess: res => { + onSuccess: (res) => { console.log('getUserInfo', res) if (res.data.code == 200) { - let userInfo = res.data.data.userInfo; - this.userInfo = userInfo; + let userInfo = res.data.data.userInfo + this.userInfo = userInfo localStorage.setItem('userInfo', JSON.stringify(userInfo)) if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') { + userInfo.schoolNames = userInfo.schoolNames.filter(n => n) localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames)) this.$store.commit('changeSchool', userInfo.schoolNames) - if (!localStorage.getItem('schoolNamesChoose')) { + if (!localStorage.getItem('schoolNamesChoose')||localStorage.getItem('schoolNamesChoose')=='null') { localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0])) this.schoolNamesChoose = userInfo.schoolNames[0] } @@ -200,49 +219,49 @@ export default { } this.showChildList = true }, - onFail: err => { + onFail: (err) => { console.log('err', err) - } - }); + }, + }) }, - formatterTime (time) { + formatterTime(time) { if (time) { return time.split(' ')[0] } else { return '' } }, - complete () { + complete() { this.getUserInfo() }, //切换学校 - changeSchool () { + changeSchool() { this.$router.push({ name: 'schoolFollow' }) }, //集团回调关闭页面 - closeJT () { + closeJT() { this.showSchool = false this.getUserInfo() }, //查看是否有集团认证 - getRZ () { + getRZ() { // this.showSchool = true this.$router.push({ name: 'schoolAttestation' }) }, //回跳重新认证 - againRZ () { + againRZ() { let backRZ = localStorage.getItem('backRZ') if (backRZ == 'true') { this.showSchool = true localStorage.setItem('backRZ', false) } - } + }, }, components: { Tabbar4, HomeChildList, HomeOrder, - HomeScan + HomeScan, }, } @@ -255,7 +274,7 @@ export default { .infomation { width: 100%; height: 320px; - background: url("~@/assets/home/bg_kq.png"); + background: url('~@/assets/home/bg_kq.png'); background-size: 100%; background-position: center; .top { diff --git a/src/views/Travel/component/schoolAdd.vue b/src/views/Travel/component/schoolAdd.vue index bb9bf4f..af1990b 100644 --- a/src/views/Travel/component/schoolAdd.vue +++ b/src/views/Travel/component/schoolAdd.vue @@ -110,13 +110,15 @@ export default { this.yxAxios.get(`${this.proxyUrl}/prod/api/wx/${appid}/getUserInfo?unionId=${localStorage.getItem('unionId')}`).then((res) => { this.$toast.clear() if (res.data.code == 200) { - localStorage.setItem('userInfo', JSON.stringify(res.data.data)) + let userInfo = res.data.data + localStorage.setItem('userInfo', JSON.stringify(userInfo)) - if(res.data.data.schoolNames || res.data.data.schoolNames == [] || res.data.data.schoolNames == 'null') { - localStorage.setItem('schoolNames',JSON.stringify(res.data.data.schoolNames)) - this.$store.commit('changeSchool', res.data.data.schoolNames) + if(userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') { + userInfo.schoolNames = userInfo.schoolNames.filter(n => n) + localStorage.setItem('schoolNames',JSON.stringify(userInfo.schoolNames)) + this.$store.commit('changeSchool', userInfo.schoolNames) if(!localStorage.getItem('schoolNamesChoose')) { - localStorage.setItem('schoolNamesChoose',JSON.stringify(res.data.data.schoolNames[0])) + localStorage.setItem('schoolNamesChoose',JSON.stringify(userInfo.schoolNames[0])) } }else { localStorage.setItem('schoolNames',[]) -- libgit2 0.21.0