diff --git a/client_mp/App.vue b/client_mp/App.vue index 45c99f9..02f8d12 100644 --- a/client_mp/App.vue +++ b/client_mp/App.vue @@ -13,25 +13,40 @@ /** * h5,app-plus(nvue下也为app-plus),mp-weixin,mp-alipay...... */ - var that=this + //var that=this // 小程序自动登录 + uni.showLoading({ + title:'微信自动登录中...', + mask: true + }) uni.login({ provider: 'weixin', - success: function (loginRes) { - that.$u.api.wxmplogin({code:loginRes.code}).then(res=>{ - that.$u.vuex('vuex_token', res.data.access) - }).catch(e=>{uni.reLaunch({ + success: (loginRes)=>{ + this.$u.api.wxmplogin({code:loginRes.code}).then(res=>{ + this.$u.vuex('vuex_token', res.data.access) + this.$u.api.getUserInfo().then(res=>{ + uni.hideLoading() + uni.showToast({ + title:"登录成功", + icon:"none" + }) + uni.reLaunch({ + url:"/pages/home/home" + }) + this.$u.vuex('vuex_user', res.data) + }) + }).catch(e=>{ + uni.hideLoading() + uni.showToast({ + title:"暂未绑定微信!", + icon:"none" + }) + uni.reLaunch({ url:'/pages/login/login' })}) } }); - // this.$u.api.getUserInfo().then(res=>{ - // this.$u.vuex('vuex_user', res.data) - // }).catch(e=>{ - // uni.reLaunch({ - // url:'/pages/login/login' - // }) - // }) + }, } diff --git a/client_mp/pages.json b/client_mp/pages.json index d2c52dc..7ff9890 100644 --- a/client_mp/pages.json +++ b/client_mp/pages.json @@ -11,6 +11,15 @@ // }] // }, "pages": [ + { + "path" : "pages/login/login", + "style" : + { + "navigationBarTitleText": "验证码登录", + "enablePullDownRefresh": false + } + + }, { "path" : "pages/home/home", "style" : @@ -28,15 +37,6 @@ "enablePullDownRefresh": false } - } - ,{ - "path" : "pages/login/login", - "style" : - { - "navigationBarTitleText": "验证码登录", - "enablePullDownRefresh": false - } - } ,{ "path" : "pages/login/login_password", diff --git a/client_mp/pages/inspectrecord/recorddetail.vue b/client_mp/pages/inspectrecord/recorddetail.vue index d752926..cead268 100644 --- a/client_mp/pages/inspectrecord/recorddetail.vue +++ b/client_mp/pages/inspectrecord/recorddetail.vue @@ -20,7 +20,7 @@ + width="260rpx" height="260rpx" :src="item" v-for="(item, index) in fileList" v-bind:key="index" style="margin: 2rpx;"> diff --git a/server/apps/system/views.py b/server/apps/system/views.py index 4c2d3a7..ac8277f 100644 --- a/server/apps/system/views.py +++ b/server/apps/system/views.py @@ -315,8 +315,8 @@ class UserViewSet(PageOrNot, ModelViewSet): 'perms': perms, } try: - user = UserThird.objects.get(user=user,type='wx_mp').user - data['wxmp_openid'] = user.openid + usert = UserThird.objects.get(user=user,type='wx_mp') + data['wxmp_openid'] = usert.openid except: pass return Response(data)