作业、考试展示优化

This commit is contained in:
caoqianming 2019-10-12 17:57:53 +08:00
parent a6acbd8aa2
commit 135f3ca3a3
16 changed files with 446 additions and 275 deletions

4
app.js
View File

@ -74,8 +74,8 @@ App({
},
globalData: {
userInfo: null,
//serverUrl: 'https://safeyun.ctcshe.com/',
serverUrl: 'http://127.0.0.1:8000/',
serverUrl: 'https://safeyun.ctcshe.com/',
//serverUrl: 'http://127.0.0.1:8000/',
//serverUrl: 'http://192.168.0.102:8000/',
//serverUrl:'http://10.7.100.250:8000/',
isaqy: 0,

View File

@ -108,6 +108,11 @@ Page({
} else {
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({
todototal: res.data.total,
todokslist: list

View File

@ -10,7 +10,7 @@
<view class="weui-tab__panel">
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">
<view class="head">
共{{todototal}}条待参加考试</view>
共{{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">
@ -18,10 +18,16 @@
<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>
<view class="weui-panel__ft weui-cell__ft_in-access">
<view wx:if="{{item.isActive}}" class="weui-media-box__title" style="background-color:green;color:white">可参加</view>
<view wx:else class="weui-media-box__title" style="background-color:red;color:white">已过期</view>
</view>
</navigator>
</block>
</view>
</view>
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
<view class="head">

View File

@ -224,6 +224,7 @@ Page({
tmIndex:tmIndex,
})
that.showChecked(tmIndex)
console.log(that.tmdata.tms)
},
previous: function () {
var that = this

View File

@ -14,12 +14,42 @@ Page({
wsnoread: 0,
jytodonum: 0,
tasknum: 0,
serverUrl: getApp().globalData.serverUrl,
// Banner数据
images: [],
// 是否显示面板指示点
indicatorDots: true,
// 滑动方向是否为纵向
vertical: false,
// 自动切换
autoplay: true,
// 采用衔接滑动
circular: true,
// 自动切换时间间隔2s
interval: 4000,
// 滑动动画时长0.5s
duration: 1000,
// 前边距,可用于露出前一项的一小部分,接受 px 和 rpx 值
previousMargin: 0,
// 后边距,可用于露出后一项的一小部分,接受 px 和 rpx 值
nextMargin: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this
let images = [
that.data.serverUrl + 'media/banner/1.jpg',
that.data.serverUrl + 'media/banner/2.jpg',
that.data.serverUrl + 'media/banner/3.jpg',
that.data.serverUrl + 'media/banner/4.jpg',
that.data.serverUrl + 'media/banner/5.jpg',
]
that.setData({
images: images
})
},
/**
@ -95,7 +125,7 @@ Page({
},
getnoread: function () {
wx.request({
url: getApp().globalData.serverUrl + 'api/notice?a=noreadnum',
url: this.data.serverUrl + 'api/notice?a=noreadnum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -115,7 +145,7 @@ Page({
var that = this
//获取隐患待办数目
wx.request({
url: getApp().globalData.serverUrl + 'troublehandle?a=todonum',
url: this.data.serverUrl + 'troublehandle?a=todonum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -135,7 +165,7 @@ Page({
var that = this
//获取作业待办数目
wx.request({
url: getApp().globalData.serverUrl + 'api/operation?a=todonum',
url: this.data.serverUrl + 'api/operation?a=todonum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -155,7 +185,7 @@ Page({
var that = this
//获取待签到培训
wx.request({
url: getApp().globalData.serverUrl + 'pxhandle?a=dqdnum',
url: this.data.serverUrl + 'pxhandle?a=dqdnum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -175,7 +205,7 @@ Page({
var that = this
//获取待考
wx.request({
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=dknum',
url: this.data.serverUrl + 'api/examtestdetail?a=dknum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -195,7 +225,7 @@ Page({
var that = this
//获取待考
wx.request({
url: getApp().globalData.serverUrl + 'gchandle?a=noreadnum',
url: this.data.serverUrl + 'gchandle?a=noreadnum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -215,7 +245,7 @@ Page({
var that = this
//获取待考
wx.request({
url: getApp().globalData.serverUrl + 'api/miss?a=noreadnum',
url: this.data.serverUrl + 'api/miss?a=noreadnum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -235,7 +265,7 @@ Page({
var that = this
//获取待考
wx.request({
url: getApp().globalData.serverUrl + 'api/suggest?a=todonum',
url: this.data.serverUrl + 'api/suggest?a=todonum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -255,7 +285,7 @@ Page({
var that = this
//获取待考
wx.request({
url: getApp().globalData.serverUrl + 'api/riskacttask?a=todonum',
url: this.data.serverUrl + 'api/riskacttask?a=todonum',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
@ -301,7 +331,8 @@ Page({
content: '该功能如需开通,请查看公告或联系管理员!',
showCancel: false
})
}}
}
}
else {
wx.showModal({
content: '加载中,请稍后。。',
@ -320,7 +351,8 @@ Page({
content: '该功能如需开通,请查看公告或联系管理员!',
showCancel: false
})
}}
}
}
else {
wx.showModal({
content: '加载中,请稍后。。',

View File

@ -1 +1,4 @@
{}
{
"usingComponents": {
}
}

View File

@ -1,4 +1,21 @@
<view class="page">
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
circular="{{circular}}"
vertical="{{vertical}}"
interval="{{interval}}"
duration="{{duration}}"
previous-margin="{{previousMargin}}px"
next-margin="{{nextMargin}}px">
<block wx:for='{{images}}' wx:key='index'>
<swiper-item>
<image src='{{item}}' mode='aspectFill' class='swiper-item-images'/>
</swiper-item>
</block>
</swiper>
<view class="page__bd">
<view class="weui-cells__title">数据采集</view>
<view class="weui-grids">

View File

@ -1 +1,5 @@
/* pages/main/main.wxss */
.swiper-item-images{
width: 100%;
height: 300rpx;
}

View File

@ -263,6 +263,7 @@ Page({
otherunsafe: this.data.otherunsafe,
safecontent: this.data.safecontent,
unsafe: this.getunsafe(),
lookers:this.data.lookers
}
//console.log(gcdata.unsafe)
wx.request({

View File

@ -27,11 +27,19 @@
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>观察人</view>
<view>记录人</view>
</view>
<view class="weui-cell__ft">
{{looker__name}}
</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>观察参与人</view>
<view class="weui-cell__ft">
{{lookers}}
</view>
</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
@ -80,7 +88,7 @@
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>过程及交流记录</view>
<view class="weui-cell__ft">
<view class="weui-cell__ft" wx:if="{{otherunsafe!=null}}">
{{otherunsafe}}
</view>
</view>
@ -88,7 +96,7 @@
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>共识或改进要求</view>
<view class="weui-cell__ft">
<view class="weui-cell__ft" wx:if="{{safecontent!=null}}">
{{safecontent}}
</view>
</view>

View File

@ -121,8 +121,8 @@
<icon class="weui-icon-checkbox_success" type="success" size="23" wx:if="{{item.checked}}"></icon>
</view>
<view>
<view class="weui-media-box__desc" style='color:red'>{{item.fxfx}}</view>
<view class="weui-media-box__desc" style='color:green'>{{item.aqcs}}</view>
<view style='color:red'>{{item.fxfx}}</view>
<view style='color:green'>{{item.aqcs}}</view>
<view class="weui-media-box__desc">{{item.cslx}}</view>
</view>
</label>

View File

@ -8,7 +8,9 @@ Page({
data: {
serverUrl: getApp().globalData.serverUrl,
zyimg2: [],
zjsp:false
zjsp:false,
zyspryname: '',
spry: [],
},
getZy: function (zyid) {
wx.showLoading({
@ -122,7 +124,7 @@ Page({
wx.request({
url: that.data.serverUrl + 'api/operation?a=qrzy',
header: {
'content-type': 'application/x-www-form-urlencoded', //
'content-type': 'aapplication/json', //
'Cookie': wx.getStorageSync("sessionid"),
},
method: 'POST',
@ -142,7 +144,7 @@ Page({
wx.request({
url: that.data.serverUrl + 'api/operation?a=spzy',
header: {
'content-type': 'application/x-www-form-urlencoded', //
'content-type': 'application/json', //
'Cookie': wx.getStorageSync("sessionid"),
},
method: 'POST',
@ -252,6 +254,24 @@ Page({
}
});
},
zjsp: function () {
var that=this
wx.request({
url: getApp().globalData.serverUrl + 'api/operation?a=spzy',
header: {
'content-type': 'application/json', //
'Cookie': wx.getStorageSync("sessionid"),
},
method: 'POST',
data: { 'zyid': that.data.zyid, 'zjsp': true, 'newsprs': that.data.spry },
success: res => {
if (res.statusCode === 200) {
wx.hideLoading();
wx.navigateBack()
}
}
});
},
openaction: function () {
var that = this
wx.showActionSheet({
@ -270,7 +290,7 @@ Page({
wx.request({
url: that.data.serverUrl + 'api/operation?a=spzy',
header: {
'content-type': 'application/x-www-form-urlencoded', //
'content-type': 'application/json', //
'Cookie': wx.getStorageSync("sessionid"),
},
method: 'POST',

View File

@ -2,13 +2,13 @@
作业详情
</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_access">
<navigator url="operationdetail?zyid={{zyid}}&fromwx=1" 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="{{zyzt.zyzt=='已关闭'}}">已关闭</view>
<view class="weui-cell__ft" style="color:green" wx:else>{{zyzt.zyzt}}</view>
</view>
<view class="weui-cell__ft_in-access" style="color:green" wx:if="{{zyzt.zyzt=='审批中'}}">{{zyzt.jdmc}}-{{zyzt.zyzt}}</view>
<view class="weui-cell__ft_in-access" style="color:green" wx:else>{{zyzt.zyzt}}</view>
</navigator>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>作业类型</view>
@ -87,8 +87,8 @@
<view class="weui-cells weui-cells_after-title">
<block wx:for="{{fxcs}}" wx:key="unique" wx:for-item="item">
<view class="weui-media-box">
<view class="weui-media-box__desc" style='color:red'>{{item.fxfx}}</view>
<view class="weui-media-box__desc" style='color:green'>{{item.aqcs}}</view>
<view style='color:red'>{{item.fxfx}}</view>
<view style='color:green'>{{item.aqcs}}</view>
<view class="weui-media-box__desc" >{{item.cslx}}</view>
</view>

View File

@ -1,5 +1,6 @@
// pages/operation/operationcheck.js
var util = require('../../utils/util.js')
var sliderWidth = 96;
Page({
/**
@ -7,6 +8,17 @@ 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
});
},
getZy: function (zyid) {
wx.showLoading({
@ -31,8 +43,6 @@ Page({
zydata.zyimg2[i] = this.data.serverUrl + zydata.zyimg2[i];
}
this.setData(zydata)
switch (zydata.zyzt) {
}
//console.log(this.data.yhzt)
}
}
@ -42,7 +52,31 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var fromwx = options.fromwx
if(fromwx==1){
var pages = getCurrentPages();//页面指针数组
var prepage = pages[pages.length - 2];//上一页面指针
var zydata = prepage.data
//格式化信息
for (var i = 0; i < zydata.zyimg.length; i++) {
zydata.zyimg[i] = this.data.serverUrl + zydata.zyimg[i];
}
for (var i = 0; i < zydata.zyimg2.length; i++) {
zydata.zyimg2[i] = this.data.serverUrl + zydata.zyimg2[i];
}
this.setData(zydata)
}else{
this.getZy(options.zyid);
}
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
});
}
});
},
/**

View File

@ -1,12 +1,20 @@
<view class="weui-cells__title">
作业详情
<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="{{zyzt.zyzt=='已关闭'}}">已关闭</view>
<view class="weui-cell__ft" style="color:green" wx:if="{{zyzt.zyzt=='审批中'}}">{{zyzt.jdmc}}-{{zyzt.zyzt}}</view>
<view class="weui-cell__ft" style="color:green" wx:else>{{zyzt.zyzt}}</view>
</view>
<view class="weui-cell weui-cell_access">
@ -74,6 +82,14 @@
</view>
</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>作业人员</view>
<view class="weui-cell__ft">
{{zyry}}
</view>
</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>现场图片</view>
@ -95,13 +111,41 @@
<view class="weui-cells weui-cells_after-title">
<block wx:for="{{fxcs}}" wx:key="unique" wx:for-item="item">
<view class="weui-media-box">
<view class="weui-media-box__desc" style='color:red'>{{item.fxfx}}</view>
<view class="weui-media-box__desc" style='color:green'>{{item.aqcs}}</view>
<view style='color:red'>{{item.fxfx}}</view>
<view style='color:green'>{{item.aqcs}}</view>
<view class="weui-media-box__desc">{{item.cslx}}</view>
</view>
</block>
</view>
<view class="weui-cells__title">审批流程</view>
<view class="weui-cells weui-cells_after-title">
<block wx:for="{{zyzt.splc}}" wx:key="unique" wx:for-item="item">
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd weui-cell_primary">
<view>{{index+1}} {{item.jdmc}}</view>
</view>
<view class="weui-cell__ft" wx:if="{{zyzt.index > index }}" style="color:green">
已执行
</view>
<view class="weui-cell__ft" wx:if="{{zyzt.index == index && zyzt.zyzt=='待关闭' }}" style="color:green">
已执行
</view>
</view>
</block>
</view>
<view class="weui-cells__title">关闭现场图片</view>
<view class="weui-cell weui-cell_access">
<view class="weui-uploader__files">
<block wx:for="{{zyimg2}}" wx:for-item="image" wx:key="unique">
<view class="weui-uploader__file">
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="zyimg2Preview"></image>
</view>
</block>
</view>
</view>
</view>
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
<view class="weui-cells__title">作业人员确认详情</view>
<view class="weui-cells weui-cells_after-title">
<block wx:for="{{qrxq}}" wx:key="unique" wx:for-item="item">
@ -132,16 +176,12 @@
<view class="weui-cell__ft" wx:if="{{item.checked == 1}}" style="color:green">
已通过
</view>
<view class="weui-cell__ft" wx:if="{{item.checked == 2}}" style="color:green">
转交审批
</view>
</block>
</view>
<view class="weui-cells__title">关闭现场图片</view>
<view class="weui-cell weui-cell_access">
<view class="weui-uploader__files">
<block wx:for="{{zyimg2}}" wx:for-item="image" wx:key="unique">
<view class="weui-uploader__file">
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="zyimg2Preview" ></image>
</view>
</block>
</view>
</view>
</view>
</view>