From 1de054e722bb7232bc1d53e21380a214203e77eb Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 19 Feb 2020 08:35:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=90=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 26 ++++++----------------- pages/bind/binduser.js | 3 ++- pages/examtest/note.js | 9 +++++++- pages/examtest/rate.js | 2 +- pages/examtest/rate.wxml | 6 ++---- pages/main/main.js | 42 ++++++++++++++++++++++++++++++++------ pages/main/main.wxml | 2 +- pages/totalrate/index.js | 4 ++-- pages/totalrate/index.wxml | 6 ++---- 9 files changed, 60 insertions(+), 40 deletions(-) diff --git a/app.js b/app.js index 978f9b0..b1ae3ae 100644 --- a/app.js +++ b/app.js @@ -32,6 +32,7 @@ App({ that.globalData.userInfo.mpopenid = res.data.mpopenid that.globalData.userInfo.perms = res.data.rights //拉取权限 that.globalData.userInfo.companyid = res.data.companyid + that.globalData.userInfo.openid = res.data.openid // if (that.callback) { //这个函数名字和你定义的一样即可 // that.callback() //执行定义的回调函数 // } @@ -41,23 +42,7 @@ App({ currentPage.callback(); // Callback that.oncallback = false; // Callback called /**** KEY PART END ****/ - let openid = res.data.openid; - if(openid==null){ - wx.showModal({ - title: '温馨提示', - content: '您还未绑定通知,\n无法接收微信公众号提醒!', - cancelText:'不用了', - confirmText:'去绑定', - success(res) { - if (res.confirm) { - wx.navigateTo({ - url: '/pages/bindwxtz/index', - }) - } else if (res.cancel) { - } - } - }) - } + //获取是否是安全员 wx.request({ url: that.globalData.serverUrl + 'api/user?a=checkaqy', @@ -106,10 +91,11 @@ App({ isaqy:0, mpopenid:'', companyid:'', - perms:[] + perms:[], + openid:null }, - serverUrl: 'https://safeyun.ctcshe.com/', - //serverUrl: 'http://127.0.0.1:8000/', + //serverUrl: 'https://safeyun.ctcshe.com/', + serverUrl: 'http://127.0.0.1:8000/', //serverUrl: 'http://192.168.0.107:8000/', //serverUrl:'http://10.0.11.195:8000/', timepass:null //定时器 diff --git a/pages/bind/binduser.js b/pages/bind/binduser.js index f495f59..3edd3d3 100644 --- a/pages/bind/binduser.js +++ b/pages/bind/binduser.js @@ -39,7 +39,8 @@ Page({ isaqy: 0, mpopenid: '', companyid: '', - perms: [] + perms: [], + openid:null } //重置globaldata和session getApp().mplogin() wx.switchTab({ diff --git a/pages/examtest/note.js b/pages/examtest/note.js index dfc02f8..9b89d7b 100644 --- a/pages/examtest/note.js +++ b/pages/examtest/note.js @@ -6,7 +6,7 @@ Page({ * 页面的初始数据 */ data: { - testdisable:false, + testdisable:true, fromWx:false }, @@ -31,6 +31,9 @@ Page({ } } + wx.showLoading({ + title: '加载中', + }) wx.request({ url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id='+examtestid, header: { @@ -39,7 +42,9 @@ Page({ }, success: res => { if (res.statusCode === 200) { + let ksdata = res.data + ksdata['testdisable'] = false if (ksdata.starttime != null) { let st = new Date(ksdata.starttime) if(new Date() - - {{index+1}} - + {{index+1}} @@ -21,7 +19,7 @@ {{item.score}}分 - {{item.took}} + {{item.tookformat}} diff --git a/pages/main/main.js b/pages/main/main.js index eef434e..42e5c3a 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -62,6 +62,23 @@ Page({ { title: "'国检战疫,有我助力'知识竞赛火热进行中!" },] }) } + // let openid = getApp().globalData.userInfo.openid; + // if (openid == null && getApp().globalData.userInfo.companyid != 2681) { + // wx.showModal({ + // title: '温馨提示', + // content: '您还未绑定通知,\n无法接收微信公众号提醒!', + // cancelText: '不用了', + // confirmText: '去绑定', + // success(res) { + // if (res.confirm) { + // wx.navigateTo({ + // url: '/pages/bindwxtz/index', + // }) + // } else if (res.cancel) { + // } + // } + // }) + // } this.getNew() }, /** @@ -76,13 +93,26 @@ Page({ */ onShow: function () { var that = this - console.log(getApp().globalData.userInfo) - //获取待阅读通知数目 - if (wx.getStorageSync('sessionid').indexOf('sessinid')!=-1){ - that.getNew() - } - }, + if (wx.getStorageSync('sessionid').indexOf('sessionid') != -1) { + that.getNew() + } + else { + getApp().mplogin() + } + if (getApp().globalData.userInfo.companyid == 2681) { + this.setData({ + isGjjt: true, + user__name: getApp().globalData.userInfo.name, + msgList: [ + { title: "齐心协力抗肺炎,众志成城渡难关。武汉加油!祖国加油!" }, + { title: "'国检战疫,有我助力'知识竞赛火热进行中!" },] + }) + } + + + + }, getNew:function(){ this.getnoread() this.getyhtodonum() diff --git a/pages/main/main.wxml b/pages/main/main.wxml index 148d110..cf5615a 100644 --- a/pages/main/main.wxml +++ b/pages/main/main.wxml @@ -76,7 +76,7 @@ 在线考试 {{dknum}} - + 实时总排名 diff --git a/pages/totalrate/index.js b/pages/totalrate/index.js index 20a0cee..47f94ce 100644 --- a/pages/totalrate/index.js +++ b/pages/totalrate/index.js @@ -80,7 +80,7 @@ Page({ title: '加载中', }), wx.request({ - url: this.data.serverUrl + 'api/examtestdetail?a=totalrate&rows=20&page=' + page, + url: this.data.serverUrl + 'api/examtestdetail?a=totalrate&rows=20&page=' + page +'&companyid='+getApp().globalData.userInfo.companyid, header: { 'content-type': 'application/json', // 默认值 'Cookie': wx.getStorageSync("sessionid"), @@ -110,7 +110,7 @@ Page({ list = this.data.ratelist.concat(res.data.rows) } for (var i = 0; i < list.length; i++) { - list[i].totaltook = util.formatSeconds(list[i].totaltook) + list[i].totaltookformat = util.formatSeconds(list[i].totaltook) } this.setData({ total: res.data.total, diff --git a/pages/totalrate/index.wxml b/pages/totalrate/index.wxml index 296eae5..df749cf 100644 --- a/pages/totalrate/index.wxml +++ b/pages/totalrate/index.wxml @@ -7,9 +7,7 @@ - - {{index+1}} - + {{index+1}} @@ -28,7 +26,7 @@ {{item.totalscore}}分 - {{item.totaltook}} + {{item.totaltookformat}}