diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ 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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ 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..1d7485a --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + 确认 + diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ 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..1d7485a --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + 确认 + 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 a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ 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..1d7485a --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + 确认 + 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 dd4d942..189edf5 100644 --- a/miniprogram/project.private.config.json +++ b/miniprogram/project.private.config.json @@ -1,7 +1,7 @@ { "projectname": "miniprogram", "setting": { - "compileHotReLoad": true, + "compileHotReLoad": false, "urlCheck": false }, "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", @@ -45,7 +45,14 @@ }, { "name": "", - "pathName": "pages/login/login", + "pathName": "pages/notice/notice", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/signName/signName", "query": "", "launchMode": "default", "scene": null diff --git a/miniprogram/app.js b/miniprogram/app.js index a039298..36fdcc5 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -29,6 +29,6 @@ nickName:"", userName:"", role:"", - devcode:"" + devcode:"", } }) diff --git a/miniprogram/app.json b/miniprogram/app.json index 2b6db76..a0b7c38 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,58 +1,63 @@ { - "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" + ], + "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/pages/index/index.js b/miniprogram/pages/index/index.js index 423e4a4..a160cc3 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -37,6 +37,8 @@ }, onGetUserInfo: function(e) { + console.log('----------') + console.log(e.detail.userInfo) if (!this.data.logged && e.detail.userInfo) { this.setData({ logged: true, diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index e1fa434..39120c5 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,14 @@ time: 15 * 1000, showTime: false }, - + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -25,52 +25,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版本开始支持,低版本需做兼容处理 @@ -167,7 +167,7 @@ } }) }, - + //登录验证 loginValidate: function () { var that = this @@ -229,19 +229,19 @@ } }) }, - + finished() { this.setData({ showTime: true }) }, - + onClickSubmit: function () { - + wx.switchTab({ - + url: '../indexapp/indexapp' - + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json index f2043a3..89884a9 100644 --- a/miniprogram/pages/login/login.json +++ b/miniprogram/pages/login/login.json @@ -1,8 +1,8 @@ { - "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", - "van-button": "../../miniprogram_npm/@vant/weapp/button" - }, - "navigationBarBackgroundColor": "#E6D480", - "disableScroll":true -} \ No newline at end of file + "usingComponents": { + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-button": "../../miniprogram_npm/@vant/weapp/button" + }, + "navigationBarBackgroundColor": "#E6D480", + "disableScroll":true + } \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml index cf2ec72..94b53f8 100644 --- a/miniprogram/pages/login/login.wxml +++ b/miniprogram/pages/login/login.wxml @@ -1,7 +1,7 @@ - - - + + + @@ -36,11 +36,11 @@ --> - + - + \ No newline at end of file diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss index b9fa569..813227a 100644 --- a/miniprogram/pages/login/login.wxss +++ b/miniprogram/pages/login/login.wxss @@ -1,93 +1,91 @@ /* miniprogram/pages/login/login.wxss */ - + .logo { - display: flex; - flex-direction: column; - align-items: center; -} - -.logo image { - margin-top: 140rpx; - width: 216rpx; - height: 200rpx; -} - -.form { - padding: 40rpx; -} - -.form .row-group { - padding: 20rpx 0; - position: relative; - border-bottom: 1rpx solid #ddd; -} - -.form .row-group text { - font-size: 28rpx; - padding: 10rpx 0; -} - -.form .row-group input { - padding: 10rpx 0; -} - -.form .row-group .txt { - color: #ccc; -} - -.form .row-group .code { - position: absolute; - right: 0; - bottom: 26rpx; - z-index: 2; - - width: 206rpx; - height: 60rpx; - border: 2rpx solid #FFB90F; - border-radius: 12rpx; - font-size: 26rpx; - font-weight: 400; - color: #080808; - display: flex; - align-items: center; - justify-content: center; -} - -.form .submit { - - /* margin-top: 80rpx; */ - color: #fff; - border: 2rpx solid #FFB90F; - background-color: #FFB90F; - font-size: 32rpx; - font-weight: bold; -} - -.login_image { - width: 750rpx; - height: 360rpx; - /* height: 2300rpx; */ - /* padding-top: 100rpx - padding-left: 250rpx; */ -} -.bottom_image { - width: 750rpx; - height: 32%; - position: fixed; - bottom: 0px; - /* padding-top: 100rpx - padding-left: 250rpx; */ -} - -.cover{ - position: fixed; - top: 0rpx; - margin-left: 290rpx; - text-align:center; - font-size: 50rpx; - color: #FFCF00; - width: 750rpx; - z-index:9999; - } - - \ No newline at end of file + display: flex; + flex-direction: column; + align-items: center; + } + + .logo image { + margin-top: 140rpx; + width: 216rpx; + height: 200rpx; + } + + .form { + padding: 40rpx; + } + + .form .row-group { + padding: 20rpx 0; + position: relative; + border-bottom: 1rpx solid #ddd; + } + + .form .row-group text { + font-size: 28rpx; + padding: 10rpx 0; + } + + .form .row-group input { + padding: 10rpx 0; + } + + .form .row-group .txt { + color: #ccc; + } + + .form .row-group .code { + position: absolute; + right: 0; + bottom: 26rpx; + z-index: 2; + + width: 206rpx; + height: 60rpx; + border: 2rpx solid #FFB90F; + border-radius: 12rpx; + font-size: 26rpx; + font-weight: 400; + color: #080808; + display: flex; + align-items: center; + justify-content: center; + } + + .form .submit { + + /* margin-top: 80rpx; */ + color: #fff; + border: 2rpx solid #FFB90F; + background-color: #FFB90F; + font-size: 32rpx; + font-weight: bold; + } + + .login_image { + width: 750rpx; + height: 360rpx; + /* height: 2300rpx; */ + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + .bottom_image { + width: 750rpx; + height: 32%; + position: fixed; + bottom: 0px; + /* padding-top: 100rpx + padding-left: 250rpx; */ + } + + .cover{ + position: fixed; + top: 0rpx; + margin-left: 290rpx; + text-align:center; + font-size: 50rpx; + color: #FFCF00; + width: 750rpx; + z-index:9999; + } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.js b/miniprogram/pages/notice/notice.js index 7aeafb9..2db206c 100644 --- a/miniprogram/pages/notice/notice.js +++ b/miniprogram/pages/notice/notice.js @@ -6,7 +6,10 @@ */ data: { time: 15 * 1000, - showTime: false + showTime: false, + popupShow: true, // 签名弹窗 + imageList: [], + buttonName: '开始签署' }, /** @@ -27,7 +30,18 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - + let imgUrl = wx.getStorageSync('signImage') + if(imgUrl) { + this.data.imageList[0] = imgUrl; + this.setData({ + imageList: this.data.imageList, + buttonName: '重新签署' + }); + } else { + this.setData({ + buttonName: '开始签署' + }); + } }, /** @@ -58,23 +72,59 @@ this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + this.setData({ + popupShow: true }) }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, +// 倒计时结束 finished() { this.setData({ showTime: true }) - wx.switchTab({ - url: '../indexapp/indexapp' + // wx.switchTab({ + // url: '../indexapp/indexapp' + // }) + }, + // 预览图片 + 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' + }) + } else { + wx.showToast({ + icon: 'error', + title: '请签名', + }) + } + }, + // 点击遮罩层 + closePopup() { + this.setData({ + popupShow: false + }) + }, + // 点击安全生产责任书图片 + clickImage() { + this.setData({ + popupShow: true + }) + } }) \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.json b/miniprogram/pages/notice/notice.json index 4c73264..8e66903 100644 --- a/miniprogram/pages/notice/notice.json +++ b/miniprogram/pages/notice/notice.json @@ -1,5 +1,7 @@ { "usingComponents": { - "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down" + "van-count-down": "../../miniprogram_npm/@vant/weapp/count-down", + "van-popup": "@vant/weapp/popup/index", + "van-button": "../../miniprogram_npm/@vant/weapp/button" } } \ No newline at end of file diff --git a/miniprogram/pages/notice/notice.wxml b/miniprogram/pages/notice/notice.wxml index 975304a..e306df6 100644 --- a/miniprogram/pages/notice/notice.wxml +++ b/miniprogram/pages/notice/notice.wxml @@ -1,10 +1,33 @@ - - - + + + - + + + 请阅读并同意《安全生产责任书》协议,并签署真实姓名。 + + + + + + + + {{buttonName}} + + + 确认 + + + diff --git a/miniprogram/pages/notice/notice.wxss b/miniprogram/pages/notice/notice.wxss index 36d7542..36ef9bd 100644 --- a/miniprogram/pages/notice/notice.wxss +++ b/miniprogram/pages/notice/notice.wxss @@ -15,4 +15,35 @@ color: #FFCF00; width: 750rpx; z-index:9999; - } \ No newline at end of file + } + +.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..7c16836 --- /dev/null +++ b/miniprogram/pages/signName/signName.js @@ -0,0 +1,151 @@ +const fileManager = wx.getFileSystemManager(); + +// 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(this.data.signFlag); + if (!this.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'); + //其他 + wx.setStorageSync('signImage', signImage) + wx.navigateBack() + } + }) + }, +}) \ 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..c9c7f89 --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -0,0 +1,146 @@ +// pages/validNameKeyword/validNameKeyword.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' +// const defaultAvatarUrl = '../../images/login.png' +Page({ + /** + * 页面的初始数据 + */ + data: { + phone: '', //用户名-手机号 + keyword: '', // 密码 + telMessage: '', // 手机号验证提示信息 + keywordMessage: '', //密码 + avatarUrl: defaultAvatarUrl, //头像 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + // 授权头像 + 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 keyword = event.detail || event; + let message = ''; + let disable = ''; + if (!keyword) { + message = '密码不能为空', + disable = true + } + this.setData({ + keywordMessage: message, + disabled: disable, + }); + if (this.data.disabled === true) { + return false; + }else { + return true; + } + }, + confirm: function (e) { + const { phone, keyword} = this.data + console.log('00000', this.data ) + if(!phone) { + this.setData({ + telMessage: '账号不能为空', + }); + return false + } + if(!keyword) { + this.setData({ + keywordMessage: '密码不能为空', + }); + return false + } else { + this.setData({ + keywordMessage: '', + }); + } + console.log('点击确认'); + + } +}) \ 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..1d7485a --- /dev/null +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + 确认 + 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 dd4d942..189edf5 100644 --- a/miniprogram/project.private.config.json +++ b/miniprogram/project.private.config.json @@ -1,7 +1,7 @@ { "projectname": "miniprogram", "setting": { - "compileHotReLoad": true, + "compileHotReLoad": false, "urlCheck": false }, "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", @@ -45,7 +45,14 @@ }, { "name": "", - "pathName": "pages/login/login", + "pathName": "pages/notice/notice", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/signName/signName", "query": "", "launchMode": "default", "scene": null diff --git a/project.private.config.json b/project.private.config.json index 251bbf7..aa1fd22 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,6 +1,6 @@ { "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "%E6%99%BA%E6%85%A7%E6%96%BD%E5%B7%A5", + "projectname": "%25E6%2599%25BA%25E6%2585%25A7%25E6%2596%25BD%25E5%25B7%25A5", "setting": { "compileHotReLoad": true },