denglu bug

This commit is contained in:
caoqianming 2019-11-08 23:05:32 +08:00
parent 135f3ca3a3
commit 9afa52f9a5
12 changed files with 265 additions and 126 deletions

27
app.js
View File

@ -3,6 +3,7 @@ App({
onLaunch: function () { onLaunch: function () {
var that = this var that = this
that.mplogin() that.mplogin()
setInterval(that.reflesh,20*60*1000)
}, },
mplogin: function () { mplogin: function () {
var that = this; var that = this;
@ -16,19 +17,26 @@ App({
}, },
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/json' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: function (res) { success: function (res) {
if (res.data.code == 1) { if (res.data.code == 1) {
//console.log(res.header["Set-Cookie"]) //console.log(res.header["Set-Cookie"])
//console.log(res) console.log(res)
wx.setStorageSync('userid', res.data.userid) wx.setStorageSync('userid', res.data.userid)
wx.setStorageSync('username', res.data.username) wx.setStorageSync('username', res.data.username)
wx.setStorageSync('sessionid', res.header["Set-Cookie"]) if (res.header.hasOwnProperty('Set-Cookie')){
wx.setStorageSync('sessionid', res.header["Set-Cookie"])
}else{
wx.setStorageSync('sessionid', res.header["set-cookie"])
}
wx.setStorageSync('mpopenid', res.data.mpopenid) wx.setStorageSync('mpopenid', res.data.mpopenid)
//console.log(res.header["Set-Cookie"])
//console.log(wx.getStorageSync("sessionid"))
if (that.callback) { //这个函数名字和你定义的一样即可 if (that.callback) { //这个函数名字和你定义的一样即可
that.callback() //执行定义的回调函数 that.callback() //执行定义的回调函数
} }
//获取是否是安全员 //获取是否是安全员
wx.request({ wx.request({
url: that.globalData.serverUrl + 'api/user?a=checkaqy', url: that.globalData.serverUrl + 'api/user?a=checkaqy',
@ -72,6 +80,19 @@ App({
} }
}) })
}, },
reflesh: function(){//刷新session
var that = this
wx.request({
url: that.globalData.serverUrl + 'api/check_session',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
},
data: {},
success: res => {
}
});
},
globalData: { globalData: {
userInfo: null, userInfo: null,
serverUrl: 'https://safeyun.ctcshe.com/', serverUrl: 'https://safeyun.ctcshe.com/',

View File

@ -108,11 +108,6 @@ Page({
} else { } else {
list = this.data.todokslist.concat(res.data.rows) list = this.data.todokslist.concat(res.data.rows)
} }
for(var n=0;n<list.length;n++){
let value = new Date(list[n].examtest__endtime) - new Date();
let isActive = value > 0 ? true : false;
list[n].isActive = isActive;
}
this.setData({ this.setData({
todototal: res.data.total, todototal: res.data.total,
todokslist: list todokslist: list

View File

@ -1,13 +1,12 @@
<!--pages/examtest/main.wxml--> <!--pages/examtest/main.wxml-->
<view class="head"> <view class="head">
<view style="float:left">倒计时 {{countdown}}</view> <view style="float:left">倒计时 {{countdown}}</view>
<navigator url="sheet" > <navigator url="sheet">
<view class="sheet">答题卡: {{ydtm}}/{{tmtotal}}</view> <view class="sheet">答题卡: {{ydtm}}/{{tmtotal}}</view>
</navigator> </navigator>
</view>
<view >
</view> </view>
<scroll-view class='body-v' scroll-y>
<view class="weui-article"> <view class="weui-article">
<view class="weui-article__h2">{{tmIndex+1}}. <view class="weui-article__h2">{{tmIndex+1}}.
<span wx:if="{{currentTm.question__type==1}}" class="txlabel">单选题</span> <span wx:if="{{currentTm.question__type==1}}" class="txlabel">单选题</span>
@ -17,27 +16,28 @@
</view> </view>
<view class="weui-article__title">{{currentTm.question__title}}</view> <view class="weui-article__title">{{currentTm.question__title}}</view>
</view> </view>
<radio-group bindchange="radioChange" wx:if="{{(currentTm.question__type==1 ||currentTm.question__type==3)}}"> <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"> <label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
<radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" /> <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__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
<view class="weui-cell__ft weui-cell__ft_in-radio" wx:if="{{item.checked}}"> <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> <icon class="weui-icon-radio" type="success_no_circle" size="16"></icon>
</view> </view>
</label> </label>
</radio-group> </radio-group>
<checkbox-group bindchange="checkboxChange" wx:if="{{currentTm.question__type==2}}"> <checkbox-group bindchange="checkboxChange" wx:if="{{currentTm.question__type==2}}">
<label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value"> <label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
<checkbox class="weui-check" value="{{item.value}}" checked="{{item.checked}}" /> <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__bd">{{item.name}}: {{currentTm.question__answer[item.value]}}</view>
<view class="weui-cell__hd weui-check__hd_in-checkbox"> <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_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> <icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked}}"></icon>
</view> </view>
</label> </label>
</checkbox-group> </checkbox-group>
<view style="position:fixed;bottom:0;left:0;width:100%;"> </scroll-view>
<view class="footer">
<view style="width:30%;float:left"> <view style="width:30%;float:left">
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button> <button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
</view> </view>
@ -45,6 +45,6 @@
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button> <button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
</view> </view>
<view style="width:30%;float:right"> <view style="width:30%;float:right">
<button class="weui-btn" type="primary" bindtap="hand" >交卷</button> <button class="weui-btn" type="primary" bindtap="hand">交卷</button>
</view> </view>
</view> </view>

View File

@ -1,6 +1,12 @@
.head{ .head{
z-index: 1;
position: fixed;
top: 0rpx;
width:100%;
height:60rpx;
color:#fff; color:#fff;
background-color: cornflowerblue; background-color: cornflowerblue;
/* text-align: center; */
} }
.txlabel{ .txlabel{
color:#fff; color:#fff;
@ -9,10 +15,26 @@
} }
.weui-btn{ .weui-btn{
width:auto; width:auto;
margin: 5px; margin: 5rpx;
} }
.sheet{ .sheet{
color:#fff; color:#fff;
background-color: red; background-color: red;
float:right float:right;
height:64rpx;
}
.body-v{
position: fixed;
z-index: -1;
top:64rpx;
bottom:124rpx;
}
.footer{
z-index: 1;
position: fixed;
bottom: 0rpx;
width:100%;
height:120rpx;
text-align: center;
border-top:1rpx solid red;
} }

View File

@ -8,14 +8,14 @@ Page({
data: { data: {
tmIndex: 0, tmIndex: 0,
answerChoices: [], answerChoices: [],
answerP:false answerP: false
}, },
tmdata: { tmdata: {
tms:[], tms: [],
ydtms:[] ydtms: []
}, },
radioChange: function (e) { radioChange: function(e) {
console.log('radio发生change事件携带value值为', e.detail.value); //console.log('radio发生change事件携带value值为', e.detail.value);
var answerChoices = this.data.answerChoices; var answerChoices = this.data.answerChoices;
for (var i = 0, len = answerChoices.length; i < len; ++i) { for (var i = 0, len = answerChoices.length; i < len; ++i) {
answerChoices[i].checked = answerChoices[i].value == e.detail.value; answerChoices[i].checked = answerChoices[i].value == e.detail.value;
@ -30,10 +30,11 @@ Page({
}) })
this.showanswer() this.showanswer()
}, },
checkboxChange: function (e) { checkboxChange: function(e) {
console.log('checkbox发生change事件携带value值为', e.detail.value); //console.log('checkbox发生change事件携带value值为', e.detail.value);
var answerChoices = this.data.answerChoices, values = e.detail.value; var answerChoices = this.data.answerChoices,
values = e.detail.value;
for (var i = 0, lenI = answerChoices.length; i < lenI; ++i) { for (var i = 0, lenI = answerChoices.length; i < lenI; ++i) {
answerChoices[i].checked = false; answerChoices[i].checked = false;
@ -53,11 +54,11 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
var that = this var that = this
wx.getStorage({ wx.getStorage({
key: 'questioncats', key: 'questioncats',
success: function (res) { success: function(res) {
let lst = res.data let lst = res.data
let nst = [] let nst = []
let nst1 = [] let nst1 = []
@ -68,7 +69,7 @@ Page({
} }
} }
that.setData({ that.setData({
tmlxs:nst1 tmlxs: nst1
}) })
wx.getStorage({ wx.getStorage({
key: 'ydtms', key: 'ydtms',
@ -76,16 +77,16 @@ Page({
that.tmdata.ydtms = res.data that.tmdata.ydtms = res.data
that.getTms() that.getTms()
}, },
fail:function(){ fail: function() {
that.getTms() that.getTms()
} }
}) })
}, },
}) })
}, },
getTms: function () { getTms: function(callback) {
var that = this var that = this
wx.showLoading({}) wx.showLoading({})
wx.request({ wx.request({
@ -95,17 +96,38 @@ Page({
'Cookie': wx.getStorageSync("sessionid"), 'Cookie': wx.getStorageSync("sessionid"),
}, },
method: 'POST', method: 'POST',
data: { 'tmlx': that.data.tmlxs,'ydtms':that.tmdata.ydtms }, data: {
'tmlx': that.data.tmlxs,
'ydtms': that.tmdata.ydtms
},
success: res => { success: res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
wx.hideLoading() wx.hideLoading()
console.log(res.data) //console.log(res.data)
let tms = res.data.rows let tms = res.data.rows
that.tmdata.tms = that.tmdata.tms.concat(tms) if(tms.length==0){
that.showTm(that.data.tmIndex) //展示题目
that.setData({ wx.showModal({
tmtotal: res.data.total, title: '提示',
}) content: '无更多新题,返回重新开始',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateBack({
})
}
}
})
}else{
that.tmdata.tms = that.tmdata.tms.concat(tms)
that.showTm(that.data.tmIndex) //展示题目和答案
that.setData({
tmtotal: res.data.total,
})
}
} }
} }
@ -114,74 +136,87 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {},
},
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
wx.setStorage({ wx.setStorage({
key: 'ydtms', key: 'ydtms',
data: this.tmdata.ydtms, data: this.tmdata.ydtms,
}) })
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
showTm: function (index) { showTm: function(index) {
var that = this var that = this
var currentTm = that.tmdata.tms[index] var currentTm = that.tmdata.tms[index]
console.log(currentTm) //console.log(currentTm)
that.setData({ 'currentTm': currentTm }) that.setData({
'currentTm': currentTm
})
var answer = currentTm.answer var answer = currentTm.answer
var sorder = Object.keys(answer).sort(); var sorder = Object.keys(answer).sort();
var answerChoices = [] var answerChoices = []
//对正确答案进行排序 //对正确答案进行排序
for(var i=0;i<sorder.length;i++){ for (var i = 0; i < sorder.length; i++) {
answerChoices.push({ 'name': sorder[i], 'value': sorder[i], 'checked': false }) answerChoices.push({
'name': sorder[i],
'value': sorder[i],
'checked': false
})
}
//console.log(answerChoices)
that.setData({
'answerChoices': answerChoices
})
if (that.tmdata.ydtms.indexOf(currentTm.id)!=-1){ //如果未答过
that.showChecked(index)
that.showanswer()
} }
console.log(answerChoices)
that.setData({ 'answerChoices': answerChoices })
that.tmdata.ydtms.push(currentTm.id) that.tmdata.ydtms.push(currentTm.id)
}, },
showChecked: function (index) { showChecked: function(index) {
var tm = this.tmdata.tms[index] let tm = this.tmdata.tms[index]
//console.log(tm)
let choices = this.data.answerChoices let choices = this.data.answerChoices
if (tm.userchecked) { if (tm.userchecked) {
if (tm.question__type = 2) { if (tm.question__type == 2) {
for (var i = 0, len = choices.length; i < len; i++) { for (var i = 0, len = choices.length; i < len; i++) {
if (tm.userchecked.indexOf(choices[i].value) != -1) { if (tm.userchecked.indexOf(choices[i].value) != -1) {
choices[i].checked = true choices[i].checked = true
@ -196,52 +231,80 @@ wx.setStorage({
} }
this.setData({ this.setData({
answerChoices: choices, answerChoices: choices,
answerP:true answerP: true
}) })
} }
}, },
showanswer:function(){ showanswer: function() {
var answerChoices = this.data.answerChoices let answerChoices = this.data.answerChoices
var currentTm = this.data.currentTm let currentTm = this.data.currentTm
for(var i=0;i<answerChoices.length;i++){ console.log(answerChoices,currentTm)
if(currentTm.type=2){
if (currentTm.right.indexOf(answerChoices[i].value)!=-1){ for (var i = 0; i < answerChoices.length; i++) {
answerChoices[i].right=true if (currentTm.type == 2) {
} if (currentTm.right.indexOf(answerChoices[i].value) != -1) {
}else{ answerChoices[i].right = true
if(answerChoices[i].value==currentTm.right){ }
answerChoices[i].right=true } else {
if (answerChoices[i].value == currentTm.right) {
answerChoices[i].right = true
}
} }
} }
} if (currentTm.type == 2) {
console.log(answerChoices) if(currentTm.userchecked==undefined){currentTm.userchecked=[]}
var answerright = this.judgeResultFun(currentTm.userchecked, currentTm.right)
this.setData({
answerright: answerright
})
} else {
if(currentTm.userchecked==undefined){currentTm.userchecked=''}
var answerright = currentTm.right == currentTm.userchecked
this.setData({
answerright: answerright
})
}
this.setData({ this.setData({
answerP: true, answerP: true,
answerChoices:answerChoices answerChoices: answerChoices
}) })
}, },
next: function () { next: function() {
var that = this var that = this
var tmIndex = that.data.tmIndex + 1 var tmIndex = that.data.tmIndex + 1
that.setData({ that.setData({
tmIndex: tmIndex, tmIndex: tmIndex,
answerP:false answerP: false
}) })
if(tmIndex+1>that.tmdata.tms.length){ if (tmIndex + 1 > that.tmdata.tms.length) {
that.getTms() that.getTms()
}else{ } else {
that.showTm(tmIndex) that.showTm(tmIndex)
} }
that.showChecked(tmIndex)
}, },
previous: function () { previous: function() {
var that = this var that = this
var tmIndex = that.data.tmIndex - 1 var tmIndex = that.data.tmIndex - 1
that.showTm(tmIndex)
that.setData({ that.setData({
tmIndex: tmIndex, tmIndex: tmIndex,
answerP: false answerP: false
}) })
that.showChecked(tmIndex) that.showTm(tmIndex)
}, },
}) judgeResultFun: function(arr1, arr2) {
let flag = true
if (arr1.length !== arr2.length) {
flag = false
} else {
arr1.forEach(item => {
if (arr2.indexOf(item) === -1) {
flag = false
}
})
}
return flag;
}
})

View File

@ -3,8 +3,8 @@
<view style="float:left">题量 {{tmIndex+1}}/{{tmtotal}}</view> <view style="float:left">题量 {{tmIndex+1}}/{{tmtotal}}</view>
</view> </view>
<view> <scroll-view class='body-v' scroll-y>
</view>
<view class="weui-article"> <view class="weui-article">
<view class="weui-article__h2">{{tmIndex+1}}. <view class="weui-article__h2">{{tmIndex+1}}.
<span wx:if="{{currentTm.type==1}}" class="txlabel">单选题</span> <span wx:if="{{currentTm.type==1}}" class="txlabel">单选题</span>
@ -16,9 +16,10 @@
<radio-group bindchange="radioChange" wx:if="{{(currentTm.type==1 ||currentTm.type==3)}}"> <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"> <label class="weui-cell weui-check__label" wx:for="{{answerChoices}}" wx:key="value">
<radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" /> <radio class="weui-check" value="{{item.value}}" checked="{{item.checked}}" />
<view wx:if="{{currentTm.answer[item.value]!=''}}">
<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: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__bd" wx:else>{{item.name}}: {{currentTm.answer[item.value]}}</view>
</view>
<view class="weui-cell__ft weui-cell__ft_in-radio" wx:if="{{item.checked}}"> <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> <icon class="weui-icon-radio" type="success_no_circle" size="16"></icon>
</view> </view>
@ -36,6 +37,8 @@
</label> </label>
</checkbox-group> </checkbox-group>
<view class="weui-article" wx:if="{{answerP}}"> <view class="weui-article" wx:if="{{answerP}}">
<view class="weui-article__h2" wx:if="{{answerright}}" style="color:green;font-weight:bold">回答正确!</view>
<view class="weui-article__h2" wx:else style="color:red;font-weight:bold">回答错误!</view>
<view class="weui-article__h2">正确答案是{{currentTm.right}},你的答案是{{currentTm.userchecked}}</view> <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:green" wx:if="{{currentTm.iscore == currentTm.score}}">回答正确</view>
<view class="weui-article__h2" style="color:red" wx:else>回答有误</view> --> <view class="weui-article__h2" style="color:red" wx:else>回答有误</view> -->
@ -44,7 +47,8 @@
<view class="weui-article__title" wx:else> <view class="weui-article__title" wx:else>
<span style="color:blue">解析: </span>无</view> <span style="color:blue">解析: </span>无</view>
</view> </view>
<view style="position:fixed;bottom:0;left:0;width:100%;"> </scroll-view>
<view class="footer">
<view style="width:30%;float:left"> <view style="width:30%;float:left">
<button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button> <button class="weui-btn" type="primary" bindtap="previous" disabled="{{tmIndex==0}}">上一题</button>
</view> </view>

View File

@ -1,6 +1,12 @@
.head{ .head{
z-index: 1;
position: fixed;
top: 0rpx;
width:100%;
height:60rpx;
color:#fff; color:#fff;
background-color: cornflowerblue; background-color: cornflowerblue;
/* text-align: center; */
} }
.txlabel{ .txlabel{
color:#fff; color:#fff;
@ -9,10 +15,26 @@
} }
.weui-btn{ .weui-btn{
width:auto; width:auto;
margin: 5px; margin: 5rpx;
} }
.sheet{ .sheet{
color:#fff; color:#fff;
background-color: red; background-color: red;
float:right float:right
} }
.body-v{
position: fixed;
z-index: -1;
top:64rpx;
bottom:124rpx;
}
.footer{
z-index: 1;
position: fixed;
bottom: 0rpx;
width:100%;
height:120rpx;
text-align: center;
border-top:1rpx solid red;
}

View File

@ -14,14 +14,14 @@
</view> </view>
</view> </view>
<view class="weui-cells__title">检查项目</view> <view class="weui-cells__title">检查项目</view>
<block wx:for="{{steps}}" wx:key="unique">
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<block wx:for="{{steps}}" wx:key="unique">
<view class="weui-article__p " style="marigin:5px"> <view class="weui-article__p " style="marigin:5px">
<view class="weui-media-box__desc" style="color:black">{{item.step}}-<span style="color:red">{{item.result}}</span></view> <view style="color:black">{{item.step}}-<span style="color:red">{{item.result}}</span></view>
<view class="weui-media-box__desc" style="color:green">{{item.hazard}}</view> <view style="color:green">{{item.hazard}}</view>
</view> </view>
</block>
</view> </view>
</block>
<view class="weui-cells__title">巡检记录</view> <view class="weui-cells__title">巡检记录</view>
<radio-group name="radio-group" class="weui-cell" bindchange="radioChange"> <radio-group name="radio-group" class="weui-cell" bindchange="radioChange">
@ -31,7 +31,7 @@
<radio color="#FF0000" value="0" checked="{{state==0}}" />设备异常</label> <radio color="#FF0000" value="0" checked="{{state==0}}" />设备异常</label>
</radio-group> </radio-group>
<view class="weui-cells weui-cells_after-title" wx:if="{{state==1}}"> <view class="weui-cells weui-cells_after-title">
<view class="weui-cell"> <view class="weui-cell">
<view class="weui-cell__bd"> <view class="weui-cell__bd">
<textarea class="weui-textarea" placeholder="请输入巡检结论" style="height: 5.3em" bindinput="bindcontentInput" /> <textarea class="weui-textarea" placeholder="请输入巡检结论" style="height: 5.3em" bindinput="bindcontentInput" />

View File

@ -285,14 +285,18 @@ Page({
getunsafe: function () { getunsafe: function () {
var x = [] var x = []
var that = this.data; var that = this.data;
var items = [that.unsafe24.child, that.unsafe25.child, that.unsafe26.child, that.unsafe27.child, that.unsafe28.child, that.unsafe29.child, that.unsafe30.child] var items = [that.unsafe24.child, that.unsafe25.child, that.unsafe26.child, that.unsafe27.child, that.unsafe28.child, that.unsafe29.child, that.unsafe30.child]
for (var i = 0, lenI = items.length; i < lenI; i++) { for (var i = 0, lenI = items.length; i < lenI; i++) {
var y = items[i] var y = items[i]
for (var m = 0, lenI = y.length; m < lenI; m++) { if(y!=undefined){
if (y[m].checked) { for (var m = 0, lenI = y.length; m < lenI; m++) {
x.push(y[m].value) if (y[m].checked) {
x.push(y[m].value)
}
} }
} }
} }
return x return x
}, },

View File

@ -10,7 +10,7 @@
<span wx:if="{{item.level == '重大风险'}}" style="background-color:red;color:white">重大风险</span> <span wx:if="{{item.level == '重大风险'}}" style="background-color:red;color:white">重大风险</span>
{{item.step}} {{item.step}}
</view> </view>
<view class="weui-media-box__desc"> <view>
<span style="background-color:orange;color:white">标准/危害因素</span> <span style="background-color:orange;color:white">标准/危害因素</span>
{{item.hazard}} {{item.hazard}}
</view> </view>

View File

@ -91,7 +91,14 @@ Page({
bindzgcsInput: function (e) { bindzgcsInput: function (e) {
this.data.zgcs = e.detail.value this.data.zgcs = e.detail.value
}, },
shChange:function(e){
console.log('switch 发生 change 事件,携带值为', e.detail.value)
if(e.detail.value){
this.data.shresult = 'reject'
}else{
this.data.shresult = 'pass'
}
},
getYh: function (troubleid) { getYh: function (troubleid) {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',

View File

@ -384,18 +384,19 @@
</view> </view>
</view> </view>
<view class="weui-cell weui-cell_switch" wx:if="{{yhzt ==4||yhzt==5}}">
<view class="weui-cell__bd">是否通过</view> </view>
<view class="weui-cell weui-cell_switch" wx:if="{{yhzt ==4||yhzt==5}}">
<view class="weui-cell__bd">驳回</view>
<view class="weui-cell__ft"> <view class="weui-cell__ft">
<switch checked bindchange="shChange" /> <switch bindchange="shChange" />
</view> </view>
</view> </view>
</view>
</view> </view>
<view class="weui-cells weui-cells_after-title" wx:if="{{yhzt==0||shresult=='reject'}}"> <view class="weui-cells weui-cells_after-title" wx:if="{{yhzt==0||shresult=='reject'}}">
<view class="weui-cell weui-cell_access"> <view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary"> <view class="weui-cell__bd weui-cell_primary">
<view>退回原因</view> <view>回原因</view>
<view class="weui-cell__bd" wx:if="{{yhzt==0}}"> <view class="weui-cell__bd" wx:if="{{yhzt==0}}">
{{pgyj}} {{pgyj}}
</view> </view>