diff --git a/pages/login/index.vue b/pages/login/index.vue index 6c85e2b..3b162f7 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -1,33 +1,45 @@ @@ -87,53 +99,51 @@ // duration:'2000' // }) request({ - url:'/api/oauth/Login1', - method:'post', - data:query, - header:{ + url: '/api/oauth/Login1', + method: 'post', + data: query, + header: { "Content-Type": "application/x-www-form-urlencoded" } }).then(res => { - // this.API.userLogin(query).then(res => { - console.log('登录信息',res) + // this.API.userLogin(query).then(res => { + console.log('登录信息', res) uni.showToast({ - title:'denglu', - duration:'2000' + title: 'denglu', + duration: '2000' }) - - if(res.code === 200){ + + if (res.code === 200) { let token = res.data.token // let user = res.data.user - console.log('token',token) + console.log('token', token) this.$store.commit('user/SET_TOKEN', token) uni.setStorageSync('AuthToken_KEY', token) uni.setStorageSync('token', token) - // uni.switchTab({ - // url: '/pages/index/apply' - // }); - that.API.getUserInfo().then(res=>{ + + that.API.getUserInfo().then(res => { console.log(res) - + let user = res.data - uni.setStorageSync('user',user) - if(uni.getStorageSync('user')){ + uni.setStorageSync('user', user) + if (uni.getStorageSync('user')) { this.loading = false uni.showToast({ - icon:"success", - title:"登陆成功" + icon: "success", + title: "登陆成功" }) uni.switchTab({ url: '/pages/home/home' }); } - - + + }) - - }else{ + + } else { uni.showToast({ - icon:"error", - title:res.msg + icon: "error", + title: res.msg }) this.loading = false } @@ -147,108 +157,139 @@ }); }, }, - + } + \ No newline at end of file diff --git a/pages/official/official.vue b/pages/official/official.vue index eef58a7..1e82a22 100644 --- a/pages/official/official.vue +++ b/pages/official/official.vue @@ -63,12 +63,12 @@ url: 'http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1', // 不传入上传地址则返回本地链接 // url: '', // 不传入上传地址则返回本地链接 }, - check:false, + check: false, // 文件名 fileName: '文件名', // 当前用户ID: userId: '', - isAdmin:false + isAdmin: false } }, onShow() { @@ -82,10 +82,10 @@ }, methods: { - change(){ - console.log('check',this.check) + change() { + console.log('check', this.check) this.check = !this.check - console.log('check',this.check) + console.log('check', this.check) }, // 获取用户信息 getUser() { @@ -96,7 +96,7 @@ this.userName = userCode.userInfo.userAccount this.userIcon = userCode.userInfo.headIcon this.organizeName = userCode.userInfo.organizeName - if(this.userId === 'admin'){ + if (this.userId === 'admin') { this.isAdmin = true } console.log(userCode) @@ -114,9 +114,9 @@ }, // 跳转到自定义分组页面 - toGrouping(){ + toGrouping() { uni.navigateTo({ - url:'/pages/official/grouping/grouping' + url: '/pages/official/grouping/grouping' }) }, // 获取企业分类 @@ -352,7 +352,7 @@ }).then(res => { console.log(res) if (res.code === 200) { - if(this.check){ + if (this.check) { this.tellNotice() } uni.showToast({ @@ -371,19 +371,19 @@ }, // 进行通知 - tellNotice(){ + tellNotice() { // 进行通知 request({ - url:'/api/extend/demo/SendMessageByApp', - method:'post', - data:{ - title:'公文消息', - companys:'公文消息,请及时查看!', - desc:this.noticeDesc, - fangshi:'通知' + url: '/api/extend/demo/SendMessageByApp', + method: 'post', + data: { + title: '公文消息', + companys: '公文消息,请及时查看!', + desc: this.noticeDesc, + fangshi: '通知' } - }).then(res=>{ - console.log('通知结果',res) + }).then(res => { + console.log('通知结果', res) }) }, getCityNames(ids) {