Initial Commit
|
@ -0,0 +1,14 @@
|
||||||
|
# Windows
|
||||||
|
[Dd]esktop.ini
|
||||||
|
Thumbs.db
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
|
||||||
|
# Node.js
|
||||||
|
node_modules/
|
|
@ -0,0 +1,102 @@
|
||||||
|
//app.js
|
||||||
|
App({
|
||||||
|
onLaunch: function () {
|
||||||
|
// 展示本地存储能力
|
||||||
|
//var logs = wx.getStorageSync('logs') || []
|
||||||
|
//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 () {
|
||||||
|
var that = this;
|
||||||
|
wx.login({
|
||||||
|
success: res => {
|
||||||
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||||
|
wx.request({
|
||||||
|
url: that.globalData.serverUrl + 'mplogin',
|
||||||
|
data: {
|
||||||
|
code: res.code
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
if (res.data.code == 1) {
|
||||||
|
//console.log(res.header["Set-Cookie"])
|
||||||
|
//console.log(res)
|
||||||
|
wx.setStorageSync('userid', res.data.userid)
|
||||||
|
wx.setStorageSync('username', res.data.username)
|
||||||
|
wx.setStorageSync('sessionid', res.header["Set-Cookie"])
|
||||||
|
wx.setStorageSync('mpopenid', res.data.mpopenid)
|
||||||
|
if (that.callback) { //这个函数名字和你定义的一样即可
|
||||||
|
that.callback() //执行定义的回调函数
|
||||||
|
}
|
||||||
|
//获取是否是安全员
|
||||||
|
wx.request({
|
||||||
|
url: that.globalData.serverUrl + 'api/user?a=checkaqy',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.data.code == 1) {
|
||||||
|
//console.log(res.data)
|
||||||
|
that.globalData.isaqy = 1
|
||||||
|
}
|
||||||
|
console.log(that.globalData.isaqy)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// //获取隐患待办数目
|
||||||
|
// wx.request({
|
||||||
|
// url: that.globalData.serverUrl + 'troublehandle?a=todonum',
|
||||||
|
// header: {
|
||||||
|
// 'content-type': 'application/json', // 默认值
|
||||||
|
// 'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
// },
|
||||||
|
// data: {},
|
||||||
|
// success: res => {
|
||||||
|
// if (res.statusCode === 200) {
|
||||||
|
// //console.log(res.data)
|
||||||
|
// that.globalData.yhtodonum = res.data.todonum
|
||||||
|
// if (that.globalData.yhtodonum > 0) {
|
||||||
|
// wx.setTabBarBadge({
|
||||||
|
// index: 1,
|
||||||
|
// text: '新'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
} else {
|
||||||
|
wx.setStorageSync('mpopenid', res.data.mpopenid)
|
||||||
|
wx.reLaunch({
|
||||||
|
url: '/pages/bind/binduser?mpopenid=' + res.data.mpopenid,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
globalData: {
|
||||||
|
userInfo: null,
|
||||||
|
//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
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/main/main",
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/logs/logs",
|
||||||
|
"pages/trouble/trouble",
|
||||||
|
"pages/train/train",
|
||||||
|
"pages/drill/drill",
|
||||||
|
"pages/trouble/addtrouble",
|
||||||
|
"pages/trouble/troubledetail",
|
||||||
|
"pages/trouble/addtroublezg",
|
||||||
|
"pages/trouble/addtroublezp",
|
||||||
|
"pages/parttree/index",
|
||||||
|
"pages/todo/todo",
|
||||||
|
"pages/trouble/troubletodo",
|
||||||
|
"pages/trouble/accesstrouble",
|
||||||
|
"pages/bind/binduser",
|
||||||
|
"pages/observe/addobserve",
|
||||||
|
"pages/observe/observe",
|
||||||
|
"pages/observe/observedetail",
|
||||||
|
"pages/miss/miss",
|
||||||
|
"pages/miss/missdetail",
|
||||||
|
"pages/miss/addmiss",
|
||||||
|
"pages/user/userdetail",
|
||||||
|
"pages/socert/socert",
|
||||||
|
"pages/socert/socertdetail",
|
||||||
|
"pages/suggest/suggest",
|
||||||
|
"pages/suggest/add",
|
||||||
|
"pages/suggest/detail",
|
||||||
|
"pages/notice/notice",
|
||||||
|
"pages/notice/detail",
|
||||||
|
"pages/public/public",
|
||||||
|
"pages/public/detail",
|
||||||
|
"pages/operation/operation",
|
||||||
|
"pages/operation/operationcheck",
|
||||||
|
"pages/operation/operationdetail",
|
||||||
|
"pages/footer/footer",
|
||||||
|
"pages/userSelect/userSelect",
|
||||||
|
"components/footer/footer",
|
||||||
|
"pages/operation/operationadd",
|
||||||
|
"pages/train/add"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"navigationBarBackgroundColor": "#fff",
|
||||||
|
"navigationBarTitleText": "安全预警lite",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
},
|
||||||
|
"tabBar": {
|
||||||
|
"color": "#7A7E83",
|
||||||
|
"selectedColor": "#3cc51f",
|
||||||
|
"borderStyle": "black",
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/main/main",
|
||||||
|
"text": "主页",
|
||||||
|
"iconPath": "image/home.png",
|
||||||
|
"selectedIconPath": "image/homec.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/index",
|
||||||
|
"text": "个人中心",
|
||||||
|
"iconPath": "image/me.png",
|
||||||
|
"selectedIconPath": "image/mec.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**app.wxss**/
|
||||||
|
@import 'weui.wxss';
|
||||||
|
@import "/wxParse/wxParse.wxss";
|
||||||
|
page{
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
font-size: 16px;
|
||||||
|
font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
.page__hd {
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
.page__bd {
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
||||||
|
.page__bd_spacing {
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__ft{
|
||||||
|
padding-bottom: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__title {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__desc {
|
||||||
|
margin-top: 5px;
|
||||||
|
color: #888888;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
Component({
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
list: { type: Array }
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
delete(res) {
|
||||||
|
console.log(res)
|
||||||
|
let index = res.currentTarget.id
|
||||||
|
let list = this.data.list
|
||||||
|
list.splice(index, 1)
|
||||||
|
this.setData({ list: list })
|
||||||
|
this.triggerEvent(
|
||||||
|
"delete",
|
||||||
|
{
|
||||||
|
selectList: list })
|
||||||
|
}, /**
|
||||||
|
* 点击确定按钮
|
||||||
|
*/
|
||||||
|
confirm() {
|
||||||
|
this.triggerEvent("submit", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<view class='container'>
|
||||||
|
<view class='scroll-wrapper'>
|
||||||
|
<scroll-view scroll-x style='scroll'>
|
||||||
|
<text id='{{index}}' class='text' wx:for='{{list}}' wx:key='{{index}}' bindtap='delete'>{{item.name}}</text> </scroll-view>
|
||||||
|
</view>
|
||||||
|
<text class='btn' bindtap='confirm'>确定</text> </view>
|
|
@ -0,0 +1,39 @@
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
padding: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fff;
|
||||||
|
align-items: center;
|
||||||
|
overflow-x: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
border-top: 2rpx solid rgba(7, 17, 27, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
overflow-x: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
padding: 40rpx 20rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
background-color: rgb(26, 173, 25);
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
|
@ -0,0 +1,242 @@
|
||||||
|
// components/path-view/index.js
|
||||||
|
import toTree from './toTree';
|
||||||
|
Component({
|
||||||
|
properties: {
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
value: [],
|
||||||
|
observer() {
|
||||||
|
this.initView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 非树形数据,仅在value无传参时生效
|
||||||
|
unnormalizedValue: {
|
||||||
|
type: Array,
|
||||||
|
value: [],
|
||||||
|
observer() {
|
||||||
|
this.initView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fatherKey: {
|
||||||
|
type: String,
|
||||||
|
value: 'pid'
|
||||||
|
},
|
||||||
|
selfKey: {
|
||||||
|
type: String,
|
||||||
|
value: 'id'
|
||||||
|
},
|
||||||
|
rootValue: {
|
||||||
|
type: null,
|
||||||
|
value: null
|
||||||
|
},
|
||||||
|
pathMode: {
|
||||||
|
type: String,
|
||||||
|
value: 'mode1'
|
||||||
|
},
|
||||||
|
firstFloorTxt: {
|
||||||
|
type: String,
|
||||||
|
value: '顶级'
|
||||||
|
},
|
||||||
|
btnTxt: {
|
||||||
|
type: String,
|
||||||
|
value: '选择'
|
||||||
|
},
|
||||||
|
contentKey: {
|
||||||
|
type: String,
|
||||||
|
value: 'name'
|
||||||
|
},
|
||||||
|
// 保持位置
|
||||||
|
// 如果开启,数据动态更新后,会保持和更新前父元素对应的界面一致
|
||||||
|
// 这里是通过记录下更新前的父元素的唯一标识符:id(或是selfKey中设定的键对应的值),在更新后找回显示出来
|
||||||
|
// 所以就算更新后路径变了(父元素本来在第四层,变成了第二层之类),仍然能显示父元素的相应界面
|
||||||
|
keepLoc: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
outValue: [],
|
||||||
|
currentPath: [],
|
||||||
|
// 判断当前是否已正在执行修改路径的方法
|
||||||
|
isChange: false,
|
||||||
|
// 映射value值,存放树形数据
|
||||||
|
normalValue: [],
|
||||||
|
currentFatherId: null
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initView() {
|
||||||
|
if (this.properties.keepLoc) {
|
||||||
|
if (this.data.outValue.length > 0) {
|
||||||
|
// 记录下当前界面元素的父节点id
|
||||||
|
let fatherId = this.properties.fatherKey;
|
||||||
|
this.setData({
|
||||||
|
currentFatherId: this.data.outValue[0][fatherId] || null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 优先使用value
|
||||||
|
if (this.properties.value.length > 0) {
|
||||||
|
this.setData({
|
||||||
|
normalValue: this.properties.value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 将unnormalizedValue标准化
|
||||||
|
this.setData({
|
||||||
|
normalValue: this.normalizeValue()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.properties.keepLoc && this.data.currentFatherId !== null) {
|
||||||
|
// 得到父元素的位置
|
||||||
|
let fatherNodeLocation = this.searchLocById(this.data.currentFatherId);
|
||||||
|
// 父元素的位置即是我们希望得到的当前路径
|
||||||
|
let currentPath = fatherNodeLocation;
|
||||||
|
this.switchPath(currentPath);
|
||||||
|
} else {
|
||||||
|
// 设置初始的输出值
|
||||||
|
this.setData({
|
||||||
|
outValue: this.data.normalValue,
|
||||||
|
currentPath: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tapItem(e) {
|
||||||
|
// 如果正在执行修改路径的方法
|
||||||
|
if (this.data.isChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
isChange: true
|
||||||
|
});
|
||||||
|
// 获取当前点击的索引
|
||||||
|
const currentIndex = e.currentTarget.dataset.index;
|
||||||
|
const currentText = e.currentTarget.dataset.text;
|
||||||
|
// 如果当前点击的标签还有下一级,就将路径改变
|
||||||
|
if (this.data.outValue[currentIndex].children) {
|
||||||
|
// 添加索引如路径
|
||||||
|
this.setData({
|
||||||
|
currentPath: [
|
||||||
|
...this.data.currentPath,
|
||||||
|
{ text: currentText, index: currentIndex }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
this.selPath();
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
isChange: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 选择路径
|
||||||
|
// pathsIndex 是 paths 的索引
|
||||||
|
selPath(pathsIndex = this.data.currentPath.length - 1) {
|
||||||
|
// 判断是否在第一级
|
||||||
|
if (this.data.currentPath.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 根据路径修改 outValue
|
||||||
|
let tmpValue = this.data.normalValue;
|
||||||
|
// 如果 pathsIndex 是 -1 就应该要回到第一级
|
||||||
|
if (pathsIndex === -1) {
|
||||||
|
this.setData({
|
||||||
|
currentPath: [],
|
||||||
|
outValue: tmpValue
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (let i = 0; i <= pathsIndex; i++) {
|
||||||
|
let item = this.data.currentPath[i].index;
|
||||||
|
tmpValue = tmpValue[item]['children'];
|
||||||
|
}
|
||||||
|
// 更新 outValue , currentPath
|
||||||
|
let endIndex = pathsIndex + 1;
|
||||||
|
this.setData({
|
||||||
|
outValue: tmpValue,
|
||||||
|
currentPath: this.data.currentPath.slice(0, endIndex)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toPath(e) {
|
||||||
|
// 如果正在执行修改路径的方法
|
||||||
|
if (this.data.isChange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
isChange: true
|
||||||
|
});
|
||||||
|
// 获取当前点击的索引
|
||||||
|
const index =
|
||||||
|
e.currentTarget.dataset.index != undefined
|
||||||
|
? e.currentTarget.dataset.index
|
||||||
|
: this.data.currentPath.length - 1;
|
||||||
|
this.selPath(index - 1);
|
||||||
|
this.setData({
|
||||||
|
isChange: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
tapBtn(e) {
|
||||||
|
this.triggerEvent('tapBtn', e.currentTarget.dataset.item);
|
||||||
|
},
|
||||||
|
// 将非标准值标准化
|
||||||
|
normalizeValue() {
|
||||||
|
return toTree({
|
||||||
|
value: this.properties.unnormalizedValue,
|
||||||
|
fatherKey: this.properties.fatherKey,
|
||||||
|
selfKey: this.properties.selfKey,
|
||||||
|
rootValue:
|
||||||
|
this.properties.rootValue === null
|
||||||
|
? undefined
|
||||||
|
: this.properties.rootValue
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 通过唯一标识符找到元素的所在位置
|
||||||
|
// 这里特意用了loc(location)表示位置而不是path,二者的区别是loc还包括了元素自身,而path不包括元素自身
|
||||||
|
// 如树形数据[{id:1,name:'1'}],id:1的位置是[1],而它的路径是[]
|
||||||
|
searchLocById(id) {
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let tree = JSON.parse(JSON.stringify(this.data.normalValue));
|
||||||
|
for (let i = 0; i < tree.length; i++) {
|
||||||
|
tree[i].__location = [i];
|
||||||
|
if (id === tree[i][this.properties.selfKey]) {
|
||||||
|
return tree[i].__location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var stark = [];
|
||||||
|
stark = stark.concat(tree);
|
||||||
|
while (stark.length) {
|
||||||
|
var temp = stark.shift();
|
||||||
|
if (temp.children) {
|
||||||
|
for (let j = 0; j < temp.children.length; j++) {
|
||||||
|
temp.children[j].__location = [...temp.__location, j];
|
||||||
|
if (id === temp.children[j][this.properties.selfKey]) {
|
||||||
|
return temp.children[j].__location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 当前节点有子节点时,将子节点放到当前的栈的前面
|
||||||
|
stark = temp.children.concat(stark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果找不到对应id的位置
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
// 直接跳转到指定路径
|
||||||
|
switchPath(pathArr = []) {
|
||||||
|
let tmpValue = JSON.parse(JSON.stringify(this.data.normalValue));
|
||||||
|
let currentPath = [];
|
||||||
|
for (let i = 0; i < pathArr.length; i++) {
|
||||||
|
let index = pathArr[i];
|
||||||
|
let text = tmpValue[index][this.properties.contentKey];
|
||||||
|
tmpValue = tmpValue[index]['children'];
|
||||||
|
currentPath.push({
|
||||||
|
text,
|
||||||
|
index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 更新 outValue , currentPath
|
||||||
|
this.setData({
|
||||||
|
outValue: tmpValue,
|
||||||
|
currentPath
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!--components/path-view/index.wxml-->
|
||||||
|
<view>
|
||||||
|
<block wx:if="{{pathMode === 'mode1'}}">
|
||||||
|
<view class="path">
|
||||||
|
<view class="btn"
|
||||||
|
bindtap="toPath">返回上级</view>
|
||||||
|
<view class="btn"
|
||||||
|
data-index="{{0}}"
|
||||||
|
bindtap="toPath">{{firstFloorTxt}}</view>
|
||||||
|
<view class="btn"
|
||||||
|
bindtap="toPath"
|
||||||
|
data-index="{{index+1}}"
|
||||||
|
wx:key="{{index}}"
|
||||||
|
wx:for="{{currentPath}}">{{item.text}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block wx:elif="{{pathMode === 'mode2'}}">
|
||||||
|
<view class="path">
|
||||||
|
<view class="btn"
|
||||||
|
wx:if="{{currentPath.length !==0}}"
|
||||||
|
bindtap="toPath">返回上级</view>
|
||||||
|
<view class="btn"
|
||||||
|
bindtap="toPath"
|
||||||
|
data-index="{{index}}"
|
||||||
|
wx:key="{{index}}"
|
||||||
|
wx:for="{{currentPath}}">{{item.text}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="list-view">
|
||||||
|
<view wx:for="{{outValue}}"
|
||||||
|
wx:key="{{index}}"
|
||||||
|
class="list-view-item"
|
||||||
|
bindtap="tapItem"
|
||||||
|
data-text="{{item[contentKey]}}"
|
||||||
|
data-index="{{index}}">
|
||||||
|
<text class="title"
|
||||||
|
space="ensp">{{item[contentKey]}} </text>
|
||||||
|
<text wx:if="{{item.children}}"
|
||||||
|
class="tip">(进入下一级)</text>
|
||||||
|
<view class="btn"
|
||||||
|
catchtap="tapBtn"
|
||||||
|
data-item="{{item}}">{{btnTxt}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1,56 @@
|
||||||
|
/* components/path-view/path-view.wxss */
|
||||||
|
.path {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 0 0 10px;
|
||||||
|
}
|
||||||
|
.path {
|
||||||
|
min-height: 30px;
|
||||||
|
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.path .btn {
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 0 5px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: #4b0;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
.list-view {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.list-view-item {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: -1px;
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.list-view-item .title {
|
||||||
|
padding-left: 20rpx;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.list-view-item .tip {
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.list-view-item .btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 7px;
|
||||||
|
right: 20rpx;
|
||||||
|
padding: 0 5px;
|
||||||
|
height: 25px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: #4b0;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
export default function toTree({
|
||||||
|
value = [],
|
||||||
|
fatherKey = 'pid',
|
||||||
|
selfKey = 'id',
|
||||||
|
childrenKey = 'children',
|
||||||
|
rootValue = undefined
|
||||||
|
} = {}) {
|
||||||
|
// 复制对象
|
||||||
|
value = JSON.parse(JSON.stringify(value));
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
let itemI = value[i];
|
||||||
|
if (itemI[fatherKey] === rootValue) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (let j = 0; j < value.length; j++) {
|
||||||
|
if (i === j) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let itemJ = value[j];
|
||||||
|
if (itemI[fatherKey] === itemJ[selfKey]) {
|
||||||
|
if (
|
||||||
|
!itemJ[childrenKey] ||
|
||||||
|
Object.prototype.toString.call(itemJ[childrenKey]) !==
|
||||||
|
'[object Array]'
|
||||||
|
) {
|
||||||
|
itemJ[childrenKey] = [];
|
||||||
|
}
|
||||||
|
itemJ[childrenKey].push(itemI);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value.filter(item => item[fatherKey] === rootValue);
|
||||||
|
}
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 892 B |
After Width: | Height: | Size: 715 B |
After Width: | Height: | Size: 512 B |
|
@ -0,0 +1,102 @@
|
||||||
|
// pages/bind/binduser.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
bindusernameInput: function (e) {
|
||||||
|
this.data.username = e.detail.value
|
||||||
|
},
|
||||||
|
bindpasswordInput: function (e) {
|
||||||
|
this.data.password = e.detail.value
|
||||||
|
},
|
||||||
|
denglu: function(){
|
||||||
|
var that=this
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'bindmp',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded', //
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data:that.data,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (res.data.code == 1) {
|
||||||
|
wx.showToast({})
|
||||||
|
getApp().onLaunch()
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/main/main',
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.showModal({
|
||||||
|
content: '账户或密码不正确!',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.setData({
|
||||||
|
mpopenid:wx.getStorageSync('mpopenid')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__hd">
|
||||||
|
<view class="page__title">登陆安全预警lite小程序</view>
|
||||||
|
<view class="page__desc">首次使用需要绑定账号</view>
|
||||||
|
<view class="page__desc">请输入预警系统账号密码</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_input">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入账号" bindinput="bindusernameInput"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_input">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入密码" bindinput="bindpasswordInput" password="true"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<button class="weui-btn" type="primary" bindtap="denglu">登陆并绑定</button>
|
||||||
|
</view>
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* pages/bind/binduser.wxss */
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
// pages/drill/drill.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<!--pages/drill/drill.wxml-->
|
||||||
|
<text>pages/drill/drill.wxml</text>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/drill/drill.wxss */
|
|
@ -0,0 +1,66 @@
|
||||||
|
// pages/footer/footer.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<!--pages/footer/footer.wxml-->
|
||||||
|
<text>pages/footer/footer.wxml</text>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/footer/footer.wxss */
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
icon20: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAMAAABgZ9sFAAAAVFBMVEXx8fHMzMzr6+vn5+fv7+/t7e3d3d2+vr7W1tbHx8eysrKdnZ3p6enk5OTR0dG7u7u3t7ejo6PY2Njh4eHf39/T09PExMSvr6+goKCqqqqnp6e4uLgcLY/OAAAAnklEQVRIx+3RSRLDIAxE0QYhAbGZPNu5/z0zrXHiqiz5W72FqhqtVuuXAl3iOV7iPV/iSsAqZa9BS7YOmMXnNNX4TWGxRMn3R6SxRNgy0bzXOW8EBO8SAClsPdB3psqlvG+Lw7ONXg/pTld52BjgSSkA3PV2OOemjIDcZQWgVvONw60q7sIpR38EnHPSMDQ4MjDjLPozhAkGrVbr/z0ANjAF4AcbXmYAAAAASUVORK5CYII=",
|
||||||
|
icon60: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAAeFBMVEUAwAD///+U5ZTc9twOww7G8MYwzDCH4YcfyR9x23Hw+/DY9dhm2WZG0kbT9NP0/PTL8sux7LFe115T1VM+zz7i+OIXxhes6qxr2mvA8MCe6J6M4oz6/frr+us5zjn2/fa67rqB4IF13XWn6ad83nxa1loqyirn+eccHxx4AAAC/klEQVRo3u2W2ZKiQBBF8wpCNSCyLwri7v//4bRIFVXoTBBB+DAReV5sG6lTXDITiGEYhmEYhmEYhmEYhmEY5v9i5fsZGRx9PyGDne8f6K9cfd+mKXe1yNG/0CcqYE86AkBMBh66f20deBc7wA/1WFiTwvSEpBMA2JJOBsSLxe/4QEEaJRrASP8EVF8Q74GbmevKg0saa0B8QbwBdjRyADYxIhqxAZ++IKYtciPXLQVG+imw+oo4Bu56rjEJ4GYsvPmKOAB+xlz7L5aevqUXuePWVhvWJ4eWiwUQ67mK51qPj4dFDMlRLBZTqF3SDvmr4BwtkECu5gHWPkmDfQh02WLxXuvbvC8ku8F57GsI5e0CmUwLz1kq3kD17R1In5816rGvQ5VMk5FEtIiWislTffuDpl/k/PzscdQsv8r9qWq4LRWX6tQYtTxvI3XyrwdyQxChXioOngH3dLgOFjk0all56XRi/wDFQrGQU3Os5t0wJu1GNtNKHdPqYaGYQuRDfbfDf26AGLYSyGS3ZAK4S8XuoAlxGSdYMKwqZKM9XJMtyqXi7HX/CiAZS6d8bSVUz5J36mEMFDTlAFQzxOT1dzLRljjB6+++ejFqka+mXIe6F59mw22OuOw1F4T6lg/9VjL1rLDoI9Xzl1MSYDNHnPQnt3D1EE7PrXjye/3pVpr1Z45hMUdcACc5NVQI0bOdS1WA0wuz73e7/5TNqBPhQXPEFGJNV2zNqWI7QKBd2Gn6AiBko02zuAOXeWIXjV0jNqdKegaE/kJQ6Bfs4aju04lMLkA2T5wBSYPKDGF3RKhFYEa6A1L1LG2yacmsaZ6YPOSAMKNsO+N5dNTfkc5Aqe26uxHpx7ZirvgCwJpWq/lmX1hA7LyabQ34tt5RiJKXSwQ+0KU0V5xg+hZrd4Bn1n4EID+WkQdgLfRNtvil9SPfwy+WQ7PFBWQz6dGWZBLkeJFXZGCfLUjCgGgqXo5TuSu3cugdcTv/HjqnBTEMwzAMwzAMwzAMwzAMw/zf/AFbXiOA6frlMAAAAABJRU5ErkJggg=="
|
||||||
|
};
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 924 B |
After Width: | Height: | Size: 200 B |
After Width: | Height: | Size: 579 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 559 B |
After Width: | Height: | Size: 979 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 816 B |
After Width: | Height: | Size: 689 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,25 @@
|
||||||
|
//index.js
|
||||||
|
//获取应用实例
|
||||||
|
const app = getApp()
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
//事件处理函数
|
||||||
|
bindViewTap: function() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../logs/logs'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onLoad: function () {
|
||||||
|
this.getName();
|
||||||
|
},
|
||||||
|
getName: function(){
|
||||||
|
var username = wx.getStorageSync('username')
|
||||||
|
var userid = wx.getStorageSync('userid')
|
||||||
|
this.setData({
|
||||||
|
username: username,
|
||||||
|
userid: userid,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<!--index.wxml-->
|
||||||
|
<view class="page">
|
||||||
|
<view class="weui-panel weui-panel_access">
|
||||||
|
<view class="weui-panel__bd">
|
||||||
|
<navigator url="../user/userdetail" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||||
|
<!-- <image class="weui-media-box__thumb" src="{{userInfo.avatarUrl}}" /> -->
|
||||||
|
<open-data type="userAvatarUrl"></open-data>
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||||
|
<view class="weui-media-box__title">平台账号: {{username}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc">昵称: <open-data type="userNickName"></open-data> (点击进入个人信息管理)</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-panel">
|
||||||
|
<view class="weui-panel__hd">资料管理</view>
|
||||||
|
<view class="weui-panel__bd">
|
||||||
|
<view class="weui-media-box weui-media-box_small-appmsg">
|
||||||
|
<view class="weui-cells weui-cells_in-small-appmsg">
|
||||||
|
<navigator url="../socert/socert" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-cell__hd"><image src="../images/socert.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>
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
//logs.js
|
||||||
|
const util = require('../../utils/util.js')
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
logs: []
|
||||||
|
},
|
||||||
|
onLoad: function () {
|
||||||
|
this.setData({
|
||||||
|
logs: (wx.getStorageSync('logs') || []).map(log => {
|
||||||
|
return util.formatTime(new Date(log))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看启动日志"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<!--logs.wxml-->
|
||||||
|
<view class="container log-list">
|
||||||
|
<block wx:for="{{logs}}" wx:for-item="log">
|
||||||
|
<text class="log-item">{{index + 1}}. {{log}}</text>
|
||||||
|
</block>
|
||||||
|
</view>
|
|
@ -0,0 +1,8 @@
|
||||||
|
.log-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 40rpx;
|
||||||
|
}
|
||||||
|
.log-item {
|
||||||
|
margin: 10rpx;
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
// pages/main/main.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that = this
|
||||||
|
//获取待阅读通知数目
|
||||||
|
if(wx.getStorageSync("sessionid")){
|
||||||
|
this.getnoread()
|
||||||
|
this.getyhtodonum()
|
||||||
|
this.getzytodonum()
|
||||||
|
this.getpxqdnum()
|
||||||
|
}else{
|
||||||
|
getApp().callback = () => {
|
||||||
|
this.getnoread()
|
||||||
|
this.getyhtodonum()
|
||||||
|
this.getzytodonum()
|
||||||
|
this.getpxqdnum()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getnoread: function(){
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/notice?a=noreadnum',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
noread: res.data.noread,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getyhtodonum:function(){
|
||||||
|
var that = this
|
||||||
|
//获取隐患待办数目
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'troublehandle?a=todonum',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
yhtodonum: res.data.todonum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getzytodonum: function () {
|
||||||
|
var that = this
|
||||||
|
//获取作业待办数目
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/operation?a=todonum',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
zytodonum: res.data.todonum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getpxqdnum:function(){
|
||||||
|
var that = this
|
||||||
|
//获取待签到培训
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'pxhandle?a=dqdnum',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data)
|
||||||
|
this.setData({
|
||||||
|
dqdnum: res.data.dqdnum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-cells__title">数据采集</view>
|
||||||
|
<view class="weui-grids">
|
||||||
|
<navigator url="/pages/trouble/trouble" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/trouble.png" />
|
||||||
|
<view class="weui-grid__label">事故隐患</view>
|
||||||
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{yhtodonum!=0}}">{{yhtodonum}}</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/observe/observe" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/watch.png" />
|
||||||
|
<view class="weui-grid__label">行为观察</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/miss/miss" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/miss.png" />
|
||||||
|
<view class="weui-grid__label">未遂事件</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/suggest/suggest" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/suggest.png" />
|
||||||
|
<view class="weui-grid__label">合理化建议</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/operation/operation" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/operation.png" />
|
||||||
|
<view class="weui-grid__label">作业许可</view>
|
||||||
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{zytodonum!=0}}">{{zytodonum}}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">学习园地</view>
|
||||||
|
<view class="weui-grids">
|
||||||
|
<navigator url="/pages/public/public" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/public.png" />
|
||||||
|
<view class="weui-grid__label">公告</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/notice/notice" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/send.png" />
|
||||||
|
<view class="weui-grid__label">通知</view>
|
||||||
|
|
||||||
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{noread!=0}}">{{noread}}</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/train/train" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/train.png" />
|
||||||
|
<view class="weui-grid__label">线下培训</view>
|
||||||
|
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{dqdnum!=0}}">{{dqdnum}}</view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="e" class="weui-grid" hover-class="weui-grid_active">
|
||||||
|
<image class="weui-grid__icon" src="../images/test.png" />
|
||||||
|
<view class="weui-grid__label">即将上线..</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/main/main.wxss */
|
|
@ -0,0 +1,227 @@
|
||||||
|
// pages/miss/addmiss.js
|
||||||
|
var dateTimePicker = require('../../utils/dateTimePicker.js');
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
misstime: '',
|
||||||
|
missplace: '',
|
||||||
|
missimg: [],
|
||||||
|
},
|
||||||
|
bindmissplaceInput: function (e) {
|
||||||
|
this.data.missplace = e.detail.value
|
||||||
|
},
|
||||||
|
binddescriptionInput: function (e) {
|
||||||
|
this.data.description = e.detail.value
|
||||||
|
},
|
||||||
|
bindpreventInput: function (e) {
|
||||||
|
this.data.prevent = e.detail.value
|
||||||
|
},
|
||||||
|
bindlessonInput: function (e) {
|
||||||
|
this.data.lesson = e.detail.value
|
||||||
|
},
|
||||||
|
submit: function () {
|
||||||
|
var that = this
|
||||||
|
if (that.data.missplace == '') {
|
||||||
|
that.Tap1('请输入发生地点!')
|
||||||
|
} else if (that.data.description == '') {
|
||||||
|
that.Tap1('请输入简要描述!')
|
||||||
|
} else {
|
||||||
|
that.upimg(0, that.data.missimg.length)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Tap1: function (x) {
|
||||||
|
wx.showModal({
|
||||||
|
title: "系统提示",
|
||||||
|
content: x,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//上传图片
|
||||||
|
upimg: function (x, y) {
|
||||||
|
var that = this
|
||||||
|
if (x < y) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '上传现场图片' + (x + 1) + '....',
|
||||||
|
})
|
||||||
|
wx.uploadFile({
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
url: getApp().globalData.serverUrl + 'upfile',
|
||||||
|
filePath: that.data.missimg[x],
|
||||||
|
name: 'upfile',
|
||||||
|
success(res) {
|
||||||
|
var obj = JSON.parse(res.data);
|
||||||
|
that.data.missimg[x] = obj['filepath']
|
||||||
|
x = x + 1
|
||||||
|
if (x < y) {
|
||||||
|
that.upimg(x, y)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
that.addobserve()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.addobserve()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addobserve: function () {
|
||||||
|
var wsdata = {
|
||||||
|
misstime: this.data.misstime,
|
||||||
|
missplace: this.data.missplace,
|
||||||
|
description: this.data.description,
|
||||||
|
missimg: this.data.missimg,
|
||||||
|
prevent: this.data.prevent,
|
||||||
|
lesson: this.data.lesson,
|
||||||
|
}
|
||||||
|
//console.log(wsdata.unsafe)
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/miss?a=add',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', //
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: wsdata,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
// 获取完整的年月日 时分秒,以及默认显示的数组
|
||||||
|
var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
|
||||||
|
var dateTimeArray1 = obj1.dateTimeArray
|
||||||
|
var dateTime1 = obj1.dateTime
|
||||||
|
var time = dateTimeArray1[0][dateTime1[0]] + '-' + dateTimeArray1[1][dateTime1[1]] + '-' + dateTimeArray1[2][dateTime1[2]] + ' ' + dateTimeArray1[3][dateTime1[3]] + ':' + dateTimeArray1[4][dateTime1[4]]
|
||||||
|
this.setData({
|
||||||
|
dateTimeArray1: obj1.dateTimeArray,
|
||||||
|
dateTime1: obj1.dateTime,
|
||||||
|
});
|
||||||
|
this.data.misstime = time
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
changeDateTime1(e) {
|
||||||
|
var dateTimeArray1 = this.data.dateTimeArray1
|
||||||
|
var dateTime1 = this.data.dateTime1
|
||||||
|
var time = dateTimeArray1[0][dateTime1[0]] + '-' + dateTimeArray1[1][dateTime1[1]] + '-' + dateTimeArray1[2][dateTime1[2]] + ' ' + dateTimeArray1[3][dateTime1[3]] + ':' + dateTimeArray1[4][dateTime1[4]]
|
||||||
|
//console.log(time)
|
||||||
|
this.data.misstime = time
|
||||||
|
this.setData({
|
||||||
|
dateTime1: e.detail.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
changeDateTimeColumn1(e) {
|
||||||
|
var arr = this.data.dateTime1,
|
||||||
|
dateArr = this.data.dateTimeArray1;
|
||||||
|
|
||||||
|
arr[e.detail.column] = e.detail.value;
|
||||||
|
dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]);
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
dateTimeArray1: dateArr,
|
||||||
|
dateTime1: arr
|
||||||
|
});
|
||||||
|
},
|
||||||
|
chooseImage: function () {
|
||||||
|
var that = this
|
||||||
|
wx.chooseImage({
|
||||||
|
count: 9,
|
||||||
|
sizeType: ['original', 'compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
missimg: that.data.missimg.concat(res.tempFilePaths)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
previewImage: function (e) {
|
||||||
|
var current = e.target.dataset.src
|
||||||
|
wx.previewImage({
|
||||||
|
current: current,
|
||||||
|
urls: this.data.missimg
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteImage: function (e) {
|
||||||
|
var that = this;
|
||||||
|
var missimg = that.data.missimg;
|
||||||
|
var index = e.currentTarget.dataset.index; //获取当前长按图片下标
|
||||||
|
wx.showModal({
|
||||||
|
title: '系统提醒',
|
||||||
|
content: '确定要删除此图片吗?',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
missimg.splice(index, 1);
|
||||||
|
} else if (res.cancel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
missimg: missimg
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增事件"
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="weui-cells__title">事件信息</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_select">
|
||||||
|
<view class="weui-cell__hd weui-cell__hd_in-select-after">
|
||||||
|
<view class="weui-label">发生时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<picker mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" bindcolumnchange="changeDateTimeColumn1" range="{{dateTimeArray1}}">
|
||||||
|
<view class="weui-select">
|
||||||
|
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_select">
|
||||||
|
<view class="weui-cell__hd weui-cell__hd_in-select-after">
|
||||||
|
<view class="weui-label">发生地点</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入发生地点" bindinput="bindmissplaceInput" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">现场图片(如有)</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view class="weui-uploader">
|
||||||
|
<view class="weui-uploader__bd">
|
||||||
|
<view class="weui-uploader__files">
|
||||||
|
<block wx:for="{{missimg}}" wx:for-item="image" wx:key="unique">
|
||||||
|
<view class="weui-uploader__file">
|
||||||
|
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="previewImage" bindlongpress="deleteImage" data-index="{{index}}"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__input-box">
|
||||||
|
<view class="weui-uploader__input" bindtap="chooseImage"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">简要描述</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<textarea class="weui-textarea" placeholder="请输入描述" style="height: 3.3em" bindinput="binddescriptionInput"/>
|
||||||
|
<view class="weui-textarea-counter">0/200</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">防范措施</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<textarea class="weui-textarea" placeholder="请输入描述" style="height: 3.3em" bindinput="bindpreventInput"/>
|
||||||
|
<view class="weui-textarea-counter">0/200</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">经验教训</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<textarea class="weui-textarea" placeholder="请输入描述" style="height: 3.3em" bindinput="bindlessonInput"/>
|
||||||
|
<view class="weui-textarea-counter">0/200</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btn-area">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="submit">提交</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/miss/addmiss.wxss */
|
|
@ -0,0 +1,121 @@
|
||||||
|
// pages/miss/miss.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
page: 1,
|
||||||
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
|
wslist:[]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getWslist(1)
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getWslist(1);
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
|
this.data.page = this.data.page + 1;
|
||||||
|
this.getWslist();
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getWslist: function (page) {
|
||||||
|
var that = this;
|
||||||
|
if (page != 1) { page = that.data.page }
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/miss?a=listall&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({
|
||||||
|
total: 0,
|
||||||
|
wslist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showModal({
|
||||||
|
content: "已经到底啦!",
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let list
|
||||||
|
if (page == 1) {
|
||||||
|
list = res.data.rows
|
||||||
|
} else {
|
||||||
|
list = this.data.wslist.concat(res.data.rows)
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
wslist: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "未遂事件",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"onReachBottomDistance": 50
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<view class="page__bd">
|
||||||
|
|
||||||
|
<view class="head">共{{total}}条未遂事件</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title" >
|
||||||
|
<block wx:for="{{wslist}}" wx:key="unique">
|
||||||
|
<navigator url="missdetail?missid={{item.missid}}" 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.missplace}}</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.missnum}} {{item.misser__name}}填报</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.misstime}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="position:fixed; bottom:0;width:100%;">
|
||||||
|
<navigator url="/pages/miss/addmiss" hover-class="navigator-hover">
|
||||||
|
<button class="weui-btn" type="primary">新增</button>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
|
@ -0,0 +1,14 @@
|
||||||
|
.weui-btn{
|
||||||
|
width:auto;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #939393;
|
||||||
|
}
|
||||||
|
.head{
|
||||||
|
color:#fff;
|
||||||
|
background-color: cornflowerblue;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
// pages/miss/missdetail.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
serverUrl: getApp().globalData.serverUrl
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.getWsdetail(options.missid);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
missimgPreview: function (e) {
|
||||||
|
var current = e.target.dataset.src
|
||||||
|
|
||||||
|
wx.previewImage({
|
||||||
|
current: current,
|
||||||
|
urls: this.data.missimg
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getWsdetail: function (missid) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/miss?a=detail&missid=' + missid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
console.log(res.data);
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
var wsdata = res.data
|
||||||
|
//格式化观察信息
|
||||||
|
for (var i = 0; i < wsdata.missimg.length; i++) {
|
||||||
|
wsdata.missimg[i] = this.data.serverUrl + wsdata.missimg[i];
|
||||||
|
}
|
||||||
|
if (wsdata.misstime != '') { wsdata.misstime = util.formatTime(new Date(wsdata.misstime)) }
|
||||||
|
if (wsdata.submittime != '') { wsdata.submittime = util.formatTime(new Date(wsdata.submittime)) }
|
||||||
|
this.setData(wsdata)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "详情"
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
<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">
|
||||||
|
{{missnum}}
|
||||||
|
</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">
|
||||||
|
{{submittime}}
|
||||||
|
</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">
|
||||||
|
{{misspart__partname}}
|
||||||
|
</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">
|
||||||
|
{{misser__name}}
|
||||||
|
</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">
|
||||||
|
{{misstime}}
|
||||||
|
</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">
|
||||||
|
{{missplace}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_access">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view>现场图片</view>
|
||||||
|
<view class="weui-uploader__files">
|
||||||
|
<block wx:for="{{missimg}}" wx:for-item="image" wx:key="unique">
|
||||||
|
<view class="weui-uploader__file">
|
||||||
|
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="missimgPreview"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</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 class="weui-cell__ft">
|
||||||
|
{{description}}
|
||||||
|
</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">
|
||||||
|
{{prevent}}
|
||||||
|
</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">
|
||||||
|
{{lesson}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/miss/missdetail.wxss */
|
|
@ -0,0 +1,147 @@
|
||||||
|
// pages/suggest/detail.js
|
||||||
|
var util = require('../../utils/util.js')
|
||||||
|
var WxParse = require('../../wxParse/wxParse.js');
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
serverUrl: getApp().globalData.serverUrl
|
||||||
|
},
|
||||||
|
openfj: function (e) {
|
||||||
|
var that =this
|
||||||
|
let fileurl = that.data.serverUrl + e.currentTarget.dataset.id
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在打开...',
|
||||||
|
})
|
||||||
|
wx.downloadFile({
|
||||||
|
url: fileurl,
|
||||||
|
success(res) {
|
||||||
|
const filePath = res.tempFilePath
|
||||||
|
console.log(filePath)
|
||||||
|
var filetype
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
console.log(filetype)
|
||||||
|
wx.openDocument({
|
||||||
|
filePath,
|
||||||
|
fileType:filetype,
|
||||||
|
success(res) {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log('打开文档成功')
|
||||||
|
},fail:function(e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.getTzdetail(options.id);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getTzdetail: function (id) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/notice?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 tzdata = res.data
|
||||||
|
let material = []
|
||||||
|
console.log(tzdata.notice.material.length)
|
||||||
|
for (var i = 0, len = tzdata.notice.material.length; i < len; i++) {
|
||||||
|
let x = {}
|
||||||
|
x['name'] = tzdata.notice.material[i].split('_').pop();
|
||||||
|
x['value'] = tzdata.notice.material[i]
|
||||||
|
material.push(x)
|
||||||
|
}
|
||||||
|
console.log(material)
|
||||||
|
this.setData({
|
||||||
|
material: material
|
||||||
|
})
|
||||||
|
this.setData(tzdata)
|
||||||
|
|
||||||
|
WxParse.wxParse('article', 'html', tzdata.notice.content, this, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "详情"
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<import src="../../wxParse/wxParse.wxml"/>
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-article">
|
||||||
|
<view class="weui-article__h1">{{notice.title}}</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>
|
||||||
|
|
||||||
|
<block wx:for="{{material}}" wx:key="unique">
|
||||||
|
<view class="weui-media-box" style="color:blue" data-id="{{item.value}}" bindtap='openfj'>
|
||||||
|
{{index+1}} {{item.name}}
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<view class="weui-article__section">
|
||||||
|
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/notice/detail.wxss */
|
|
@ -0,0 +1,123 @@
|
||||||
|
// pages/miss/miss.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
page: 1,
|
||||||
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
|
tzlist: []
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getTzlist(1)
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getTzlist(1);
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
|
this.data.page = this.data.page + 1;
|
||||||
|
this.getTzlist();
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
getTzlist: function (page) {
|
||||||
|
var that = this;
|
||||||
|
if (page != 1) { page = that.data.page }
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'api/notice?a=listtome&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({
|
||||||
|
total: 0,
|
||||||
|
noread: 0,
|
||||||
|
tzlist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showModal({
|
||||||
|
content: "已经到底啦!",
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let list
|
||||||
|
if (page == 1) {
|
||||||
|
list = res.data.rows
|
||||||
|
} else {
|
||||||
|
list = this.data.tzlist.concat(res.data.rows)
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
noread:res.data.noread,
|
||||||
|
tzlist: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "收件箱",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"onReachBottomDistance": 50
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<view class="page__bd">
|
||||||
|
|
||||||
|
<view class="head">共{{total}}条通知,其中{{noread}}条未读</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title" >
|
||||||
|
<block wx:for="{{tzlist}}" wx:key="unique">
|
||||||
|
<navigator url="detail?id={{item.noticeid__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.noticeid__title}}</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.noticeid__pubpart__partname}} {{item.noticeid__pubuser__name}}发布</view>
|
||||||
|
<view class="weui-media-box__desc">{{item.noticeid__submittime}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||||
|
<view class="weui-media-box__title" wx:if="{{item.read == 0}}" style="background-color:yellow">未读</view>
|
||||||
|
<view class="weui-media-box__title" wx:else style="background-color:green">已读</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view style="position:fixed; bottom:0;width:100%;">
|
||||||
|
<navigator url="/pages/miss/addmiss" hover-class="navigator-hover">
|
||||||
|
<button class="weui-btn" type="primary">新增</button>
|
||||||
|
</navigator>
|
||||||
|
</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,397 @@
|
||||||
|
var dateTimePicker = require('../../utils/dateTimePicker.js');
|
||||||
|
// pages/observe/addobserve.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
lookeder: '',
|
||||||
|
looktime: '',
|
||||||
|
lookplace: '',
|
||||||
|
actname: '',
|
||||||
|
lookimg: [],
|
||||||
|
},
|
||||||
|
bindlookederInput: function (e) {
|
||||||
|
this.data.lookeder = e.detail.value
|
||||||
|
},
|
||||||
|
bindlookplaceInput: function (e) {
|
||||||
|
this.data.lookplace = e.detail.value
|
||||||
|
},
|
||||||
|
bindactnameInput: function (e) {
|
||||||
|
this.data.actname = e.detail.value
|
||||||
|
},
|
||||||
|
bindotherunsafeInput: function (e) {
|
||||||
|
this.data.otherunsafe = e.detail.value
|
||||||
|
},
|
||||||
|
bindsafecontentInput: function (e) {
|
||||||
|
this.data.safecontent = e.detail.value
|
||||||
|
},
|
||||||
|
checkboxChange24: function (e) {
|
||||||
|
var x = this.data.unsafe24;
|
||||||
|
var checkboxItems = this.data.unsafe24.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe24: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange25: function (e) {
|
||||||
|
var x = this.data.unsafe25;
|
||||||
|
var checkboxItems = this.data.unsafe25.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe25: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange26: function (e) {
|
||||||
|
var x = this.data.unsafe26;
|
||||||
|
var checkboxItems = this.data.unsafe26.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe26: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange27: function (e) {
|
||||||
|
var x = this.data.unsafe27;
|
||||||
|
var checkboxItems = this.data.unsafe27.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe27: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange28: function (e) {
|
||||||
|
var x = this.data.unsafe28;
|
||||||
|
var checkboxItems = this.data.unsafe28.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe28: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange29: function (e) {
|
||||||
|
var x = this.data.unsafe29;
|
||||||
|
var checkboxItems = this.data.unsafe29.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe29: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkboxChange30: function (e) {
|
||||||
|
var x = this.data.unsafe30;
|
||||||
|
var checkboxItems = this.data.unsafe30.child, values = e.detail.value;
|
||||||
|
for (var i = 0, lenI = checkboxItems.length; i < lenI; ++i) {
|
||||||
|
checkboxItems[i].checked = false;
|
||||||
|
|
||||||
|
for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
|
||||||
|
if (checkboxItems[i].value == values[j]) {
|
||||||
|
checkboxItems[i].checked = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.child = checkboxItems
|
||||||
|
this.setData({
|
||||||
|
unsafe30: x
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
// 获取完整的年月日 时分秒,以及默认显示的数组
|
||||||
|
var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
|
||||||
|
var dateTimeArray1 = obj1.dateTimeArray
|
||||||
|
var dateTime1 = obj1.dateTime
|
||||||
|
var time = dateTimeArray1[0][dateTime1[0]] + '-' + dateTimeArray1[1][dateTime1[1]] + '-' + dateTimeArray1[2][dateTime1[2]] + ' ' + dateTimeArray1[3][dateTime1[3]] + ':' + dateTimeArray1[4][dateTime1[4]]
|
||||||
|
this.setData({
|
||||||
|
dateTimeArray1: obj1.dateTimeArray,
|
||||||
|
dateTime1: obj1.dateTime,
|
||||||
|
});
|
||||||
|
this.data.looktime = time
|
||||||
|
//获取观察字典
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'gchandle?a=getdics',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
//console.log(res.data.data)
|
||||||
|
this.setData({
|
||||||
|
unsafe24: res.data.data[0],
|
||||||
|
unsafe25: res.data.data[1],
|
||||||
|
unsafe26: res.data.data[2],
|
||||||
|
unsafe27: res.data.data[3],
|
||||||
|
unsafe28: res.data.data[4],
|
||||||
|
unsafe29: res.data.data[5],
|
||||||
|
unsafe30: res.data.data[6],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submit: function () {
|
||||||
|
var that = this
|
||||||
|
if (that.data.lookeder == '') {
|
||||||
|
that.Tap1('请填写被观察对象!')
|
||||||
|
} else if (that.data.lookplace == '') {
|
||||||
|
that.Tap1('请输入观察地点!')
|
||||||
|
} else if (that.data.actname == '') {
|
||||||
|
that.Tap1('请输入作业名称!')
|
||||||
|
} else {
|
||||||
|
that.upimg(0, that.data.lookimg.length)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Tap1: function (x) {
|
||||||
|
wx.showModal({
|
||||||
|
title: "系统提示",
|
||||||
|
content: x,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//上传图片
|
||||||
|
upimg: function (x, y) {
|
||||||
|
var that = this
|
||||||
|
if (x < y) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '上传现场图片' + (x + 1) + '....',
|
||||||
|
})
|
||||||
|
wx.uploadFile({
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
url: getApp().globalData.serverUrl + 'upfile',
|
||||||
|
filePath: that.data.lookimg[x],
|
||||||
|
name: 'upfile',
|
||||||
|
success(res) {
|
||||||
|
var obj = JSON.parse(res.data);
|
||||||
|
that.data.lookimg[x] = obj['filepath']
|
||||||
|
x = x + 1
|
||||||
|
if (x < y) {
|
||||||
|
that.upimg(x, y)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
that.addobserve()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.addobserve()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addobserve: function () {
|
||||||
|
var gcdata = {
|
||||||
|
lookeder: this.data.lookeder,
|
||||||
|
looktime: this.data.looktime,
|
||||||
|
lookplace: this.data.lookplace,
|
||||||
|
actname: this.data.actname,
|
||||||
|
lookimg: this.data.lookimg,
|
||||||
|
otherunsafe: this.data.otherunsafe,
|
||||||
|
safecontent: this.data.safecontent,
|
||||||
|
unsafe: this.getunsafe(),
|
||||||
|
}
|
||||||
|
//console.log(gcdata.unsafe)
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'gchandle?a=add',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', //
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: gcdata,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getunsafe: function () {
|
||||||
|
var x = []
|
||||||
|
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]
|
||||||
|
for (var i = 0, lenI = items.length; i < lenI; i++) {
|
||||||
|
var y = items[i]
|
||||||
|
for (var m = 0, lenI = y.length; m < lenI; m++) {
|
||||||
|
if (y[m].checked) {
|
||||||
|
x.push(y[m].value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
changeDateTime1(e) {
|
||||||
|
var dateTimeArray1 = this.data.dateTimeArray1
|
||||||
|
var dateTime1 = this.data.dateTime1
|
||||||
|
var time = dateTimeArray1[0][dateTime1[0]] + '-' + dateTimeArray1[1][dateTime1[1]] + '-' + dateTimeArray1[2][dateTime1[2]] + ' ' + dateTimeArray1[3][dateTime1[3]] + ':' + dateTimeArray1[4][dateTime1[4]]
|
||||||
|
//console.log(time)
|
||||||
|
this.data.looktime = time
|
||||||
|
this.setData({
|
||||||
|
dateTime1: e.detail.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
changeDateTimeColumn1(e) {
|
||||||
|
var arr = this.data.dateTime1,
|
||||||
|
dateArr = this.data.dateTimeArray1;
|
||||||
|
|
||||||
|
arr[e.detail.column] = e.detail.value;
|
||||||
|
dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]);
|
||||||
|
|
||||||
|
this.setData({
|
||||||
|
dateTimeArray1: dateArr,
|
||||||
|
dateTime1: arr
|
||||||
|
});
|
||||||
|
},
|
||||||
|
chooseImage: function () {
|
||||||
|
var that = this
|
||||||
|
wx.chooseImage({
|
||||||
|
count: 9,
|
||||||
|
sizeType: ['original', 'compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
lookimg: that.data.lookimg.concat(res.tempFilePaths)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
previewImage: function (e) {
|
||||||
|
var current = e.target.dataset.src
|
||||||
|
wx.previewImage({
|
||||||
|
current: current,
|
||||||
|
urls: this.data.lookimg
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteImage: function (e) {
|
||||||
|
var that = this;
|
||||||
|
var lookimg = that.data.lookimg;
|
||||||
|
var index = e.currentTarget.dataset.index; //获取当前长按图片下标
|
||||||
|
wx.showModal({
|
||||||
|
title: '系统提醒',
|
||||||
|
content: '确定要删除此图片吗?',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
lookimg.splice(index, 1);
|
||||||
|
} else if (res.cancel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
lookimg: lookimg
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "新增观察"
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
|
||||||
|
|
||||||
|
<view class="weui-cells__title">现场图片</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd weui-cell_primary">
|
||||||
|
<view class="weui-uploader">
|
||||||
|
<view class="weui-uploader__bd">
|
||||||
|
<view class="weui-uploader__files">
|
||||||
|
<block wx:for="{{lookimg}}" wx:for-item="image" wx:key="unique">
|
||||||
|
<view class="weui-uploader__file">
|
||||||
|
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="previewImage" bindlongpress="deleteImage" data-index="{{index}}"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__input-box">
|
||||||
|
<view class="weui-uploader__input" bindtap="chooseImage"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">观察信息</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell weui-cell_input">
|
||||||
|
<view class="weui-cell__hd">
|
||||||
|
<view class="weui-label">被观察对象</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入" bindinput="bindlookederInput" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_select">
|
||||||
|
<view class="weui-cell__hd weui-cell__hd_in-select-after">
|
||||||
|
<view class="weui-label">观察时间</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<picker mode="multiSelector" value="{{dateTime1}}" bindchange="changeDateTime1" bindcolumnchange="changeDateTimeColumn1" range="{{dateTimeArray1}}">
|
||||||
|
<view class="weui-select">
|
||||||
|
{{dateTimeArray1[0][dateTime1[0]]}}-{{dateTimeArray1[1][dateTime1[1]]}}-{{dateTimeArray1[2][dateTime1[2]]}} {{dateTimeArray1[3][dateTime1[3]]}}:{{dateTimeArray1[4][dateTime1[4]]}}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_select">
|
||||||
|
<view class="weui-cell__hd weui-cell__hd_in-select-after">
|
||||||
|
<view class="weui-label">观察地点</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入观察地点" bindinput="bindlookplaceInput" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell weui-cell_select">
|
||||||
|
<view class="weui-cell__hd weui-cell__hd_in-select-after">
|
||||||
|
<view class="weui-label">作业名称</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<input class="weui-input" placeholder="请输入作业名称" bindinput="bindactnameInput" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="weui-cells__title">不安全行为记录卡</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe24.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange24">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe24.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe25.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange25">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe25.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe26.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange26">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe26.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe27.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange27">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe27.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe28.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange28">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe28.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe29.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange29">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe29.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title" >{{unsafe30.text}}</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<checkbox-group bindchange="checkboxChange30">
|
||||||
|
<label class="weui-cell weui-check__label" wx:for="{{unsafe30.child}}" wx:key="value">
|
||||||
|
<checkbox class="weui-check" value="{{item.value}}" />
|
||||||
|
<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>
|
||||||
|
<view class="weui-cell__bd">{{item.text}}</view>
|
||||||
|
</label>
|
||||||
|
</checkbox-group>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">其他不安全行为</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<textarea class="weui-textarea" placeholder="请输入描述" style="height: 3.3em" bindinput="bindotherunsafeInput"/>
|
||||||
|
<view class="weui-textarea-counter">0/200</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cells__title">安全或提倡的行为</view>
|
||||||
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<textarea class="weui-textarea" placeholder="请输入描述" style="height: 3.3em" bindinput="bindsafecontentInput"/>
|
||||||
|
<view class="weui-textarea-counter">0/200</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btn-area">
|
||||||
|
<button class="weui-btn" type="primary" bindtap="submit">提交</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/observe/addobserve.wxss */
|
|
@ -0,0 +1,121 @@
|
||||||
|
// pages/observe/observe.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
page:1,
|
||||||
|
serverUrl: getApp().globalData.serverUrl,
|
||||||
|
gclist:[]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getGclist(1)
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
var that = this;
|
||||||
|
that.getGclist(1);
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
this.data.page = 1;
|
||||||
|
},
|
||||||
|
onReachBottom: function () {
|
||||||
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
|
this.data.page = this.data.page + 1;
|
||||||
|
this.getGclist();
|
||||||
|
|
||||||
|
},
|
||||||
|
getGclist: function (page) {
|
||||||
|
var that = this;
|
||||||
|
if (page != 1) { page = that.data.page }
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
}),
|
||||||
|
wx.request({
|
||||||
|
url: this.data.serverUrl + 'gchandle?a=listall&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({
|
||||||
|
total: 0,
|
||||||
|
gclist: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wx.showModal({
|
||||||
|
content: "已经到底啦!",
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: "确定",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let list
|
||||||
|
if (page == 1) {
|
||||||
|
list = res.data.rows
|
||||||
|
} else {
|
||||||
|
list = this.data.gclist.concat(res.data.rows)
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
gclist: list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|