排名优化
This commit is contained in:
parent
3a2e0ce1f7
commit
1de054e722
26
app.js
26
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 //定时器
|
||||
|
|
|
@ -39,7 +39,8 @@ Page({
|
|||
isaqy: 0,
|
||||
mpopenid: '',
|
||||
companyid: '',
|
||||
perms: []
|
||||
perms: [],
|
||||
openid:null
|
||||
} //重置globaldata和session
|
||||
getApp().mplogin()
|
||||
wx.switchTab({
|
||||
|
|
|
@ -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()<st){
|
||||
|
@ -59,6 +64,8 @@ Page({
|
|||
ksdata['msg'] = '您已考过!'
|
||||
}
|
||||
this.setData(ksdata)
|
||||
wx.hideLoading()
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -114,7 +114,7 @@ Page({
|
|||
list = this.data.ratelist.concat(res.data.rows)
|
||||
}
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
list[i].took = util.formatSeconds(list[i].took)
|
||||
list[i].tookformat = util.formatSeconds(list[i].took)
|
||||
}
|
||||
this.setData({
|
||||
total: res.data.total,
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
<block wx:for="{{ratelist}}" wx:key="unique">
|
||||
<view class="weui-panel__bd">
|
||||
<view class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg" style="width:10rpx">
|
||||
{{index+1}}
|
||||
</view>
|
||||
<span style="color:darkblue">{{index+1}}</span>
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||
<!-- <image class="weui-media-box__thumb" src="{{userInfo.avatarUrl}}" /> -->
|
||||
<image class="weui-media-box__thumb" src="{{item.user__headimgurl}}"></image>
|
||||
|
@ -21,7 +19,7 @@
|
|||
|
||||
<view class="weui-media-box__title" style="background-color:orange;color:white;font-weight:bold">{{item.score}}分</view>
|
||||
|
||||
<view class="weui-media-box__desc" style="background-color:green;color:white">{{item.took}}</view>
|
||||
<view class="weui-media-box__desc" style="background-color:green;color:white">{{item.tookformat}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<view class="weui-grid__label">在线考试</view>
|
||||
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{dknum!=0}}">{{dknum}}</view>
|
||||
</view>
|
||||
<navigator class="weui-grid" hover-class="weui-grid_active" url="../totalrate/index" >
|
||||
<navigator class="weui-grid" hover-class="weui-grid_active" url="../totalrate/index" wx:if="{{isGjjt}}">
|
||||
<image class="weui-grid__icon" src="../images/rate.png" />
|
||||
<view class="weui-grid__label">实时总排名</view>
|
||||
</navigator>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
<block wx:for="{{ratelist}}" wx:key="unique">
|
||||
<view class="weui-panel__bd">
|
||||
<view class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg" style="width:10rpx">
|
||||
{{index+1}}
|
||||
</view>
|
||||
<span style="color:darkblue">{{index+1}}</span>
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||
<!-- <image class="weui-media-box__thumb" src="{{userInfo.avatarUrl}}" /> -->
|
||||
<image class="weui-media-box__thumb" src="{{item.user__headimgurl}}"></image>
|
||||
|
@ -28,7 +26,7 @@
|
|||
|
||||
<view class="weui-media-box__title" style="background-color:orange;color:white;font-weight:bold">{{item.totalscore}}分</view>
|
||||
|
||||
<view class="weui-media-box__desc" style="background-color:green;color:white">{{item.totaltook}}</view>
|
||||
<view class="weui-media-box__desc" style="background-color:green;color:white">{{item.totaltookformat}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
Loading…
Reference in New Issue