扫码考试bug

This commit is contained in:
caoqianming 2020-02-17 23:06:39 +08:00
parent a3250d97f4
commit 3a2e0ce1f7
3 changed files with 44 additions and 5 deletions

View File

@ -7,7 +7,9 @@ Page({
data: { data: {
username:'', username:'',
password:'', password:'',
mpopenid:'' mpopenid:'',
isExists:false,
msg:''
}, },
usernameChange: function (e) { usernameChange: function (e) {
this.data.username = e.detail.value this.data.username = e.detail.value
@ -54,6 +56,30 @@ Page({
} }
}); });
}, },
getUserbasic:function(){
var that = this
wx.request({
url: getApp().globalData.serverUrl + 'api/user?a=get_user_from_username&username='+that.data.username,
header: {
'content-type': 'application/json', //
},
method: 'GET',
success: res => {
if (res.data.code == 1) {
that.setData({
isExists:true
})
that.setData(res.data.data)
} else {
that.setData({
isExists: false,
msg:'未查到该账户信息,是否账户有误'
})
}
}
});
},
onGetInfo:function(e){ onGetInfo:function(e){
this.setData({ this.setData({
userInfo:e.detail.userInfo userInfo:e.detail.userInfo

View File

@ -7,10 +7,18 @@
</view> </view>
<view class="page__bd"> <view class="page__bd">
<view class="weui-cells__title">登陆</view> <view class="weui-cells__title">登陆</view>
<view class="weui-cells_desc" wx:if="{{!isExists}}" style="color:red">{{msg}}</view>
<view class="weui-cells_desc" wx:if="{{isExists}}" style="text-align:center">
<span style="color:orange;font-weight:bold">{{name}}</span>
--
<span style="color:darkblue;font-weight:bold">{{ubelongpart__partname}}</span>
--
<span style="color:darkblue;font-weight:bold">{{usecomp__partname}}</span>
</view>
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_input"> <view class="weui-cell weui-cell_input">
<view class="weui-cell__bd"> <view class="weui-cell__bd">
<input class="weui-input" placeholder="请输入账号" bindinput="usernameChange"/> <input class="weui-input" placeholder="请输入账号" bindinput="usernameChange" bindblur="getUserbasic"/>
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_input"> <view class="weui-cell weui-cell_input">

View File

@ -21,9 +21,14 @@ Page({
let q = decodeURIComponent(options.q) let q = decodeURIComponent(options.q)
if (q) { if (q) {
examtestid = util.getQueryString(q, 'id') examtestid = util.getQueryString(q, 'id')
this.setData({ if (wx.getStorageSync('sessionid').indexOf('sessinid') != -1) {
fromWx: true this.setData({
}) fromWx: true
})
}else{
getApp().onLaunch()
}
} }
} }
wx.request({ wx.request({