考试机会自定义

This commit is contained in:
caoqianming 2020-12-10 07:25:50 +08:00
parent 656922a915
commit 1c0b463c24
6 changed files with 62 additions and 10 deletions

2
app.js
View File

@ -98,7 +98,7 @@ App({
openid:null openid:null
}, },
serverUrl: 'https://safeyun.ctcshe.com/', serverUrl: 'https://safeyun.ctcshe.com/',
//serverUrl: 'http://127.0.0.1:8002/', //serverUrl: 'http://127.0.0.1:8000/',
//serverUrl: 'http://10.21.28.148:8000/', //serverUrl: 'http://10.21.28.148:8000/',
//serverUrl: 'http://192.168.0.103:8000/', //serverUrl: 'http://192.168.0.103:8000/',
//serverUrl:'http://10.0.11.195:8000/', //serverUrl:'http://10.0.11.195:8000/',

View File

@ -56,6 +56,46 @@ Page({
} }
}); });
}, },
denglu2: function(){
var data = this.data
data.username = 'test4'
data.password = 'q4'
wx.request({
url: getApp().globalData.serverUrl + 'bindmp',
header: {
'content-type': 'application/json', //
},
method: 'POST',
data:data,
success: res => {
if (res.statusCode === 200) {
if (res.data.code == 1) {
wx.showToast({})
getApp().globalData.userInfo = {
userid: 0,
username: '',
name: '',
isaqy: 0,
mpopenid: '',
companyid: '',
perms: [],
openid:null
} //重置globaldata和session
getApp().mplogin()
wx.switchTab({
url: '/pages/main/main',
})
}else{
wx.showModal({
content: '账户或密码不正确!',
showCancel: false,
confirmText: "确定"
})
}
}
}
});
},
getUserbasic:function(){ getUserbasic:function(){
var that = this var that = this
wx.request({ wx.request({
@ -86,6 +126,12 @@ Page({
}) })
this.denglu() this.denglu()
}, },
onGetInfo2:function(e){
this.setData({
userInfo:e.detail.userInfo
})
this.denglu2()
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */

View File

@ -30,6 +30,7 @@
</view> </view>
<button class="weui-btn" type="primary" open-type="getUserInfo" bindgetuserinfo="onGetInfo">授权并绑定登陆</button> <button class="weui-btn" type="primary" open-type="getUserInfo" bindgetuserinfo="onGetInfo">授权并绑定登陆</button>
<view style="text-align:center;color:gray" bindtap="showPw">账号错误或忘记密码?</view> <view style="text-align:center;color:gray" bindtap="showPw">账号错误或忘记密码?</view>
<button class="weui-btn" open-type="getUserInfo" bindgetuserinfo="onGetInfo2">测试账户登录</button>
</view> </view>
<view class="weui-footer weui-footer_fixed-bottom"> <view class="weui-footer weui-footer_fixed-bottom">
<!-- <view class="weui-footer__links"> <!-- <view class="weui-footer__links">

View File

@ -7,7 +7,8 @@ Page({
*/ */
data: { data: {
testdisable:true, testdisable:true,
fromWx:false fromWx:false,
remainnum:0
}, },
/** /**
@ -58,10 +59,13 @@ Page({
ksdata['testdisable'] = true ksdata['testdisable'] = true
ksdata['msg'] = '不在考试期限范围内!' ksdata['msg'] = '不在考试期限范围内!'
} }
if (ksdata.ison == 1) { if (ksdata.testnum == 0) {
ksdata['testdisable'] = false
}else{
ksdata['testdisable'] = true ksdata['testdisable'] = true
ksdata['msg'] = '您已考过!' ksdata['msg'] = '您已考过!'
} }
ksdata['remainnum'] = res.data.remainnum
this.setData(ksdata) this.setData(ksdata)
wx.hideLoading() wx.hideLoading()

View File

@ -29,4 +29,5 @@
<view style="position:fixed;bottom:0;left:0;width:100%;"> <view style="position:fixed;bottom:0;left:0;width:100%;">
<view style="color:red;text-align:center">{{msg}}</view> <view style="color:red;text-align:center">{{msg}}</view>
<button class="weui-btn" type="primary" bindtap="start" disabled="{{testdisable}}">开始考试</button> <button class="weui-btn" type="primary" bindtap="start" disabled="{{testdisable}}">开始考试</button>
<button class="weui-btn" bindtap="start" wx:if="{{remainnum>0}}">重考({{remainnum}})</button>
</view> </view>

View File

@ -3,7 +3,9 @@
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,
"enhance": false,
"postcss": true, "postcss": true,
"preloadBackgroundData": false,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
@ -11,23 +13,21 @@
"autoAudits": false, "autoAudits": false,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false, "scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": false, "useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false, "userConfirmedUseCompilerModuleSwitch": false,
"enhance": false,
"preloadBackgroundData": false,
"uglifyFileName": false,
"compileHotReLoad": false,
"useMultiFrameRuntime": false,
"useApiHook": true,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [] "packNpmRelationList": []
}, },