diff --git a/weapp/app.js b/weapp/app.js index a1e1ff7..395a29f 100644 --- a/weapp/app.js +++ b/weapp/app.js @@ -6,15 +6,57 @@ App({ baseUrl: 'http://10.8.30.112:4900', //api 镇江本地环境 webUrl: "http://10.8.30.112:5900/", //web 镇江本地环境 imgUrl: 'http://10.8.30.112:5900/_file-server/', //文件 镇江本地环境 - + // baseUrl: 'http://10.8.16.102:4900', //api 南昌本地环境 // webUrl: "http://10.8.16.102:5900/", //web 南昌本地环境 // imgUrl: 'http://10.8.16.102:5900/_file-server/', //文件 南昌本地环境 - + // baseUrl: 'http://127.0.0.1:6015', //api 测试环境 // webUrl: "http://127.0.0.1:6014/", //web 测试环境 // imgUrl: 'http://127.0.0.1:6014/_file-server/', //文件 本测试环境 - key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY' //获取位置信息 + key: 'ODQBZ-3FZAU-6VIVL-2XXNM-F7CP7-WVFCY', //获取位置信息 + + inspecterList: [ // 巡检人员tabBar / app.json 也要写 + { + "pagePath": "/pages/index/index", + "iconPath": "/images/tabBar/icon_polling.png", + "selectedIconPath": "/images/tabBar/icon_polling_active.png", + "text": "巡检总览" + }, + { + "pagePath": "/pages/overview/overview", + "iconPath": "/images/tabBar/icon_menu.png", + "selectedIconPath": "/images/tabBar/icon_menu_active.png", + "text": "工作台" + }, + { + "pagePath": "/pages/myInfo/myInfo", + "iconPath": "/images/tabBar/icon_person.png", + "selectedIconPath": "/images/tabBar/icon_person_active.png", + "text": "我的" + } + ], + + managerList: [ // 管理人员tabBar / app.json 也要写 + { + "pagePath": "/pages/home/home", + "iconPath": "/images/tabBar/icon_polling.png", + "selectedIconPath": "/images/tabBar/icon_polling_active.png", + "text": "首页" + }, + { + "pagePath": "/pages/overview/overview", + "iconPath": "/images/tabBar/icon_menu.png", + "selectedIconPath": "/images/tabBar/icon_menu_active.png", + "text": "工作台" + }, + { + "pagePath": "/pages/myInfo/myInfo", + "iconPath": "/images/tabBar/icon_person.png", + "selectedIconPath": "/images/tabBar/icon_person_active.png", + "text": "我的" + } + ], }, onShow (e) { // 检查是否有更新 diff --git a/weapp/app.json b/weapp/app.json index 61c9182..ad3e20a 100644 --- a/weapp/app.json +++ b/weapp/app.json @@ -1,73 +1,76 @@ { - "pages": [ - "pages/index/index", - "pages/login/login", - "pages/myInfo/myInfo", - "pages/overview/overview", - "pages/home/home" - ], - "subPackages": [ - { - "root": "package", - "pages": [ - "polling/polling", - "polling/inspectionRecordDetail/inspectionRecordDetail", - "basic/basic", - "startInspection/startInspection", - "inspectionInput/inspectionInput", - "troubleshooting/index", - "troubleshooting/shootingForm/index", - "inspectionReport/inspectionReport", - "pointsStatus/pointsStatus", - "homePage/homePage" - ] - } - ], - "window": { - "backgroundTextStyle": "dark", - "navigationBarBackgroundColor": "#1979ff", - "navigationBarTextStyle": "white" - }, - "tabBar": { - "color": "#000000", - "selectedColor": "#2F54FF", - "borderStyle": "black", - "backgroundColor": "#ffffff", - "list": [ - { - "pagePath": "pages/index/index", - "iconPath": "images/tabBar/icon_polling.png", - "selectedIconPath": "images/tabBar/icon_polling_active.png", - "text": "巡检总览" - }, - { - "pagePath": "pages/home/home", - "iconPath": "images/tabBar/icon_polling.png", - "selectedIconPath": "images/tabBar/icon_polling_active.png", - "text": "首页" - }, - { - "pagePath": "pages/overview/overview", - "iconPath": "images/tabBar/icon_menu.png", - "selectedIconPath": "images/tabBar/icon_menu_active.png", - "text": "工作台" - }, - { - "pagePath": "pages/myInfo/myInfo", - "iconPath": "images/tabBar/icon_person.png", - "selectedIconPath": "images/tabBar/icon_person_active.png", - "text": "我的" - } - ] - }, - "permission": { - "scope.userLocation": { - "desc": "你的位置信息将用于小程序位置接口的效果展示" - } - }, - "requiredPrivateInfos": [ - "getLocation" - ], - "sitemapLocation": "sitemap.json", - "lazyCodeLoading": "requiredComponents" + "pages": [ + "pages/index/index", + "pages/login/login", + "pages/myInfo/myInfo", + "pages/overview/overview", + "pages/home/home", + "custom-tab-bar/index" + ], + "subPackages": [ + { + "root": "package", + "pages": [ + "polling/polling", + "polling/inspectionRecordDetail/inspectionRecordDetail", + "basic/basic", + "startInspection/startInspection", + "inspectionInput/inspectionInput", + "troubleshooting/index", + "troubleshooting/shootingForm/index", + "inspectionReport/inspectionReport", + "pointsStatus/pointsStatus", + "homePage/homePage" + ] + } + ], + "window": { + "backgroundTextStyle": "dark", + "navigationBarBackgroundColor": "#1979ff", + "navigationBarTextStyle": "white" + }, + "tabBar": { + "custom": true, + "color": "#000000", + "selectedColor": "#2F54FF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "images/tabBar/icon_polling.png", + "selectedIconPath": "images/tabBar/icon_polling_active.png", + "text": "巡检总览" + }, + { + "pagePath": "pages/overview/overview", + "iconPath": "images/tabBar/icon_menu.png", + "selectedIconPath": "images/tabBar/icon_menu_active.png", + "text": "工作台" + }, + { + "pagePath": "pages/myInfo/myInfo", + "iconPath": "images/tabBar/icon_person.png", + "selectedIconPath": "images/tabBar/icon_person_active.png", + "text": "我的" + }, + { + "pagePath": "pages/home/home", + "iconPath": "images/tabBar/icon_polling.png", + "selectedIconPath": "images/tabBar/icon_polling_active.png", + "text": "首页" + } + ] + }, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "requiredPrivateInfos": [ + "getLocation" + ], + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents", + "usingComponents": {} } \ No newline at end of file diff --git a/weapp/app.wxss b/weapp/app.wxss index 4c14ea7..cf723d8 100644 --- a/weapp/app.wxss +++ b/weapp/app.wxss @@ -1,19 +1,19 @@ /**app.wxss**/ .page { - /* vant 全局CSS变量 */ - /* DropdownMenu */ - --dropdown-menu-background-color: transparent; - --dropdown-menu-box-shadow: none; - --dropdown-menu-title-active-text-color: #1684FF; - --dropdown-menu-option-active-color: #1684FF; + /* vant 全局CSS变量 */ + /* DropdownMenu */ + --dropdown-menu-background-color: transparent; + --dropdown-menu-box-shadow: none; + --dropdown-menu-title-active-text-color: #1684FF; + --dropdown-menu-option-active-color: #1684FF; } .container { - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: space-between; - padding: 200rpx 0; - box-sizing: border-box; -} + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} \ No newline at end of file diff --git a/weapp/custom-tab-bar/index.js b/weapp/custom-tab-bar/index.js new file mode 100644 index 0000000..6fa7319 --- /dev/null +++ b/weapp/custom-tab-bar/index.js @@ -0,0 +1,32 @@ +Component({ + data: { + selected: 0, + color: "#7A7E83", + selectedColor: "#1070E8", + list: [] + }, + attached () { + let userRole = wx.getStorageSync('userRole'); + // 0 表示普通用户 1表示管理员 + console.log('userRole', userRole); + if (userRole && userRole.includes('管理')) { + this.setData({ + list: getApp().globalData.managerList + }) + } else { + this.setData({ + list: getApp().globalData.inspecterList + }) + } + }, + methods: { + switchTab (e) { + const data = e.currentTarget.dataset + const url = data.path + // this.setData({ + // selected: data.index + // }) + wx.switchTab({ url }) + } + } +}) \ No newline at end of file diff --git a/weapp/custom-tab-bar/index.json b/weapp/custom-tab-bar/index.json new file mode 100644 index 0000000..fba482a --- /dev/null +++ b/weapp/custom-tab-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/weapp/custom-tab-bar/index.wxml b/weapp/custom-tab-bar/index.wxml new file mode 100644 index 0000000..c9936c9 --- /dev/null +++ b/weapp/custom-tab-bar/index.wxml @@ -0,0 +1,8 @@ + + + + + + {{item.text}} + + \ No newline at end of file diff --git a/weapp/custom-tab-bar/index.wxss b/weapp/custom-tab-bar/index.wxss new file mode 100644 index 0000000..f582f78 --- /dev/null +++ b/weapp/custom-tab-bar/index.wxss @@ -0,0 +1,38 @@ +.tab-bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 48px; + background: white; + display: flex; + padding-bottom: env(safe-area-inset-bottom); +} + +.tab-bar-border { + background-color: rgba(0, 0, 0, 0.33); + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + transform: scaleY(0.5); +} + +.tab-bar-item { + flex: 1; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.tab-bar-item image { + width: 27px; + height: 27px; +} + +.tab-bar-item view { + font-size: 10px; +} \ No newline at end of file diff --git a/weapp/pages/home/home.js b/weapp/pages/home/home.js index 0ab33e6..2bad412 100644 --- a/weapp/pages/home/home.js +++ b/weapp/pages/home/home.js @@ -1,66 +1,77 @@ // pages/home/home.js Page({ - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow () { + const userInfo = wx.getStorageSync('userInfo'); + if (!userInfo || !userInfo.id) { + wx.reLaunch({ + url: '/pages/login/login' + }); + } else { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 0 + }) + } + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage () { + + } }) \ No newline at end of file diff --git a/weapp/pages/index/index.js b/weapp/pages/index/index.js index 7141b9e..8f8bbb0 100644 --- a/weapp/pages/index/index.js +++ b/weapp/pages/index/index.js @@ -5,146 +5,151 @@ const moment = require("../../utils/moment"); Page({ - /** - * 页面的初始数据 - */ - data: { - project: [], - todayRecord: [], // 今日巡检记录 - markers: [], - isShowCallout: false, - }, - - setMarkers(project, todayRecord) { - const markers = project.map(p => { - let todayCount = 0; - todayRecord.forEach(r => { - if (r.projectId === p.id) { todayCount += 1 } - }) - return { - id: p.id, - latitude: p.latitude, - longitude: p.longitude, - name: p.name, - iconPath: '/images/gis.png', - width: 29, - height: 44, - callout: { - content: `${p.name}\n今日巡检:${todayCount}次`, - padding: 10, - display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK', - borderColor: '#1684FF', - borderWidth: 1, - }, - } - }) - this.setData({ markers }) - }, - - // 获取结构物和今日巡检次数 - getData() { - const that = this; - wx.showLoading({ title: '加载中' }) - const promiseArr = []; - promiseArr.push(Request.get(getProjectList(), {})); - promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); - Promise.all(promiseArr).then(res => { - wx.hideLoading() - that.setData({ - project: res[0].rows, - todayRecord: res[1] - }) - that.setMarkers(res[0].rows, res[1]); - // 缩放视野展示所有 markers - const mapCtx = wx.createMapContext('mapDom') - mapCtx.includePoints({ - points: res[0].rows, - padding: [40, 40, 40, 40] - }) - }) - }, - - showCallout() { - this.setData( - { isShowCallout: !this.data.isShowCallout }, - () => { this.setMarkers(this.data.markers, this.data.todayRecord); } - ); - }, - - onRefresh() { - this.getData(); - }, - - onMarkerTap(e) { - const describe = this.data.project.find(p => p.id === e.detail.markerId).describe || ''; - wx.navigateTo({url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}&describe=${describe}`}) - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - const userInfo = wx.getStorageSync('userInfo'); - if (!userInfo || !userInfo.id) { - wx.reLaunch({ - url: '/pages/login/login' - }); - } - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - const userInfo = wx.getStorageSync('userInfo'); - if (!userInfo || !userInfo.id) { - wx.reLaunch({ - url: '/pages/login/login' - }); - } else { - this.getData(); - } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, + /** + * 页面的初始数据 + */ + data: { + project: [], + todayRecord: [], // 今日巡检记录 + markers: [], + isShowCallout: false, + }, + + setMarkers (project, todayRecord) { + const markers = project.map(p => { + let todayCount = 0; + todayRecord.forEach(r => { + if (r.projectId === p.id) { todayCount += 1 } + }) + return { + id: p.id, + latitude: p.latitude, + longitude: p.longitude, + name: p.name, + iconPath: '/images/gis.png', + width: 29, + height: 44, + callout: { + content: `${p.name}\n今日巡检:${todayCount}次`, + padding: 10, + display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK', + borderColor: '#1684FF', + borderWidth: 1, + }, + } + }) + this.setData({ markers }) + }, + + // 获取结构物和今日巡检次数 + getData () { + const that = this; + wx.showLoading({ title: '加载中' }) + const promiseArr = []; + promiseArr.push(Request.get(getProjectList(), {})); + promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); + Promise.all(promiseArr).then(res => { + wx.hideLoading() + that.setData({ + project: res[0].rows, + todayRecord: res[1] + }) + that.setMarkers(res[0].rows, res[1]); + // 缩放视野展示所有 markers + const mapCtx = wx.createMapContext('mapDom') + mapCtx.includePoints({ + points: res[0].rows, + padding: [40, 40, 40, 40] + }) + }) + }, + + showCallout () { + this.setData( + { isShowCallout: !this.data.isShowCallout }, + () => { this.setMarkers(this.data.markers, this.data.todayRecord); } + ); + }, + + onRefresh () { + this.getData(); + }, + + onMarkerTap (e) { + const describe = this.data.project.find(p => p.id === e.detail.markerId).describe || ''; + wx.navigateTo({ url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}&describe=${describe}` }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad (options) { + const userInfo = wx.getStorageSync('userInfo'); + if (!userInfo || !userInfo.id) { + wx.reLaunch({ + url: '/pages/login/login' + }); + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow () { + const userInfo = wx.getStorageSync('userInfo'); + if (!userInfo || !userInfo.id) { + wx.reLaunch({ + url: '/pages/login/login' + }); + } else { + this.getData(); + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 0 + }) + } + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage () { - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } + } }) \ No newline at end of file diff --git a/weapp/pages/index/index.wxss b/weapp/pages/index/index.wxss index ae0e4ca..05864a1 100644 --- a/weapp/pages/index/index.wxss +++ b/weapp/pages/index/index.wxss @@ -1,7 +1,7 @@ /* pages/index/index.wxss */ .map { width: 100vw; - height: 100vh; + height: calc(100vh - 82px); } .action-box { diff --git a/weapp/pages/login/login.js b/weapp/pages/login/login.js index 467c57f..c0707b6 100644 --- a/weapp/pages/login/login.js +++ b/weapp/pages/login/login.js @@ -4,129 +4,142 @@ import { Request } from "../../common"; Page({ - /** - * 页面的初始数据 - */ - data: { - scene: null, - }, - - // 登录 - getLogin: function (e) { - if (e.detail.value.username.length == 0 || e.detail.value.password == 0) { - wx.showToast({ - title: '请输入账号密码', - icon: 'none', - }) - return - } - wx.showLoading() - Request.post(loginUrl(), { - "username": e.detail.value.username, - "password": e.detail.value.password - }).then((res) => { - if (!res.authorized) { - wx.showToast({ title: "登录失败", icon: "none" }); - return; - } - wx.setStorageSync('token', res.token); - wx.setStorageSync("userInfo", res); - getApp().globalData.userInfo = res - wx.hideLoading() - if (this.data.scene) { - wx.redirectTo({ - url: `/package/inspectionInput/inspectionInput?scene=${this.data.scene}`, + /** + * 页面的初始数据 + */ + data: { + scene: null, + }, + + // 登录 + getLogin: function (e) { + if (e.detail.value.username.length == 0 || e.detail.value.password == 0) { + wx.showToast({ + title: '请输入账号密码', + icon: 'none', + }) + return + } + wx.showLoading() + Request.post(loginUrl(), { + "username": e.detail.value.username, + "password": e.detail.value.password + }).then((res) => { + if (!res.authorized) { + wx.showToast({ title: "登录失败", icon: "none" }); + return; + } + wx.setStorageSync('token', res.token); + wx.setStorageSync("userInfo", res); + getApp().globalData.userInfo = res + wx.setStorageSync('userRole', res.role) + + wx.hideLoading() + + if (this.data.scene) { + wx.redirectTo({ + url: `/package/inspectionInput/inspectionInput?scene=${this.data.scene}`, + }) + return; + } + console.log(res.role); + setTimeout(() => { + console.log(`跳转`); + if (res.role.includes('管理')) { + wx.switchTab({ + url: '/pages/home/home', + }) + } else { + wx.switchTab({ + url: '/pages/index/index', + }) + } + }, 1000) }) - return; - } - wx.switchTab({ - url: '/pages/index/index', - }) - }) - }, - - bindForget() { - wx.showModal({ - title: '温馨提示', - content: '请联系管理员:18888888888', - confirmText: '拨打电话', - confirmColor: '#488EFF', - cancelColor: '#488EFF', - success(res) { - if (res.confirm) { - wx.makePhoneCall({ - phoneNumber: "18888888888", - success: function () { - console.log("拨打电话成功!") - }, - fail: function () { - console.log("拨打电话失败!") + }, + + bindForget () { + wx.showModal({ + title: '温馨提示', + content: '请联系管理员:18888888888', + confirmText: '拨打电话', + confirmColor: '#488EFF', + cancelColor: '#488EFF', + success (res) { + if (res.confirm) { + wx.makePhoneCall({ + phoneNumber: "18888888888", + success: function () { + console.log("拨打电话成功!") + }, + fail: function () { + console.log("拨打电话失败!") + } + }) + } } - }) + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad (options) { + let that = this; + const { scene } = options; + if (scene) { + that.setData({ + scene + }) } - } - }) - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let that = this; - const { scene } = options; - if (scene) { - that.setData({ - scene - }) - } - }, + }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady () { - }, + }, - /** - * 生命周期函数--监听页面显示 - */ - onShow() { + /** + * 生命周期函数--监听页面显示 + */ + onShow () { - }, + }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { + /** + * 生命周期函数--监听页面隐藏 + */ + onHide () { - }, + }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { + /** + * 生命周期函数--监听页面卸载 + */ + onUnload () { - }, + }, - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh () { - }, + }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom () { - }, + }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { + /** + * 用户点击右上角分享 + */ + onShareAppMessage () { - } + } }) \ No newline at end of file diff --git a/weapp/pages/myInfo/myInfo.js b/weapp/pages/myInfo/myInfo.js index 634e481..877d215 100644 --- a/weapp/pages/myInfo/myInfo.js +++ b/weapp/pages/myInfo/myInfo.js @@ -4,99 +4,103 @@ import { Request } from "../../common"; Page({ - /** - * 页面的初始数据 - */ - data: { - - }, - - bindClick() { - wx.navigateTo({ - url: '/package/basic/basic', - }) - }, - - // 登出 - logout() { - wx.showModal({ - title: '切换用户', - content: '将退出当前用户,重新登录', - confirmText: '切换用户', - confirmColor: '#1979ff', - success: res => { - if (res.confirm) { - wx.showLoading() - Request.put(logoutUrl(), {}).then((res) => { - wx.clearStorage(); - getApp().globalData.userInfo = null; - wx.reLaunch({ - url: '../login/login', + /** + * 页面的初始数据 + */ + data: { + + }, + + bindClick () { + wx.navigateTo({ + url: '/package/basic/basic', + }) + }, + + // 登出 + logout () { + wx.showModal({ + title: '切换用户', + content: '将退出当前用户,重新登录', + confirmText: '切换用户', + confirmColor: '#1979ff', + success: res => { + if (res.confirm) { + wx.showLoading() + Request.put(logoutUrl(), {}).then((res) => { + wx.clearStorage(); + getApp().globalData.userInfo = null; + wx.reLaunch({ + url: '../login/login', + }) + wx.hideLoading() + }) + } + } + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad (options) { + let that = this; + let userInfo = wx.getStorageSync('userInfo'); + that.setData({ + userInfo + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow () { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 2 }) - wx.hideLoading() - }) } - } - }) - }, + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let that = this; - let userInfo = wx.getStorageSync('userInfo'); - that.setData({ - userInfo - }) - }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide () { - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { + }, - }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload () { - /** - * 生命周期函数--监听页面显示 - */ - onShow() { + }, - }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh () { - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { + }, - }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom () { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { + }, - }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage () { - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } + } }) \ No newline at end of file diff --git a/weapp/pages/myInfo/myInfo.wxss b/weapp/pages/myInfo/myInfo.wxss index 3bbcb05..439c664 100644 --- a/weapp/pages/myInfo/myInfo.wxss +++ b/weapp/pages/myInfo/myInfo.wxss @@ -1,175 +1,176 @@ /* pages/myInfo/myInfo.wxss */ page { - background-color: #F7F7FA; + background-color: #F7F7FA; } .over-ellipsis { - text-overflow: ellipsis; - overflow: hidden; - word-break: break-all; - white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; } .bg { - position: absolute; - left: -25%; - width: 150%; - height: 145px; - background-color: #1979ff; - border-bottom-left-radius: 100%; - border-bottom-right-radius: 100%; - background-image: linear-gradient(0deg, #4E87FF, #1979ff 100%); - z-index: -1; + position: absolute; + left: -25%; + width: 150%; + height: 145px; + background-color: #1979ff; + border-bottom-left-radius: 100%; + border-bottom-right-radius: 100%; + background-image: linear-gradient(0deg, #4E87FF, #1979ff 100%); + z-index: -1; } /* 容器 */ .box { - padding: 30rpx; - font-family: 'PingFang SC-Medium'; + padding-top: 42rpx; + padding: 30rpx; + font-family: 'PingFang SC-Medium'; } .header-item-container { - width: 100%; - height: 165px; - border-radius: 10rpx; - background-size: 100% 165px; + width: 100%; + height: 165px; + border-radius: 10rpx; + background-size: 100% 165px; } .info-box { - width: 100%; - height: 127px; - display: flex; - justify-content: space-between; + width: 100%; + height: 127px; + display: flex; + justify-content: space-between; } .avatar { - width: 54px; - min-width: 54px; - height: 54px; - padding: 16px; - margin-bottom: 30px; + width: 54px; + min-width: 54px; + height: 54px; + padding: 16px; + margin-bottom: 30px; } .info { - height: 100%; - min-width: 55%; - max-width: 60%; - display: flex; - flex-direction: column; - justify-content: space-evenly; + height: 100%; + min-width: 55%; + max-width: 60%; + display: flex; + flex-direction: column; + justify-content: space-evenly; } .userName { - font-size: 36rpx; - font-weight: 600; + font-size: 36rpx; + font-weight: 600; } .contact { - display: flex; - align-items: center; - min-width: 190px; + display: flex; + align-items: center; + min-width: 190px; } .contact .icon { - width: 20px; - min-width: 20px; - height: 20px; + width: 20px; + min-width: 20px; + height: 20px; } .contact .text { - min-width: 170px; - margin-left: 8px; - font-size: 14px; - color: #00000080; + min-width: 170px; + margin-left: 8px; + font-size: 14px; + color: #00000080; } .post { - border: 1px solid #006BE3; - border-radius: 100px 0 0 100px; - min-width: 30px; - max-width: 60px; - height: 25px; - line-height: 25px; - color: #006BE3; - font-size: 14px; - padding: 0 7px; - margin-top: 20px; + border: 1px solid #006BE3; + border-radius: 100px 0 0 100px; + min-width: 30px; + max-width: 60px; + height: 25px; + line-height: 25px; + color: #006BE3; + font-size: 14px; + padding: 0 7px; + margin-top: 20px; } .dept-box { - height: 36px; - display: flex; - align-items: center; - justify-content: flex-end; + height: 36px; + display: flex; + align-items: center; + justify-content: flex-end; } .dept-box .dept { - font-size: 14px; - color: #FFFFFF; - margin-right: 10px; + font-size: 14px; + color: #FFFFFF; + margin-right: 10px; } .company { - font-size: 28rpx; - font-family: "PingFang SC"; - color: rgb(138, 138, 138); - margin-top: 14rpx; + font-size: 28rpx; + font-family: "PingFang SC"; + color: rgb(138, 138, 138); + margin-top: 14rpx; } .body-container { - width: 100%; - background: rgb(255, 255, 255); - border-radius: 10rpx; - flex-direction: column; - display: flex; - margin-top: 30rpx; - margin-bottom: 30rpx; + width: 100%; + background: rgb(255, 255, 255); + border-radius: 10rpx; + flex-direction: column; + display: flex; + margin-top: 30rpx; + margin-bottom: 30rpx; } .body-item { - height: 110rpx; - flex-direction: row; - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 30rpx; - border-bottom: 1px solid #EFEFF4; + height: 110rpx; + flex-direction: row; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 30rpx; + border-bottom: 1px solid #EFEFF4; } .body-info { - font-size: 32rpx; - font-family: "PingFang SC"; - font-weight: 600; + font-size: 32rpx; + font-family: "PingFang SC"; + font-weight: 600; } .body-number { - font-size: 30rpx; - font-family: "PingFang SC"; - color: rgb(138, 138, 138); + font-size: 30rpx; + font-family: "PingFang SC"; + color: rgb(138, 138, 138); } .foot-container { - position: absolute; - bottom: 50px; - width: 90%; - height: 42px; - border: 1px solid #006BE3; - border-radius: 24px; + position: absolute; + bottom: 140px; + width: 90%; + height: 42px; + border: 1px solid #006BE3; + border-radius: 24px; } .foot-item { - font-weight: 600; - font-size: 16px; - color: #006BE3; - text-align: center; - line-height: 42px; + font-weight: 600; + font-size: 16px; + color: #006BE3; + text-align: center; + line-height: 42px; } .right { - width: 32rpx; - height: 32rpx; - display: block; - float: right; - margin: 38rpx 40rpx; + width: 32rpx; + height: 32rpx; + display: block; + float: right; + margin: 38rpx 40rpx; } \ No newline at end of file diff --git a/weapp/pages/overview/overview.js b/weapp/pages/overview/overview.js index 1bbd590..c0bacf1 100644 --- a/weapp/pages/overview/overview.js +++ b/weapp/pages/overview/overview.js @@ -1,85 +1,89 @@ // pages/overview/overview.js Page({ - /** - * 页面的初始数据 - */ - data: { - - }, - - // 巡检 - bindPolling() { - wx.navigateTo({ - url: '/package/polling/polling', - }) - }, - - bindTroubleshooting() { - wx.navigateTo({ - url: '/package/troubleshooting/index', - }) - }, - - bindInspectionReport() { - wx.navigateTo({ - url: '/package/inspectionReport/inspectionReport', - }) - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } + /** + * 页面的初始数据 + */ + data: { + + }, + + // 巡检 + bindPolling () { + wx.navigateTo({ + url: '/package/polling/polling', + }) + }, + + bindTroubleshooting () { + wx.navigateTo({ + url: '/package/troubleshooting/index', + }) + }, + + bindInspectionReport () { + wx.navigateTo({ + url: '/package/inspectionReport/inspectionReport', + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow () { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 1 + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage () { + + } }) \ No newline at end of file diff --git a/weapp/project.private.config.json b/weapp/project.private.config.json index 1e5f97d..d6f30e2 100644 --- a/weapp/project.private.config.json +++ b/weapp/project.private.config.json @@ -31,5 +31,6 @@ } ] } - } + }, + "libVersion": "2.29.2" } \ No newline at end of file