diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js
new file mode 100644
index 0000000..e56fef9
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js
@@ -0,0 +1,140 @@
+// pages/validNameKeyword/validNameKeyword.js
+// const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
+const defaultAvatarUrl = '../../images/login.png'
+var app = getApp()
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ nickname: '', // 昵称
+ phone: '', //用户名-手机号
+ password: '', // 密码
+ telMessage: '', // 手机号验证提示信息
+ keywordMessage: '', //密码
+ avatarUrl: defaultAvatarUrl, //头像
+ },
+
+ // 授权头像
+ onChooseAvatar(e) {
+ const { avatarUrl } = e.detail
+ this.setData({
+ avatarUrl,
+ })
+ },
+ // 校验手机号
+ telChange: function (event) {
+ const phone = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (phone) {
+ if (/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
+ message = '';
+ disable = false;
+ } else {
+ message = '您输入的手机号码有误';
+ disable = true;
+ }
+ } else {
+ message = '账号不能为空',
+ disable = true
+ }
+ this.setData({
+ telMessage: message,
+ disabled: disable,
+ txn_tel: phone
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ keywordChange: function (event) {
+ const password = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (!password) {
+ message = '密码不能为空',
+ disable = true
+ }
+ this.setData({
+ keywordMessage: message,
+ disabled: disable,
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ // 点击确认
+ confirm: function (e) {
+ const { phone, password, nickname, avatarUrl} = this.data
+ console.log(nickname);
+ console.log('00000', this.data )
+ if(!nickname) {
+ wx.showToast({
+ title: '昵称不能为空',
+ icon: 'error'
+ })
+ return false
+ }
+ if(!phone) {
+ this.setData({
+ telMessage: '账号不能为空',
+ });
+ return false
+ }
+ if(!password) {
+ this.setData({
+ keywordMessage: '密码不能为空',
+ });
+ return false
+ } else {
+ this.setData({
+ keywordMessage: '',
+ });
+ }
+ console.log('点击确认');
+ wx.showLoading("登录中...")
+ wx.request({
+ url: app.globalData.httpsUrl + "app/user/login",
+ data: {
+ username: phone, // 用户名(手机号)
+ // password: cryptFirst.encrypt(password),
+ password: password,
+ weChatName: nickname,
+ weChatImage: avatarUrl,
+ openId: app.globalData.openid,
+ },
+ method: 'POST',
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定
+ wx.showToast({
+ title: '绑定失败,请联系管理员',
+ icon: 'none'
+ })
+ } else if(res.data.code === 2402) {
+ wx.showToast({
+ title: '密码错误',
+ icon: 'error'
+ })
+ }
+ },
+ fail: function (err) {
+ wx.hideLoading();
+ wx.showToast({
+ title: `发生错误, 请联系管理员`,
+ icon: 'none'
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js
new file mode 100644
index 0000000..e56fef9
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js
@@ -0,0 +1,140 @@
+// pages/validNameKeyword/validNameKeyword.js
+// const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
+const defaultAvatarUrl = '../../images/login.png'
+var app = getApp()
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ nickname: '', // 昵称
+ phone: '', //用户名-手机号
+ password: '', // 密码
+ telMessage: '', // 手机号验证提示信息
+ keywordMessage: '', //密码
+ avatarUrl: defaultAvatarUrl, //头像
+ },
+
+ // 授权头像
+ onChooseAvatar(e) {
+ const { avatarUrl } = e.detail
+ this.setData({
+ avatarUrl,
+ })
+ },
+ // 校验手机号
+ telChange: function (event) {
+ const phone = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (phone) {
+ if (/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
+ message = '';
+ disable = false;
+ } else {
+ message = '您输入的手机号码有误';
+ disable = true;
+ }
+ } else {
+ message = '账号不能为空',
+ disable = true
+ }
+ this.setData({
+ telMessage: message,
+ disabled: disable,
+ txn_tel: phone
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ keywordChange: function (event) {
+ const password = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (!password) {
+ message = '密码不能为空',
+ disable = true
+ }
+ this.setData({
+ keywordMessage: message,
+ disabled: disable,
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ // 点击确认
+ confirm: function (e) {
+ const { phone, password, nickname, avatarUrl} = this.data
+ console.log(nickname);
+ console.log('00000', this.data )
+ if(!nickname) {
+ wx.showToast({
+ title: '昵称不能为空',
+ icon: 'error'
+ })
+ return false
+ }
+ if(!phone) {
+ this.setData({
+ telMessage: '账号不能为空',
+ });
+ return false
+ }
+ if(!password) {
+ this.setData({
+ keywordMessage: '密码不能为空',
+ });
+ return false
+ } else {
+ this.setData({
+ keywordMessage: '',
+ });
+ }
+ console.log('点击确认');
+ wx.showLoading("登录中...")
+ wx.request({
+ url: app.globalData.httpsUrl + "app/user/login",
+ data: {
+ username: phone, // 用户名(手机号)
+ // password: cryptFirst.encrypt(password),
+ password: password,
+ weChatName: nickname,
+ weChatImage: avatarUrl,
+ openId: app.globalData.openid,
+ },
+ method: 'POST',
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定
+ wx.showToast({
+ title: '绑定失败,请联系管理员',
+ icon: 'none'
+ })
+ } else if(res.data.code === 2402) {
+ wx.showToast({
+ title: '密码错误',
+ icon: 'error'
+ })
+ }
+ },
+ fail: function (err) {
+ wx.hideLoading();
+ wx.showToast({
+ title: `发生错误, 请联系管理员`,
+ icon: 'none'
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.json b/miniprogram/pages/validNameKeyword/validNameKeyword.json
new file mode 100644
index 0000000..b00648c
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-field": "@vant/weapp/field/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js
new file mode 100644
index 0000000..e56fef9
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js
@@ -0,0 +1,140 @@
+// pages/validNameKeyword/validNameKeyword.js
+// const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
+const defaultAvatarUrl = '../../images/login.png'
+var app = getApp()
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ nickname: '', // 昵称
+ phone: '', //用户名-手机号
+ password: '', // 密码
+ telMessage: '', // 手机号验证提示信息
+ keywordMessage: '', //密码
+ avatarUrl: defaultAvatarUrl, //头像
+ },
+
+ // 授权头像
+ onChooseAvatar(e) {
+ const { avatarUrl } = e.detail
+ this.setData({
+ avatarUrl,
+ })
+ },
+ // 校验手机号
+ telChange: function (event) {
+ const phone = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (phone) {
+ if (/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
+ message = '';
+ disable = false;
+ } else {
+ message = '您输入的手机号码有误';
+ disable = true;
+ }
+ } else {
+ message = '账号不能为空',
+ disable = true
+ }
+ this.setData({
+ telMessage: message,
+ disabled: disable,
+ txn_tel: phone
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ keywordChange: function (event) {
+ const password = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (!password) {
+ message = '密码不能为空',
+ disable = true
+ }
+ this.setData({
+ keywordMessage: message,
+ disabled: disable,
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ // 点击确认
+ confirm: function (e) {
+ const { phone, password, nickname, avatarUrl} = this.data
+ console.log(nickname);
+ console.log('00000', this.data )
+ if(!nickname) {
+ wx.showToast({
+ title: '昵称不能为空',
+ icon: 'error'
+ })
+ return false
+ }
+ if(!phone) {
+ this.setData({
+ telMessage: '账号不能为空',
+ });
+ return false
+ }
+ if(!password) {
+ this.setData({
+ keywordMessage: '密码不能为空',
+ });
+ return false
+ } else {
+ this.setData({
+ keywordMessage: '',
+ });
+ }
+ console.log('点击确认');
+ wx.showLoading("登录中...")
+ wx.request({
+ url: app.globalData.httpsUrl + "app/user/login",
+ data: {
+ username: phone, // 用户名(手机号)
+ // password: cryptFirst.encrypt(password),
+ password: password,
+ weChatName: nickname,
+ weChatImage: avatarUrl,
+ openId: app.globalData.openid,
+ },
+ method: 'POST',
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定
+ wx.showToast({
+ title: '绑定失败,请联系管理员',
+ icon: 'none'
+ })
+ } else if(res.data.code === 2402) {
+ wx.showToast({
+ title: '密码错误',
+ icon: 'error'
+ })
+ }
+ },
+ fail: function (err) {
+ wx.hideLoading();
+ wx.showToast({
+ title: `发生错误, 请联系管理员`,
+ icon: 'none'
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.json b/miniprogram/pages/validNameKeyword/validNameKeyword.json
new file mode 100644
index 0000000..b00648c
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-field": "@vant/weapp/field/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
new file mode 100644
index 0000000..266c316
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
@@ -0,0 +1,39 @@
+
+pages/validNameKeyword/validNameKeyword.wxml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js
new file mode 100644
index 0000000..e56fef9
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js
@@ -0,0 +1,140 @@
+// pages/validNameKeyword/validNameKeyword.js
+// const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
+const defaultAvatarUrl = '../../images/login.png'
+var app = getApp()
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ nickname: '', // 昵称
+ phone: '', //用户名-手机号
+ password: '', // 密码
+ telMessage: '', // 手机号验证提示信息
+ keywordMessage: '', //密码
+ avatarUrl: defaultAvatarUrl, //头像
+ },
+
+ // 授权头像
+ onChooseAvatar(e) {
+ const { avatarUrl } = e.detail
+ this.setData({
+ avatarUrl,
+ })
+ },
+ // 校验手机号
+ telChange: function (event) {
+ const phone = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (phone) {
+ if (/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
+ message = '';
+ disable = false;
+ } else {
+ message = '您输入的手机号码有误';
+ disable = true;
+ }
+ } else {
+ message = '账号不能为空',
+ disable = true
+ }
+ this.setData({
+ telMessage: message,
+ disabled: disable,
+ txn_tel: phone
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ keywordChange: function (event) {
+ const password = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (!password) {
+ message = '密码不能为空',
+ disable = true
+ }
+ this.setData({
+ keywordMessage: message,
+ disabled: disable,
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ // 点击确认
+ confirm: function (e) {
+ const { phone, password, nickname, avatarUrl} = this.data
+ console.log(nickname);
+ console.log('00000', this.data )
+ if(!nickname) {
+ wx.showToast({
+ title: '昵称不能为空',
+ icon: 'error'
+ })
+ return false
+ }
+ if(!phone) {
+ this.setData({
+ telMessage: '账号不能为空',
+ });
+ return false
+ }
+ if(!password) {
+ this.setData({
+ keywordMessage: '密码不能为空',
+ });
+ return false
+ } else {
+ this.setData({
+ keywordMessage: '',
+ });
+ }
+ console.log('点击确认');
+ wx.showLoading("登录中...")
+ wx.request({
+ url: app.globalData.httpsUrl + "app/user/login",
+ data: {
+ username: phone, // 用户名(手机号)
+ // password: cryptFirst.encrypt(password),
+ password: password,
+ weChatName: nickname,
+ weChatImage: avatarUrl,
+ openId: app.globalData.openid,
+ },
+ method: 'POST',
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定
+ wx.showToast({
+ title: '绑定失败,请联系管理员',
+ icon: 'none'
+ })
+ } else if(res.data.code === 2402) {
+ wx.showToast({
+ title: '密码错误',
+ icon: 'error'
+ })
+ }
+ },
+ fail: function (err) {
+ wx.hideLoading();
+ wx.showToast({
+ title: `发生错误, 请联系管理员`,
+ icon: 'none'
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.json b/miniprogram/pages/validNameKeyword/validNameKeyword.json
new file mode 100644
index 0000000..b00648c
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-field": "@vant/weapp/field/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
new file mode 100644
index 0000000..266c316
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
@@ -0,0 +1,39 @@
+
+pages/validNameKeyword/validNameKeyword.wxml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxss b/miniprogram/pages/validNameKeyword/validNameKeyword.wxss
new file mode 100644
index 0000000..34bdee6
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxss
@@ -0,0 +1,52 @@
+page {
+ background: #fff;
+ display: flex;
+ flex-direction: column;
+ padding-top: 200rpx;
+}
+.valid-name-keyword {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding-top: 200rpx;
+}
+.image {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+.image .img {
+ width: 200rpx;
+ height: 200rpx;
+}
+.valid-name-keyword-form {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin: 60rpx 0;
+}
+.label-class {
+ font-size: 32rpx !important;
+ letter-spacing: 4rpx;
+ font-weight: 600 !important;
+}
+
+.avatar-wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 0;
+}
+
+.avatar {
+ width: 200rpx;
+ height: 200rpx;
+ border-radius: 8px;
+}
+.weui-input {
+ text-align: center;
+ margin-top: 20rpx;
+}
+
+
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 50a8a54..7381a58 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,7 +18,9 @@
// this.globalData = {}
},
globalData: {
- httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://logapi.smartlog.work/",
+ // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地
+ httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地
// httpsUrl: "http://139.198.18.188:8083/",
// url: "http://127.0.0.1:8083/",
//httpsUrl: "http://127.0.0.1:8083/",
@@ -27,6 +29,11 @@
nickName:"",
userName:"",
role:"",
- devcode:""
+ devcode:"",
+ projectList: [], // 项目列表
+ safeBookStatus: '0', // 安全生产责任书签署状态
+ selectProjectId: '', // 选择的项目id
+ selectProjectName: '', // 选择的项目名称
+ updateSignImageId: '', // 更新签名图片id
}
})
diff --git a/miniprogram/app.json b/miniprogram/app.json
index 2b6db76..fc09168 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,58 +1,64 @@
{
- "cloud": true,
- "pages": [
- "pages/login/login",
- "pages/indexapp/indexapp",
- "pages/earth/earth",
- "pages/applog/applog",
- "pages/addDevice/addDevice",
- "pages/addDevicelog/addDeviceLog",
- "pages/searchLog/searchLog",
- "pages/notice/notice"
- ],
- "window": {
- "backgroundColor": "#E6D480",
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#FFCF00",
- "navigationBarTitleText": "智慧施工",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#CCCCCC",
- "selectedColor": "#666666",
- "backgroundColor": "#FFFFFF",
- "list": [
- {
- "pagePath": "pages/indexapp/indexapp",
- "iconPath": "images/index.png",
- "selectedIconPath": "images/index-actived.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/earth/earth",
- "iconPath": "images/earth.png",
- "selectedIconPath": "images/earth-actived.png",
- "text": "地图"
- },
- {
- "pagePath": "pages/applog/applog",
- "iconPath": "images/log.png",
- "selectedIconPath": "images/log-actived.png",
- "text": "日志"
- }
- ]
- },
- "sitemapLocation": "sitemap.json",
- "permission": {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ "cloud": true,
+ "pages": [
+ "pages/login/login",
+ "pages/indexapp/indexapp",
+ "pages/earth/earth",
+ "pages/applog/applog",
+ "pages/addDevice/addDevice",
+ "pages/addDevicelog/addDeviceLog",
+ "pages/searchLog/searchLog",
+ "pages/notice/notice",
+ "pages/validNameKeyword/validNameKeyword",
+ "pages/signName/signName",
+ "pages/safeBook/safeBook"
+ ],
+ "window": {
+ "backgroundColor": "#E6D480",
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#FFCF00",
+ "navigationBarTitleText": "智慧施工",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#CCCCCC",
+ "selectedColor": "#666666",
+ "backgroundColor": "#FFFFFF",
+ "list": [
+ {
+ "pagePath": "pages/indexapp/indexapp",
+ "iconPath": "images/index.png",
+ "selectedIconPath": "images/index-actived.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/earth/earth",
+ "iconPath": "images/earth.png",
+ "selectedIconPath": "images/earth-actived.png",
+ "text": "地图"
+ },
+ {
+ "pagePath": "pages/applog/applog",
+ "iconPath": "images/log.png",
+ "selectedIconPath": "images/log-actived.png",
+ "text": "日志"
+ }
+ ]
+ },
+ "sitemapLocation": "sitemap.json",
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于小程序位置接口的效果展示"
+ }
+ },
+ "requiredPrivateInfos": [
+ "getLocation",
+ "chooseLocation"
+ ],
+ "networkTimeout": {
+ "request": 30000,
+ "connectSocket": 30000,
+ "uploadFile": 30000,
+ "downloadFile": 30000
}
- },
- "requiredPrivateInfos": ["getLocation", "chooseLocation"],
- "networkTimeout": {
- "request": 30000,
- "connectSocket": 30000,
- "uploadFile": 30000,
- "downloadFile": 30000
- }
}
\ No newline at end of file
diff --git a/miniprogram/data/json.js b/miniprogram/data/json.js
new file mode 100644
index 0000000..e310dce
--- /dev/null
+++ b/miniprogram/data/json.js
@@ -0,0 +1,21 @@
+var book = {
+ title: '安全生产责任书',
+ introduction: '为确保施工期间的人身、设备安全,进一步明确施工单位安全职责,落实安全责任,根据有关规定要求,特签订本责任书,有关条文如下:',
+ list: [
+ '1 、甲方单位负责人应对现场施工负责人、工程技术人员及施工人员全面交待现场工作条件及工作环境,对有关安全注意事项进行交底,并应有完整的培训记录。',
+ '2、开工前应组织对全体现场施工作业人员进行安全、技术交底,明确工作任务,使全体施工现场各级人员掌握工程特点及安全操作规程、施工安全措施、安全注意事项。对施工作业人员定期进行安全检查和总结,并有记录。',
+ '3、禁止使用未成年人及老弱、残人员。对施工现场的新入人员(包括临时工、合同工与参加劳动人员)必须进行安全教育及交待现场安全注意事项、相关记录,方可进场作业。',
+ '4、施工期间,各种交通工具、设备和工具等均由施工单位自备。工程中使用的施工机械、工器具及防护设施必须有安全检查记录。如发生任何伤亡事故由施工单位承担一切经济和法律责任。',
+ '5、现场施工要求:设备安装调试方法应按照设备施工规范进行。所涉及安装调试的设备需由现场负责人将设备施工规范附在责任书后面,并进行培训和签字。各类传感设备安装,需下井安装的下井前需使用四合一气体检测仪确认井下有无有害气体,浓度达到安全标准再进行后续相关操作,否则应立即停止施工并上报有关单位。在道路上施工的需放置警示墩,安装人员穿戴反光背心,并由专人看护引导车辆和行人。登高作业时,安装人员需高空作业的需使用防坠绳,高挂抵用防止高空坠落。仪器设备安装调试过程中,需接引220V或380V电源的,需要先断电操作,操作前必须使用电笔明确是否带电。施工前要进行岗前安全培训,确保施工安全实施。开、关井盖应按照现场负责人培训方法进行,防止造成伤害。如施工单位未按照上述要求或甲方现场负责人指导施工,所造成的一切后果均由施工单位承担全部经济、法律责任。 施工单位施工中造成破坏或环境危险的应立即报告公司及相关甲方现场负责人,并积极配合将事故控制在最小的损失范围。',
+ '6、施工单位应在施工现场的危险部位设置明显的安全警示标志。施工单位对工程施工可能造成损害的毗邻建筑物、构筑物等,应当采取专项防护措施。',
+ '7、施工单位必须接受包括甲方在内的各级部门(承建、建设、监理、政府主管部门)的监督和指导,发生人身事故或危及施工安全情况必须立即报告有关部门和公司。甲方及各级部门对施工单位提出的有效意见须及时整改。',
+ '8、若因施工单位违反本责任书或违反《安全生产法》及安全规章制度,由此造成的一切后果均由施工单位承担全部经济、法律责任。 ',
+ '9、在施工区域需要遵守该区域相关规定,楼内禁止吸烟,违规者依据规定罚款500元。未经允许严禁触碰电脑、仪器等设备,楼内房间涉密,严禁随意进入未经允许的房间。',
+ '10、对于用电设备工具,施工结束后应拆除充电电池,防止误启动规避误伤风险。',
+ // '11、本责任书一式二份,双方各执一份,施工安装前进行培训和签署,未尽事宜,双方协商解决,本责任书经双方签字后生效。'
+ ]
+}
+
+module.exports = {
+ safeBookJson: book
+}
\ No newline at end of file
diff --git a/miniprogram/images/finish.png b/miniprogram/images/finish.png
new file mode 100644
index 0000000..ffe0b6a
--- /dev/null
+++ b/miniprogram/images/finish.png
Binary files differ
diff --git a/miniprogram/images/not-finish.png b/miniprogram/images/not-finish.png
new file mode 100644
index 0000000..83d28b1
--- /dev/null
+++ b/miniprogram/images/not-finish.png
Binary files differ
diff --git a/miniprogram/pages/earth/earth copy.js b/miniprogram/pages/earth/earth copy.js
new file mode 100644
index 0000000..8bc3b3b
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.js
@@ -0,0 +1,588 @@
+// miniprogram/pages/earth/earth.js
+
+// 引入SDK核心类
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ listData: [],
+ devcodes: "",
+ marker_latitude: "",
+ marker_longitude: "",
+ title: "",
+ isShow: false,
+ tips: [],
+ value: '',
+ show: false,
+ enableSsatellite: false,
+ windowWidth: 0,
+ longitude: "116.627340",
+ latitude: "39.874390",
+ longitude84: "",
+ latitude84: "",
+ markers: [],
+ controls: []
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var that = this;
+ //设置地图组件
+ wx.getSystemInfo({
+ success(res) {
+ var windowWidth = res.windowWidth
+ var windowHeight = res.windowHeight
+ var query = wx.createSelectorQuery()
+ var platform =res.platform
+ query.select('#map').boundingClientRect()
+ query.exec(function (res) {
+ that.setData({
+ controls: [{
+ id: 1,
+ iconPath: '../../images/copy.png',
+ position: {
+ left: windowWidth - 40,
+ top: 20,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 2,
+ iconPath: '../../images/write.png',
+ position: {
+ left: windowWidth - 40,
+ top: 60,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 3,
+ iconPath: '../../images/add.png',
+ position: {
+ left: windowWidth - 40,
+ top: 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 4,
+ iconPath: '../../images/navigation.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 5,
+ iconPath: '../../images/gps.png',
+ position: {
+ left: 10,
+ top: windowHeight - 100,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 6,
+ iconPath: '../../images/aim.png',
+ position: {
+ left: 10,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }, {
+ id: 7,
+ iconPath: '../../images/applocat.png',
+ position: {
+ left: res[0].width / 2 - 20,
+ top: platform=="ios"?res[0].height / 2 - 80:res[0].height / 2 - 40,
+ width: 40,
+ height: 40
+ },
+ clickable: true
+ }, {
+ id: 8,
+ iconPath: '../../images/back.png',
+ position: {
+ left: windowWidth - 40,
+ top: windowHeight - 140,
+ width: 30,
+ height: 30
+ },
+ clickable: true
+ }]
+ })
+ })
+
+ }
+ })
+
+ // 实例化API核心类
+ qqmapsdk = new QQMapWX({
+ key: 'BGPBZ-C5O3P-ROUDR-LWC4J-63EKH-V5FRX'
+ })
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+ //输入设备编号获取marker位置信息
+ var that = this;
+ if ( app.globalData.devcode!="") {
+ var devcode = app.globalData.devcode
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: devcode,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ app.globalData.devcode="";
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = that.data.markers;
+ for (var i = 0; i < listResultData.length; i++) {
+ markersArr = markersArr.concat({
+ iconPath: "../../images/locat.png",
+ id: Number(listResultData[i].id),
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ padding: true,
+ color: '#000000',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ });
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ app.globalData.devcode="";
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+} else {
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude,
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+}
+
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+
+ //定位出来
+
+ locationPosition: function () {
+ var that = this;
+ //获取当前坐标(gcj02)
+ wx.getLocation({
+ type: "gcj02",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude: parseFloat(res.latitude).toFixed(6),
+ longitude: parseFloat(res.longitude).toFixed(6),
+ // markers: [{
+ // latitude: res.latitude,
+ // longitude: res.longitude
+ // }]
+ })
+ //获取当前坐标(wgs84),特别注意需要放在加载里面,否则获取有误
+ wx.getLocation({
+ type: "wgs84",
+ altitude: true,
+ success: function (res) {
+ that.setData({
+ latitude84: parseFloat(res.latitude).toFixed(6),
+ longitude84: parseFloat(res.longitude).toFixed(6)
+ })
+ }
+ })
+ }
+ })
+ },
+
+ //加载地图组件
+ controltap: function (e) {
+ // console.log(e.controlId);
+ //进入添加设备页
+ if (1 == e.controlId) {
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.getClipboardData({
+ success: function (res) {
+ wx.showToast({
+ title: '复制坐标成功'
+ })
+ }
+ })
+ }
+ })
+ } else if (3 == e.controlId) {
+ //先定位
+ // this.locationPosition()
+ wx.setClipboardData({
+ data: this.data.latitude + "," + this.data.longitude + "," + this.data.latitude84 + "," + this.data.longitude84,
+ success: function (res) {
+ wx.showToast({
+ title: '坐标已获取',
+ duration: 1000
+ })
+ }
+ })
+ wx.navigateTo({
+ url: '../addDevice/addDevice'
+ })
+ } else if (2 == e.controlId) {
+ this.setData({
+ show: true
+ });
+ } else if (4 == e.controlId) {
+ wx.openLocation({
+ latitude: Number(this.data.marker_latitude),
+ longitude: Number(this.data.marker_longitude),
+ name: this.data.title,
+ scale: 35
+ })
+ } else if (5 == e.controlId) {
+ var flag = this.data.enableSsatellite;
+ this.setData({
+ enableSsatellite: !flag
+ });
+ } else if (6 == e.controlId) {
+ //先清marker
+ this.setData({
+ markers: []
+ })
+ this.locationPosition()
+ }else if (8 == e.controlId) {
+ //跳转日志缓存页
+ wx.switchTab({
+ url: '../applog/applog',
+ })
+ }
+ },
+ showPopup() {
+ this.setData({
+ show: true
+ });
+ },
+
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+
+ //获取设备maker
+ leave() {
+
+ var that = this;
+ if (that.data.devcodes == "") {
+ that.setData({
+ markers:[]
+ })
+ return false;
+ }
+ wx.request({
+ method: "POST",
+ url: app.globalData.httpsUrl + "appDeviceAdd/findListByCodes",
+ data: {
+ devcodes: that.data.devcodes
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
+ },
+ success(res) {
+ if (res.data.code == 200) {
+ var listResultData = res.data.data;
+ that.setData({
+ listData: listResultData
+ })
+ var markersArr = []
+ for (var i = 0; i < listResultData.length; i++) {
+ let arr = {
+ iconPath: "../../images/locat.png",
+ id: listResultData[i].id,
+ callout: {
+ content: "编号:"+listResultData[i].devcode+"\r\n位置:"+listResultData[i].position+"\r\n时间:"+listResultData[i].createtime,
+ fontSize: '14',
+ // padding: true,
+ color: '#212121',
+ borderColor: '#F4EA2A',
+ bgColor: '#F4EA2A',
+ borderWidth: 5,
+ display: 'ALWAYS',
+ textAlign: 'left',
+ // borderRadius: 15
+ },
+ latitude: listResultData[i].latitude,
+ longitude: listResultData[i].longitude,
+ width: 40,
+ height: 40
+ };
+ markersArr.push(arr)
+ }
+ that.setData({
+ markers: markersArr,
+ latitude: listResultData[0].latitude,
+ longitude: listResultData[0].longitude,
+ marker_latitude: listResultData[0].latitude,
+ marker_longitude: listResultData[0].longitude,
+ title: listResultData[0].devcode
+ })
+ }
+ },
+ fail(err) {
+ wx.showToast({
+ title: "无法获取设备地理信息!",
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+
+ markertap(e) {
+ var that = this;
+ for (var i = 0; i < this.data.listData.length; i++) {
+ if (e.markerId == this.data.listData[i].id) {
+ this.setData({
+ marker_latitude: this.data.listData[i].latitude,
+ marker_longitude: this.data.listData[i].longitude,
+ title: this.data.listData[i].devcode
+ })
+ }
+ // wx.openLocation({
+ // latitude: Number(that.data.marker_latitude),
+ // longitude: Number(that.data.marker_longitude),
+ // name: that.data.title,
+ // scale: 35
+ // })
+ }
+ },
+
+
+
+ bindregionchange: function (e) {
+ var that = this
+ if (e.causedBy == "drag") {
+ var mapCtx = wx.createMapContext("map")
+ mapCtx.getCenterLocation({
+ // type: "gcj02",
+ success: function (res) {
+ // var markersArr = that.data.markers
+ // for (var i = 0; i < markersArr.length; i++) {
+ // if (markersArr[i].iconPath == undefined) {
+ // markersArr.splice(i, 1)
+ // }
+ // }
+ var latitude = res.latitude
+ var longitude = res.longitude
+ // markersArr = markersArr.concat({
+ // latitude: latitude,
+ // longitude: longitude
+ // })
+ //拖拽地图获取不到84坐标系,保存为空
+ that.setData({
+ latitude: parseFloat(latitude).toFixed(6),
+ longitude: parseFloat(longitude).toFixed(6),
+ latitude84: "",
+ longitude84: "",
+ // markers: markersArr
+ })
+ // mapCtx.moveToLocation();
+ // that.getLocal(latitude, longitude)
+ }
+ })
+ }
+ },
+
+ onChange: function (e) {
+ this.setData({
+ value: e.detail,
+ });
+ var _this = this;
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res)
+ if (res && res.data) {
+ _this.setData({
+ isShow: true,
+ tips: res.data
+ });
+ }
+ },
+ complete: function (res){
+ console.log(res);
+ }
+ })
+ },
+ bindSearch: function (e) {
+ var location = e.target.dataset.location;
+ this.setData({
+ isShow: false,
+ longitude: location.lng,
+ latitude: location.lat,
+ marker_latitude: location.lat,
+ marker_longitude: location.lng,
+ title: e.target.dataset.keywords,
+ value: e.target.dataset.keywords,
+ markers: [{
+ id: 0,
+ longitude: location.lng,
+ latitude: location.lat,
+ iconPath: '../../images/locat.png',
+ width: 50,
+ height: 50,
+ }]
+ })
+ },
+
+
+ confirmdevcodes: function (event) {
+ var that = this;
+ that.setData({
+ devcodes: event.detail.value
+ });
+ },
+
+
+ onClick: function () {
+
+ // 调用接口
+ qqmapsdk.search({
+ keyword: this.data.value,
+ success: function (res) {
+ console.log(res);
+ },
+ fail: function (res) {
+ console.log(res);
+ },
+ complete: function (res) {
+ console.log(res);
+ }
+ });
+ },
+
+ confirm(event) {
+ var that = this;
+ var formValue = event.detail.value;
+ var formName = event.target.dataset.id;
+ var fromN = 'form.' + [formName];
+ that.setData({
+ [fromN]: formValue
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth copy.wxml b/miniprogram/pages/earth/earth copy.wxml
new file mode 100644
index 0000000..7f70912
--- /dev/null
+++ b/miniprogram/pages/earth/earth copy.wxml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/earth/earth.wxml b/miniprogram/pages/earth/earth.wxml
index 87474f8..8663307 100644
--- a/miniprogram/pages/earth/earth.wxml
+++ b/miniprogram/pages/earth/earth.wxml
@@ -12,6 +12,7 @@
{{longitude}},{{latitude}}
+
diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js
index 849dbdb..3479395 100644
--- a/miniprogram/pages/indexapp/indexapp.js
+++ b/miniprogram/pages/indexapp/indexapp.js
@@ -7,6 +7,8 @@
*/
data: {
+ actionSheetShow: false, // 选择项目面板显隐(有一个项目的时候不展示)
+ projectList: [], // 项目列表
count: 1,
onshow: true,
value: "",
@@ -24,6 +26,7 @@
width: 50,
height: 50
}],
+ isSign: false, // 是否已经签名
},
@@ -31,7 +34,20 @@
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ const projectList = app.globalData.projectList.map(item => {
+ return {
+ name: item.projectName,
+ id: item.projectId
+ }
+ })
+ this.setData({
+ projectList: projectList
+ })
+ if(this.data.projectList.length > 1) { // 多个项目
+ this.setData({
+ actionSheetShow: true
+ })
+ }
},
/**
@@ -45,7 +61,10 @@
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ console.log('333333', app.globalData.safeBookStatus);
+ this.setData({
+ isSign: app.globalData.safeBookStatus == '0' ? false : true
+ })
if (this.data.onshow) {
this.initPages();
}
@@ -258,4 +277,19 @@
})
this.data.devcode !== '' ? this.searchlogs(this.data.devcode) : this.searchlogs()
},
+ // 点击图标
+ clickFinishArea() {
+ wx.navigateTo({
+ url: '../safeBook/safeBook',
+ })
+ },
+ // 选择好项目
+ selectProject(e) {
+ console.log('选择的项目id', e.detail.id);
+ app.globalData.selectProjectId = e.detail.id; // 项目id
+ app.globalData.selectProjectName = e.detail.name; // 项目名称
+ this.setData({
+ actionSheetShow: false
+ })
+ }
})
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.json b/miniprogram/pages/indexapp/indexapp.json
index bc43213..e6011dd 100644
--- a/miniprogram/pages/indexapp/indexapp.json
+++ b/miniprogram/pages/indexapp/indexapp.json
@@ -1,14 +1,15 @@
{
- "usingComponents": {
- "van-button": "../../miniprogram_npm/@vant/weapp/button",
- "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
- "van-row": "../../miniprogram_npm/@vant/weapp/row",
- "van-col": "../../miniprogram_npm/@vant/weapp/col",
- "van-search": "../../miniprogram_npm/@vant/weapp/search",
- "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
- "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
- "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down"
- },
- "navigationBarTitleText": "首页",
- "onReachBottomDistance":50
-}
\ No newline at end of file
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button",
+ "van-icon": "../../miniprogram_npm/@vant/weapp/icon",
+ "van-row": "../../miniprogram_npm/@vant/weapp/row",
+ "van-col": "../../miniprogram_npm/@vant/weapp/col",
+ "van-search": "../../miniprogram_npm/@vant/weapp/search",
+ "van-popup": "../../miniprogram_npm/@vant/weapp/popup",
+ "van-transition": "../../miniprogram_npm/@vant/weapp/transition",
+ "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down",
+ "van-action-sheet": "@vant/weapp/action-sheet/index"
+ },
+ "navigationBarTitleText": "首页",
+ "onReachBottomDistance":50
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml
index f65b082..ef1abb8 100644
--- a/miniprogram/pages/indexapp/indexapp.wxml
+++ b/miniprogram/pages/indexapp/indexapp.wxml
@@ -3,9 +3,11 @@
-
+
+
+
+
-
@@ -67,3 +69,10 @@
-->
+
+
diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss
index fc27fcb..2ae0abb 100644
--- a/miniprogram/pages/indexapp/indexapp.wxss
+++ b/miniprogram/pages/indexapp/indexapp.wxss
@@ -1,162 +1,182 @@
/* miniprogram/pages/indexapp/indexapp.wxss */
page {
- height: 60%;
- min-height:60%;
- /* position:fixed */
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #665D5D;
- height: 1rpx;
-}
-
-.point-image {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 10rpx;
-}
-
-.titleinfo {
- font-size: 30rpx;
- padding: 2px;
- font-weight: bold;
-}
-
-.log-list {
- /* height: 10%;
- display: flex; */
- padding: 2px;
- margin-top: 2px;
- border-bottom: 1px solid #e5e5e5;
- /* flex-flow: column; */
-}
-
-.log-info {
- flex: 1;
- /* padding-left: 2rpx; */
- /* border-bottom: 1px solid #ccc; */
-}
-
-.log-image {
- width: 70rpx;
- height: 75rpx;
- padding: 5rpx;
-}
-
-/* .title{
- font-size: 28rpx;
-} */
-.scan-img {
- width: 60rpx;
- height: 60rpx;
- margin-top: 20rpx;
-}
-.list {
- display: flex;
- border-bottom: 1px solid #dfdfdf;
-}
-.viewlist {
- height: 50%;
- min-height:50%;
- width: 100%;
-}
-.left {
- width: 25%;
- margin-left: 20rpx
-}
-
-.left image {
- width: 100%;
- height: 280rpx;
-}
-
-.middle {
- width: 55%;
- margin-right: 20rpx
-}
-
-.right {
- width: 20%;
-}
-
-.left,
-.middle,
-.right {
- height: 280rpx;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
-}
-
-.row {
- width: 100%;
- margin: 0 5rpx 5rpx 15rpx;
-}
-
-.row-title {
- font-size: 15px;
- font-weight: bold;
-}
-
-.row-content,
-.right-content,
-.right-content-btn {
- font-size: 12px;
-}
-
-.row view {
- display: inline-block;
- padding-right: 5rpx;
-}
-
-.right-content {
- color: #F76D61;
- margin-right: 10rpx;
-}
-
-.right-content-btn {
- border: 1px solid #F76D61;
- color: #F76D61;
- margin-top: 20rpx;
- margin-left: 0;
- width: 130rpx;
- height: 55rpx;
- line-height: 55rpx;
- background-color: #ffffff;
-}
-
-.noticeClass{
- height: 2300rpx;
- width: 750rpx;
- overflow-y:hidden;
-}
-
-
-
-.cover{
- float: right;
- text-align:center;
- /* line-height: 80rpx; */
- font-size: 32rpx;
- width: 750rpx;
- /* height: 50rpx; */
- /* width: 80rpx; */
- color: #FFCF00;
- background-color: #FFCF00;
- /* border:1.5rpx solid #FFCF00; */
- /* border-radius: 18rpx; */
- /* position:fixed; */
-
-}
-
-/* .vanstyle{
- button: not([size='mini']) {
- user agent stylesheetmin-height: 40px;
- width: 650rpx;
- margin-left: 20rpx;
- margin-right: auto;
-
- }
-
-} */
-
+ height: 60%;
+ min-height:60%;
+ /* position:fixed */
+ }
+ .icon-finishi-area {
+ position: fixed;
+ right: 20rpx;
+ top: 60rpx;
+ height: 100rpx;
+ width: 100rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+ background-color: #fff;
+ z-index: 99999999;
+
+ /* w */
+ }
+ .icon-finishi {
+ width: 70rpx;
+ height: 70rpx;
+ }
+
+ .subtitle {
+ font-size: 28rpx;
+ color: #665D5D;
+ height: 1rpx;
+ }
+
+ .point-image {
+ width: 70rpx;
+ height: 70rpx;
+ margin-bottom: 10rpx;
+ }
+
+ .titleinfo {
+ font-size: 30rpx;
+ padding: 2px;
+ font-weight: bold;
+ }
+
+ .log-list {
+ /* height: 10%;
+ display: flex; */
+ padding: 2px;
+ margin-top: 2px;
+ border-bottom: 1px solid #e5e5e5;
+ /* flex-flow: column; */
+ }
+
+ .log-info {
+ flex: 1;
+ /* padding-left: 2rpx; */
+ /* border-bottom: 1px solid #ccc; */
+ }
+
+ .log-image {
+ width: 70rpx;
+ height: 75rpx;
+ padding: 5rpx;
+ }
+
+ /* .title{
+ font-size: 28rpx;
+ } */
+ .scan-img {
+ width: 60rpx;
+ height: 60rpx;
+ margin-top: 20rpx;
+ }
+ .list {
+ display: flex;
+ border-bottom: 1px solid #dfdfdf;
+ }
+ .viewlist {
+ height: 50%;
+ min-height:50%;
+ width: 100%;
+ }
+ .left {
+ width: 25%;
+ margin-left: 20rpx
+ }
+
+ .left image {
+ width: 100%;
+ height: 280rpx;
+ }
+
+ .middle {
+ width: 55%;
+ margin-right: 20rpx
+ }
+
+ .right {
+ width: 20%;
+ }
+
+ .left,
+ .middle,
+ .right {
+ height: 280rpx;
+ margin-bottom: 20rpx;
+ margin-top: 20rpx;
+ }
+
+ .row {
+ width: 100%;
+ margin: 0 5rpx 5rpx 15rpx;
+ }
+
+ .row-title {
+ font-size: 15px;
+ font-weight: bold;
+ }
+
+ .row-content,
+ .right-content,
+ .right-content-btn {
+ font-size: 12px;
+ }
+
+ .row view {
+ display: inline-block;
+ padding-right: 5rpx;
+ }
+
+ .right-content {
+ color: #F76D61;
+ margin-right: 10rpx;
+ }
+
+ .right-content-btn {
+ border: 1px solid #F76D61;
+ color: #F76D61;
+ margin-top: 20rpx;
+ margin-left: 0;
+ width: 130rpx;
+ height: 55rpx;
+ line-height: 55rpx;
+ background-color: #ffffff;
+ }
+
+ .noticeClass{
+ height: 2300rpx;
+ width: 750rpx;
+ overflow-y:hidden;
+ }
+
+
+
+ .cover{
+ float: right;
+ text-align:center;
+ /* line-height: 80rpx; */
+ font-size: 32rpx;
+ width: 750rpx;
+ /* height: 50rpx; */
+ /* width: 80rpx; */
+ color: #FFCF00;
+ background-color: #FFCF00;
+ /* border:1.5rpx solid #FFCF00; */
+ /* border-radius: 18rpx; */
+ /* position:fixed; */
+
+ }
+
+ /* .vanstyle{
+ button: not([size='mini']) {
+ user agent stylesheetmin-height: 40px;
+ width: 650rpx;
+ margin-left: 20rpx;
+ margin-right: auto;
+
+ }
+
+ } */
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index cb0542a..019de2a 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -1,7 +1,7 @@
// miniprogram/pages/login/login.js
var app = getApp()
Page({
-
+
/**
* 页面的初始数据
*/
@@ -10,14 +10,13 @@
time: 15 * 1000,
showTime: false
},
-
+
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
},
-
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -25,52 +24,52 @@
this.setData({
windowWidth: wx.getSystemInfoSync().windowWidth
})
-
+
},
-
+
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+
},
-
+
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
-
+
},
-
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+
},
-
+
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+
},
-
+
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
-
+
},
-
-
+
+
showLoading: function (message) {
if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
@@ -96,7 +95,11 @@
wx.hideToast();
}
},
-
+ //登录
+// loginCheck: async function() {
+// await this.loginClick();
+// await this.loginValidate();
+// },
//注册
loginClick: function () {
var that = this
@@ -122,18 +125,25 @@
attr: nickname,
openid: app.globalData.openid
},
- success: function (res) {
+ success: function (res) {//注册成功
that.hideLoading();
- wx.showToast({
- title: res.data.data+",\r\n请从正式版入口登录!",
- icon: 'none',
- duration: 2000
- })
-
+ // wx.showToast({
+ // title: res.data.data+",\r\n请从正式版入口登录!",
+ // icon: 'none',
+ // duration: 2000
+ // })
+ that.loginValidate()
// //授权成功后跳转
// wx.switchTab({
// url: '../indexapp/indexapp'
// })
+ },
+ fail: function() {//注册失败
+ wx.showToast({
+ icon: 'none',
+ title: '请联系管理员授权',
+ duration: 2000
+ })
}
})
},
@@ -156,59 +166,63 @@
}
})
},
-
+
//登录验证
loginValidate: function () {
var that = this
- that.showLoading("登录中...")
+ that.showLoading("授权中...")
wx.login({
success: function (res) {
if (res.code) {
console.info(res);
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/login",
- data: {
- code: res.code
- },
- success: function (res) {
- app.globalData.openid = res.data.data
- wx.request({
- url: app.globalData.httpsUrl + "appUserOpenid/validate",
- data: {
- openid: app.globalData.openid
- },
- success: function (res) {
- that.hideLoading();
- if (res.data.data) {
- app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
- app.globalData.nickName = res.data.data.attr
- app.globalData.role = res.data.data.role
- wx.navigateTo({
- url: '../notice/notice'
- })
- } else {
- wx.showToast({
- icon: 'none',
- title: '请联系管理员授权',
- duration: 2000
- })
- }
- },
- fail: function (err) {
- that.hideLoading();
- wx.showToast({
- title: '验证失败',
- })
- }
- })
- },
- fail: function (res) {
- that.hideLoading();
- wx.showToast({
- title: '服务器异常',
- })
- }
- })
+ that.getIsBound(res.code) // 判断用户是否绑定
+ // wx.request({
+ // url: app.globalData.httpsUrl + "appUserOpenid/login",
+ // data: {
+ // code: res.code
+ // },
+ // success: function (res) {
+ // app.globalData.openid = res.data.data
+ // console.log('openid', app.globalData.openid, res.data.data);
+
+ // // wx.request({
+ // // url: app.globalData.httpsUrl + "appUserOpenid/validate",
+ // // data: {
+ // // openid: app.globalData.openid
+ // // },
+ // // success: function (res) {
+ // // that.hideLoading();
+ // // if (res.data.data) {
+ // // app.globalData.userName = res.data.data.attr1 == '' ? res.data.data.attr : res.data.data.attr1
+ // // app.globalData.nickName = res.data.data.attr
+ // // app.globalData.role = res.data.data.role
+ // // wx.navigateTo({
+ // // url: '../notice/notice'
+ // // })
+ // // } else {
+ // // that.loginClick();//注册
+ // // // wx.showToast({
+ // // // icon: 'none',
+ // // // title: '请联系管理员授权',
+ // // // duration: 2000
+ // // // })
+ // // }
+ // // },
+ // // fail: function (err) {
+ // // that.hideLoading();
+ // // wx.showToast({
+ // // title: '验证失败',
+ // // })
+ // // }
+ // // })
+ // },
+ // fail: function (res) {
+ // that.hideLoading();
+ // wx.showToast({
+ // title: '服务器异常',
+ // })
+ // }
+ // })
}
},
fail: function (res) {
@@ -217,18 +231,94 @@
})
},
- finished() {
- this.setData({
- showTime: true
- })
- },
-
- onClickSubmit: function () {
-
- wx.switchTab({
-
- url: '../indexapp/indexapp'
-
- })
- }
+ // 判断用户是否绑定
+ getIsBound(code) {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "appUserOpenid/login",
+ data: {
+ code: code
+ },
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.openid = res.data.data
+ that.getSafeBookStatus() // 获取安全生产责任书状态
+ that.fetchProjectList().then(() => {
+ that.onClickSubmit() // 跳首页
+ })
+ } else if(res.data.code === 201) { // 未绑定
+ app.globalData.openid = res.data.data
+ that.fetchProjectList().then(() => {
+ wx.navigateTo({
+ url: '../validNameKeyword/validNameKeyword',
+ })
+ })
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '验证用户绑定失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ finished() {
+ this.setData({
+ showTime: true
+ })
+ },
+ onClickSubmit: function () {
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ },
+ // 获取项目列表
+ async fetchProjectList() {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "/app/user/project",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 已绑定
+ app.globalData.projectList = res.data.data
+ resolve()
+ }
+ },
+ fail: function (err) {
+ that.hideLoading();
+ wx.showToast({
+ title: '获取项目列表失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+ },
+ // 查询安全生产责任书签署状态
+ getSafeBookStatus() {
+ var that = this
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/sign-status",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ app.globalData.safeBookStatus = res.data.data.signStatus + '';
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取安全生产责任书签署状态失败',
+ icon: 'none'
+ })
+ }
+ })
+ },
})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.js b/miniprogram/pages/safeBook/safeBook.js
new file mode 100644
index 0000000..cf68ab1
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.js
@@ -0,0 +1,138 @@
+// pages/safeBook/safeBook.js
+var safeBookJson = require('../../data/json')
+var app = getApp();
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ safeBookData: {}, // json数据
+ showTime: false,
+ popupShow: true, // 签名弹窗
+ imageList: [],
+ buttonName: '开始签署'
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ safeBookData: safeBookJson.safeBookJson
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.getSignName().then(res => {
+ app.globalData.updateSignImageId = res.id // 更新图片id
+ let imgUrl = res.signImage // 图片地址
+ wx.setStorageSync('signImage', imgUrl)
+ console.log('签名图片', imgUrl);
+ if(imgUrl) {
+ this.data.imageList[0] = imgUrl;
+ this.setData({
+ imageList: this.data.imageList,
+ buttonName: '重新签署'
+ });
+ } else {
+ this.setData({
+ buttonName: '开始签署'
+ });
+ }
+ })
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.setData({
+ popupShow: true
+ })
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ },
+ // 预览图片
+ previewBigImage(e) {
+ let imgs = this.data.imageList;
+ let {index} = e.currentTarget.dataset;
+ wx.previewImage({
+ //当前显示图片
+ current: imgs[index],
+ //所有图片
+ urls: imgs
+ })
+ },
+ // 点击开始签署
+ startSign() {
+ wx.navigateTo({
+ url: '../signName/signName',
+ })
+ },
+ // 点击确认
+ confirm() {
+ if(this.data.imageList.length) {
+ // wx.switchTab({
+ // url: '../indexapp/indexapp'
+ // })
+ wx.navigateBack()
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '请签名',
+ })
+ }
+ },
+ // 点击遮罩层
+ closePopup() {
+ this.setData({
+ popupShow: false
+ })
+ },
+ // 点击安全生产责任书图片
+ clickImage() {
+ this.setData({
+ popupShow: true
+ })
+ },
+ // 获取签名图图片
+ getSignName() {
+ return new Promise((resolve, reject) => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/today-detail",
+ data: {
+ openId: app.globalData.openid
+ },
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve(res.data.data)
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '获取签名图片失败',
+ icon: 'none'
+ })
+ }
+ })
+ })
+
+ }
+
+})
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.json b/miniprogram/pages/safeBook/safeBook.json
new file mode 100644
index 0000000..449ea37
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-popup": "@vant/weapp/popup/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/safeBook/safeBook.wxml b/miniprogram/pages/safeBook/safeBook.wxml
new file mode 100644
index 0000000..b38363f
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxml
@@ -0,0 +1,35 @@
+
+
+ {{safeBookData.title}}
+
+ {{safeBookData.introduction}}
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+ {{buttonName}}
+
+
+ 确认
+
+
diff --git a/miniprogram/pages/safeBook/safeBook.wxss b/miniprogram/pages/safeBook/safeBook.wxss
new file mode 100644
index 0000000..8161eab
--- /dev/null
+++ b/miniprogram/pages/safeBook/safeBook.wxss
@@ -0,0 +1,59 @@
+/* pages/safeBook/safeBook.wxss */
+page {
+ min-height: 100%;
+ color: #000;
+ line-height: 54rpx;
+}
+.main {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding: 32rpx 32rpx 80rpx 32rpx;
+ box-sizing: border-box;
+ text-align: justify;
+ background: linear-gradient(#ffcf00 0%, rgba(255, 207, 0, .4) 7%, #fefcf2 100%);
+}
+.title {
+ font-size: 40rpx;
+ font-weight: 900;
+ letter-spacing: 6rpx;
+ margin: 32rpx;
+}
+.introduction {
+ font-size: 30rpx;
+}
+.list-item {
+ margin: 16rpx 0;
+}
+
+.popup-title {
+ padding: 20rpx;
+ font-size: 28rpx;
+ color: #4a4a4a;
+}
+.popup-blue {
+ color: #3e79f2;
+}
+.area {
+ padding: 0 20rpx;
+}
+.name-area {
+ position: relative;
+ width: 100%;
+ height: 400rpx;
+ display: flex;
+ justify-content: center;
+ box-sizing: border-box;
+ margin-bottom: 30rpx;
+ border: 1rpx solid #ccc;
+}
+.img-area {
+ width: 100%;
+ height: 400rpx;
+ overflow-y: auto;
+}
+.area-login_image {
+ width: 100%;
+ height: 95%;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.js b/miniprogram/pages/signName/signName.js
new file mode 100644
index 0000000..7d6b203
--- /dev/null
+++ b/miniprogram/pages/signName/signName.js
@@ -0,0 +1,247 @@
+const fileManager = wx.getFileSystemManager();
+var app = getApp()
+// canvas 全局配置
+var context = null; // 使用 wx.createContext 获取绘图上下文 context
+var isButtonDown = false;
+var arrx = [];
+var arry = [];
+var arrz = [];
+var canvasw = 0;
+var canvash = 0;
+//获取系统信息
+wx.getSystemInfo({
+ success: function (res) {
+ canvasw = res.windowHeight * 1.2; //设备宽度
+ // canvash = res.windowWidth * 7 / 15;
+ canvash = res.windowWidth * 1.2;
+ }
+});
+//注册页面
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ signFlag: false,
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ context = wx.createCanvasContext('canvas');
+ context.setFillStyle('#fff')
+ context.fillRect(0, 0, canvasw * 2, canvash)
+ context.draw(true)
+ context.beginPath()
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ },
+ onShow() {
+ arrx = [];
+ arry = [];
+ arrz = [];
+ if(context) {
+ this.cleardraw()
+ }
+ },
+
+ isJSON(str) {
+ if (typeof str == 'string') {
+ try {
+ var obj = JSON.parse(str);
+ if (typeof obj == 'object' && obj) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ }
+ },
+
+ canvasIdErrorCallback: function (e) { },
+ //开始
+ canvasStart: function (event) {
+ isButtonDown = true;
+ arrz.push(0);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ //context.moveTo(event.changedTouches[0].x, event.changedTouches[0].y);
+
+ },
+ //过程
+ canvasMove: function (event) {
+ if (isButtonDown) {
+ arrz.push(1);
+ arrx.push(event.changedTouches[0].x);
+ arry.push(event.changedTouches[0].y);
+ // context.lineTo(event.changedTouches[0].x, event.changedTouches[0].y);
+ // context.stroke();
+ // context.draw()
+ };
+
+ this.setData({
+ signFlag: true,
+ })
+
+ for (var i = 0; i < arrx.length; i++) {
+ if (arrz[i] == 0) {
+ context.moveTo(arrx[i], arry[i])
+ } else {
+ context.lineTo(arrx[i], arry[i])
+ };
+
+ };
+
+ context.setStrokeStyle('#000000');
+ context.setLineWidth(4);
+ context.setLineCap('round');
+ context.setLineJoin('round');
+ context.stroke();
+ context.draw(true);
+ },
+ canvasEnd: function (event) {
+ isButtonDown = false;
+ },
+ cleardraw: function () {
+ //清除画布
+ arrx = [];
+ arry = [];
+ arrz = [];
+ context.clearRect(0, 0, canvasw * 10, canvash);
+ context.draw(true);
+ },
+ //导出图片
+ getimg: function () {
+ let that = this
+ if (arrx.length == 0) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ };
+ console.log(that.data.signFlag);
+ if (!that.data.signFlag) {
+ wx.showModal({
+ title: '提示',
+ content: '签名内容不能为空!',
+ showCancel: false
+ });
+ return false;
+ }
+ //生成图片
+ wx.canvasToTempFilePath({
+ canvasId: 'canvas',
+ success: function (res) {
+ //将图片转换为base64 的格式
+ // let signImage = 'data:image/jpg;base64,' + fileManager.readFileSync(res.tempFilePath, 'base64');
+ let signImage = res.tempFilePath;
+ //其他
+ that.uploadFilePromise(signImage).then(res => {
+ const tempUrl = JSON.parse(res).data
+ console.log('000', tempUrl, wx.getStorageSync('signImage'));
+ if(!wx.getStorageSync('signImage')) { // 新增签署图片
+ that.addSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ } else { // 更新签署图片
+ that.updateSignImage(tempUrl).then(() => {
+ wx.navigateBack()
+ }).catch(() => {
+ wx.setStorageSync('signImage', '')
+ })
+ }
+ })
+ }
+ })
+ },
+ // 新增签名图片
+ async addSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/add",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) { // 0未签署 1已签署
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '新增安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 更新签名图片
+ async updateSignImage(signImage) {
+ await new Promise(resolve => {
+ wx.request({
+ url: app.globalData.httpsUrl + "product/safe/update",
+ data: {
+ openId: app.globalData.openid,
+ signImage: signImage, // 签署图片
+ projectId: app.globalData.selectProjectId, // 项目id
+ id: app.globalData.updateSignImageId
+ },
+ method: 'POST',
+ success: function (res) {
+ if(res.data.code === 200) {
+ resolve()
+ }
+ },
+ fail: function (err) {
+ wx.showToast({
+ title: '更新安全责任书签名失败,请联系管理员',
+ icon: 'none'
+ })
+ rejec()
+ }
+ })
+ })
+ },
+ // 上传图片
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = wx.uploadFile({
+ url: app.globalData.httpsUrl + 'appDeviceAdd/fileUpload',
+ filePath: url,
+ name: 'file',
+ formData: {
+ //图片张数
+ // 'length': 上边的filelist.length
+ },
+ header: {
+ "Content-Type": "multipart/form-data"
+ },
+ success: (res) => {
+ resolve(res.data)
+ },
+ fail: (res) => {
+ wx.showToast({
+ title: '上传图片失败、请联系管理员',
+ icon: 'none'
+ })
+ reject()
+ },
+ });
+ })
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.json b/miniprogram/pages/signName/signName.json
new file mode 100644
index 0000000..ec68222
--- /dev/null
+++ b/miniprogram/pages/signName/signName.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ },
+ "navigationBarTitleText": "手写签名",
+ "pageOrientation": "landscape"
+}
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxml b/miniprogram/pages/signName/signName.wxml
new file mode 100644
index 0000000..efa261d
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ 请在横线上方签字
+
+
+ 重签
+ 完成
+
\ No newline at end of file
diff --git a/miniprogram/pages/signName/signName.wxss b/miniprogram/pages/signName/signName.wxss
new file mode 100644
index 0000000..8070e50
--- /dev/null
+++ b/miniprogram/pages/signName/signName.wxss
@@ -0,0 +1,53 @@
+
+page{
+ /* background: #fff; */
+ overflow-x: auto;
+ padding: 0 20rpx;
+ }
+ .container {
+ /* width: 95%; */
+ width: 200%;
+
+ position: absolute;
+ height: 100%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 5px;
+ }
+ .canvas {
+ width: 100%;
+ height: 83%;
+ border-bottom: 1px solid #ffcf00;
+ box-sizing: border-box;
+ }
+ .tips{
+ position: fixed;
+ bottom: 20rpx;
+ left: 42%;
+ height: 10%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ color: #aaa;
+ }
+ .button-area {
+ width: 100%;
+ background-color: #ffcf00;
+ }
+ .button {
+ position: fixed;
+ right: 120rpx;
+ bottom: 20rpx;
+ }
+ .button1 {
+ position: fixed;
+ right: 30rpx;
+ bottom: 20rpx;
+ }
+ .button-custom {
+ width: 80rpx;
+ }
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js
new file mode 100644
index 0000000..e56fef9
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js
@@ -0,0 +1,140 @@
+// pages/validNameKeyword/validNameKeyword.js
+// const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
+const defaultAvatarUrl = '../../images/login.png'
+var app = getApp()
+Page({
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ nickname: '', // 昵称
+ phone: '', //用户名-手机号
+ password: '', // 密码
+ telMessage: '', // 手机号验证提示信息
+ keywordMessage: '', //密码
+ avatarUrl: defaultAvatarUrl, //头像
+ },
+
+ // 授权头像
+ onChooseAvatar(e) {
+ const { avatarUrl } = e.detail
+ this.setData({
+ avatarUrl,
+ })
+ },
+ // 校验手机号
+ telChange: function (event) {
+ const phone = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (phone) {
+ if (/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
+ message = '';
+ disable = false;
+ } else {
+ message = '您输入的手机号码有误';
+ disable = true;
+ }
+ } else {
+ message = '账号不能为空',
+ disable = true
+ }
+ this.setData({
+ telMessage: message,
+ disabled: disable,
+ txn_tel: phone
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ keywordChange: function (event) {
+ const password = event.detail || event;
+ let message = '';
+ let disable = '';
+ if (!password) {
+ message = '密码不能为空',
+ disable = true
+ }
+ this.setData({
+ keywordMessage: message,
+ disabled: disable,
+ });
+ if (this.data.disabled === true) {
+ return false;
+ }else {
+ return true;
+ }
+ },
+ // 点击确认
+ confirm: function (e) {
+ const { phone, password, nickname, avatarUrl} = this.data
+ console.log(nickname);
+ console.log('00000', this.data )
+ if(!nickname) {
+ wx.showToast({
+ title: '昵称不能为空',
+ icon: 'error'
+ })
+ return false
+ }
+ if(!phone) {
+ this.setData({
+ telMessage: '账号不能为空',
+ });
+ return false
+ }
+ if(!password) {
+ this.setData({
+ keywordMessage: '密码不能为空',
+ });
+ return false
+ } else {
+ this.setData({
+ keywordMessage: '',
+ });
+ }
+ console.log('点击确认');
+ wx.showLoading("登录中...")
+ wx.request({
+ url: app.globalData.httpsUrl + "app/user/login",
+ data: {
+ username: phone, // 用户名(手机号)
+ // password: cryptFirst.encrypt(password),
+ password: password,
+ weChatName: nickname,
+ weChatImage: avatarUrl,
+ openId: app.globalData.openid,
+ },
+ method: 'POST',
+ success: function (res) {
+ wx.hideLoading();
+ if(res.data.code === 200) { // 已绑定
+ wx.switchTab({
+ url: '../indexapp/indexapp'
+ })
+ } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定
+ wx.showToast({
+ title: '绑定失败,请联系管理员',
+ icon: 'none'
+ })
+ } else if(res.data.code === 2402) {
+ wx.showToast({
+ title: '密码错误',
+ icon: 'error'
+ })
+ }
+ },
+ fail: function (err) {
+ wx.hideLoading();
+ wx.showToast({
+ title: `发生错误, 请联系管理员`,
+ icon: 'none'
+ })
+ }
+ })
+
+ }
+})
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.json b/miniprogram/pages/validNameKeyword/validNameKeyword.json
new file mode 100644
index 0000000..b00648c
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {
+ "van-field": "@vant/weapp/field/index",
+ "van-button": "../../miniprogram_npm/@vant/weapp/button"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
new file mode 100644
index 0000000..266c316
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml
@@ -0,0 +1,39 @@
+
+pages/validNameKeyword/validNameKeyword.wxml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxss b/miniprogram/pages/validNameKeyword/validNameKeyword.wxss
new file mode 100644
index 0000000..34bdee6
--- /dev/null
+++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxss
@@ -0,0 +1,52 @@
+page {
+ background: #fff;
+ display: flex;
+ flex-direction: column;
+ padding-top: 200rpx;
+}
+.valid-name-keyword {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ padding-top: 200rpx;
+}
+.image {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+.image .img {
+ width: 200rpx;
+ height: 200rpx;
+}
+.valid-name-keyword-form {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin: 60rpx 0;
+}
+.label-class {
+ font-size: 32rpx !important;
+ letter-spacing: 4rpx;
+ font-weight: 600 !important;
+}
+
+.avatar-wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 0;
+}
+
+.avatar {
+ width: 200rpx;
+ height: 200rpx;
+ border-radius: 8px;
+}
+.weui-input {
+ text-align: center;
+ margin-top: 20rpx;
+}
+
+
diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json
index 7bbb91d..1cd8aa6 100644
--- a/miniprogram/project.private.config.json
+++ b/miniprogram/project.private.config.json
@@ -24,13 +24,6 @@
},
{
"name": "",
- "pathName": "pages/addDevicelog/addDeviceLog",
- "query": "",
- "launchMode": "default",
- "scene": null
- },
- {
- "name": "",
"pathName": "pages/searchLog/searchLog",
"query": "",
"launchMode": "default",