瀏覽代碼

Merge remote-tracking branch 'origin/master'

zxy 3 年之前
父節點
當前提交
d8cd54343c

+ 45 - 4
light-application-wx/pages/index-admin/index-admin.js

@@ -19,10 +19,51 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
-        that.setData({
-            username: app.globalData.userInfo.usernameShow,
-            role_name: app.globalData.roleInfo.name
-        });
+        if (!app.globalData.userInfo.usernameShow || !app.globalData.userInfo.nickName || !app.globalData.userInfo.headImgUrl) {
+            wx.showModal({
+                title: '提示',
+                content: '轻应用需要取您的用户信息',
+                showCancel: false,
+                confirmText: '确定',
+                success: (res) => {
+                    if (res.confirm) {
+                        wx.getUserProfile({
+                            desc: '提升用户体验感',
+                            success: (res) => {
+                                app.globalData.userInfo.usernameShow = res.userInfo.nickName;
+                                app.globalData.userInfo.nickName = res.userInfo.nickName;
+                                app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
+                                that.setData({
+                                    username: app.globalData.userInfo.usernameShow,
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                                util.post({
+                                    url: '/sys/user/updateNoAuth',
+                                    data: {
+                                        id: app.globalData.userInfo.id,
+                                        nickName: res.userInfo.nickName,
+                                        usernameShow: res.userInfo.nickName,
+                                        headImgUrl: res.userInfo.avatarUrl
+                                    }
+                                });
+                            },
+                            fail: (res) => {
+                                util.toast('拒绝授权将影响您的体验感');
+                                that.setData({
+                                    username: '未知用户',
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                            }
+                        });
+                    }
+                },
+            });
+        } else {
+            that.setData({
+                username: app.globalData.userInfo.usernameShow,
+                role_name: app.globalData.roleInfo.name
+            });
+        }
         // 下一场会议
         util.get({
             url: '/api/meeting/info/getNextMeeting',

+ 2 - 3
light-application-wx/pages/index-guest/index-guest.js

@@ -30,9 +30,8 @@ Page({
                 success: (res) => {
                     if (res.confirm) {
                         wx.getUserProfile({
-                            desc: '提供优质服务',
+                            desc: '提升用户体验感',
                             success: (res) => {
-                                console.info(res.userInfo)
                                 app.globalData.userInfo.usernameShow = res.userInfo.nickName;
                                 app.globalData.userInfo.nickName = res.userInfo.nickName;
                                 app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
@@ -147,7 +146,7 @@ Page({
      */
     meetingInfo: function () {
         wx.navigateTo({
-            url: '../meeting-cover/meeting-cover?item=' + this.data.nextMeeting,
+            url: '../meeting-cover/meeting-cover?item=' + JSON.stringify(this.data.nextMeeting),
         });
     },
 

+ 92 - 19
light-application-wx/pages/index/index.js

@@ -2,12 +2,17 @@
 const app = getApp();
 const util = require('../../utils/util.js');
 Page({
+
+    /**
+     * 页面的初始数据
+     */
     data: {
         imgPath: app.globalData.imgPath,
         path: app.globalData.path,
         username: app.globalData.userInfo.usernameShow,
         role_name: app.globalData.roleInfo.name,
-        app_bottom: '大城细管·大城众管·大城智管'
+        app_bottom: '大城细管·大城众管·大城智管',
+        nextMeeting: null
     },
 
     /**
@@ -15,24 +20,71 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
-        that.setData({
-            username: app.globalData.userInfo.usernameShow,
-            role_name: app.globalData.roleInfo.name
-        });
+        if (!app.globalData.userInfo.usernameShow || !app.globalData.userInfo.nickName || !app.globalData.userInfo.headImgUrl) {
+            wx.showModal({
+                title: '提示',
+                content: '轻应用需要取您的用户信息',
+                showCancel: false,
+                confirmText: '确定',
+                success: (res) => {
+                    if (res.confirm) {
+                        wx.getUserProfile({
+                            desc: '提升用户体验感',
+                            success: (res) => {
+                                app.globalData.userInfo.usernameShow = res.userInfo.nickName;
+                                app.globalData.userInfo.nickName = res.userInfo.nickName;
+                                app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
+                                that.setData({
+                                    username: app.globalData.userInfo.usernameShow,
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                                util.post({
+                                    url: '/sys/user/updateNoAuth',
+                                    data: {
+                                        id: app.globalData.userInfo.id,
+                                        nickName: res.userInfo.nickName,
+                                        usernameShow: res.userInfo.nickName,
+                                        headImgUrl: res.userInfo.avatarUrl
+                                    }
+                                });
+                            },
+                            fail: (res) => {
+                                util.toast('拒绝授权将影响您的体验感');
+                                that.setData({
+                                    username: '未知用户',
+                                    role_name: app.globalData.roleInfo.name
+                                });
+                            }
+                        });
+                    }
+                },
+            });
+        } else {
+            that.setData({
+                username: app.globalData.userInfo.usernameShow,
+                role_name: app.globalData.roleInfo.name
+            });
+        }
         // 下一场会议
         util.get({
             url: '/api/meeting/info/getNextMeeting',
             success: (res) => {
                 wx.hideLoading();
+                console.info(res)
                 if (res.data.code != 200) {
                     util.toast(res.data.msg);
                 } else {
                     let datas = res.data.data;
-                    that.setData({
-                        nextTitle: datas.title,
-                        nextTime: util.formatDate(datas.receptionTime),
-                        nextUnit: datas.receptionObject
-                    });
+                    if (datas && datas.length > 0) {
+                        that.setData({
+                            nextMeeting: datas,
+                            nextTitle: datas.title,
+                            nextTime: util.formatDate(datas.receptionTime),
+                            nextUnit: datas.receptionObject
+                        });
+                    } else {
+                        util.toast('暂无下一场会议');
+                    }
                 }
             }
         });
@@ -88,6 +140,36 @@ Page({
     },
 
     /**
+     * 点击查看下一场会议详情
+     */
+    meetingInfo: function () {
+        let nextMeeting = this.data.nextMeeting;
+        if (nextMeeting) {
+            wx.navigateTo({
+                url: '../meeting-cover/meeting-cover?item=' + JSON.stringify(nextMeeting),
+            });
+        } else {
+            util.toast('暂无下一场会议');
+        }
+    },
+
+    /**
+     * 日常巡检
+     */
+    dailyInspection: function () {
+
+    },
+
+    /**
+     * 会议巡检
+     */
+    meetingInspection: function () {
+        wx.navigateTo({
+            url: '../meeting-list/meeting-list?type=INSPECTION',
+        });
+    },
+
+    /**
      * 点击参观议程跳转至会议列表
      */
     visitAgenda: function () {
@@ -124,15 +206,6 @@ Page({
         });
     },
 
-    /**
-     * 会议巡检
-     */
-    meetingInspection: function () {
-        wx.navigateTo({
-            url: '../meeting-inspection/meeting-inspection',
-        });
-    },
-
     changeRole: function () {
         wx.redirectTo({
             url: '../index-admin/index-admin',

+ 2 - 2
light-application-wx/pages/index/index.wxml

@@ -5,7 +5,7 @@
         <view class="app-bottom">{{app_bottom}}</view>
     </view>
 
-    <view class="next" style="background-image: url({{imgPath}}/index-next.png);">
+    <view class="next" style="background-image: url({{imgPath}}/index-next.png);" bindtap="meetingInfo">
         <view class="line-row">
             <view class="line"></view>
             <span>下一场</span>
@@ -27,7 +27,7 @@
 </view>
 <view class="second-part">
     <view class="inspection">
-        <view class="inspection-left" style="background-image: url({{imgPath}}/index-inspection.png);">
+        <view class="inspection-left" style="background-image: url({{imgPath}}/index-inspection.png);" bindtap="dailyInspection">
             <image mode="heightFix" src="{{imgPath}}/index-inspection-in1.png"></image>
             <text>日常巡检</text>
         </view>

+ 0 - 3
light-application-wx/pages/login/login.js

@@ -253,9 +253,6 @@ Page({
      */
     getPhoneNumber: function (res) {
         let that = this;
-        console.info(res)
-        // const encryptedData = res.detail.encryptedData;
-        // const iv = res.detail.iv;
         //用户按了允许授权按钮
         if (res.detail.encryptedData) {
             util.post({

+ 62 - 27
light-application-wx/pages/meeting-inspection/meeting-inspection.js

@@ -1,42 +1,45 @@
 // pages/meeting-inspection/meeting-inspection.js
+const util = require('../../utils/util.js');
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-        inspectionProjectList: [
-            {
-                name: '数字调音台(HuShan)',
-                status: '10'
-            }, {
-                name: '数字调音台(ITC)',
-                status: '10'
-            }, {
-                name: '音频处理器(ITC)',
-                status: '10'
-            }, {
-                name: '功率放大器(7台)',
-                status: '10'
-            }, {
-                name: '797电容话筒(2只)',
-                status: '10'
-            }, {
-                name: '797电容话筒(32只)',
-                status: '10'
-            }, {
-                name: '797电容话筒(21只)',
-                status: '10'
-            }
-        ],
-        currentTab: 10//10:会前 20:会中 30:会后
+        inspectionProjectList: [],
+        currentTab: 10,//10:会前 20:会中 30:会后
+        meetingId: '',
+        inspectionResultList: []
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        let that = this;
+        let templetId = options.templetId;
+        let meetingId = options.meetingId;
+        util.get({
+            url: '/api/inspection/template/getProjectByTemplateId',
+            header: {
+                'Content-Type': 'application/x-www-form-urlencoded'
+            },
+            data: {
+                templateId: templetId
+            },
+            success: (res) => {
+                wx.hideLoading();
+                console.info(res);
+                if (res.data.code != 200) {
+                    util.toast(res.data.msg);
+                } else {
+                    that.setData({
+                        inspectionProjectList: res.data.data,
+                        meetingId: meetingId
+                    });
+                }
+            }
+        });
     },
 
     /**
@@ -91,11 +94,38 @@ Page({
     switchTab(e) {
         this.setData({ currentTab: e.currentTarget.dataset.no });
     },
+
+    /**
+     * 巡检结果正常
+     * @param {*} e 
+     */
+    normal: function (e) {
+        let that = this;
+        // 修改巡检结果为正常(10)
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].result = 10;
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].color = '#2EC3CD';
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].results = '正常';
+        let list = that.data.inspectionResultList;
+        list.push({
+            inspectionProjectId: e.currentTarget.dataset.id,
+            result: 10
+        });
+        that.setData({
+            inspectionProjectList: that.data.inspectionProjectList,
+            inspectionResultList: list
+        });
+    },
+
+    /**
+     * 巡检结果不正常
+     * @param {*} e 
+     */
     abnormal: function (e) {
         wx.navigateTo({
             url: '../meeting-inspection-abnormal/meeting-inspection-abnormal',
         })
     },
+
     /**
      * 历史记录
      * @param {*} e 
@@ -103,6 +133,11 @@ Page({
     history: function (e) {
         wx.navigateTo({
             url: '../meeting-inspection-history/meeting-inspection-history',
-        })
+        });
+    },
+
+    submitInspection: function () {
+        console.info(this.data.inspectionResultList)
+        console.info(this.data.meetingId)
     }
 })

+ 6 - 5
light-application-wx/pages/meeting-inspection/meeting-inspection.wxml

@@ -24,19 +24,20 @@
     <view class="history-record" bindtap="history">历史记录</view>
   </view>
   <scroll-view scroll-y="true" class="body">
-    <view class="inspection-project" wx:for="{{inspectionProjectList}}" wx:key="i">
+    <view class="inspection-project" wx:for="{{inspectionProjectList}}" wx:key="i" wx:index="index">
       <view>
         <text class="project-name">{{item.name}}</text>
         <view class="divider"></view>
         <view class="buju">
           <text class="status-title">设备运行状态</text>
-          <view class="buju1">
-            <view class="button" bindtap="abnormal">不正常</view>
-            <view class="button">正常</view>
+          <view class="buju1" wx:if="{{!item.result}}">
+            <view class="button" data-index="{{index}}" data-id="{{item.id}}" bindtap="abnormal">不正常</view>
+            <view class="button" data-index="{{index}}" data-id="{{item.id}}" bindtap="normal">正常</view>
           </view>
+          <view wx:if="{{item.result}}" style="color: {{item.color}};">{{item.results}}</view>
         </view>
       </view>
     </view>
   </scroll-view>
-  <button style="width:80%;" class="submit-button">提交</button>
+  <button style="width:80%;" class="submit-button" bindtap="submitInspection">提交</button>
 </view>

+ 19 - 4
light-application-wx/pages/meeting-list/meeting-list.js

@@ -9,7 +9,8 @@ Page({
         current: 1,
         size: 10,
         total: 0,
-        list: []
+        list: [],
+        type: ''
     },
 
     /**
@@ -17,6 +18,9 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
+        that.setData({
+            type: options.type
+        });
         util.get({
             url: '/api/meeting/info/list',
             data: {
@@ -143,10 +147,21 @@ Page({
      * @param {*} e 
      */
     meetingCover: function (e) {
+        let that = this;
         let item = e.currentTarget.dataset.item;
-        wx.navigateTo({
-            url: '../meeting-cover/meeting-cover?item=' + JSON.stringify(item),
-        });
+        if ('INSPECTION' == that.data.type) {
+            if (item.status == 20) {
+                util.toast('会议已结束');
+            } else {
+                wx.navigateTo({
+                    url: '../meeting-inspection/meeting-inspection?templetId=' + item.inspectionTemplateId + '&meetingId=' + item.id,
+                });
+            }
+        } else {
+            wx.navigateTo({
+                url: '../meeting-cover/meeting-cover?item=' + JSON.stringify(item),
+            });
+        }
     },
 
     /**

+ 0 - 4
light-application-wx/pages/meeting-list/meeting-list.wxml

@@ -10,9 +10,5 @@
             <label>主题:</label>
             <text>{{item.title}}</text>
         </view>
-        <!-- <view class="operation" wx:if="{{item.status == 10}}">
-            <text class="edit" data-id="{{item.id}}" catchtap="editMeeting" hover-stop-propagation="true">编辑</text>
-            <text class="del" data-id="{{item.id}}" catchtap="delMeeting" hover-stop-propagation="true">删除</text>
-        </view> -->
     </view>
 </scroll-view>