安全预警模拟练习
This commit is contained in:
parent
303ad947b6
commit
582590b6db
17
app.js
17
app.js
|
@ -1,21 +1,8 @@
|
||||||
//app.js
|
//app.js
|
||||||
App({
|
App({
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
// 展示本地存储能力
|
var that = this
|
||||||
//var logs = wx.getStorageSync('logs') || []
|
that.mplogin()
|
||||||
//logs.unshift(Date.now())
|
|
||||||
//wx.setStorageSync('logs', logs)
|
|
||||||
// wx.checkSession({
|
|
||||||
// success() {
|
|
||||||
// //session_key 未过期,并且在本生命周期一直有效
|
|
||||||
// console.log(wx.getStorageSync("sessionid"))
|
|
||||||
// },
|
|
||||||
// fail() {
|
|
||||||
// // session_key 已经失效,需要重新执行登录流程
|
|
||||||
// // 登录
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
this.mplogin();
|
|
||||||
},
|
},
|
||||||
mplogin: function () {
|
mplogin: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
20
app.json
20
app.json
|
@ -38,7 +38,22 @@
|
||||||
"pages/userSelect/userSelect",
|
"pages/userSelect/userSelect",
|
||||||
"components/footer/footer",
|
"components/footer/footer",
|
||||||
"pages/operation/operationadd",
|
"pages/operation/operationadd",
|
||||||
"pages/train/add"
|
"pages/train/add",
|
||||||
|
"pages/train/detail",
|
||||||
|
"pages/train/check",
|
||||||
|
"pages/train/qrcode",
|
||||||
|
"pages/operation/list",
|
||||||
|
"pages/examtest/index",
|
||||||
|
"pages/examtest/note",
|
||||||
|
"pages/examtest/main",
|
||||||
|
"pages/examtest/sheet",
|
||||||
|
"pages/examtest/result",
|
||||||
|
"pages/examtest/detail",
|
||||||
|
"pages/safecert/index",
|
||||||
|
"pages/safecert/detail",
|
||||||
|
"pages/exercise/index",
|
||||||
|
"pages/questioncat/index",
|
||||||
|
"pages/exercise/main"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
|
@ -65,5 +80,6 @@
|
||||||
"selectedIconPath": "image/mec.png"
|
"selectedIconPath": "image/mec.png"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"sitemapLocation": "sitemap.json"
|
||||||
}
|
}
|
|
@ -3,4 +3,5 @@
|
||||||
<scroll-view scroll-x style='scroll'>
|
<scroll-view scroll-x style='scroll'>
|
||||||
<text id='{{index}}' class='text' wx:for='{{list}}' wx:key='{{index}}' bindtap='delete'>{{item.name}}</text> </scroll-view>
|
<text id='{{index}}' class='text' wx:for='{{list}}' wx:key='{{index}}' bindtap='delete'>{{item.name}}</text> </scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<text class='btn' bindtap='confirm'>确定</text> </view>
|
<text class='btn' bindtap='confirm'>确定</text>
|
||||||
|
</view>
|
|
@ -25,7 +25,7 @@
|
||||||
.text {
|
.text {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
padding: 40rpx 20rpx;
|
padding: 20rpx 20rpx;
|
||||||
margin-right: 10rpx;
|
margin-right: 10rpx;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ Page({
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.code == 1) {
|
if (res.data.code == 1) {
|
||||||
wx.showToast({})
|
wx.showToast({})
|
||||||
getApp().onLaunch()
|
getApp().mplogin()
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: '/pages/main/main',
|
url: '/pages/main/main',
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
// pages/examtest/detail.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
detaildata:{
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
var detailid = options.detailid
|
||||||
|
this.data.detailid = detailid
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中..',
|
||||||
|
})
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=detail&id='+detailid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading()
|
||||||
|
var data = res.data
|
||||||
|
data.starttime = util.formatTime2(new Date(data.starttime))
|
||||||
|
this.detaildata = data
|
||||||
|
this.setData({
|
||||||
|
starttime:data.starttime,
|
||||||
|
took:data.took,
|
||||||
|
tmIndex:0,
|
||||||
|
tmtotal: data['testdetail'].length,
|
||||||
|
currentTm:data['testdetail'][0]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
this.showanswer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
next:function(){
|
||||||
|
var that=this
|
||||||
|
var tmIndex = that.data.tmIndex +1
|
||||||
|
that.setData({
|
||||||
|
tmIndex:tmIndex,
|
||||||
|
currentTm:that.detaildata.testdetail[tmIndex]
|
||||||
|
})
|
||||||
|
that.showanswer()
|
||||||
|
},
|
||||||
|
previous: function () {
|
||||||
|
var that = this
|
||||||
|
var tmIndex = that.data.tmIndex - 1
|
||||||
|
that.setData({
|
||||||
|
tmIndex: tmIndex,
|
||||||
|
currentTm: that.detaildata.testdetail[tmIndex]
|
||||||
|
})
|
||||||
|
that.showanswer()
|
||||||
|
},
|
||||||
|
showanswer: function () {
|
||||||
|
var that = this
|
||||||
|
var currentTm = that.data.currentTm
|
||||||
|
console.log(currentTm)
|
||||||
|
var answer = currentTm.question__answer
|
||||||
|
var sorder = Object.keys(answer).sort();
|
||||||
|
var answerChecked=[]
|
||||||
|
for (var x = 0; x < sorder.length; x++) {
|
||||||
|
if (answer[sorder[x]] != '') {
|
||||||
|
if(currentTm.userchecked!=undefined){
|
||||||
|
var ii = currentTm.userchecked.indexOf(sorder[x])
|
||||||
|
}else{
|
||||||
|
ii=1
|
||||||
|
}
|
||||||
|
if ( ii!= -1 && currentTm.question__right.indexOf(sorder[x]) != -1){
|
||||||
|
answerChecked.push({ 'name': sorder[x] + ':' + answer[sorder[x]], 'right': true, 'checked': true })
|
||||||
|
} else if (ii != -1){
|
||||||
|
answerChecked.push({ 'name': sorder[x] + ':' + answer[sorder[x]], 'right': false, 'checked': true })
|
||||||
|
} else if (currentTm.question__right.indexOf(sorder[x]) != -1){
|
||||||
|
answerChecked.push({ 'name': sorder[x] + ':' + answer[sorder[x]], 'right': true, 'checked': false })
|
||||||
|
}else{
|
||||||
|
answerChecked.push({ 'name': sorder[x] + ':' + answer[sorder[x]], 'right': false, 'checked': false })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
that.setData({ 'answerChecked': answerChecked })
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "试卷详情"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<!--pages/examtest/main.wxml-->
|
||||||
|
<view class="head">
|
||||||
|
|
||||||
|
<view style="float:left">答题耗时{{took}}分钟</view>
|
||||||
|
</view>
|
||||||
|
<view >
|
||||||
|
</view>
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__h2">{{tmIndex+1}}.
|
||||||
|
<span wx:if="{{currentTm.question__type==1}}" class="txlabel">单选题</span>
|
||||||
|
<span wx:if="{{currentTm.question__type==2}}" class="txlabel">多选题</span>
|
||||||
|
<span wx:if="{{currentTm.question__type==3}}" class="txlabel">判断题</span>
|
||||||
|
<span> ({{currentTm.score}}分)</span>
|
||||||
|
</view>
|
||||||
|
<view class="weui-article__title">{{currentTm.question__title}}</view>
|
||||||
|
</view>
|
||||||
|
<radio-group wx:if="{{(currentTm.question__type==1 ||currentTm.question__type==3)}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChecked}}" wx:key="value">
|
||||||
|
<view class="weui-cell__bd" wx:if="{{item.right}}" style="color:green;font-weight:bold">{{item.name}}</view>
|
||||||
|
<view class="weui-cell__bd" wx:else>{{item.name}}</view>
|
||||||
|
<view class="weui-cell__ft weui-cell__ft_in-radio" >
|
||||||
|
<icon class="weui-icon-cancel" type="cancel" size="23" wx:if="{{item.checked && !item.right}}"></icon>
|
||||||
|
<icon class="weui-icon-success" type="success" size="23" wx:if="{{item.checked && item.right}}"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
<checkbox-group wx:if="{{currentTm.question__type==2}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChecked}}" wx:key="value">
|
||||||
|
<view class="weui-cell__bd" wx:if="{{item.right}}" style="color:green;font-weight:bold">{{item.name}}</view>
|
||||||
|
<view class="weui-cell__bd" wx:else>{{item.name}}</view>
|
||||||
|
<view class="weui-cell__hd weui-check__hd_in-checkbox">
|
||||||
|
<icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked && item.right}}"></icon>
|
||||||
|
<icon class="weui-icon-checkbox_cancel" type="cancel" size="23" wx:if="{{item.checked && !item.right}}"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__h2">正确答案是{{currentTm.question__right}},你的答案是{{currentTm.userchecked}}</view>
|
||||||
|
<view class="weui-article__h2" style="color:green" wx:if="{{currentTm.iscore == currentTm.score}}">回答正确</view>
|
||||||
|
<view class="weui-article__h2" style="color:red" wx:else>回答有误</view>
|
||||||
|
<view class="weui-article__title" wx:if="{{currentTm.question__resoluation != null}}"><span style="color:blue">解析: </span>{{currentTm.question__resoluation}}</view>
|
||||||
|
<view class="weui-article__title" wx:else><span style="color:blue">解析: </span>无</view>
|
||||||
|
</view>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
||||||
|
|
||||||
|
<view style="width:50%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:50%;float:right">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,18 @@
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
}
|
||||||
|
.txlabel{
|
||||||
|
color:#fff;
|
||||||
|
background-color: rgb(216, 140, 0);
|
||||||
|
padding: 2px
|
||||||
|
}
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.sheet{
|
||||||
|
color:#fff;
|
||||||
|
background-color: red;
|
||||||
|
float:right
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
//var base64 = require("../images/base64");
|
||||||
|
var sliderWidth = 96;
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
page: 1,
|
||||||
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
|
allyhlist: [],
|
||||||
|
tabs: ["待考", "已考"],
|
||||||
|
activeIndex: 0,
|
||||||
|
sliderOffset: 0,
|
||||||
|
sliderLeft: 0
|
||||||
|
},
|
||||||
|
tabClick: function (e) {
|
||||||
|
var that = this
|
||||||
|
that.setData({
|
||||||
|
sliderOffset: e.currentTarget.offsetLeft,
|
||||||
|
activeIndex: e.currentTarget.id
|
||||||
|
});
|
||||||
|
if (that.data.activeIndex == 0) {
|
||||||
|
that.gettodokslist(1)
|
||||||
|
that.data.todopage = 1
|
||||||
|
}
|
||||||
|
else if (that.data.activeIndex == 1) {
|
||||||
|
that.getyklist(1)
|
||||||
|
that.data.page = 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getyklist: function (page) {
|
||||||
|
var that = this;
|
||||||
|
if (page != 1) { page = that.data.page }
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/examtestdetail?a=listyk&rows=10&page=' + page,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data.rows.length == 0) {
|
||||||
|
if (page == 1) {
|
||||||
|
this.setData({
|
||||||
|
yktotal: 0,
|
||||||
|
yklist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showModal({
|
||||||
|
content: "已经到底啦!",
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let list
|
||||||
|
if (page == 1) {
|
||||||
|
list = res.data.rows
|
||||||
|
} else {
|
||||||
|
list = this.data.yklist.concat(res.data.rows)
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
yktotal: res.data.total,
|
||||||
|
yklist: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
gettodokslist: function (page) {
|
||||||
|
var that = this;
|
||||||
|
if (page != 1) { page = that.data.todopage }
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/examtestdetail?a=listdk&rows=10&page=' + page,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data.rows.length == 0) {
|
||||||
|
if (page == 1) {
|
||||||
|
this.setData({
|
||||||
|
todototal: 0,
|
||||||
|
todokslist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showModal({
|
||||||
|
content: "已经到底啦!",
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let list
|
||||||
|
if (page == 1) {
|
||||||
|
list = res.data.rows
|
||||||
|
} else {
|
||||||
|
list = this.data.todokslist.concat(res.data.rows)
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
todototal: res.data.total,
|
||||||
|
todokslist: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onLoad: function () {
|
||||||
|
// this.setData({
|
||||||
|
// icon: base64.icon20
|
||||||
|
// });
|
||||||
|
var that = this;
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
|
||||||
|
sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow: function () {
|
||||||
|
var that = this;
|
||||||
|
console.log(that.data.activeIndex)
|
||||||
|
if (that.data.activeIndex == 0) {
|
||||||
|
that.gettodokslist(1)
|
||||||
|
that.data.todopage = 1
|
||||||
|
}
|
||||||
|
else if (that.data.activeIndex == 1) {
|
||||||
|
that.getyklist(1)
|
||||||
|
that.data.page = 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
var that = this;
|
||||||
|
if (that.data.activeIndex == 0) {
|
||||||
|
that.gettodokslist(1)
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
that.data.todopage = 1
|
||||||
|
}
|
||||||
|
else if (that.data.activeIndex == 1) {
|
||||||
|
that.getyklist(1)
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
that.data.page = 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onReachBottom: function () {
|
||||||
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
if (that.data.activeIndex == 0) {
|
||||||
|
this.data.todopage = this.data.todopage + 1;
|
||||||
|
this.gettodokslist();
|
||||||
|
}
|
||||||
|
else if (that.data.activeIndex == 1) {
|
||||||
|
this.data.page = this.data.page + 1;
|
||||||
|
this.getyklist();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "在线考试",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
<view class="weui-tab">
|
||||||
|
<view class="weui-navbar">
|
||||||
|
<block wx:for="{{tabs}}" wx:key="*this">
|
||||||
|
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
|
||||||
|
<view class="weui-navbar__title">{{item}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-tab__panel">
|
||||||
|
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">
|
||||||
|
<view class="head">
|
||||||
|
共{{todototal}}条待参加考试</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<block wx:for="{{todokslist}}" wx:key="unique">
|
||||||
|
<navigator url="note?examtestid={{item.examtest__id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<view class="weui-media-box__title">{{item.examtest__name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc" style="color:green">答卷时长:{{item.examtest__duration}}分钟 通过分数:{{item.examtest__passscore}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
||||||
|
<view class="head">
|
||||||
|
共{{yktotal}}条考试</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<block wx:for="{{yklist}}" wx:key="unique">
|
||||||
|
<navigator url="detail?detailid={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<view class="weui-media-box__title">{{item.examtest__name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc">参加时间:{{item.starttime}}</view>
|
||||||
|
<view class="weui-media-box__desc" style="color:blue">耗时:{{item.took}}分钟 得分:{{item.score}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||||
|
<view class="weui-media-box__title" wx:if="{{item.passcode==1}}" style="color:green">
|
||||||
|
通过
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__title" wx:if="{{item.passcode==0 && item.ison==1}}" style="color:red">
|
||||||
|
未通过
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,13 @@
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #939393;
|
||||||
|
}
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -0,0 +1,323 @@
|
||||||
|
// pages/examtest/main.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
tmIndex: 0,
|
||||||
|
answerChoices:[],
|
||||||
|
ydtm:0
|
||||||
|
},
|
||||||
|
tmdata: {
|
||||||
|
|
||||||
|
},
|
||||||
|
calydtm:function(e){
|
||||||
|
var tms = this.tmdata.tms
|
||||||
|
var ydtm = 0
|
||||||
|
for (var i = 0, len = tms.length; i < len; ++i) {
|
||||||
|
if(tms[i].userchecked && tms[i].userchecked.length !=0){
|
||||||
|
ydtm +=1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
ydtm:ydtm
|
||||||
|
})
|
||||||
|
},
|
||||||
|
radioChange: function (e) {
|
||||||
|
console.log('radio发生change事件,携带value值为:', e.detail.value);
|
||||||
|
var answerChoices = this.data.answerChoices;
|
||||||
|
for (var i = 0, len = answerChoices.length; i < len; ++i) {
|
||||||
|
answerChoices[i].checked = answerChoices[i].value == e.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
answerChoices: answerChoices,
|
||||||
|
});
|
||||||
|
this.tmdata.tms[this.data.tmIndex]['userchecked'] = e.detail.value
|
||||||
|
this.calydtm()
|
||||||
|
},
|
||||||
|
checkboxChange: function (e) {
|
||||||
|
console.log('checkbox发生change事件,携带value值为:', e.detail.value);
|
||||||
|
|
||||||
|
var answerChoices = this.data.answerChoices, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = answerChoices.length; i < lenI; ++i) {
|
||||||
|
answerChoices[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (answerChoices[i].value == values[j]) {
|
||||||
|
answerChoices[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
answerChoices: answerChoices,
|
||||||
|
});
|
||||||
|
this.tmdata.tms[this.data.tmIndex]['userchecked'] = e.detail.value
|
||||||
|
this.calydtm()
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
if(options.id){
|
||||||
|
this.setData({
|
||||||
|
testid:options.id
|
||||||
|
})
|
||||||
|
wx.showLoading({})
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtest?a=detailtm&id=' + options.id,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(res.data)
|
||||||
|
let tms = res.data
|
||||||
|
this.tmdata = tms
|
||||||
|
console.log(tms.duration)
|
||||||
|
let mil = tms.duration * 60 * 1000
|
||||||
|
console.log(mil)
|
||||||
|
this.begin(mil)
|
||||||
|
this.showTm(0)
|
||||||
|
this.setData({
|
||||||
|
tmtotal: tms.tms.length,
|
||||||
|
starttime: util.formatTime(new Date()) })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
// wx.showModal({
|
||||||
|
// title: '系统提示',
|
||||||
|
// content: '未完成答卷,是否要提交答卷!',
|
||||||
|
// confirmText: "提交",
|
||||||
|
// cancelText: "点错了",
|
||||||
|
// success: function (res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// } else {
|
||||||
|
// this.onShow()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
begin: function (mil) {
|
||||||
|
var temp = formatmil(mil);
|
||||||
|
this.setData({
|
||||||
|
countdown: temp,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (mil < 2000) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '时间到,正在交卷..',
|
||||||
|
});
|
||||||
|
this.handtest()
|
||||||
|
return
|
||||||
|
};
|
||||||
|
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
mil -= 1000;
|
||||||
|
this.begin(mil);
|
||||||
|
}, 1000
|
||||||
|
);
|
||||||
|
},
|
||||||
|
showTm: function (index) {
|
||||||
|
var that = this
|
||||||
|
var currentTm = that.tmdata.tms[index]
|
||||||
|
console.log(currentTm)
|
||||||
|
that.setData({ 'currentTm': currentTm })
|
||||||
|
var answer = currentTm.question__answer
|
||||||
|
var i = 0
|
||||||
|
var x = ['A','B','C','D','E','F']
|
||||||
|
var answerChoices = []
|
||||||
|
for(var key in answer){
|
||||||
|
if(answer[key]!=''){
|
||||||
|
answerChoices.push({'name':x[i],'value':key,'checked':false})
|
||||||
|
i = i + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(answerChoices)
|
||||||
|
that.setData({ 'answerChoices': answerChoices})
|
||||||
|
},
|
||||||
|
showChecked: function(index){
|
||||||
|
var tm = this.tmdata.tms[index]
|
||||||
|
let choices = this.data.answerChoices
|
||||||
|
if(tm.userchecked){
|
||||||
|
if (tm.question__type = 2) {
|
||||||
|
for (var i = 0, len = choices.length; i < len; i++) {
|
||||||
|
if (tm.userchecked.indexOf(choices[i].value) != -1) {
|
||||||
|
choices[i].checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (var i = 0, len = choices.length; i < len; i++) {
|
||||||
|
if (choices[i].value == tm.userchecked) {
|
||||||
|
choices[i].checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
answerChoices: choices
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
next:function(){
|
||||||
|
var that = this
|
||||||
|
var tmIndex = that.data.tmIndex+1
|
||||||
|
that.showTm(tmIndex)
|
||||||
|
that.setData({
|
||||||
|
tmIndex:tmIndex,
|
||||||
|
})
|
||||||
|
that.showChecked(tmIndex)
|
||||||
|
},
|
||||||
|
previous: function () {
|
||||||
|
var that = this
|
||||||
|
var tmIndex = that.data.tmIndex - 1
|
||||||
|
that.showTm(tmIndex)
|
||||||
|
that.setData({
|
||||||
|
tmIndex: tmIndex,
|
||||||
|
})
|
||||||
|
that.showChecked(tmIndex)
|
||||||
|
},
|
||||||
|
hand:function(){
|
||||||
|
var that = this
|
||||||
|
if (that.data.ydtm < that.tmdata.tms.length){
|
||||||
|
wx.showModal({
|
||||||
|
title: '警告',
|
||||||
|
content: '答卷未完成,确定提交?',
|
||||||
|
confirmText: "确定",
|
||||||
|
cancelText: "取消",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.handtest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.showModal({
|
||||||
|
content: '确定提交?',
|
||||||
|
confirmText: "确定",
|
||||||
|
cancelText: "取消",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.handtest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handtest:function(){
|
||||||
|
var data={
|
||||||
|
'testid': this.data.testid,
|
||||||
|
'starttime':this.data.starttime,
|
||||||
|
'endtime': util.formatTime(new Date()),
|
||||||
|
'sheet':this.tmdata.tms
|
||||||
|
}
|
||||||
|
wx.showLoading({
|
||||||
|
title: '自动判卷中..',
|
||||||
|
})
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=handtest&id=' + this.data.testid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: data,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.redirectTo({
|
||||||
|
url: 'result?' + parseParams(res.data.data),
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
function formatmil(mil) {
|
||||||
|
var allSecond = Math.floor(mil / 1000);
|
||||||
|
var h = Math.floor(allSecond / 3600);
|
||||||
|
var m = Math.floor((allSecond - h * 3600) / 60);
|
||||||
|
var s = Math.floor(allSecond - h * 3600 - m * 60);
|
||||||
|
h = toTow(h);
|
||||||
|
m = toTow(m);
|
||||||
|
s = toTow(s);
|
||||||
|
return h + ":" + m + ":" + s;
|
||||||
|
}
|
||||||
|
function toTow(num) {
|
||||||
|
if (num < 10) {
|
||||||
|
return "0" + num;
|
||||||
|
} else {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function parseParams(data) {
|
||||||
|
try {
|
||||||
|
var tempArr = [];
|
||||||
|
for (var i in data) {
|
||||||
|
var key = encodeURIComponent(i);
|
||||||
|
var value = encodeURIComponent(data[i]);
|
||||||
|
tempArr.push(key + '=' + value);
|
||||||
|
}
|
||||||
|
var urlParamsStr = tempArr.join('&');
|
||||||
|
return urlParamsStr;
|
||||||
|
} catch (err) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "考试中"
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
<!--pages/examtest/main.wxml-->
|
||||||
|
<view class="head">
|
||||||
|
|
||||||
|
<view style="float:left">倒计时 {{countdown}}</view>
|
||||||
|
<navigator url="sheet" >
|
||||||
|
<view class="sheet">答题卡: {{ydtm}}/{{tmtotal}}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
<view >
|
||||||
|
</view>
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__h2">{{tmIndex+1}}.
|
||||||
|
<span wx:if="{{currentTm.question__type==1}}" class="txlabel">单选题</span>
|
||||||
|
<span wx:if="{{currentTm.question__type==2}}" class="txlabel">多选题</span>
|
||||||
|
<span wx:if="{{currentTm.question__type==3}}" class="txlabel">判断题</span>
|
||||||
|
<span> ({{currentTm.score}}分)</span>
|
||||||
|
</view>
|
||||||
|
<view class="weui-article__title">{{currentTm.question__title}}</view>
|
||||||
|
</view>
|
||||||
|
<radio-group bindchange="radioChange" wx:if="{{(currentTm.question__type==1 ||currentTm.question__type==3)}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||||
|
<radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||||
|
|
||||||
|
<view class="weui-cell__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__ft weui-cell__ft_in-radio" wx:if="{{item.checked}}">
|
||||||
|
<icon class="weui-icon-radio" type="success_no_circle" size="16"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
<checkbox-group bindchange="checkboxChange" wx:if="{{currentTm.question__type==2}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||||
|
<view class="weui-cell__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__hd weui-check__hd_in-checkbox">
|
||||||
|
<icon class="weui-icon-checkbox_circle" type="circle" size="23" wx:if="{{!item.checked}}"></icon>
|
||||||
|
<icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked}}"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
||||||
|
<view style="width:30%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:30%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:30%;float:right">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="hand" >交卷</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,18 @@
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
}
|
||||||
|
.txlabel{
|
||||||
|
color:#fff;
|
||||||
|
background-color: rgb(216, 140, 0);
|
||||||
|
padding: 2px
|
||||||
|
}
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.sheet{
|
||||||
|
color:#fff;
|
||||||
|
background-color: red;
|
||||||
|
float:right
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
// pages/examtest/note.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id='+options.examtestid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
let ksdata = res.data
|
||||||
|
if (ksdata.starttime != '') { ksdata.starttime = util.formatTime2(new Date(ksdata.starttime)) }
|
||||||
|
if (ksdata.endtime != '') { ksdata.endtime = util.formatTime2(new Date(ksdata.endtime)) }
|
||||||
|
this.setData(res.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
start: function () {
|
||||||
|
wx.reLaunch({
|
||||||
|
url: 'main?id='+this.data.id,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "考试须知"
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__title" style="text-align:center;margin-top:10rpx">考试须知</view>
|
||||||
|
<view class="page_bd">
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__title">1.考试详情</view>
|
||||||
|
<view>名称:<span style="color:blue">{{name}}</span></view>
|
||||||
|
<view>答卷时长:<span style="color:red">{{duration}}分钟</span></view>
|
||||||
|
<view>满分{{totalscore}};{{passscore}}以上通过</view>
|
||||||
|
<view>{{exampaper__total.dx.num}}道单选题,{{exampaper__total.duox.num}}道多选题,{{exampaper__total.pd.num}}道判断题</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__title">2.答题须知</view>
|
||||||
|
<view style="color:red">进入答题后请不要后退或返回桌面</view>
|
||||||
|
<view>用户可点击上一题/下一题进行切换答题</view>
|
||||||
|
<view>用户选择好选项后会自动跳转至下一题</view>
|
||||||
|
<view>请合理安排时间答题,可提前交卷,超时会自动提交</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="start">开始考试</button>
|
||||||
|
</view>
|
|
@ -0,0 +1,4 @@
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
// pages/examtest/result.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.setData({
|
||||||
|
passcode: options.passcode,
|
||||||
|
score:options.score,
|
||||||
|
totalscore:options.totalscore,
|
||||||
|
rights:options.rights,
|
||||||
|
tmnum:options.tmnum,
|
||||||
|
detailid: options.examtestdetailid
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
detail:function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'detail?detailid=' + this.data.detailid,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
back:function(){
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/main/main'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "在线考试"
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="weui-msg">
|
||||||
|
<view class="weui-msg__icon-area" wx:if="{{passcode==1}}">
|
||||||
|
<icon type="success" size="93"></icon>
|
||||||
|
</view>
|
||||||
|
<view class="weui-msg__icon-area" wx:else>
|
||||||
|
<icon type="warn" size="93"></icon>
|
||||||
|
</view>
|
||||||
|
<view class="weui-msg__text-area" wx:if="{{passcode==1}}">
|
||||||
|
<view class="weui-msg__title">恭喜你,通过考试!</view>
|
||||||
|
<view class="weui-msg__desc">得分<span class="b">{{score}}</span>,满分{{totalscore}}</view>
|
||||||
|
<view class="weui-msg__desc">全对<span class="b">{{rights}}</span>题,共{{tmnum}}题</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-msg__text-area" wx:else>
|
||||||
|
<view class="weui-msg__title">很遗憾,下次加油!</view>
|
||||||
|
<view class="weui-msg__desc">得分<span class="b">{{score}}</span>,满分{{totalscore}}</view>
|
||||||
|
<view class="weui-msg__desc">全对<span class="b">{{rights}}</span>题,共{{tmnum}}题</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-msg__opr-area">
|
||||||
|
<view class="weui-btn-area">
|
||||||
|
<button class="weui-btn" type="primary" bindtap='detail'>考卷详情</button>
|
||||||
|
<button class="weui-btn" type="default" bindtap='back'>返回主页</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,8 @@
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.b{
|
||||||
|
color:red;
|
||||||
|
font-weight: bold
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
// pages/examtest/sheet.js
|
||||||
|
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
back: function (e) {
|
||||||
|
console.log(e.currentTarget.dataset.index);
|
||||||
|
var tmIndex = e.currentTarget.dataset.index
|
||||||
|
var pages = getCurrentPages();
|
||||||
|
var prevPage = pages[pages.length - 2]; //上一个页面
|
||||||
|
prevPage.setData({
|
||||||
|
tmIndex:tmIndex
|
||||||
|
})
|
||||||
|
prevPage.showTm(tmIndex)
|
||||||
|
prevPage.showChecked(tmIndex)
|
||||||
|
wx.navigateBack({
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
var pages = getCurrentPages();
|
||||||
|
var prevPage = pages[pages.length - 2]; //上一个页面
|
||||||
|
var tmlist = prevPage.tmdata.tms //取上页data里的数据也可以修改
|
||||||
|
console.log(tmlist)
|
||||||
|
this.setData({
|
||||||
|
tmlist:tmlist
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "答题卡"
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!--pages/examtest/sheet.wxml-->
|
||||||
|
<view style="width:100%;display:flex;padding:20rpx;flex-wrap: wrap ">
|
||||||
|
<view wx:for="{{tmlist}}" wx:key="id" >
|
||||||
|
|
||||||
|
<view wx:if="{{item.userchecked && item.userchecked.length !=0 }}" class="ok" data-index="{{index}}" bindtap='back'>
|
||||||
|
{{index+1}}
|
||||||
|
</view>
|
||||||
|
<view wx:else class="no" data-index="{{index}}" bindtap='back'>
|
||||||
|
{{index+1}}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* pages/examtest/sheet.wxss */
|
||||||
|
.ok{
|
||||||
|
display: flex;
|
||||||
|
color:#fff;
|
||||||
|
background-color: green;
|
||||||
|
border:4rpx solid green;
|
||||||
|
height:100rpx;
|
||||||
|
width:100rpx;
|
||||||
|
margin:20rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.no{
|
||||||
|
display: flex;
|
||||||
|
border:4rpx solid red;
|
||||||
|
height:100rpx;
|
||||||
|
width:100rpx;
|
||||||
|
margin:20rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
|
@ -0,0 +1,147 @@
|
||||||
|
// pages/exercise/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
catsname:'',
|
||||||
|
start1:true,
|
||||||
|
start2:false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
var that = this
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'questioncats',
|
||||||
|
success: function(res) {
|
||||||
|
let lst = res.data
|
||||||
|
let nst = []
|
||||||
|
let nst1 = []
|
||||||
|
if (lst) {
|
||||||
|
for (var i = 0; i < lst.length; i++) {
|
||||||
|
nst.push(lst[i]['name'])
|
||||||
|
nst1.push(lst[i]['id'])
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
catsname: nst.join(','),
|
||||||
|
cats: nst1.join(','),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that=this
|
||||||
|
let lst = getApp().globalData.selectList
|
||||||
|
let nst = []
|
||||||
|
let nst1 = []
|
||||||
|
if (lst) {
|
||||||
|
for (var i = 0; i < lst.length; i++) {
|
||||||
|
nst.push(lst[i]['name'])
|
||||||
|
nst1.push(lst[i]['id'])
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
catsname: nst.join(','),
|
||||||
|
cats: nst1.join(','),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'ydtms',
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
start1: false,
|
||||||
|
start2: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
choosequestioncat:function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/questioncat/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
start1:function(){
|
||||||
|
if(this.data.catsname!=''){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'main',
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.showModal({
|
||||||
|
content: '请选择题目分类!',
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
start2: function () {
|
||||||
|
if (this.data.catsname != '') {
|
||||||
|
wx.removeStorage({
|
||||||
|
key: 'ydtms',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
},
|
||||||
|
complete:function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'main',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
wx.showModal({
|
||||||
|
content: '请选择题目分类!',
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__hd">
|
||||||
|
<view class="page__title">模拟练习</view>
|
||||||
|
<view class="page__desc">选择题库分类进行练习。</view>
|
||||||
|
</view>
|
||||||
|
<view class="page__bd page__bd_spacing">
|
||||||
|
<button class="weui-btn" type="primary" bindtap='choosequestioncat'>选择分类</button>
|
||||||
|
<view class="weui-cells__title">已选分类</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title" style="height: 5.3em">
|
||||||
|
{{catsname}}
|
||||||
|
</view>
|
||||||
|
<button class="weui-btn" type="primary" bindtap='start1' wx:if='{{start1}}'>开始练习</button>
|
||||||
|
<button class="weui-btn" type="primary" bindtap='start1' wx:if='{{start2}}'>继续练习</button>
|
||||||
|
<button class="weui-btn" type="primary" bindtap='start2' wx:if='{{start2}}'>重新开始</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
|
@ -0,0 +1,8 @@
|
||||||
|
.button-sp-area{
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-top: 15px;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
.mini-btn{
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
|
@ -0,0 +1,247 @@
|
||||||
|
// pages/examtest/main.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
tmIndex: 0,
|
||||||
|
answerChoices: [],
|
||||||
|
answerP:false
|
||||||
|
},
|
||||||
|
tmdata: {
|
||||||
|
tms:[],
|
||||||
|
ydtms:[]
|
||||||
|
},
|
||||||
|
radioChange: function (e) {
|
||||||
|
console.log('radio发生change事件,携带value值为:', e.detail.value);
|
||||||
|
var answerChoices = this.data.answerChoices;
|
||||||
|
for (var i = 0, len = answerChoices.length; i < len; ++i) {
|
||||||
|
answerChoices[i].checked = answerChoices[i].value == e.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
answerChoices: answerChoices,
|
||||||
|
});
|
||||||
|
this.tmdata.tms[this.data.tmIndex]['userchecked'] = e.detail.value
|
||||||
|
this.setData({
|
||||||
|
currentTm: this.tmdata.tms[this.data.tmIndex]
|
||||||
|
})
|
||||||
|
this.showanswer()
|
||||||
|
},
|
||||||
|
checkboxChange: function (e) {
|
||||||
|
console.log('checkbox发生change事件,携带value值为:', e.detail.value);
|
||||||
|
|
||||||
|
var answerChoices = this.data.answerChoices, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = answerChoices.length; i < lenI; ++i) {
|
||||||
|
answerChoices[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (answerChoices[i].value == values[j]) {
|
||||||
|
answerChoices[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.tmdata.tms[this.data.tmIndex]['userchecked'] = e.detail.value
|
||||||
|
this.setData({
|
||||||
|
answerChoices: answerChoices,
|
||||||
|
currentTm: this.tmdata.tms[this.data.tmIndex]
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
var that = this
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'questioncats',
|
||||||
|
success: function (res) {
|
||||||
|
let lst = res.data
|
||||||
|
let nst = []
|
||||||
|
let nst1 = []
|
||||||
|
if (lst) {
|
||||||
|
for (var i = 0; i < lst.length; i++) {
|
||||||
|
nst.push(lst[i]['name'])
|
||||||
|
nst1.push(lst[i]['id'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
tmlxs:nst1
|
||||||
|
})
|
||||||
|
wx.getStorage({
|
||||||
|
key: 'ydtms',
|
||||||
|
success: function(res) {
|
||||||
|
that.tmdata.ydtms = res.data
|
||||||
|
that.getTms()
|
||||||
|
},
|
||||||
|
fail:function(){
|
||||||
|
that.getTms()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
getTms: function () {
|
||||||
|
var that = this
|
||||||
|
wx.showLoading({})
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/question?a=exercise',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: { 'tmlx': that.data.tmlxs,'ydtms':that.tmdata.ydtms },
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(res.data)
|
||||||
|
let tms = res.data.rows
|
||||||
|
that.tmdata.tms = that.tmdata.tms.concat(tms)
|
||||||
|
that.showTm(that.data.tmIndex) //展示题目
|
||||||
|
that.setData({
|
||||||
|
tmtotal: res.data.total,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
wx.setStorage({
|
||||||
|
key: 'ydtms',
|
||||||
|
data: this.tmdata.ydtms,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
showTm: function (index) {
|
||||||
|
var that = this
|
||||||
|
var currentTm = that.tmdata.tms[index]
|
||||||
|
console.log(currentTm)
|
||||||
|
that.setData({ 'currentTm': currentTm })
|
||||||
|
var answer = currentTm.answer
|
||||||
|
var sorder = Object.keys(answer).sort();
|
||||||
|
var answerChoices = []
|
||||||
|
//对正确答案进行排序
|
||||||
|
for(var i=0;i<sorder.length;i++){
|
||||||
|
answerChoices.push({ 'name': sorder[i], 'value': sorder[i], 'checked': false })
|
||||||
|
}
|
||||||
|
console.log(answerChoices)
|
||||||
|
that.setData({ 'answerChoices': answerChoices })
|
||||||
|
that.tmdata.ydtms.push(currentTm.id)
|
||||||
|
},
|
||||||
|
showChecked: function (index) {
|
||||||
|
var tm = this.tmdata.tms[index]
|
||||||
|
let choices = this.data.answerChoices
|
||||||
|
if (tm.userchecked) {
|
||||||
|
if (tm.question__type = 2) {
|
||||||
|
for (var i = 0, len = choices.length; i < len; i++) {
|
||||||
|
if (tm.userchecked.indexOf(choices[i].value) != -1) {
|
||||||
|
choices[i].checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (var i = 0, len = choices.length; i < len; i++) {
|
||||||
|
if (choices[i].value == tm.userchecked) {
|
||||||
|
choices[i].checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
answerChoices: choices,
|
||||||
|
answerP:true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showanswer:function(){
|
||||||
|
var answerChoices = this.data.answerChoices
|
||||||
|
var currentTm = this.data.currentTm
|
||||||
|
for(var i=0;i<answerChoices.length;i++){
|
||||||
|
if(currentTm.type=2){
|
||||||
|
if (currentTm.right.indexOf(answerChoices[i].value)!=-1){
|
||||||
|
answerChoices[i].right=true
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(answerChoices[i].value==currentTm.right){
|
||||||
|
answerChoices[i].right=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(answerChoices)
|
||||||
|
this.setData({
|
||||||
|
answerP: true,
|
||||||
|
answerChoices:answerChoices
|
||||||
|
})
|
||||||
|
},
|
||||||
|
next: function () {
|
||||||
|
var that = this
|
||||||
|
var tmIndex = that.data.tmIndex + 1
|
||||||
|
that.setData({
|
||||||
|
tmIndex: tmIndex,
|
||||||
|
answerP:false
|
||||||
|
})
|
||||||
|
if(tmIndex+1>that.tmdata.tms.length){
|
||||||
|
that.getTms()
|
||||||
|
}else{
|
||||||
|
that.showTm(tmIndex)
|
||||||
|
}
|
||||||
|
that.showChecked(tmIndex)
|
||||||
|
},
|
||||||
|
previous: function () {
|
||||||
|
var that = this
|
||||||
|
var tmIndex = that.data.tmIndex - 1
|
||||||
|
that.showTm(tmIndex)
|
||||||
|
that.setData({
|
||||||
|
tmIndex: tmIndex,
|
||||||
|
answerP: false
|
||||||
|
})
|
||||||
|
that.showChecked(tmIndex)
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "模拟练习"
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
<!--pages/examtest/main.wxml-->
|
||||||
|
<view class="head">
|
||||||
|
|
||||||
|
<view style="float:left">题量 {{tmIndex+1}}/{{tmtotal}}</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__h2">{{tmIndex+1}}.
|
||||||
|
<span wx:if="{{currentTm.type==1}}" class="txlabel">单选题</span>
|
||||||
|
<span wx:if="{{currentTm.type==2}}" class="txlabel">多选题</span>
|
||||||
|
<span wx:if="{{currentTm.type==3}}" class="txlabel">判断题</span>
|
||||||
|
</view>
|
||||||
|
<view class="weui-article__title">{{currentTm.title}}</view>
|
||||||
|
</view>
|
||||||
|
<radio-group bindchange="radioChange" wx:if="{{(currentTm.type==1 ||currentTm.type==3)}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||||
|
<radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||||
|
|
||||||
|
<view class="weui-cell__bd" wx:if="{{item.right}}" style="color:green;font-weight:bold">{{item.name}}: {{currentTm.answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__bd" wx:else>{{item.name}}: {{currentTm.answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__ft weui-cell__ft_in-radio" wx:if="{{item.checked}}">
|
||||||
|
<icon class="weui-icon-radio" type="success_no_circle" size="16"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
<checkbox-group bindchange="checkboxChange" wx:if="{{currentTm.type==2}}">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
|
||||||
|
<view class="weui-cell__bd" wx:if="{{item.right}}" style="color:green;font-weight:bold">{{item.name}}: {{currentTm.answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__bd" wx:else>{{item.name}}: {{currentTm.answer[item.value]}}</view>
|
||||||
|
<view class="weui-cell__hd weui-check__hd_in-checkbox">
|
||||||
|
<icon class="weui-icon-checkbox_circle" type="circle" size="23" wx:if="{{!item.checked}}"></icon>
|
||||||
|
<icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked}}"></icon>
|
||||||
|
</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
<view class="weui-article" wx:if="{{answerP}}">
|
||||||
|
<view class="weui-article__h2">正确答案是{{currentTm.right}},你的答案是{{currentTm.userchecked}}</view>
|
||||||
|
<!-- <view class="weui-article__h2" style="color:green" wx:if="{{currentTm.iscore == currentTm.score}}">回答正确</view>
|
||||||
|
<view class="weui-article__h2" style="color:red" wx:else>回答有误</view> -->
|
||||||
|
<view class="weui-article__title" wx:if="{{currentTm.resoluation != null}}">
|
||||||
|
<span style="color:blue">解析: </span>{{currentTm.resoluation}}</view>
|
||||||
|
<view class="weui-article__title" wx:else>
|
||||||
|
<span style="color:blue">解析: </span>无</view>
|
||||||
|
</view>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
||||||
|
<view style="width:30%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:30%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:30%;float:right">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="showanswer">查看答案</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,18 @@
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
}
|
||||||
|
.txlabel{
|
||||||
|
color:#fff;
|
||||||
|
background-color: rgb(216, 140, 0);
|
||||||
|
padding: 2px
|
||||||
|
}
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.sheet{
|
||||||
|
color:#fff;
|
||||||
|
background-color: red;
|
||||||
|
float:right
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 582 B |
Binary file not shown.
After Width: | Height: | Size: 638 B |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
|
@ -28,6 +28,17 @@
|
||||||
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
|
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
|
||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box weui-media-box_small-appmsg">
|
||||||
|
<view class="weui-cells weui-cells_in-small-appmsg">
|
||||||
|
<navigator url="../safecert/index" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-cell__hd"><image src="../images/safecert.png" style="width: 20px;height: 20px;margin-right: 5px" /></view>
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>我的安全资格证书</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -5,14 +5,18 @@ Page({
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
yhtodonum:0,
|
||||||
|
zytodonum:0,
|
||||||
|
noread:0,
|
||||||
|
dqdnum:0,
|
||||||
|
dknum:0,
|
||||||
|
kaoshi:false
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,16 +33,20 @@ Page({
|
||||||
var that = this
|
var that = this
|
||||||
//获取待阅读通知数目
|
//获取待阅读通知数目
|
||||||
if(wx.getStorageSync("sessionid")){
|
if(wx.getStorageSync("sessionid")){
|
||||||
|
this.getrights()
|
||||||
this.getnoread()
|
this.getnoread()
|
||||||
this.getyhtodonum()
|
this.getyhtodonum()
|
||||||
this.getzytodonum()
|
this.getzytodonum()
|
||||||
this.getpxqdnum()
|
this.getpxqdnum()
|
||||||
|
this.getdknum() //待考
|
||||||
}else{
|
}else{
|
||||||
getApp().callback = () => {
|
getApp().callback = () => {
|
||||||
|
this.getrights()
|
||||||
this.getnoread()
|
this.getnoread()
|
||||||
this.getyhtodonum()
|
this.getyhtodonum()
|
||||||
this.getzytodonum()
|
this.getzytodonum()
|
||||||
this.getpxqdnum()
|
this.getpxqdnum()
|
||||||
|
this.getdknum()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,5 +163,47 @@ Page({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
getdknum: function () {
|
||||||
|
var that = this
|
||||||
|
//获取待考
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=dknum',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
dknum: res.data.dknum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getrights:function(){
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/rights?a=have',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data.rights.indexOf('25'))
|
||||||
|
if (res.data.rights.indexOf('25') != -1) {//考试功能
|
||||||
|
this.setData({
|
||||||
|
kaoshi: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(this.data.kaoshi)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
|
@ -42,9 +42,14 @@
|
||||||
<view class="weui-grid__label">线下培训</view>
|
<view class="weui-grid__label">线下培训</view>
|
||||||
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{dqdnum!=0}}">{{dqdnum}}</view>
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{dqdnum!=0}}">{{dqdnum}}</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<navigator url="e" class="weui-grid" hover-class="weui-grid_active">
|
<navigator url="/pages/examtest/index" class="weui-grid" hover-class="weui-grid_active" wx:if="{{kaoshi}}">
|
||||||
<image class="weui-grid__icon" src="../images/test.png" />
|
<image class="weui-grid__icon" src="../images/examtest.png" />
|
||||||
<view class="weui-grid__label">即将上线..</view>
|
<view class="weui-grid__label">在线考试</view>
|
||||||
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{dknum!=0}}">{{dknum}}</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/exercise/index" class="weui-grid" hover-class="weui-grid_active" wx:if="{{kaoshi}}">
|
||||||
|
<image class="weui-grid__icon" src="../images/exercise.png" />
|
||||||
|
<view class="weui-grid__label">模拟练习</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -126,6 +126,7 @@ Page({
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
var tzdata = res.data
|
var tzdata = res.data
|
||||||
let material = []
|
let material = []
|
||||||
|
console.log(tzdata)
|
||||||
console.log(tzdata.notice.material.length)
|
console.log(tzdata.notice.material.length)
|
||||||
for (var i = 0, len = tzdata.notice.material.length; i < len; i++) {
|
for (var i = 0, len = tzdata.notice.material.length; i < len; i++) {
|
||||||
let x = {}
|
let x = {}
|
||||||
|
@ -135,9 +136,12 @@ Page({
|
||||||
}
|
}
|
||||||
console.log(material)
|
console.log(material)
|
||||||
this.setData({
|
this.setData({
|
||||||
material: material
|
material: material,
|
||||||
|
title:tzdata.notice.title,
|
||||||
|
readpeople:tzdata.readpeople,
|
||||||
|
readsnum:tzdata.readsnum
|
||||||
})
|
})
|
||||||
this.setData(tzdata)
|
|
||||||
|
|
||||||
WxParse.wxParse('article', 'html', tzdata.notice.content, this, 0)
|
WxParse.wxParse('article', 'html', tzdata.notice.content, this, 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="page__bd">
|
<view class="page__bd">
|
||||||
<view class="weui-article">
|
<view class="weui-article">
|
||||||
<view class="weui-article__h1">{{notice.title}}</view>
|
<view class="weui-article__h1">{{title}}</view>
|
||||||
<view class="weui-article__h2">阅读人数:<span style="color:blue">{{readpeople}} </span>阅读次数:<span style="color:blue">{{readsnum}} </span></view>
|
<view class="weui-article__h2">阅读人数:<span style="color:blue">{{readpeople}} </span>阅读次数:<span style="color:blue">{{readsnum}} </span></view>
|
||||||
<view class="weui-cells__title">附件</view>
|
<view class="weui-cells__title">附件</view>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<view class="page__bd">
|
|
||||||
|
|
||||||
<view class="head">共{{total}}条行为观察</view>
|
<view class="head">共{{total}}条行为观察</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</navigator>
|
</navigator>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<view style="position:fixed; bottom:0;width:100%;">
|
<view style="position:fixed; bottom:0;width:100%;">
|
||||||
<navigator url="/pages/observe/addobserve" hover-class="navigator-hover">
|
<navigator url="/pages/observe/addobserve" hover-class="navigator-hover">
|
||||||
<button class="weui-btn" type="primary">新增</button>
|
<button class="weui-btn" type="primary">新增</button>
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
// pages/operation/list.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
getzylxlist: function () {
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'getdickey?dicclass=33',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', //
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
let zylxlist = res.data.rows
|
||||||
|
this.setData({
|
||||||
|
zylxlist: zylxlist,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.getzylxlist()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<view class="head">
|
||||||
|
选择作业类型</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<block wx:for="{{zylxlist}}" wx:key="unique">
|
||||||
|
<navigator url="operationadd?zylx={{item.dickeyid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<view class="weui-media-box__title">{{item.dickeyname}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc" style="color:green">{{item.detail}}</view>
|
||||||
|
<view class="weui-media-box__desc" style="color:red">审批流程:{{item.splcdetail}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
|
@ -0,0 +1,5 @@
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ Page({
|
||||||
if (that.data.activeIndex == 0) {
|
if (that.data.activeIndex == 0) {
|
||||||
that.getmyZylist(1)
|
that.getmyZylist(1)
|
||||||
that.data.mypage = 1
|
that.data.mypage = 1
|
||||||
that.getzylxlist()
|
|
||||||
}
|
}
|
||||||
else if (that.data.activeIndex == 1) {
|
else if (that.data.activeIndex == 1) {
|
||||||
that.gettodoZylist(1)
|
that.gettodoZylist(1)
|
||||||
|
@ -187,7 +186,6 @@ Page({
|
||||||
if (that.data.activeIndex == 0) {
|
if (that.data.activeIndex == 0) {
|
||||||
that.getmyZylist(1)
|
that.getmyZylist(1)
|
||||||
that.data.mypage = 1
|
that.data.mypage = 1
|
||||||
that.getzylxlist()
|
|
||||||
}
|
}
|
||||||
else if (that.data.activeIndex == 1) {
|
else if (that.data.activeIndex == 1) {
|
||||||
that.gettodoZylist(1)
|
that.gettodoZylist(1)
|
||||||
|
@ -233,47 +231,12 @@ Page({
|
||||||
this.getallZylist();
|
this.getallZylist();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getzylxlist: function () {
|
|
||||||
wx.request({
|
|
||||||
url: getApp().globalData.serverUrl + 'getdickey?dicclass=33&a=combobox',
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/json', //
|
|
||||||
'Cookie': wx.getStorageSync("sessionid"),
|
|
||||||
},
|
|
||||||
method: 'GET',
|
|
||||||
success: res => {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
let zylxlist=res.data
|
|
||||||
let zylxtext = []
|
|
||||||
for (var i = 0; i < zylxlist.length; i++) {
|
|
||||||
zylxtext.push(zylxlist[i]['text'])
|
|
||||||
}
|
|
||||||
this.setData({
|
|
||||||
zylxlist: zylxlist,
|
|
||||||
zylxtext: zylxtext
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
open: function () {
|
open: function () {
|
||||||
var that = this
|
|
||||||
console.log(that.data.zylxlist)
|
|
||||||
wx.showActionSheet({
|
|
||||||
itemList: that.data.zylxtext,
|
|
||||||
success: function (res) {
|
|
||||||
if (!res.cancel) {
|
|
||||||
console.log(res.tapIndex)
|
|
||||||
if(false){
|
|
||||||
|
|
||||||
}else{
|
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: 'operationadd?zylx=' + that.data.zylxlist[res.tapIndex]['value'],
|
url: 'list',
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
}
|
},
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
|
@ -1,5 +1,3 @@
|
||||||
<view class="page">
|
|
||||||
<view class="page__bd">
|
|
||||||
<view class="weui-tab">
|
<view class="weui-tab">
|
||||||
<view class="weui-navbar">
|
<view class="weui-navbar">
|
||||||
<block wx:for="{{tabs}}" wx:key="*this">
|
<block wx:for="{{tabs}}" wx:key="*this">
|
||||||
|
@ -33,9 +31,7 @@
|
||||||
</navigator>
|
</navigator>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
|
||||||
<button class="weui-btn" type="primary" bindtap="open">申请</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
|
@ -87,5 +83,6 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view style="position:fixed;bottom:0;left:0;width:100%;" hidden="{{activeIndex != 0}}">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="open">申请</button>
|
||||||
</view>
|
</view>
|
|
@ -320,7 +320,9 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
wx.navigateBack()
|
wx.navigateBack({
|
||||||
|
delta: 2
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
{
|
{
|
||||||
"usingComponents": {}
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "作业详情"
|
||||||
}
|
}
|
|
@ -136,11 +136,12 @@ Page({
|
||||||
x['value'] = ggdata.notice.material[i]
|
x['value'] = ggdata.notice.material[i]
|
||||||
material.push(x)
|
material.push(x)
|
||||||
}
|
}
|
||||||
console.log(material)
|
//console.log(material)
|
||||||
this.setData({
|
this.setData({
|
||||||
material: material
|
material: material,
|
||||||
|
title: ggdata.notice.title,
|
||||||
|
reads: ggdata.notice.reads
|
||||||
})
|
})
|
||||||
this.setData(ggdata)
|
|
||||||
|
|
||||||
WxParse.wxParse('article', 'html', ggdata.notice.content, this, 0)
|
WxParse.wxParse('article', 'html', ggdata.notice.content, this, 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="page__bd">
|
<view class="page__bd">
|
||||||
<view class="weui-article">
|
<view class="weui-article">
|
||||||
<view class="weui-article__h1">{{notice.title}}</view>
|
<view class="weui-article__h1">{{title}}</view>
|
||||||
<view class="weui-article__h2">阅读量:<span style="color:blue">{{notice.reads}}</span></view>
|
<view class="weui-article__h2">阅读量:<span style="color:blue">{{reads}}</span></view>
|
||||||
<view class="weui-cells__title">附件</view>
|
<view class="weui-cells__title">附件</view>
|
||||||
|
|
||||||
<block wx:for="{{material}}" wx:key="unique">
|
<block wx:for="{{material}}" wx:key="unique">
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
export default { /**
|
||||||
|
* 给数组去重
|
||||||
|
*/ checkRepeat(list) {
|
||||||
|
let noRepList = [list[0]]
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
let repeat = false
|
||||||
|
for (let j = 0; j < noRepList.length; j++)
|
||||||
|
{ if (noRepList[j].id === list[i].id) {
|
||||||
|
repeat = true
|
||||||
|
break } }
|
||||||
|
if (!repeat) { noRepList.push(list[i]) } }
|
||||||
|
return noRepList
|
||||||
|
}, //删除list中id为 delId 的元素
|
||||||
|
deleteItemById(list, delId){
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].id == delId) {
|
||||||
|
list.splice(i, 1)
|
||||||
|
return list; }
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,351 @@
|
||||||
|
|
||||||
|
//import API from '../../../utils/API.js'
|
||||||
|
import ArrayUtils from 'ArrayUtils.js'
|
||||||
|
//import EventBus from '../../../components/NotificationCenter/WxNotificationCenter.js'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
currentList: [], //当前展示的列表
|
||||||
|
selectList: [], //已选择的元素列表
|
||||||
|
originalList: [], //最原始的数据列表
|
||||||
|
indexList: [], //存储目录层级的数组,用于准确的返回上一层
|
||||||
|
selectList: [], //已选中的人员列表
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad: function (options) {
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: '选择分类'
|
||||||
|
})
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
|
||||||
|
init() {
|
||||||
|
//上次选中的列表,用于判断是不是取消选中了
|
||||||
|
this.lastTimeSelect = []
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
let list = convert(res.data)
|
||||||
|
this.setData({
|
||||||
|
currentList: list,
|
||||||
|
originalList: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
clickItem(res) {
|
||||||
|
console.log(res)
|
||||||
|
let index = res.currentTarget.id;
|
||||||
|
let item = this.data.currentList[index]
|
||||||
|
|
||||||
|
console.log("item", item)
|
||||||
|
if(item.children.length!=0){
|
||||||
|
this.setData({
|
||||||
|
currentList: item.children
|
||||||
|
})
|
||||||
|
//将当前的索引存入索引目录中。索引多一个表示目录多一级
|
||||||
|
let indexes = this.data.indexList
|
||||||
|
indexes.push(index)
|
||||||
|
//是目录不是具体的用户
|
||||||
|
this.setData({
|
||||||
|
indexList: indexes
|
||||||
|
})
|
||||||
|
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
||||||
|
this.setLastTimeSelectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
//返回按钮
|
||||||
|
goBack() {
|
||||||
|
let indexList = this.data.indexList
|
||||||
|
if (indexList.length > 0) {
|
||||||
|
//返回时删掉最后一个索引
|
||||||
|
indexList.pop()
|
||||||
|
if (indexList.length == 0) {
|
||||||
|
//indexList长度为0说明回到了最顶层
|
||||||
|
this.setData({
|
||||||
|
currentList: this.data.originalList,
|
||||||
|
indexList: indexList
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
//循环将当前索引的对应数组赋值给currentList
|
||||||
|
let list = this.data.originalList
|
||||||
|
for (let i = 0; i < indexList.length; i++) {
|
||||||
|
let index = indexList[i]
|
||||||
|
list = list[index].children
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
currentList: list,
|
||||||
|
indexList: indexList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
||||||
|
this.setLastTimeSelectList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
||||||
|
setLastTimeSelectList() {
|
||||||
|
this.lastTimeSelect = []
|
||||||
|
this.data.currentList.forEach(item => {
|
||||||
|
if (item.checked) {
|
||||||
|
this.lastTimeSelect.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//根据部门获取下列列表
|
||||||
|
// _getUserByGroup(item) {
|
||||||
|
// wx.request({
|
||||||
|
// url: getApp().globalData.serverUrl + 'api/partuser?a=getall&parentid=' + item.id,
|
||||||
|
// header: {
|
||||||
|
// 'content-type': 'application/json', // 默认值
|
||||||
|
// 'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
// },
|
||||||
|
// data: {},
|
||||||
|
// success: res => {
|
||||||
|
// if (res.statusCode === 200) {
|
||||||
|
// let list = res.data.data
|
||||||
|
// console.log(res.list)
|
||||||
|
// this.setData({
|
||||||
|
// currentList: list
|
||||||
|
// })
|
||||||
|
// this.addList2DataTree()
|
||||||
|
// this.setLastTimeSelectList();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// getApp().get(API.selectUserByGroup(), params, result => {
|
||||||
|
// console.log('result', result)
|
||||||
|
// let list = this.transformData(result.data.data, item.id)
|
||||||
|
// this.setData({
|
||||||
|
// currentList: list
|
||||||
|
// })
|
||||||
|
// this.addList2DataTree()
|
||||||
|
// //清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect。写在这里防止异步请求时执行顺序问题
|
||||||
|
// this.setLastTimeSelectList();
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//将请求的数据转化为需要的格式
|
||||||
|
// transformData(list, parentId) {
|
||||||
|
// //先将数据转化为固定的格式
|
||||||
|
// let newList = []
|
||||||
|
// for (let i = 0; i < list.length; i++) {
|
||||||
|
// let item = list[i]
|
||||||
|
// newList.push({
|
||||||
|
// id: item.id,
|
||||||
|
// name: item.realName,
|
||||||
|
// parentId: parentId,
|
||||||
|
// checked: false,
|
||||||
|
// isPeople: true,
|
||||||
|
// userType: item.userType,
|
||||||
|
// gender: item.gender,
|
||||||
|
// children: []
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// return newList;
|
||||||
|
// },
|
||||||
|
|
||||||
|
//将当前列表挂载在原数据树上, 目前支持5层目录,如需更多接着往下写就好
|
||||||
|
addList2DataTree() {
|
||||||
|
let currentList = this.data.currentList;
|
||||||
|
let originalList = this.data.originalList;
|
||||||
|
let indexes = this.data.indexList
|
||||||
|
switch (indexes.length) {
|
||||||
|
case 1:
|
||||||
|
originalList[indexes[0]].children = currentList
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
originalList[indexes[0]].children[indexes[1]].children = currentList
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
originalList[indexes[0]].children[indexes[1]].children[indexes[2]].children = currentList
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
originalList[indexes[0]].children[indexes[1]].children[indexes[2]].children[indexes[3]].children = currentList
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
originalList[indexes[0]].children[indexes[1]].children[indexes[2]].children[indexes[3]].children[indexes[4]].children = currentList
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
originalList[indexes[0]].children[indexes[1]].children[indexes[2]].children[indexes[3]].children[indexes[4]].children[indexes[5]].children = currentList
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
originalList: originalList
|
||||||
|
})
|
||||||
|
console.log("originalList", originalList)
|
||||||
|
},
|
||||||
|
|
||||||
|
//选框变化回调
|
||||||
|
checkChange(res) {
|
||||||
|
console.log(res)
|
||||||
|
let values = res.detail.value
|
||||||
|
let selectItems = []
|
||||||
|
//将值取出拼接成 id,name 格式
|
||||||
|
values.forEach(value => {
|
||||||
|
let arrs = value.split(",")
|
||||||
|
selectItems.push({ id: arrs[0], name: arrs[1] })
|
||||||
|
})
|
||||||
|
console.log("selectItems", selectItems)
|
||||||
|
console.log("lastTimeSelect", this.lastTimeSelect)
|
||||||
|
|
||||||
|
//将本次选择的与上次选择的比对,本次比上次多说明新增了,本次比上次少说明删除了,找出被删除的那条数据,在footer中也删除
|
||||||
|
if (selectItems.length > this.lastTimeSelect.length) {
|
||||||
|
//将 selectList 与 selectItems 拼接并去重
|
||||||
|
let newList = this.data.selectList.concat(selectItems)
|
||||||
|
newList = ArrayUtils.checkRepeat(newList)
|
||||||
|
this.setData({
|
||||||
|
selectList: newList
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
//找出取消勾选的item,从selectList中删除
|
||||||
|
//比对出取消勾选的是哪个元素
|
||||||
|
let diffItem = {}
|
||||||
|
this.lastTimeSelect.forEach(item => {
|
||||||
|
let flag = false;
|
||||||
|
selectItems.forEach(item2 => {
|
||||||
|
if (item.id === item2.id) {
|
||||||
|
flag = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!flag) {
|
||||||
|
diffItem = item
|
||||||
|
console.log("diff=", item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//找出被删除的元素在 selectList 中的位置
|
||||||
|
let list = this.data.selectList
|
||||||
|
let delIndex = 0;
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].id === diffItem.id) {
|
||||||
|
delIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//从list中删除这个元素
|
||||||
|
list.splice(delIndex, 1)
|
||||||
|
this.setData({
|
||||||
|
selectList: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log("selectList", this.data.selectList)
|
||||||
|
//更新 currentList 选中状态并重新挂载在数据树上,以保存选择状态
|
||||||
|
this.updateCurrentList(this.data.currentList, this.data.selectList)
|
||||||
|
},
|
||||||
|
|
||||||
|
//footer点击删除回调
|
||||||
|
footerDelete(res) {
|
||||||
|
console.log(res)
|
||||||
|
this.setData({
|
||||||
|
selectList: res.detail.selectList
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('selectList', this.data.selectList)
|
||||||
|
this.updateCurrentList(this.data.currentList, res.detail.selectList)
|
||||||
|
},
|
||||||
|
|
||||||
|
//点击 footer 的确定按钮提交数据
|
||||||
|
submitData(res) {
|
||||||
|
let selectList = this.data.selectList
|
||||||
|
//通过 WxNotificationCenter 发送选择的结果通知
|
||||||
|
//EventBus.postNotificationName("SelectPeopleDone", selectList)
|
||||||
|
//将选择结果存入 app.js 的 globalData
|
||||||
|
getApp().globalData.selectList = selectList
|
||||||
|
wx.setStorage({
|
||||||
|
key: 'questioncats',
|
||||||
|
data: selectList,
|
||||||
|
success: function(res) {},
|
||||||
|
fail: function(res) {},
|
||||||
|
complete: function(res) {},
|
||||||
|
})
|
||||||
|
//返回
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
console.log("selectdone", selectList)
|
||||||
|
},
|
||||||
|
|
||||||
|
//更新 currentList 并将更新后的列表挂载在数据树上
|
||||||
|
updateCurrentList(currentList, selectList) {
|
||||||
|
//let newList = []
|
||||||
|
let selectids = []
|
||||||
|
for (var i = 0; i < selectList.length; i++) {
|
||||||
|
selectids.push(selectList[i]['id'])
|
||||||
|
}
|
||||||
|
for (var i = 0; i < currentList.length; i++) {
|
||||||
|
if (selectids.indexOf(currentList[i]['id'].toString()) >= 0) {
|
||||||
|
currentList[i]['checked'] = true
|
||||||
|
} else {
|
||||||
|
currentList[i]['checked'] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(currentList)
|
||||||
|
this.setData({
|
||||||
|
currentList: currentList
|
||||||
|
})
|
||||||
|
this.addList2DataTree()
|
||||||
|
this.setLastTimeSelectList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
function convert(rows) {
|
||||||
|
function exists(rows, parentId) {
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
if (rows[i].id == parentId) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodes = [];
|
||||||
|
// get the top level nodes
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
var row = rows[i];
|
||||||
|
if (!exists(rows, row.parentId)) {
|
||||||
|
nodes.push({
|
||||||
|
id: row.id,
|
||||||
|
parentId: 0,
|
||||||
|
name: row.name,
|
||||||
|
checked:false,
|
||||||
|
children:[]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var toDo = [];
|
||||||
|
for (var i = 0; i < nodes.length; i++) {
|
||||||
|
toDo.push(nodes[i]);
|
||||||
|
}
|
||||||
|
while (toDo.length) {
|
||||||
|
var node = toDo.shift(); // the parent node
|
||||||
|
// get the children nodes
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
var row = rows[i];
|
||||||
|
if (row.parentId == node.id) {
|
||||||
|
var child = { id: row.id, name: row.name,parentId:row.parentId,checked:false,children:[] };
|
||||||
|
if (node.children) {
|
||||||
|
node.children.push(child);
|
||||||
|
} else {
|
||||||
|
node.children = [child];
|
||||||
|
}
|
||||||
|
toDo.push(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"footer": "/components/footer/footer"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<view class='container'>
|
||||||
|
<view class='btn-wrapper'>
|
||||||
|
<button bindtap='goBack'>返回上一层</button>
|
||||||
|
</view>
|
||||||
|
<view class='people-wrapper'>
|
||||||
|
<scroll-view scroll-y class='scrollview'>
|
||||||
|
<checkbox-group bindchange="checkChange">
|
||||||
|
<view class='item' wx:for='{{currentList}}' wx:key='{{item.id}}'>
|
||||||
|
<checkbox checked='{{item.checked}}' value='{{item.id + "," + item.name}}' wx:if='{{item.children.length==0}}'> </checkbox>
|
||||||
|
<view id='{{index}}' class='item-content' bindtap='clickItem'>
|
||||||
|
<image class='img' wx:if='{{item.children.length!=0}}' src='../images/part.png'></image>
|
||||||
|
<image class='img' wx:else src='../images/file.png'></image>
|
||||||
|
<text class='itemtext'>{{item.name}}</text> </view>
|
||||||
|
</view>
|
||||||
|
</checkbox-group>
|
||||||
|
<view class='no-data' wx:if='{{currentList.length===0}}'>暂无数据</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<view class='footer'>
|
||||||
|
<footer list='{{selectList}}' binddelete='footerDelete' bindsubmit="submitData" />
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,82 @@
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 20rpx;
|
||||||
|
overflow-x: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
font-size: 24rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.people-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollview {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
margin: 0 20rpx;
|
||||||
|
border-bottom: 1rpx solid rgba(7, 17, 27, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-content {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.itemtext {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
serverUrl: getApp().globalData.serverUrl
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.getsafecertdetail(options.id);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getsafecertdetail: function (id) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/safecert?a=detail&id=' + id,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
console.log(res.data);
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
var data = res.data
|
||||||
|
this.setData(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "详情"
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
<view class="weui-cells__title">
|
||||||
|
证书详情</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>姓名</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{realname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>性别</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{gender}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>资格类型</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{zglx}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>单位类型</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{dwlx}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>发证机关</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{fzjg}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>应复审日期</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{yfsrq}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>有效期开始时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{yxqkssj}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>有效期结束时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{yxqjssj}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/safecert/detail.wxss */
|
|
@ -0,0 +1,170 @@
|
||||||
|
// pages/safecert/safecert.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getsafecertlist()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getsafecertlist: function () {
|
||||||
|
wx.showLoading({ title: '加载中', }),
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/user?a=detailself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data['userprofile__cardnum'] == null || res.data['userprofile__realname'] == null | res.data['userprofile__cardnum'] == '' || res.data['userprofile__realname'] == '') {
|
||||||
|
wx.showModal({
|
||||||
|
title: '系统提示',
|
||||||
|
content: '个人信息管理里身份证等信息缺失,无法查询,是否去完善?',
|
||||||
|
confirmText: "确定",
|
||||||
|
cancelText: "取消",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../user/userdetail',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.navigateBack({
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showLoading({ title: '查询中', }),
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/safecert?a=listself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
safecertlist: res.data.rows
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (res.data.total == 0) {
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/safecert?a=addspiderself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/safecert?a=listself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
safecertlist: res.data.rows
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (res.data.total == 0) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '系统提示',
|
||||||
|
content: '联网查询无证书,是否个人信息有误!',
|
||||||
|
confirmText: "是",
|
||||||
|
cancelText: "算了",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../user/userdetail',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "资格证书",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"onReachBottomDistance": 50
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<view class="page__bd">
|
||||||
|
|
||||||
|
<view class="weui-cells__title">共{{total}}张证书</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title" >
|
||||||
|
<block wx:for="{{safecertlist}}" wx:key="unique">
|
||||||
|
<navigator url="detail?id={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<view class="weui-media-box__title">{{item.zglx}} {{item.dwlx}}</view>
|
||||||
|
<view class="weui-media-box__desc">有效期结束日期 {{item.yxqjssj}}</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.fzjg}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -9,6 +9,7 @@ Page({
|
||||||
dqxz:'',
|
dqxz:'',
|
||||||
jynr:'',
|
jynr:'',
|
||||||
qwxg:'',
|
qwxg:'',
|
||||||
|
jylb:0,
|
||||||
serverUrl: getApp().globalData.serverUrl,
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
},
|
},
|
||||||
ohShitfadeOut() {
|
ohShitfadeOut() {
|
||||||
|
@ -49,6 +50,11 @@ Page({
|
||||||
popErrorMsg: '请输入建议内容!',
|
popErrorMsg: '请输入建议内容!',
|
||||||
});
|
});
|
||||||
this.ohShitfadeOut();
|
this.ohShitfadeOut();
|
||||||
|
} else if (that.data.jylb == 0) {
|
||||||
|
this.setData({
|
||||||
|
popErrorMsg: '请选择建议类别!',
|
||||||
|
});
|
||||||
|
this.ohShitfadeOut();
|
||||||
}else if (that.data.qwxg == '') {
|
}else if (that.data.qwxg == '') {
|
||||||
this.setData({
|
this.setData({
|
||||||
popErrorMsg: '请输入期望效果!',
|
popErrorMsg: '请输入期望效果!',
|
||||||
|
|
|
@ -285,6 +285,7 @@ Page({
|
||||||
participantnum: this.data.cjrs,
|
participantnum: this.data.cjrs,
|
||||||
duration: this.data.pxsc
|
duration: this.data.pxsc
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '系统提示',
|
title: '系统提示',
|
||||||
content: '确认提交将发送培训通知!',
|
content: '确认提交将发送培训通知!',
|
||||||
|
@ -292,6 +293,9 @@ Page({
|
||||||
cancelText: "取消",
|
cancelText: "取消",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在发布...',
|
||||||
|
})
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.serverUrl + 'addtrain',
|
url: getApp().globalData.serverUrl + 'addtrain',
|
||||||
header: {
|
header: {
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
// pages/bind/binduser.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
// let pxid = options.pxid
|
||||||
|
console.log(options)
|
||||||
|
let pxid
|
||||||
|
if(options.pxid){
|
||||||
|
pxid = options.pxid
|
||||||
|
this.setData({
|
||||||
|
pxid: pxid,
|
||||||
|
isfrom:1
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
let q = decodeURIComponent(options.q)
|
||||||
|
|
||||||
|
if (q) {
|
||||||
|
// console.log("index 生命周期 onload url=" + q)
|
||||||
|
// console.log("index 生命周期 onload 参数 trainid=" + util.getQueryString(q, 'trainid'))
|
||||||
|
pxid = util.getQueryString(q, 'trainid')
|
||||||
|
this.setData({
|
||||||
|
pxid: pxid,
|
||||||
|
isfrom: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(pxid)
|
||||||
|
|
||||||
|
this.getPx(pxid)
|
||||||
|
},
|
||||||
|
getPx: function (id) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'pxhandle?a=detail&trainid=' + id,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
var pxdata = res.data
|
||||||
|
if (pxdata.starttime != '') { pxdata.starttime = util.formatTime(new Date(pxdata.starttime)) }
|
||||||
|
this.setData(pxdata)
|
||||||
|
if(pxdata.state==1){
|
||||||
|
this.setData({
|
||||||
|
disabled:true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//console.log(this.data.yhzt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkconfirm:function(){
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'pxhandle?a=check&trainid=' + this.data.pxid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if(this.data.isfrom==1){
|
||||||
|
wx.showToast({
|
||||||
|
title: '签到成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
wx.navigateBack()
|
||||||
|
}else{
|
||||||
|
wx.showToast({
|
||||||
|
title: '签到成功!',
|
||||||
|
})
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../train/train',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//console.log(this.data.yhzt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "签到"
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__hd">
|
||||||
|
<view class="page__title">培训签到</view>
|
||||||
|
</view>
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-cells__title">培训详情</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>名称</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{starttime}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>地点</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainplace}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>授课人</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{lecturer__name != ''}}">
|
||||||
|
{{lecturer__name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{teacher != ''}}">
|
||||||
|
{{teacher}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="text-align:center;color:red" wx:if="{{state==1}}">该培训已关闭,不能签到</view>
|
||||||
|
<button class="weui-btn" type="primary" bindtap="checkconfirm" disabled="{{disabled}}" >确认签到</button>
|
||||||
|
</view>
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* pages/bind/binduser.wxss */
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
|
@ -0,0 +1,148 @@
|
||||||
|
//var base64 = require("../images/base64");
|
||||||
|
var sliderWidth = 96;
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
|
tabs: ["培训内容", "参加人员"],
|
||||||
|
activeIndex: 0,
|
||||||
|
sliderOffset: 0,
|
||||||
|
sliderLeft: 0
|
||||||
|
},
|
||||||
|
tabClick: function (e) {
|
||||||
|
var that = this
|
||||||
|
that.setData({
|
||||||
|
sliderOffset: e.currentTarget.offsetLeft,
|
||||||
|
activeIndex: e.currentTarget.id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openfj: function (e) {
|
||||||
|
var that = this
|
||||||
|
let fileurl = that.data.serverUrl + e.currentTarget.dataset.id
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在下载...',
|
||||||
|
})
|
||||||
|
wx.downloadFile({
|
||||||
|
url: fileurl,
|
||||||
|
success(res) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '成功,正在打开...',
|
||||||
|
})
|
||||||
|
const filePath = res.tempFilePath
|
||||||
|
console.log(filePath)
|
||||||
|
var filetype
|
||||||
|
let tpurls = []
|
||||||
|
if (fileurl.indexOf(".docx") != -1) {
|
||||||
|
filetype = 'docx'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".xlsx") != -1) {
|
||||||
|
filetype = 'xlsx'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".xls") != -1) {
|
||||||
|
filetype = 'xls'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".pptx") != -1) {
|
||||||
|
filetype = 'pptx'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".ppt") != -1) {
|
||||||
|
filetype = 'ppt'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".pdf") != -1) {
|
||||||
|
filetype = 'pdf'
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".png") != -1) {
|
||||||
|
filetype = 'tp'
|
||||||
|
tpurls.push(filePath)
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (fileurl.indexOf(".jpg") != -1) {
|
||||||
|
filetype = 'tp'
|
||||||
|
tpurls.push(filePath)
|
||||||
|
}
|
||||||
|
that.openit(filePath, filetype, tpurls)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
openit: function (filePath, filetype, tpurls){
|
||||||
|
wx.hideLoading()
|
||||||
|
if(filetype == 'tp'){
|
||||||
|
wx.previewImage({
|
||||||
|
urls: tpurls,
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.openDocument({
|
||||||
|
filePath,
|
||||||
|
fileType: filetype,
|
||||||
|
success(res) {
|
||||||
|
console.log('打开文档成功')
|
||||||
|
}, fail: function (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
onLoad: function (options) {
|
||||||
|
// this.setData({
|
||||||
|
// icon: base64.icon20
|
||||||
|
// });
|
||||||
|
var that = this;
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
|
||||||
|
sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(options.trainid)
|
||||||
|
that.getPx(options.trainid)
|
||||||
|
},
|
||||||
|
onShow: function () {
|
||||||
|
},
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
onReachBottom: function () {
|
||||||
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
|
},
|
||||||
|
getPx: function (id) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'pxhandle?a=detail&trainid=' + id,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
var pxdata = res.data
|
||||||
|
if (pxdata.starttime != '') { pxdata.starttime = util.formatTime(new Date(pxdata.starttime)) }
|
||||||
|
for (var i = 0; i < pxdata.cjrydetail.length; i++) {
|
||||||
|
let qdsj = pxdata.cjrydetail[i].qdsj
|
||||||
|
if (qdsj != null)
|
||||||
|
{ pxdata.cjrydetail[i].qdsj = util.formatTime(new Date(qdsj));}
|
||||||
|
|
||||||
|
}
|
||||||
|
let material = []
|
||||||
|
for (var i = 0, len = pxdata.material.length; i < len; i++) {
|
||||||
|
let x = {}
|
||||||
|
x['name'] = pxdata.material[i].split('_').pop();
|
||||||
|
x['value'] = pxdata.material[i]
|
||||||
|
material.push(x)
|
||||||
|
}
|
||||||
|
pxdata.material = material
|
||||||
|
pxdata.matershow = material[0].name
|
||||||
|
console.log(pxdata.material)
|
||||||
|
this.setData(pxdata)
|
||||||
|
|
||||||
|
//console.log(this.data.yhzt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "培训详情"
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-tab">
|
||||||
|
<view class="weui-navbar">
|
||||||
|
<block wx:for="{{tabs}}" wx:key="*this">
|
||||||
|
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
|
||||||
|
<view class="weui-navbar__title">{{item}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-tab__panel">
|
||||||
|
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>当前状态</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" style="color:green" wx:if="{{state==1}}">已关闭</view>
|
||||||
|
<view class="weui-cell__ft" style="color:green" wx:if="{{state==0}}">待评估</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{starttime}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训地点</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainplace}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训名称</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训类型</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{traintype__dickeyname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>人员类型</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{manlevel__dickeyname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训级别</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainlevel__dicname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训内容</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{traincontent__dickeyname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>具体内容</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{detailcontent}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训部门</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainpart}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>授课人</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{lecturer__name != ''}}">
|
||||||
|
{{lecturer__name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{teacher != ''}}">
|
||||||
|
{{teacher}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>培训时长</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{duration}}小时
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">评估详情</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>参加人数</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" >{{participantnum}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>掌握人数</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{knownum}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">附件列表</view>
|
||||||
|
<block wx:for="{{material}}" wx:key="unique" wx:if = "{{matershow != ''}}">
|
||||||
|
<view class="weui-media-box" style="color:blue" data-id="{{item.value}}" bindtap='openfj'>
|
||||||
|
{{index+1}}——{{item.name}}
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<block wx:for="{{cjrydetail}}" wx:key="unique" wx:for-item="item">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>{{item.participant__name}}</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.participant__ubelongpart__partname}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{item.checked == 0}}" style="color:red">
|
||||||
|
<view>未签到</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{item.checked == 1}}" style="color:green">
|
||||||
|
<view>已签到</view>
|
||||||
|
<view wx:if="{{item.qdsj != null}}">{{item.qdsj}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,13 @@
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #939393;
|
||||||
|
}
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
// pages/bind/binduser.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
import drawQrcode from '../../utils/weapp.qrcode.esm.js'
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
let pxid = options.pxid
|
||||||
|
this.setData({
|
||||||
|
pxid: pxid
|
||||||
|
})
|
||||||
|
this.getPx(pxid)
|
||||||
|
let text = 'https://safeyun.ctcshe.com/miniprogram/checktrain?trainid=' + pxid
|
||||||
|
console.log(text)
|
||||||
|
drawQrcode({
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
canvasId: 'qdQrcode',
|
||||||
|
// ctx: wx.createCanvasContext('myQrcode'),
|
||||||
|
text: text,
|
||||||
|
// v1.0.0+版本支持在二维码上绘制图片
|
||||||
|
// image: {
|
||||||
|
// imageResource: '../../images/icon.png',
|
||||||
|
// dx: 70,
|
||||||
|
// dy: 70,
|
||||||
|
// dWidth: 60,
|
||||||
|
// dHeight: 60
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getPx: function (id) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'pxhandle?a=detail&trainid=' + id,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
var pxdata = res.data
|
||||||
|
if (pxdata.starttime != '') { pxdata.starttime = util.formatTime(new Date(pxdata.starttime)) }
|
||||||
|
this.setData(pxdata)
|
||||||
|
|
||||||
|
//console.log(this.data.yhzt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "签到二维码"
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__hd">
|
||||||
|
<view class="page__title">签到二维码</view>
|
||||||
|
<view class="page__desc">请在培训开始前展示给参加人员扫码</view>
|
||||||
|
</view>
|
||||||
|
<view class="qrcode">
|
||||||
|
<canvas canvas-id="qdQrcode" style="width:200px;height:200px"></canvas>
|
||||||
|
</view>
|
||||||
|
<view class="page__bd" style="margin:5px">
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>名称</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainname}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{starttime}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>地点</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft">
|
||||||
|
{{trainplace}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>授课人</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{lecturer__name != ''}}">
|
||||||
|
{{lecturer__name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__ft" wx:if="{{teacher != ''}}">
|
||||||
|
{{teacher}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,4 @@
|
||||||
|
.qrcode{
|
||||||
|
display:flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
|
@ -1,11 +1,12 @@
|
||||||
//var base64 = require("../images/base64");
|
//var base64 = require("../images/base64");
|
||||||
var sliderWidth = 96;
|
var sliderWidth = 96;
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
page: 1,
|
page: 1,
|
||||||
serverUrl: getApp().globalData.serverUrl,
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
allpxlist: [],
|
allpxlist: [],
|
||||||
tabs: ["我发起的", "我参加的", "全部"],
|
tabs: ["我发布的", "我参加的", "全部"],
|
||||||
activeIndex: 1,
|
activeIndex: 1,
|
||||||
sliderOffset: 0,
|
sliderOffset: 0,
|
||||||
sliderLeft: 0
|
sliderLeft: 0
|
||||||
|
@ -237,5 +238,17 @@ Page({
|
||||||
url: 'add',
|
url: 'add',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
check:function(){
|
||||||
|
wx.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
success(res) {
|
||||||
|
console.log(res)
|
||||||
|
let pxid = util.getQueryString(res.result, 'trainid')
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'check?pxid='+pxid,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
});
|
});
|
|
@ -1,5 +1,3 @@
|
||||||
<view class="page">
|
|
||||||
<view class="page__bd">
|
|
||||||
<view class="weui-tab">
|
<view class="weui-tab">
|
||||||
<view class="weui-navbar">
|
<view class="weui-navbar">
|
||||||
<block wx:for="{{tabs}}" wx:key="*this">
|
<block wx:for="{{tabs}}" wx:key="*this">
|
||||||
|
@ -15,34 +13,42 @@
|
||||||
共{{fqtotal}}条线下培训</view>
|
共{{fqtotal}}条线下培训</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
<block wx:for="{{fqpxlist}}" wx:key="unique">
|
<block wx:for="{{fqpxlist}}" wx:key="unique">
|
||||||
<navigator url="detail?pxid={{item.pxid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
<view class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
|
||||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<navigator url="detail?trainid={{item.trainid}}">
|
||||||
<view class="weui-media-box__title">{{item.trainname}}
|
<view class="weui-media-box__title">{{item.trainname}}
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-media-box__desc" wx:if="{{item.lecturer__name != null}}">{{item.trainnum}} {{item.lecturer__name}}授课</view>
|
<view class="weui-media-box__desc" wx:if="{{item.lecturer__name != null}}">{{item.trainnum}} {{item.lecturer__name}}授课</view>
|
||||||
<view class="weui-media-box__desc" wx:else>{{item.trainnum}} {{item.teacher}}授课</view>
|
<view class="weui-media-box__desc" wx:else>{{item.trainnum}} {{item.teacher}}授课</view>
|
||||||
<view class="weui-media-box__desc">{{item.trainplace}}-{{item.starttime}}</view>
|
<view class="weui-media-box__desc">{{item.trainplace}}-{{item.starttime}}</view>
|
||||||
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||||
<view class="weui-media-box__title" style="color:white;background-color:green" wx:if="{{item.state == 1}}">已关闭</view>
|
<view class="weui-media-box__title">
|
||||||
<view class="weui-media-box__title" wx:if="{{item.state == 0}}">待评估</view>
|
<view wx:if="{{item.state == 0}}">待评估</view>
|
||||||
|
<view wx:if="{{item.state == 1}}" style="color:white;background-color:green">已关闭</view>
|
||||||
|
<navigator url='qrcode?pxid={{item.trainid}}'>
|
||||||
|
<view wx:if="{{item.state == 0}}">
|
||||||
|
<button class="weui-btn mini-btn" type="primary" size="mini">签到二维码</button>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
<!-- <view wx:if="{{item.todouser__name != null}}">
|
<!-- <view wx:if="{{item.todouser__name != null}}">
|
||||||
<view class="weui-media-box__desc">{{item.todouser__name}}</view>
|
<view class="weui-media-box__desc">{{item.todouser__name}}</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</navigator>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
|
||||||
<button class="weui-btn" type="primary" bindtap="open">发布培训</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
共{{cjtotal}}条线下培训</view>
|
共{{cjtotal}}条线下培训</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
<block wx:for="{{cjpxlist}}" wx:key="unique">
|
<block wx:for="{{cjpxlist}}" wx:key="unique">
|
||||||
<navigator url="detail?pxid={{item.pxid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
<navigator url="detail?trainid={{item.train__trainid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
<view class="weui-media-box__title">{{item.train__trainname}}
|
<view class="weui-media-box__title">{{item.train__trainname}}
|
||||||
</view>
|
</view>
|
||||||
|
@ -53,6 +59,8 @@
|
||||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||||
<view class="weui-media-box__title" style="color:white;background-color:green" wx:if="{{item.checked == 1}}">已签到</view>
|
<view class="weui-media-box__title" style="color:white;background-color:green" wx:if="{{item.checked == 1}}">已签到</view>
|
||||||
<view class="weui-media-box__title" wx:if="{{item.checked == 0}}">未签到</view>
|
<view class="weui-media-box__title" wx:if="{{item.checked == 0}}">未签到</view>
|
||||||
|
<view class="weui-media-box__title" wx:if="{{item.train__state == 0}}">待评估</view>
|
||||||
|
<view class="weui-media-box__title" wx:if="{{item.train__state == 1}}">已关闭</view>
|
||||||
<!-- <view wx:if="{{item.todouser__name != null}}">
|
<!-- <view wx:if="{{item.todouser__name != null}}">
|
||||||
<view class="weui-media-box__desc">{{item.todouser__name}}</view>
|
<view class="weui-media-box__desc">{{item.todouser__name}}</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
@ -60,13 +68,14 @@
|
||||||
</navigator>
|
</navigator>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-tab__content" hidden="{{activeIndex != 2}}">
|
<view class="weui-tab__content" hidden="{{activeIndex != 2}}">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
共{{alltotal}}条线下培训</view>
|
共{{alltotal}}条线下培训</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
<block wx:for="{{allpxlist}}" wx:key="unique">
|
<block wx:for="{{allpxlist}}" wx:key="unique">
|
||||||
<navigator url="detail?pxid={{item.pxid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
<navigator url="detail?trainid={{item.trainid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
<view class="weui-media-box__title">{{item.trainname}}
|
<view class="weui-media-box__title">{{item.trainname}}
|
||||||
</view>
|
</view>
|
||||||
|
@ -87,5 +96,9 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;" hidden="{{activeIndex != 0}}">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="open">发布培训</button>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="position:fixed;bottom:0;left:0;width:100%;" hidden="{{activeIndex != 1}}">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="check">扫码签到</button>
|
||||||
</view>
|
</view>
|
|
@ -44,11 +44,19 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if(res.data.rows.length==0){
|
if(res.data.rows.length==0){
|
||||||
|
if (page == 1) {
|
||||||
|
this.setData({
|
||||||
|
alltotal: 0,
|
||||||
|
allyhlist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
content: "已经到底啦!",
|
content: "已经到底啦!",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: "确定",
|
confirmText: "确定",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
let list
|
let list
|
||||||
if(page==1){
|
if(page==1){
|
||||||
|
@ -81,11 +89,19 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.rows.length == 0) {
|
if (res.data.rows.length == 0) {
|
||||||
|
if (page == 1) {
|
||||||
|
this.setData({
|
||||||
|
mytotal: 0,
|
||||||
|
myyhlist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
content: "已经到底啦!",
|
content: "已经到底啦!",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: "确定",
|
confirmText: "确定",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let list
|
let list
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
|
@ -118,11 +134,19 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.rows.length == 0) {
|
if (res.data.rows.length == 0) {
|
||||||
|
if (page == 1) {
|
||||||
|
this.setData({
|
||||||
|
todototal: 0,
|
||||||
|
todoyhlist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
content: "已经到底啦!",
|
content: "已经到底啦!",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: "确定",
|
confirmText: "确定",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let list
|
let list
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
|
@ -205,4 +229,9 @@ Page({
|
||||||
this.getallYhlist();
|
this.getallYhlist();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
add:function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'addtrouble',
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
|
@ -1,5 +1,4 @@
|
||||||
<view class="page">
|
|
||||||
<view class="page__bd">
|
|
||||||
<view class="weui-tab">
|
<view class="weui-tab">
|
||||||
<view class="weui-navbar">
|
<view class="weui-navbar">
|
||||||
<block wx:for="{{tabs}}" wx:key="*this">
|
<block wx:for="{{tabs}}" wx:key="*this">
|
||||||
|
@ -39,11 +38,6 @@
|
||||||
</navigator>
|
</navigator>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view style="position:fixed;bottom:0;left:0;width:100%;">
|
|
||||||
<navigator url="/pages/trouble/addtrouble" hover-class="navigator-hover">
|
|
||||||
<button class="weui-btn" type="primary">新增</button>
|
|
||||||
</navigator>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
|
||||||
<view class="head">共{{todototal}}条隐患待处理</view>
|
<view class="head">共{{todototal}}条隐患待处理</view>
|
||||||
|
@ -51,7 +45,9 @@
|
||||||
<block wx:for="{{todoyhlist}}" wx:key="unique">
|
<block wx:for="{{todoyhlist}}" wx:key="unique">
|
||||||
<navigator url="accesstrouble?troubleid={{item.troubleid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
<navigator url="accesstrouble?troubleid={{item.troubleid}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
<view class="weui-media-box__title">{{item.yhdj__dickeyname}} <span wx:if="{{item.yhlb__dickeyname != null}}">{{item.yhlb__dickeyname}}</span></view>
|
<view class="weui-media-box__title">{{item.yhdj__dickeyname}}
|
||||||
|
<span wx:if="{{item.yhlb__dickeyname != null}}">{{item.yhlb__dickeyname}}</span>
|
||||||
|
</view>
|
||||||
<view class="weui-media-box__desc">{{item.yhnum}} {{item.fxr__name}}填报</view>
|
<view class="weui-media-box__desc">{{item.yhnum}} {{item.fxr__name}}填报</view>
|
||||||
<view class="weui-media-box__desc">{{item.tbsj}}</view>
|
<view class="weui-media-box__desc">{{item.tbsj}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -104,5 +100,6 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view style="position:fixed;bottom:0;left:0;width:100%;" hidden="{{activeIndex != 0}}">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="add">新增</button>
|
||||||
</view>
|
</view>
|
|
@ -12,3 +12,4 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view class='footer'>
|
<view class='footer'>
|
||||||
<footer list='{{selectList}}' binddelete='footerDelete' bindsubmit="submitData" /> </view>
|
<footer list='{{selectList}}' binddelete='footerDelete' bindsubmit="submitData" />
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"appid": "wx5c39b569f01c27db",
|
"appid": "wx5c39b569f01c27db",
|
||||||
"projectname": "aqyj",
|
"projectname": "aqyj",
|
||||||
"isGameTourist": false,
|
"isGameTourist": false,
|
||||||
|
"simulatorType": "wechat",
|
||||||
|
"simulatorPluginLibVersion": {},
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
|
@ -8,13 +8,30 @@ const formatTime = date => {
|
||||||
|
|
||||||
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||||
}
|
}
|
||||||
|
const formatTime2 = date => {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
const day = date.getDate()
|
||||||
|
const hour = date.getHours()
|
||||||
|
const minute = date.getMinutes()
|
||||||
|
|
||||||
|
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
|
||||||
|
}
|
||||||
const formatNumber = n => {
|
const formatNumber = n => {
|
||||||
n = n.toString()
|
n = n.toString()
|
||||||
return n[1] ? n : '0' + n
|
return n[1] ? n : '0' + n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let getQueryString = function (url, name) {
|
||||||
|
console.log("url = " + url)
|
||||||
|
console.log("name = " + name)
|
||||||
|
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||||
|
var r = url.substr(1).match(reg)
|
||||||
|
if (r != null) { console.log("r = " + r)
|
||||||
|
console.log("r[2] = " + r[2])
|
||||||
|
return r[2] } return null; }
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
getQueryString: getQueryString,
|
||||||
formatTime: formatTime,
|
formatTime: formatTime,
|
||||||
|
formatTime2:formatTime2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue