diff --git a/config.js b/config.js index f02367e..2e98cc0 100644 --- a/config.js +++ b/config.js @@ -7,14 +7,14 @@ import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI) // 当前环境 -const type = 'dev' +const type = 'prod' // 环境配置 const config = { dev : { - // baseUrl : 'http://h5.xzaiyp.top/school-api', - baseUrl : 'https://school-admin.xzaiyp.top/school-api', + baseUrl : 'http://h5.xzaiyp.top/school-api', + // baseUrl : 'https://school-admin.xzaiyp.top/school-api', }, prod : { baseUrl : 'https://school-admin.xzaiyp.top/school-api', diff --git a/pages/center/center.vue b/pages/center/center.vue index 30549ca..5637da5 100644 --- a/pages/center/center.vue +++ b/pages/center/center.vue @@ -5,9 +5,8 @@ - + + {{ userInfo.name || '文韵飞扬' }} @@ -27,8 +26,8 @@ - + @@ -200,7 +199,7 @@ box-sizing: border-box; border-radius: 20rpx; } - + .lists { width: calc(100% - 40rpx); box-sizing: border-box; diff --git a/pages/order/order.vue b/pages/order/order.vue index 6615125..2ee93b7 100644 --- a/pages/order/order.vue +++ b/pages/order/order.vue @@ -31,9 +31,9 @@ - 驳回 + 驳回 - 结单 + 结单 diff --git a/pages/repair/repair.vue b/pages/repair/repair.vue index f8fabbc..9ba398d 100644 --- a/pages/repair/repair.vue +++ b/pages/repair/repair.vue @@ -9,9 +9,10 @@ - + - + @@ -59,8 +60,8 @@ @confirm="roomConfirm"> --> - + @@ -155,10 +156,14 @@ currentIndex: undefined, //当前操作的图片索引 floorList: [], //楼栋列表 // roomNumberList: [], //室号列表 - projectList : [], //项目列表 + projectList: [], //项目列表 } }, onShow() { + //用户没有登录 + if (!this.userInfo.id) { + this.logout() + } if (wx.onNeedPrivacyAuthorization) { wx.onNeedPrivacyAuthorization(resolve => { this.resolvePrivacyAuthorization = resolve @@ -166,7 +171,7 @@ }) } if (this.floorList.length < 1) this.getActorGoList() - if(this.projectList.length < 1) this.getProjectList() + if (this.projectList.length < 1) this.getProjectList() }, onReady() { this.$refs.form.setRules(this.rules); @@ -224,8 +229,11 @@ //打开选择楼栋 floorPickerOpen() { - if(this.floorList.length == 0){ - return uni.showToast({ icon: 'none' , title: '暂无楼栋供用户选择' }) + if (this.floorList.length == 0) { + return uni.showToast({ + icon: 'none', + title: '暂无楼栋供用户选择' + }) } this.$refs.floorPicker.open(); }, @@ -245,16 +253,19 @@ // } // this.$refs.roomPicker.open(); // }, - + //用户选择了项目 projectConfirm(project) { this.form.project = project.value[0].name }, - + //打开选择项目 projectPickerOpen() { - if(this.projectList.length == 0){ - return uni.showToast({ icon: 'none' , title: '暂无项目供用户选择' }) + if (this.projectList.length == 0) { + return uni.showToast({ + icon: 'none', + title: '暂无项目供用户选择' + }) } this.$refs.projectPicker.open(); }, @@ -264,8 +275,11 @@ this.$refs.form.validate().then(res => { let images = this.form.image.join() if (this.userInfo && this.userInfo.isDai == '1') { - this.cleanfrom() //清空表单内容 - return uni.showToast({ icon: 'none' , title: '维修员不能主动提交报修' }) + this.cleanfrom() //清空表单内容 + return uni.showToast({ + icon: 'none', + title: '维修员不能主动提交报修' + }) } this.$api('addSchoolOrder', { ...this.form, @@ -327,9 +341,18 @@ this.$api('getRepairList', res => { this.getRepairList = [] this.projectList.push(res.result) - console.log(this.projectList); }) - } + }, + + //退出登录 + logout() { + uni.reLaunch({ + url: '/pages/login/studentLogin' + }) + uni.removeStorageSync('token'); + uni.removeStorageSync('userInfo'); + this.$store.commit('setUserInfo', {}) + }, }, computed: { ...mapState(['userInfo']), diff --git a/store/store.js b/store/store.js index 5d1ec50..9a70687 100644 --- a/store/store.js +++ b/store/store.js @@ -48,11 +48,12 @@ const store = new Vuex.Store({ uni.setStorageSync('token', res.result.token); uni.setStorageSync('userInfo', JSON.stringify(res.result.userInfo)); state.userInfo = res.result.userInfo + //用户未设置用户名和头像,跳转上传头像或设置昵称页面 if (!state.userInfo.nickName || !state.userInfo.headImage) { uni.navigateTo({ url: '/pages/login/wxUserInfo' }) - } else { + } else { //跳转报修页面 uni.switchTab({ url: '/pages/repair/repair' })