Jelajahi Sumber

1.修改进入逻辑
2.修改上课逻辑

FailedToRead 2 tahun lalu
induk
melakukan
ddd7753b97

+ 1 - 0
miniprogram/component/faultItem/faultItem.ts

@@ -42,6 +42,7 @@ Component({
                 faultTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.reportTime), "yyyy-MM-dd HH:mm"),
                 myItemData: this.properties.itemData
             })
+            console.log("myItemData:", this.data.myItemData)
 
         },
         detached: function () {

+ 1 - 1
miniprogram/component/fileItem/fileItem.ts

@@ -38,7 +38,7 @@ Component({
         clickFileItem: function (event: any) {
 
             wx.navigateTo({
-                url: '../../../pages/document/document?lessId=' +  event.currentTarget.id
+                url: '../../../pages/document/document?lessId=' +  event.currentTarget.id+'&pageTitle='+this.data.itemData.title
             })
         },
         clickMore: function (event: any) {

+ 23 - 16
miniprogram/component/myInfo/myInfo.ts

@@ -331,24 +331,31 @@ Component({
                 })
                 return;
             }
+            let params = {}
             if (!this.data.userPwd) {
-                wx.showToast({
-                    title: '请输入密码',
-                    icon: 'none',
-                    duration: 1000
-                })
-                return;
-            }
-            let params = {
-                id: httpUtil.httpData.userId,
-                city: this.data.cityValue,
-                classId: this.data.classId,
-                name: this.data.userName,
-                password: this.data.userPwd,
-                province: this.data.provinceValue,//省份
-                region: this.data.regionValue,//地区
-                schoolId: this.data.schoolId,
+                params = {
+                    id: httpUtil.httpData.userId,
+                    city: this.data.cityValue,
+                    classId: this.data.classId,
+                    name: this.data.userName,
+                    province: this.data.provinceValue,//省份
+                    region: this.data.regionValue,//地区
+                    schoolId: this.data.schoolId,
+                }
+            } else {
+                params = {
+                    id: httpUtil.httpData.userId,
+                    city: this.data.cityValue,
+                    classId: this.data.classId,
+                    name: this.data.userName,
+                    password: this.data.userPwd,
+                    province: this.data.provinceValue,//省份
+                    region: this.data.regionValue,//地区
+                    schoolId: this.data.schoolId,
+                }
             }
+
+
             httpUtil.wxPut(httpUtil.interfaces.updateUserInfo, params).then((res: any) => {
                 console.log("更新个人信息成功:", res)
                 ConstsData.AppData.myInfoData = res.data.data

+ 95 - 22
miniprogram/component/teacher/teacherMonitor/monitor.ts

@@ -34,6 +34,7 @@ Component({
         deviceId: '',
         //0=未上课 1=正在上课
         pageState: 0,
+        hiddenInput: false,
 
         //#region 开始上课用到的数据
 
@@ -44,6 +45,13 @@ Component({
         hasGetFile: false,
         imgList: [],
         //#endregion
+
+
+        //弹窗
+        windowHidden: true,
+        windowRegion: 'test',
+        windowSchool: 'test',
+        windowClass: 'test'
     },
 
     lifetimes: {
@@ -51,11 +59,17 @@ Component({
             // 在组件实例被从页面节点树添加时执行
 
             this.getMyInfo();
+            this.setData({
+                pageState: ConstsData.AppData.monitorsPageIndex
+            })
+            // console.log("monitorsPageIndex:", ConstsData.AppData.monitorsPageIndex)
 
         },
         detached: function () {
             // 在组件实例被从页面节点树移除时执行
-
+            this.setData({
+                hasGetFile: false
+            })
         },
     },
 
@@ -79,17 +93,18 @@ Component({
                 this.changeOrganizeInfo()
             }
 
+            if (ConstsData.AppData.monitorsPageIndex == 1) {
+                this.setData({
+                    hasGetFile: true
+                })
+                this.getDocumentFile()
+            }
 
         },
 
 
         changeOrganizeInfo: function () {
 
-
-            //设置名字
-            this.setData({
-                userName: ConstsData.AppData.myInfoData.name
-            })
             //切换地区
             this.setData({
                 regionOne: [],
@@ -333,10 +348,27 @@ Component({
             var that = this;
             wx.scanCode({ //扫描API
                 success(res) { //扫描成功
-                    console.log(res) //输出回调信息
-                    that.setData({
-                        scanCodeMsg: res.result
-                    });
+                    console.log("扫码返回:", res.result) //输出回调信息
+                    let a = JSON.parse(res.result)
+                    console.log("res.result.deviceId:", a.deviceId)
+
+                    httpUtil.wxGet(httpUtil.interfaces.getDeviceById + a.deviceId, null).then((res: any) => {
+                        console.log("获取设备信息成功:", res)
+                        that.setData({
+                            deviceId: a.deviceId,
+                            windowRegion: res.data.data.provinceCity,
+                            windowSchool: res.data.data.schoolName,
+                            windowClass: res.data.data.className,
+                            hiddenInput: true,
+                            windowHidden: false,
+
+                        })
+                    }).catch((res) => {
+                        console.log("获取设备信息失败:", res)
+                    })
+                    // that.setData({
+                    //     scanCodeMsg: res.result
+                    // });
                     wx.showToast({
                         title: '扫码成功',
                         icon: 'success',
@@ -386,9 +418,11 @@ Component({
                         pageState: 1,
                         videoUrl: res.data.data.liveUrl,
                         lessId: res.data.data.id,
-                        hasGetFile: true
+                        hasGetFile: true,
+                        windowHidden: true
                     })
-                    this.triggerEvent('canChangeIndex', { canChange: false })
+                    ConstsData.AppData.monitorsPageIndex = 1
+                    // this.triggerEvent('canChangeIndex', { canChange: false })
                     this.getDocumentFile()
                 }
             }).catch((res) => {
@@ -413,9 +447,11 @@ Component({
                         console.log('点击确认回调')
                         that.setData({
                             pageState: 0,
-                            hasGetFile: false
+                            hasGetFile: false,
+                            hiddenInput: false
                         })
-                        that.triggerEvent('canChangeIndex', { canChange: true })
+                        ConstsData.AppData.monitorsPageIndex = 0
+                        // that.triggerEvent('canChangeIndex', { canChange: true })
                     } else {
                         console.log('点击取消回调')
                     }
@@ -429,24 +465,50 @@ Component({
         getDocumentFile: function () {
             let that = this;
             let params = {
-                lessId: that.data.lessId,
-                deviceId: that.data.deviceId,
-                userId: httpUtil.httpData.userId,
+                lessId: '',
+                deviceId: '',
+                userId: '',
                 pageNo: 1,
-                pageSize: 100000,
-
+                pageSize: 100000
             }
+            if (ConstsData.AppData.monitorsPageGetDocumentParams.lessId) {
+                params = {
+                    lessId: that.data.lessId,
+                    deviceId: that.data.deviceId,
+                    userId: httpUtil.httpData.userId,
+                    pageNo: 1,
+                    pageSize: 100000,
+                }
+                ConstsData.AppData.monitorsPageGetDocumentParams = params
+            } else {
+                params = ConstsData.AppData.monitorsPageGetDocumentParams
+            }
+
+
             httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
                 console.log("获取所有文件成功:", res)
+                let showarr: any[] = []
+                res.data.data.list.forEach((item) => {
+                    if (item.type == 0) {
+                        showarr.push(item)
+                    }
+                })
                 that.setData({
-                    imgList: res.data.data.list
+                    imgList: showarr
                 })
                 let getfile = setInterval(function () {
                     if (that.data.hasGetFile) {
                         httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
                             console.log("获取所有文件成功:", res)
+
+                            let showarr: any[] = []
+                            res.data.data.list.forEach((item) => {
+                                if (item.type == 0) {
+                                    showarr.push(item)
+                                }
+                            })
                             that.setData({
-                                imgList: res.data.data.list
+                                imgList: showarr
                             })
                         }).catch((res) => {
                             console.log("获取所有文件失败:", res)
@@ -460,11 +522,22 @@ Component({
             })
 
 
-        }
+        },
 
 
 
         ////#endregion
+
+        hideWindow: function () {
+            this.setData({
+                hiddenInput: false,
+                windowHidden: true
+            })
+            return true;
+        },
+
     }
 
+
+
 })

+ 117 - 65
miniprogram/component/teacher/teacherMonitor/monitor.wxml

@@ -1,96 +1,148 @@
 <!--pages/teacher/monitor/monitor.wxml-->
-<view wx:if="{{pageState==0}}" class="container" style="background-color: #F4F4F4;">
-    <view class="qrcode_layout">
-        <view class="qrcode_layout_bg" bindtap="scanCode">
-            <image src="../../../image/teacher/qrcode.png" style="width:60rpx;height:60rpx"></image>
-            <text>扫一扫</text>
+<view>
+    <view wx:if="{{pageState==0}}" class="container" style="background-color: #F4F4F4;">
+        <view class="qrcode_layout">
+            <view class="qrcode_layout_bg" bindtap="scanCode">
+                <image src="../../../image/teacher/qrcode.png" style="width:60rpx;height:60rpx"></image>
+                <text>扫一扫</text>
+            </view>
+        </view>
+        <view class="center_layout">
+            <text class="center_title">上课地点</text>
+            <view class="center_picker_layout">
+                <!--选择地区-->
+                <view class="item_input_bg" style=" margin-top: 0rpx;   box-shadow: 0px 1px 0px 0px #EEEEEE;">
+                    <text class="item_input_title">地区:</text>
+                    <picker mode="multiSelector" bindchange="bindRegionChange" bindcolumnchange="bindMultiPickerColumnChange" range="{{region}}" class="item_picker_bg" value="{{regionIndex}}">
+                        <view class="item_picker_content">
+                            <p> {{region[0][regionIndex[0]]}} </p>
+                            <p> {{region[1][regionIndex[1]]}} </p>
+                            <p> {{region[2][regionIndex[2]]}} </p>
+                        </view>
+                    </picker>
+                    <view class="item_picker_icon_layout">
+                        <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+                    </view>
+                </view>
+                <!--选择地区 end-->
+                <!--选择学校-->
+                <view class="item_input_bg" style=" margin-top: 2rpx;box-shadow: 0px 1px 0px 0px #EEEEEE;">
+                    <text class="item_input_title">学校:</text>
+                    <picker mode="multiSelector" bindcolumnchange="bindSchoolPicker" range="{{schoolArray}}" value="{{[schoolIndex,0]}}" class="item_picker_bg">
+                        <view class="item_picker_content">
+                            {{schoolArray[0][schoolIndex]}}
+                        </view>
+                    </picker>
+                    <view class="item_picker_icon_layout">
+                        <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+                    </view>
+                </view>
+                <!--选择学校end-->
+                <!--选择班级-->
+                <view class="item_input_bg" style=" margin-top: 2rpx;box-shadow: 0px 1px 0px 0px #EEEEEE;">
+                    <text class="item_input_title">班级:</text>
+                    <picker bindchange="bindClssPicker" value="{{classIndex}}" range="{{classArray}}" class="item_picker_bg">
+                        <view class="item_picker_content">
+                            {{classArray[classIndex]}}
+                        </view>
+                    </picker>
+                    <view class="item_picker_icon_layout">
+                        <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+                    </view>
+                </view>
+                <!--选择班级end-->
+                <view class="item_input_bg" style="margin-top: 1rpx;">
+                    <text class="item_input_title">设备ID:</text>
+                    <input class="item_input_content" placeholder="请输入设备ID" bindinput="bindDeviceInput" value="{{deviceId}}" hidden="{{hiddenInput}}" />
+                </view>
+            </view>
+            <view class="login_btn_layout" style="margin-left: 0rpx;margin-top: 190rpx;" bindtap="startMonitor">
+                <button class="login_btn" style="width: 100%; margin-left: 0rpx;font-size: 36rpx;font-weight: 400;">开始上课</button>
+            </view>
+        </view>
+
+
+    </view>
+
+
+
+    <!--开始上课之后-->
+    <view wx:if="{{pageState==1}}" class="container" style="background-color: #F4F4F4;">
+        <view style="margin-top: 33rpx;">
+            <text class="title">设备监控</text>
+        </view>
+        <!--播放视频的视频框-->
+        <view style="width: 100%;height: 422rpx; background-color: blue;margin-top: 40rpx;;display: flex;">
+            <live-player style="width: 100%; height: 100%; " src="{{videoUrl}}" autoplay="{{true}}"></live-player>
+            <view style="width: 100%;height: 422rpx; position: absolute;">
+                <view class="light_green {{videostatus==1?'light_red':''}}"></view>
+            </view>
+        </view>
+        <!--播放视频的视频框-->
+
+        <!-- 快照-->
+        <view style="margin-top:48rpx;font-size:25rpx;font-weight: 500;">
+            <text style="margin-left:10rpx">快照</text>
+            <scroll-view scroll-x class="image_scroll">
+                <view wx:for="{{imgList}}" wx:key="index" style="display:inline-block;">
+                    <image class="image" src="{{item.url}}"></image>
+                    <view class="image_index">{{index+1}}</view>
+                </view>
+            </scroll-view>
         </view>
+        <!-- 快照-->
+        <!-- 下课按钮-->
+        <view>
+            <image bindtap="classOver" class="class_over" src="../../../image/teacher/class_over.png"></image>
+        </view>
+        <!-- 下课按钮-->
     </view>
-    <view class="center_layout">
-        <text class="center_title">上课地点</text>
+    <!--开始上课之后-->
+
+</view>
+
+<!--扫码显示弹窗-->
+<view class="container" hidden="{{windowHidden}}" catchtap="hideWindow">
+
+
+    <view style="width: 100%; height: 100%; background-color: rgba(0,0,0,0.60);;position: absolute; left: 0;top: 0;display: flex;justify-content: center;">
         <view class="center_picker_layout">
             <!--选择地区-->
-            <view class="item_input_bg" style=" margin-top: 0rpx;   box-shadow: 0px 1px 0px 0px #EEEEEE;">
+            <view class="item_input_bg" style=" margin-top: 300rpx;   box-shadow: 0px 1px 0px 0px #EEEEEE;">
                 <text class="item_input_title">地区:</text>
-                <picker mode="multiSelector" bindchange="bindRegionChange" bindcolumnchange="bindMultiPickerColumnChange" range="{{region}}" class="item_picker_bg" value="{{regionIndex}}">
-                    <view class="item_picker_content">
-                        <p> {{region[0][regionIndex[0]]}} </p>
-                        <p> {{region[1][regionIndex[1]]}} </p>
-                        <p> {{region[2][regionIndex[2]]}} </p>
-                    </view>
-                </picker>
+                <text class="item_picker_content">{{windowRegion}}</text>
                 <view class="item_picker_icon_layout">
-                    <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+
                 </view>
             </view>
             <!--选择地区 end-->
             <!--选择学校-->
             <view class="item_input_bg" style=" margin-top: 2rpx;box-shadow: 0px 1px 0px 0px #EEEEEE;">
                 <text class="item_input_title">学校:</text>
-                <picker mode="multiSelector" bindcolumnchange="bindSchoolPicker" range="{{schoolArray}}" value="{{[schoolIndex,0]}}" class="item_picker_bg">
-                    <view class="item_picker_content">
-                        {{schoolArray[0][schoolIndex]}}
-                    </view>
-                </picker>
+                <text class="item_picker_content">{{windowSchool}}</text>
                 <view class="item_picker_icon_layout">
-                    <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+
                 </view>
             </view>
             <!--选择学校end-->
             <!--选择班级-->
             <view class="item_input_bg" style=" margin-top: 2rpx;box-shadow: 0px 1px 0px 0px #EEEEEE;">
                 <text class="item_input_title">班级:</text>
-                <picker bindchange="bindClssPicker" value="{{classIndex}}" range="{{classArray}}" class="item_picker_bg">
-                    <view class="item_picker_content">
-                        {{classArray[classIndex]}}
-                    </view>
-                </picker>
+                <text class="item_picker_content">{{windowClass}}</text>
                 <view class="item_picker_icon_layout">
-                    <image src="../../../image/teacher/dropdown_icon.png" class="item_picker_icon"></image>
+
                 </view>
             </view>
             <!--选择班级end-->
             <view class="item_input_bg" style="margin-top: 1rpx;">
                 <text class="item_input_title">设备ID:</text>
-                <input class="item_input_content" placeholder="请输入设备ID" bindinput="bindDeviceInput" value="{{deviceId}}" />
+                <text class="item_input_content" style="overflow: hidden;text-overflow: ellipsis;">{{deviceId}}</text>
+            </view>
+            <view class="login_btn_layout" style="margin-left: 0rpx;margin-top: 30rpx;justify-content: center;width: 100%;" bindtap="startMonitor">
+                <button class="login_btn" style="width: 100%; margin-left: 0rpx;font-size: 36rpx;font-weight: 400;">开始上课</button>
             </view>
         </view>
-        <view class="login_btn_layout" style="margin-left: 0rpx;margin-top: 190rpx;" bindtap="startMonitor">
-            <button class="login_btn" style="width: 100%; margin-left: 0rpx;font-size: 36rpx;font-weight: 400;">开始上课</button>
-        </view>
-    </view>
-</view>
-
-
-<!--开始上课之后-->
-<view wx:if="{{pageState==1}}" class="container" style="background-color: #F4F4F4;">
-    <view style="margin-top: 33rpx;">
-        <text class="title">设备监控</text>
-    </view>
-    <!--播放视频的视频框-->
-    <view style="width: 100%;height: 422rpx; background-color: blue;margin-top: 40rpx;;display: flex;">
-        <live-player style="width: 100%; height: 100%; " src="{{videoUrl}}" autoplay="{{true}}"></live-player>
-        <view style="width: 100%;height: 422rpx; position: absolute;">
-            <view class="light_green {{videostatus==1?'light_red':''}}"></view>
-        </view>
-    </view>
-    <!--播放视频的视频框-->
 
-    <!-- 快照-->
-    <view style="margin-top:48rpx;font-size:25rpx;font-weight: 500;">
-        <text style="margin-left:10rpx">快照</text>
-        <scroll-view scroll-x class="image_scroll">
-            <view wx:for="{{imgList}}" wx:key="index" style="display:inline-block;">
-                <image class="image" src="{{item.url}}"></image>
-                <view class="image_index">{{index+1}}</view>
-            </view>
-        </scroll-view>
-    </view>
-    <!-- 快照-->
-    <!-- 下课按钮-->
-    <view>
-        <image bindtap="classOver" class="class_over" src="../../../image/teacher/class_over.png"></image>
     </view>
-    <!-- 下课按钮-->
 </view>
-<!--开始上课之后-->
+<!--扫码显示弹窗-->

+ 8 - 2
miniprogram/pages/document/document.ts

@@ -9,7 +9,8 @@ Page({
         lessId: '',
         itemList: null,
         showItemIndex: 0,
-        downloadAll: false
+        downloadAll: false,
+        pageTitle:''
     },
 
     /**
@@ -22,7 +23,11 @@ Page({
         }
         this.setData({
             lessId: options.lessId,
-            downloadAll: bool
+            downloadAll: bool,
+            pageTitle:options.pageTitle
+        })
+        wx.setNavigationBarTitle({
+            title: options.pageTitle
         })
         this.getDocumentAll();
 
@@ -57,6 +62,7 @@ Page({
             this.setData({
                 itemList: res.data.data.list
             })
+ 
             if (this.data.downloadAll) {
                 //下载全部
                 console.log("this.data.downloadAll:", this.data.downloadAll)

+ 86 - 3
miniprogram/pages/index/index.ts

@@ -10,7 +10,13 @@ Page({
      * 页面的初始数据
      */
     data: {
-        init: false
+        init: false,
+        userType: '',
+        userRole: '',
+        teacherEnable: false,
+        installerEnable: false,
+        repairmanEnable: false,
+        itEnable: false
     },
 
     /**
@@ -19,7 +25,11 @@ Page({
     onLoad() {
 
 
+    },
+
 
+
+    onShow() {
         httpUtil.wxGet(httpUtil.interfaces.getOrganizeAll, null).then((res: any) => {
             ConstsData.AppData.organizeInfo = res.data
             storage.getStorage(storage.storageKey.userId).then((res: any) => {
@@ -28,8 +38,38 @@ Page({
                     console.log("获取个人信息成功:", myinfo)
                     ConstsData.AppData.myInfoData = myinfo.data.data
                     this.setData({
-                        init: true
+                        init: true,
+                        userType: myinfo.data.data.type,
+                        userRole: myinfo.data.data.role
                     })
+                    console.log("this.data.userType:", this.data.userType)
+
+                    let typeArr: string[] = []
+                    if (this.data.userRole) {
+
+                        typeArr = this.data.userRole.split(",")
+                    }
+                    switch (Number(this.data.userType)) {
+                        case 0:
+                        //超级管理员,判断userRole
+                        case 1:
+                        //区域管理员,判断userRole
+                        case 2:
+                            //普通管理员,判断userRole
+                            if (typeArr) {
+                                this.choseType(typeArr)
+                            }
+                            break;
+                        case 3:
+                            //教师,除了教师亮,其他都不亮
+                            this.setData({
+                                teacherEnable: true,
+                                installerEnable: false,
+                                repairmanEnable: false,
+                                itEnable: false
+                            })
+                            break;
+                    }
                 })).catch((myinfo) => {
                     console.log("获取个人信息失败:", myinfo)
                     this.setData({
@@ -39,7 +79,11 @@ Page({
             }).catch((res) => {
                 console.log("获取保存的UID失败了=", res)
                 this.setData({
-                    init: true
+                    init: true,
+                    teacherEnable: true,
+                    installerEnable: true,
+                    repairmanEnable: true,
+                    itEnable: true
                 })
             })
         }).catch((res) => {
@@ -50,6 +94,33 @@ Page({
         })
 
     },
+
+    choseType: function (arr: any[]) {
+        arr.forEach((item: any) => {
+            switch (Number(item)) {
+                case 1:
+                    //安装员
+                    this.setData({
+                        installerEnable: true
+                    })
+                    break;
+                case 2:
+                    //IT管理员
+                    this.setData({
+                        itEnable: true
+                    })
+                    break;
+                case 3:
+                    //维修员
+                    this.setData({
+                        repairmanEnable: true
+                    })
+                    break;
+            }
+        });
+    },
+
+
     clickItem: function (event: any) {
         if (!this.data.init) {
             wx.showToast({
@@ -63,21 +134,33 @@ Page({
         let toUrl = '';
         switch (Number(event.target.id)) {
             case 0:
+                if (!this.data.teacherEnable) {
+                    return;
+                }
                 console.log("click teacher")
                 type = loginType.Teacher
                 toUrl = "../teacher/index/index"
                 break;
             case 1:
+                if (!this.data.installerEnable) {
+                    return;
+                }
                 console.log("click installer")
                 type = loginType.Installer
                 toUrl = "../installer/index/index"
                 break;
             case 2:
+                if (!this.data.repairmanEnable) {
+                    return;
+                }
                 console.log("click repairman")
                 type = loginType.Repairman
                 toUrl = "../repairman/index/index"
                 break;
             case 3:
+                if (!this.data.itEnable) {
+                    return;
+                }
                 console.log("click it")
                 type = loginType.IT
                 toUrl = "../itadministrator/index/index"

+ 5 - 5
miniprogram/pages/index/index.wxml

@@ -2,25 +2,25 @@
 
 <view class="container">
     <view class="page">
-      
+
         <text style="margin-top: 200rpx;">请选择身份</text>
         <view class="layout">
             <view class="item_bg">
-                <view class="teacher" id="0" bindtap="clickItem">
+                <view class="{{teacherEnable ?'teacher':'teacher_enable_false'}}" id="0" bindtap="clickItem">
                     <image id="0" class="item_icon" src="../../image/index/teacher.png"></image>
                     <text id="0" class="item_text">教师</text>
                 </view>
-                <view class="installer" id="1" bindtap="clickItem">
+                <view class="{{installerEnable ?'installer':'installer_enable_false'}}" id="1" bindtap="clickItem">
                     <image id="1" class="item_icon" src="../../image/index/installer.png"></image>
                     <text id="1" class="item_text">安装员</text>
                 </view>
             </view>
             <view class="item_bg">
-                <view class="repairman" id="2" bindtap="clickItem">
+                <view class="{{repairmanEnable ?'repairman':'repairman_enable_false'}}" id="2" bindtap="clickItem">
                     <image id="2" class="item_icon" src="../../image/index/repairman.png"></image>
                     <text id="2" class="item_text">维修员</text>
                 </view>
-                <view class="it" id="3" bindtap="clickItem">
+                <view class="{{itEnable ?'it':'it_enable_false'}}" id="3" bindtap="clickItem">
                     <image id="3" class="item_icon" src="../../image/index/it.png"></image>
                     <text id="3" class="item_text">IT管理员</text>
                 </view>

+ 45 - 0
miniprogram/pages/index/index.wxss

@@ -42,6 +42,17 @@
     border-radius: 10px;
 }
 
+.teacher_enable_false {
+    width: 250rpx;
+    height: 250rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    background: linear-gradient(136deg, #838383 2%, #838383);
+    border-radius: 10px;
+}
+
 .installer {
     width: 250rpx;
     height: 250rpx;
@@ -53,6 +64,18 @@
     border-radius: 10px;
 }
 
+.installer_enable_false {
+    width: 250rpx;
+    height: 250rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    background: linear-gradient(135deg, #838383 2%, #838383 38%);
+    border-radius: 10px;
+}
+
+
 .repairman {
     width: 250rpx;
     height: 250rpx;
@@ -64,6 +87,17 @@
     border-radius: 10px;
 }
 
+.repairman_enable_false {
+    width: 250rpx;
+    height: 250rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    background: linear-gradient(135deg, #838383 2%, #838383 38%);
+    border-radius: 10px;
+}
+
 .it {
     width: 250rpx;
     height: 250rpx;
@@ -75,6 +109,17 @@
     border-radius: 10px;
 }
 
+.it_enable_false {
+    width: 250rpx;
+    height: 250rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    background: linear-gradient(135deg, #838383 2%, #838383 38%);
+    border-radius: 10px;
+}
+
 .item_icon {
     height: 76rpx;
     width: 76rpx

+ 63 - 4
miniprogram/pages/login/login.ts

@@ -19,7 +19,11 @@ Page({
     inputPwdText: '',
     hasGetVCode: false,
     getVCodeText: "获取验证码",
-    getvcodeInter: -5
+    getvcodeInter: -5,
+    teacherEnable: false,
+    installerEnable: false,
+    repairmanEnable: false,
+    itEnable: false
   },
 
   onLoad(opention: any) {
@@ -179,14 +183,26 @@ Page({
         console.log("登录成功:", res)
         httpUtil.httpData.userId = res.data.data.id;
         ConstsData.AppData.myInfoData = res.data.data
-
         storage.saveStorage(storage.storageKey.userId, res.data.data.id).then((res) => {
           console.log("保存成功:", res)
         }).catch((res) => {
           console.log("保存失败:", res)
         })
+        if (ConstsData.AppData.myInfoData.type == 3) {
+          this.setData({
+            teacherEnable: true
+          })
+          //是老师,并且点击进入的也是老师
+          if (Number(this.data.loginType) == loginType.Teacher) {
+            this.toNextPage()
+          }
+        } else {
+          if (!res.data.data.role) {
+            let arr = res.data.data.role.split(",")
+            this.choseType(arr)
+          }
+        }
 
-        this.toNextPage();
       } else {
         console.log("登录失败:", res)
         this.showToast(res.data.message)
@@ -258,7 +274,50 @@ Page({
     })
   },
 
-
+  choseType: function (arr: any[]) {
+    arr.forEach((item: any) => {
+      switch (Number(item)) {
+        case 1:
+          //安装员
+          this.setData({
+            installerEnable: true
+          })
+          //如果是安装员,又从安装员进来的
+          if (this.data.loginType == loginType.Installer) {
+            this.toNextPage();
+          } else {
+            console.log("没有权限")
+            wx.navigateBack()
+          }
+          break;
+        case 2:
+          //IT管理员
+          this.setData({
+            itEnable: true
+          })
+
+          if (this.data.loginType == loginType.Installer) {
+            this.toNextPage();
+          } else {
+            console.log("没有权限")
+            wx.navigateBack()
+          }
+          break;
+        case 3:
+          //维修员
+          this.setData({
+            repairmanEnable: true
+          })
+          if (this.data.loginType == loginType.Repairman) {
+            this.toNextPage();
+          } else {
+            console.log("没有权限")
+            wx.navigateBack()
+          }
+          break;
+      }
+    });
+  },
   //登录成功后跳转界面
   toNextPage: function () {
 

+ 5 - 0
miniprogram/utils/const.ts

@@ -53,6 +53,11 @@ const AppData = {
         type: 3,
         userName: ""
     },
+
+    monitorsPageIndex:0,
+    monitorsPageGetDocumentParams:{
+        lessId:''
+    }