Browse Source

1.故障详情界面数据修改
2.评论界面
3.评论接口
4.手机号验证码登录

FailedToRead 2 years ago
parent
commit
91d20ab24b

+ 2 - 2
miniprogram/app.json

@@ -9,8 +9,8 @@
         "pages/installer/index/index",
         "pages/repairman/index/index",
         "pages/itadministrator/index/index",
-        "pages/document/document"
-     
+        "pages/document/document",
+        "pages/comment/comment"
     ],
     "window": {
         "backgroundTextStyle": "light",

+ 7 - 1
miniprogram/component/fauleInfoItem/faultInfoItem.ts

@@ -13,7 +13,8 @@ Component({
      */
     data: {
         myItemData: null,
-        itemTime: ''
+        itemTime: '',
+        imgArr: [],
     },
 
     lifetimes: {
@@ -26,6 +27,11 @@ Component({
                 itemTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.created), "yyyy-MM-dd HH:mm"),
 
             })
+            if (this.properties.itemData.img) {
+                this.setData({
+                    imgArr: this.properties.itemData.img.split(',')
+                })
+            }
 
         },
         detached: function () {

+ 2 - 2
miniprogram/component/fauleInfoItem/faultInfoItem.wxml

@@ -10,8 +10,8 @@
         <text class="contentLayoutText">{{myItemData.describe}}</text>
     </view>
 
-    <scroll-view scroll-x class="itemImgScroll">
-        <view wx:for="{{6}}" class="itemScrollItem" wx:key="index">
+    <scroll-view scroll-x class="itemImgScroll" wx:if="{{imgArr.length()>0}}">
+        <view wx:for="{{imgArr}}" class="itemScrollItem" wx:key="index">
             <image class="itemScrollItemImg"></image>
         </view>
 

+ 5 - 12
miniprogram/component/faultItem/faultItem.ts

@@ -1,5 +1,4 @@
-// component/faultItem/faultItem.ts
-import { httpUtil } from '../../utils/restful';
+
 import { TimeUtil } from '../../utils/TimeUtil'
 Component({
     /**
@@ -56,19 +55,13 @@ Component({
      */
     methods: {
         toFaultInfoPage: function () {
-            console.log("去故障详情界面")
-            httpUtil.wxGet(httpUtil.interfaces.getFaultInfoByDevId + this.data.itemData.id, null).then((res: any) => {
-                console.log("获取故障详情成功:", res)
+            console.log("去故障详情界面:", this.data.itemData.id)
 
-                let item = JSON.stringify(res.data.data)
+            wx.navigateTo({
+                url: '../../faultInfo/faultInfo?faultId=' + this.data.itemData.id,
+            })
 
-                wx.navigateTo({
-                    url: '../../faultInfo/faultInfo?item=' + item
-                })
 
-            }).catch((res: any) => {
-                console.log("获取故障详情失败:", res)
-            })
 
         }
     }

+ 1 - 1
miniprogram/component/faultItem/faultItem.wxml

@@ -1,7 +1,7 @@
 <!--component/faultItem/faultItem.wxml-->
 
 <view class="item_bg" bindtap="toFaultInfoPage">
-    <view class="{{status==0?'fault_status_wait':''}} {{status==1?'fault_status_over':''}}  {{status==1?'fault_status_repair':''}}">
+    <view class="{{status==0?'fault_status_wait':''}} {{status==2?'fault_status_over':''}}  {{status==1?'fault_status_repair':''}}">
         <text class="fault_status_text">{{statusText}}</text>
     </view>
 

+ 1 - 1
miniprogram/component/teacher/teacherFault/teacherFault.wxml

@@ -79,7 +79,7 @@
                 <view wx:for="{{postFaultListImg}}" wx:key="index" style="display:inline-block;">
                     <image class="fault_info_scroll_item" src="{{item}}"></image>
                 </view>
-                <image class="fault_info_scroll_item" style="background-color: red;" bindtap="getFaultImg"></image>
+                <image class="fault_info_scroll_item" src="../../../image/teacher/fault_add_img.png" bindtap="getFaultImg"></image>
             </scroll-view>
         </view>
 

+ 0 - 1
miniprogram/component/teacher/teacherFault/teacherFault.wxss

@@ -96,7 +96,6 @@
 .fault_info_scroll_item {
     width: 167rpx;
     height: 93rpx;
-    background-color: saddlebrown;
     margin-left: 10rpx;
     margin-right: 10rpx;
 }

+ 6 - 5
miniprogram/component/teacher/teacherMonitor/monitor.ts

@@ -43,7 +43,7 @@ Component({
         videoUrl: '',
         lessId: '',
         hasGetFile: false,
-        imgList: [],
+        imgList: Array<String>(),
         //#endregion
 
 
@@ -185,7 +185,7 @@ Component({
                 })
 
                 let newArray: string[] = [];
-                res.data.data.forEach((element, index) => {
+                res.data.data.forEach((element: any, index: any) => {
                     if (ConstsData.AppData.myInfoData.schoolId == element.id) {
                         this.setData({
                             schoolIndex: index,
@@ -376,6 +376,7 @@ Component({
                     })
                 },
                 fail: (res: any) => {//接口调用失败的回调函数
+                    console.log("扫码失败res:", res)
                     wx.showToast({
                         title: '扫码失败',
                         icon: 'success',
@@ -487,8 +488,8 @@ Component({
 
             httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
                 console.log("获取所有文件成功:", res)
-                let showarr: any[] = []
-                res.data.data.list.forEach((item) => {
+                let showarr: String[] = []
+                res.data.data.list.forEach((item: any) => {
                     if (item.type == 0) {
                         showarr.push(item)
                     }
@@ -502,7 +503,7 @@ Component({
                             console.log("获取所有文件成功:", res)
 
                             let showarr: any[] = []
-                            res.data.data.list.forEach((item) => {
+                            res.data.data.list.forEach((item: any) => {
                                 if (item.type == 0) {
                                     showarr.push(item)
                                 }

BIN
miniprogram/image/comment/comment_good_false.png


BIN
miniprogram/image/comment/comment_good_true.png


BIN
miniprogram/image/comment/comment_notgood_false.png


BIN
miniprogram/image/comment/comment_notgood_true.png


BIN
miniprogram/image/comment/comment_verygood_false.png


BIN
miniprogram/image/comment/comment_verygood_true.png


BIN
miniprogram/image/teacher/fault_add_img.png


+ 4 - 0
miniprogram/pages/comment/comment.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "评价"
+}

+ 89 - 0
miniprogram/pages/comment/comment.ts

@@ -0,0 +1,89 @@
+// pages/comment/comment.ts
+import { httpUtil } from "../../utils/restful"
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        veryGoodStatus: true,
+        veryGoodUrls: '../../image/comment/comment_verygood_true.png',
+        goodStatus: false,
+        goodUrls: "../../image/comment/comment_good_false.png",
+        notGoodStatus: false,
+        notGoodUrl: "../../image/comment/comment_notgood_false.png",
+        postFaultId: '',
+        describe: ''
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        this.setData({
+            postFaultId: options.faultId
+        })
+    },
+
+    commitComment: function (e: any) {
+        let content = e.detail.value['send - input'] ? e.detail.value['send - input'] : e.detail.value
+        console.log("1====", content)
+        this.setData({
+            describe: content
+        })
+        this.postComment()
+    },
+    clickVeryGood() {
+        this.setData({
+            veryGoodStatus: true,
+            veryGoodUrls: '../../image/comment/comment_verygood_true.png',
+            goodStatus: false,
+            goodUrls: "../../image/comment/comment_good_false.png",
+            notGoodStatus: false,
+            notGoodUrl: "../../image/comment/comment_notgood_false.png"
+        })
+    },
+    clickGood() {
+        this.setData({
+            veryGoodStatus: false,
+            veryGoodUrls: '../../image/comment/comment_verygood_false.png',
+            goodStatus: true,
+            goodUrls: "../../image/comment/comment_good_true.png",
+            notGoodStatus: false,
+            notGoodUrl: "../../image/comment/comment_notgood_false.png"
+        })
+    },
+    clickNotGood() {
+        this.setData({
+            veryGoodStatus: false,
+            veryGoodUrls: '../../image/comment/comment_verygood_false.png',
+            goodStatus: false,
+            goodUrls: "../../image/comment/comment_good_false.png",
+            notGoodStatus: true,
+            notGoodUrl: "../../image/comment/comment_notgood_true.png"
+        })
+    },
+
+    postComment: function () {
+        let params = {
+            faultId: this.data.postFaultId,
+            describe: this.data.describe
+        }
+        httpUtil.wxPost(httpUtil.interfaces.postComment, params).then((res => {
+            console.log("提交评论成功:", res)
+            wx.showToast({
+                title: '提交成功',
+                duration: 1000
+            })
+            setTimeout(function () {
+                wx.navigateBack()
+            }, 1000)
+        })).catch((res) => {
+            console.log("提交评论失败:", res)
+            wx.showToast({
+                title: '提交失败',
+                duration: 1000
+            })
+        })
+    }
+})

+ 23 - 0
miniprogram/pages/comment/comment.wxml

@@ -0,0 +1,23 @@
+<!--pages/comment/comment.wxml-->
+<view class="container" style="display: flex;justify-content: start;flex-direction: column;align-items: center;">
+    <view class="topLayout">
+        <view class="topLayout_Item" catchtap="clickVeryGood">
+            <image src="{{veryGoodUrls}}" class="topLayout_Item_Img"></image>
+            <text class="{{veryGoodStatus?'topLayout_Item_Text_true':'topLayout_Item_Text_false'}}">很满意</text>
+        </view>
+        <view class="topLayout_Item" catchtap="clickGood">
+            <image src="{{goodUrls}}" class="topLayout_Item_Img"></image>
+            <text class="{{goodStatus?'topLayout_Item_Text_true':'topLayout_Item_Text_false'}}">很满意</text>
+        </view>
+        <view class="topLayout_Item" catchtap="clickNotGood">
+            <image src="{{notGoodUrl}}" class="topLayout_Item_Img"></image>
+            <text class="{{notGoodStatus?'topLayout_Item_Text_true':'topLayout_Item_Text_false'}}">很满意</text>
+        </view>
+    </view>
+
+
+    <view style="border: 1rpx solid #505050; width:90%;margin-top: 57rpx;height: 444rpx;">
+        <textarea style="padding: 20rpx;" maxlength="-1" placeholder="我要攒/吐槽" bindconfirm="commitComment" confirm-type="send" confirm-hold="{{true}}"></textarea>
+    </view>
+
+</view>

+ 35 - 0
miniprogram/pages/comment/comment.wxss

@@ -0,0 +1,35 @@
+/* pages/comment/comment.wxss */
+
+.topLayout {
+    height: 142rpx;
+    width: 85%;
+    margin-top: 42rpx;
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+}
+
+.topLayout_Item {
+    height: 100%;
+    width: 100rpx;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+}
+
+.topLayout_Item_Img {
+    width: 80rpx;
+    height: 80rpx;
+}
+
+.topLayout_Item_Text_true {
+    font-size: 30rpx;
+    color: #f5a725;
+    width: 100%;
+}
+
+.topLayout_Item_Text_false {
+    font-size: 30rpx;
+    color: #505050;
+    width: 100%;
+}

+ 5 - 5
miniprogram/pages/document/document.ts

@@ -10,7 +10,7 @@ Page({
         itemList: null,
         showItemIndex: 0,
         downloadAll: false,
-        pageTitle:''
+        pageTitle: ''
     },
 
     /**
@@ -24,10 +24,10 @@ Page({
         this.setData({
             lessId: options.lessId,
             downloadAll: bool,
-            pageTitle:options.pageTitle
+            pageTitle: options.pageTitle
         })
         wx.setNavigationBarTitle({
-            title: options.pageTitle
+            title: options.pageTitle?.toString()
         })
         this.getDocumentAll();
 
@@ -62,11 +62,11 @@ Page({
             this.setData({
                 itemList: res.data.data.list
             })
- 
+
             if (this.data.downloadAll) {
                 //下载全部
                 console.log("this.data.downloadAll:", this.data.downloadAll)
-                this.data.itemList.forEach((item, index) => {
+                this.data.itemList.forEach((item: { type: any; }, index: string) => {
                     this.selectComponent('#documentItem' + index).downLoadItem(1, item.type);
                 });
             }

+ 52 - 72
miniprogram/pages/faultInfo/faultInfo.ts

@@ -1,4 +1,6 @@
 // pages/faultInfo/faultInfo.ts
+// component/faultItem/faultItem.ts
+import { httpUtil } from '../../utils/restful';
 Page({
 
     /**
@@ -6,100 +8,78 @@ Page({
      */
     data: {
         //是否隐藏评价按钮
-        showAppraise: true,
+        showAppraise: false,
         contentLineHeight: 0,
-        itemData: null,
+        itemData: {
+            id: ''
+        },
         faultLevText: '',
-        imgList: []
+        imgList: [],
+        faultId: '',
+        faultProcessList: []
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        let obj = JSON.parse(options.item);
-        console.log("obnj-----", obj)
-        let showAppraise = true
-        if (obj.processType == 2) {
-            showAppraise = false
-        }
-        // 0:普通 1:待查 2:紧急
-        let faulevText = '';
-        switch (obj.faultLevel) {
-            case 0:
-                faulevText = '普通'
-                break;
-            case 1:
-                faulevText = '待查'
-                break;
-            case 2:
-                faulevText = '紧急'
-                break;
-        }
         this.setData({
-            itemData: obj,
-            showAppraise: showAppraise,
-            faultLevText: faulevText,
-            imgList: obj.img.split(',')
+            faultId: options.faultId
         })
-        console.log("imgList:", this.data.imgList)
-    },
 
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
 
     },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-        let that = this;
-        //创建节点选择器
-        var query = wx.createSelectorQuery();
-        //选择id
-        query.select('#contentView').boundingClientRect()
-        query.exec(function (res) {
-            that.setData({
-                contentLineHeight: res[0].height
-            })
-        })
-    },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
+    onShow() {
 
-    },
+        console.log("获取的ID:", this.data.faultId)
+        httpUtil.wxGet(httpUtil.interfaces.getFaultInfoByDevId + this.data.faultId, null).then((res: any) => {
+            console.log("获取故障详情成功:", res)
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
+            let item = res.data.data
+            let showAppraise = true
+            if (item.processType == 2) {
+                showAppraise = false
+            }
+            // 0:普通 1:待查 2:紧急
+            let faulevText = '';
+            switch (item.faultLevel) {
+                case 0:
+                    faulevText = '普通'
+                    break;
+                case 1:
+                    faulevText = '待查'
+                    break;
+                case 2:
+                    faulevText = '紧急'
+                    break;
+            }
 
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
+            this.setData({
+                faultProcessList: [],
+            })
+            this.setData({
 
-    },
+                itemData: item,
+                showAppraise: showAppraise,
+                faultLevText: faulevText,
+                imgList: item.img.split(','),
+                faultProcessList: item.faultProcessList
+            })
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
+            console.log("imgList:", this.data.imgList)
 
+        }).catch((res: any) => {
+            console.log("获取故障详情失败:", res)
+        })
     },
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
+    toCommentPage: function () {
+        // console.log("itemData:", this.data.itemData)
+        console.log(" this.data.itemData.id:", this.data.itemData.id)
+        wx.navigateTo({
+            url: "../../pages/comment/comment?faultId=" + this.data.itemData.id,
+        })
     }
 })

+ 2 - 2
miniprogram/pages/faultInfo/faultInfo.wxml

@@ -11,7 +11,7 @@
 
                         <view id="contentView" style="display: flex;flex-direction: column;justify-content: start;  align-items: center;">
                             <view class="centerInfoLayout_Line" style="height: {{contentLineHeight}}px;"></view>
-                            <view wx:for="{{itemData.faultProcessList}}" wx:key="index">
+                            <view wx:for="{{faultProcessList}}" wx:key="index">
                                 <faultInfoItem itemData="{{item}}"></faultInfoItem>
                             </view>
                         </view>
@@ -51,7 +51,7 @@
         </scroll-view>
 
 
-        <view class="appraiseLayout" hidden="{{showAppraise}}">
+        <view class="appraiseLayout" hidden="{{showAppraise}}" catchtap="toCommentPage">
             <text style="font-size: 31rpx;color: #ffffff;">评价</text>
         </view>
     </view>

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

@@ -33,6 +33,7 @@ Page({
         httpUtil.wxGet(httpUtil.interfaces.getOrganizeAll, null).then((res: any) => {
             ConstsData.AppData.organizeInfo = res.data
             storage.getStorage(storage.storageKey.userId).then((res: any) => {
+
                 httpUtil.httpData.userId = res.data
                 httpUtil.wxGet(httpUtil.interfaces.getUserById, null).then(((myinfo: any) => {
                     console.log("获取个人信息成功:", myinfo)
@@ -42,11 +43,8 @@ Page({
                         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)) {
@@ -72,6 +70,7 @@ Page({
                     }
                 })).catch((myinfo) => {
                     console.log("获取个人信息失败:", myinfo)
+
                     this.setData({
                         init: true
                     })

+ 40 - 11
miniprogram/pages/login/login.ts

@@ -61,7 +61,7 @@ Page({
   },
 
   // 获取验证码
-  clickGetVCode: function (event: any) {
+  clickGetVCode: function () {
     console.log("账号密码登录")
     if (this.data.hasGetVCode) {
       this.showToast("请勿频繁点击")
@@ -88,7 +88,7 @@ Page({
       }
       time--;
       that.setData({
-        getVCodeText: time.toString(),
+        getVCodeText: time.toString() + "秒",
         hasGetVCode: true
       })
     }, 1000)
@@ -104,7 +104,7 @@ Page({
 
 
   //账号密码登录——---------------------------
-  showAccountPwd: function (event: any) {
+  showAccountPwd: function () {
     if (this.data.showAccPwd) {
       this.setData({
         showAccPwd: false
@@ -118,7 +118,7 @@ Page({
 
 
   //显示修改密码的框
-  showUpdatePwdLayout: function (event: any) {
+  showUpdatePwdLayout: function () {
 
     if (this.data.showUpdatePassWordLayout) {
       this.setData({
@@ -238,7 +238,27 @@ Page({
         }).catch((res) => {
           console.log("保存失败:", res)
         })
-        this.toNextPage()
+        if (Number(ConstsData.AppData.myInfoData.type) == 3) {
+          //走了3里面
+          this.setData({
+            teacherEnable: true
+          })
+          //是老师,并且点击进入的也是老师
+          if (Number(this.data.loginType) == loginType.Teacher) {
+            this.toNextPage()
+          } else {
+            this.goBack()
+          }
+        } else {
+          console.log("走了不是3")
+          if (!res.data.data.role) {
+            let arr = res.data.data.role.split(",")
+            this.choseType(arr)
+          } else {
+            this.goBack()
+            wx.navigateBack()
+          }
+        }
       } else {
         this.showToast(res.data.message)
       }
@@ -286,8 +306,7 @@ Page({
           if (this.data.loginType == loginType.Installer) {
             this.toNextPage();
           } else {
-            console.log("没有权限")
-            wx.navigateBack()
+            this.goBack()
           }
           break;
         case 2:
@@ -299,8 +318,7 @@ Page({
           if (this.data.loginType == loginType.Installer) {
             this.toNextPage();
           } else {
-            console.log("没有权限")
-            wx.navigateBack()
+            this.goBack()
           }
           break;
         case 3:
@@ -311,8 +329,7 @@ Page({
           if (this.data.loginType == loginType.Repairman) {
             this.toNextPage();
           } else {
-            console.log("没有权限")
-            wx.navigateBack()
+            this.goBack()
           }
           break;
       }
@@ -345,6 +362,18 @@ Page({
     })
   },
 
+
+  goBack: function () {
+    wx.showToast({
+      title: '身份选择错误',
+      icon: 'none',
+      duration: 1000
+    })
+    setTimeout(function () {
+      wx.navigateBack()
+    }, 1000)
+  },
+
   showToast: function (message: string) {
     wx.showToast({
       title: message,

+ 2 - 2
miniprogram/pages/register/register.ts

@@ -268,7 +268,7 @@ Page({
     },
 
     //获取验证码
-    getVerificationCode: function (event: any) {
+    getVerificationCode: function () {
 
         if (this.data.hasGetVCode) {
             this.showToast("请勿频繁点击")
@@ -295,7 +295,7 @@ Page({
             }
             time--;
             that.setData({
-                getVCodeText: time.toString(),
+                getVCodeText: time.toString() + "秒",
                 hasGetVCode: true
             })
         }, 1000)

+ 8 - 4
miniprogram/utils/const.ts

@@ -54,11 +54,15 @@ const AppData = {
         userName: ""
     },
 
-    monitorsPageIndex:0,
-    monitorsPageGetDocumentParams:{
-        lessId:''
+    monitorsPageIndex: 0,
+    monitorsPageGetDocumentParams: {
+        lessId: '',
+        deviceId: '',
+        userId: '',
+        pageNo: 1,
+        pageSize: 100000,
     }
-    
+
 
 
 }

+ 3 - 0
miniprogram/utils/restful.ts

@@ -70,8 +70,11 @@ const interfaces = {
 
     //获取文件夹所有文件接口(拼接ID)(删除文件delete方法)
     getDocumentFile: '/tch/document',
+
     //#endregion
 
+    //提交评价
+    postComment: '/tch/faultProcess',
 
 
 }