Browse Source

1.文件库界面
2.故障报修界面修改
3.修改切换tab方式

FailedToRead 2 years ago
parent
commit
394098035d

+ 11 - 9
miniprogram/component/faultItem/faultItem.wxss

@@ -4,19 +4,21 @@
     width: 701rpx;
     height: 169rpx;
     background: #ffffff;
-    border-radius: 7px;
-    box-shadow: 0px 1px 17px 0px rgba(0, 0, 0, 0.16);
+    border-radius: 7rpx;
+    box-shadow: 0px 1rpx 17rpx 0px rgba(0, 0, 0, 0.16);
     display: flex;
     flex-direction: row;
-    margin-top: 30rpx;
+   margin-bottom: 15rpx;
+   margin-top: 15rpx;
+    
 }
 
 .fault_status_wait {
     width: 134rpx;
     height: 169rpx;
     background: #f5a725;
-    border-radius: 7px 0px 0px 7px;
-    box-shadow: 0px 1px 17px 0px rgba(0, 0, 0, 0.16);
+    border-radius: 7rpx 0px 0px 7rpx;
+    box-shadow: 0px 1rpx 17rpx 0px rgba(0, 0, 0, 0.16);
     display: flex;
     justify-content: center;
     align-items: center;
@@ -26,8 +28,8 @@
     width: 134rpx;
     height: 169rpx;
     background: #64C55A;
-    border-radius: 7px 0px 0px 7px;
-    box-shadow: 0px 1px 17px 0px rgba(0, 0, 0, 0.16);
+    border-radius: 7rpx 0px 0px 7rpx;
+    box-shadow: 0px 1rpx 17rpx 0rpx rgba(0, 0, 0, 0.16);
     display: flex;
     justify-content: center;
     align-items: center;
@@ -37,8 +39,8 @@
     width: 134rpx;
     height: 169rpx;
     background: #CCCCCC;
-    border-radius: 7px 0px 0px 7px;
-    box-shadow: 0px 1px 17px 0px rgba(0, 0, 0, 0.16);
+    border-radius: 7rpx 0px 0px 7rpx;
+    box-shadow: 0px 1rpx 17rpx 0px rgba(0, 0, 0, 0.16);
     display: flex;
     justify-content: center;
     align-items: center;

+ 4 - 0
miniprogram/component/fileItem/fileItem.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 23 - 0
miniprogram/component/fileItem/fileItem.ts

@@ -0,0 +1,23 @@
+// component/fileItem/fileItem.ts
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+
+    }
+})

+ 9 - 0
miniprogram/component/fileItem/fileItem.wxml

@@ -0,0 +1,9 @@
+<!--component/fileItem/fileItem.wxml-->
+<view class="fileitem_bg">
+    <image src="../../image/teacher/file_icon.png" class="fileitem_icon"></image>
+    <view class="fileitem_content">
+        <text style="color: #333333;font-size: 34rpx;">春夏秋冬</text>
+        <text style="color: #333333;font-size: 28rpx;">上传时间:2021-12-11 11:00</text>
+    </view>
+    <image src="../../image/teacher/file_more.png" class="fileitem_more_icon"></image>
+</view>

+ 32 - 0
miniprogram/component/fileItem/fileItem.wxss

@@ -0,0 +1,32 @@
+/* component/fileItem/fileItem.wxss */
+.fileitem_bg {
+    width: 667rpx;
+    height: 99rpx;
+    margin-bottom: 48rpx;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+}
+
+.fileitem_icon {
+    width: 54rpx;
+    height: 44rpx
+}
+
+
+.fileitem_content {
+    flex: 1;
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+    justify-content: center;
+    margin-left: 18rpx;
+}
+
+.fileitem_more_icon {
+    width: 32rpx;
+    height: 7rpx;
+    align-self: flex-start;
+    margin-top: 21rpx;
+}

+ 7 - 8
miniprogram/component/teacher/teacherFault/teacherFault.wxml

@@ -1,15 +1,14 @@
-<!--component/teacher/teacherFault/teacherFault.wxml-->
-<view class="container">
+<view class="page">
     <view class="toptitle">
         <text class="toptitle_left">报修记录</text>
         <view class="toptitle_right">
             <text class="toptitle_right_text">报修记录</text>
-            <image src="../../../image/teacher/dropdown_icon.png" class="toptitle_right_icon"></image>
+            <image src="../../../image/teacher/dorpdown_white_icon.png" class="toptitle_right_icon"></image>
         </view>
     </view>
-    <view style="display: flex;flex-direction: column; justify-content: center; align-items: center;">
-        <fauleItem faultStatus="0"></fauleItem>
-        <fauleItem faultStatus="1"></fauleItem>
-        <fauleItem faultStatus="2"></fauleItem>
-    </view>
+    <scroll-view scroll-y="true" class="scrollview">
+        <view wx:for="{{30}}" class="scroll_item_bg">
+            <fauleItem faultStatus="{{index%3}}"></fauleItem>
+        </view>
+    </scroll-view>
 </view>

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

@@ -1,8 +1,16 @@
 /* component/teacher/teacherFault/teacherFault.wxss */
+.page {
+    display: flex;
+    flex-direction: column;
+    height: 100%;
+    align-items: center;
+    justify-content: flex-start;
+}
 
 .toptitle {
     display: flex;
     flex-direction: row;
+    width: 100%;
     justify-content: space-between;
     align-items: center;
 }
@@ -35,6 +43,20 @@
 
 .toptitle_right_icon {
     width: 24rpx;
-    height: 24rpx;
+    height: 14rpx;
     margin-left: 20rpx;
+}
+
+
+.scrollview {
+    margin-top: 25rpx;
+    flex: 1;
+    height: 0;
+    width: 100%;
+    margin-bottom: 112rpx;
+}
+
+.scroll_item_bg {
+    display: flex;
+    justify-content: center;
 }

+ 5 - 1
miniprogram/component/teacher/teacherFile/teacherFile.json

@@ -1,5 +1,9 @@
 {
     "component": true,
-    "usingComponents": {},
+    "usingComponents": {
+
+        "fileItem": "../../fileItem/fileItem"
+
+    },
     "navigationBarTitleText": "文件库"
 }

+ 19 - 1
miniprogram/component/teacher/teacherFile/teacherFile.ts

@@ -11,9 +11,27 @@ Component({
      * 组件的初始数据
      */
     data: {
-
+        scrollHeight: 0
     },
+    lifetimes: {
+        attached: function () {
+            // 在组件实例被从页面节点树添加时执行
+            let that = this;
+            wx.getSystemInfo({
+                success: function (res) {
+                    that.setData({
+                        scrollHeight: res.windowHeight
+                    });
+                }
+            });
+
 
+        },
+        detached: function () {
+            // 在组件实例被从页面节点树移除时执行
+
+        },
+    },
     /**
      * 组件的方法列表
      */

+ 20 - 2
miniprogram/component/teacher/teacherFile/teacherFile.wxml

@@ -1,2 +1,20 @@
-<!--component/teacher/teacherFile/teacherFile.wxml-->
-<text>component/teacher/teacherFile/teacherFile.wxml</text>
+<view class="page">
+    <view>
+        <!--搜索框-->
+        <view class="search_layout">
+            <image class="search_layout_icon"></image>
+            <input class="search_layout_input" placeholder="输入关键词搜索" />
+        </view>
+        <!--搜索框-->
+        <view class="all_text_bg">
+            <text class="all_text">全部文件</text>
+        </view>
+    </view>
+
+    <scroll-view scroll-y="true" class="scrollview">
+        <view wx:for="{{20}}" style="display: flex; justify-content: center;">
+            <fileItem></fileItem>
+        </view>
+
+    </scroll-view>
+</view>

+ 54 - 1
miniprogram/component/teacher/teacherFile/teacherFile.wxss

@@ -1 +1,54 @@
-/* component/teacher/teacherFile/teacherFile.wxss */
+/* component/teacher/teacherFile/teacherFile.wxss */
+
+.page {
+    display: flex;
+    flex-direction: column;
+    height: 100%;
+    align-items: center;
+    justify-content: flex-start;
+}
+
+.search_layout {
+    width: 716rpx;
+    height: 72rpx;
+    background: #f4f4f4;
+    border-radius: 7rpx;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+}
+
+.search_layout_icon {
+    width: 46rpx;
+    height: 46rpx;
+    background-color: red;
+    margin-left: 20rpx;
+}
+
+.search_layout_input {
+    margin-left: 34rpx;
+    flex: 1;
+    margin-right: 20rpx;
+    font-size: 31rpx;
+    color: #333333;
+}
+
+
+.all_text_bg {
+    margin-top: 38rpx;
+    width: 667rpx;
+    margin-left: 23rpx;
+}
+
+.all_text {
+    color: #6D6D6D;
+    font-size: 30rpx;
+    line-height: 42px;
+}
+
+.scrollview {
+    flex: 1;
+    height: 0;
+    width: 100%;
+    margin-bottom: 112rpx;
+}

BIN
miniprogram/image/teacher/dorpdown_white_icon.png


BIN
miniprogram/image/teacher/file_icon.png


BIN
miniprogram/image/teacher/file_more.png


BIN
miniprogram/image/teacher/search_icon.png


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

@@ -1,5 +1,5 @@
 // pages/index/index.ts
-
+import { httpUtil } from "../../utils/restful";
 import { loginType } from '../../utils/loginType'
 
 Page({
@@ -15,7 +15,11 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad() {
-
+        // httpUtil.wxGet(httpUtil.interfaces.getUserById, null).then((res) => {
+        //     console.log("res:", res)
+        // }).catch((res) => {
+        //     console.log(res)
+        // })
     },
     clickItem: function (event: any) {
         console.log(event.target.id)

+ 1 - 1
miniprogram/pages/teacher/index/index.ts

@@ -52,7 +52,7 @@ Page({
 
     //禁止用户手滑选项卡
     catchTouchMove: function () {
-        return false
+       
     },
 
     //选项卡滑动

+ 7 - 22
miniprogram/pages/teacher/index/index.wxml

@@ -1,28 +1,13 @@
 <!--pages/teacher/index/index.wxml-->
 <view class="container">
     <!-- 根据选项卡选择的index显示界面 -->
-    <swiper class='swiper' current='{{currPageIndex}}' duration="0">
-        <!-- 监控界面 -->
-        <swiper-item capture-catch:touchmove="catchTouchMove">
-            <teacherMonitor></teacherMonitor>
-        </swiper-item>
-        <!-- 监控界面 -->
-        <!-- 文件库界面 -->
-        <swiper-item capture-catch:touchmove="catchTouchMove">
-            <teacherFile></teacherFile>
-        </swiper-item>
-        <!-- 文件库界面 -->
-        <!-- 故障报修界面 -->
-        <swiper-item capture-catch:touchmove="catchTouchMove">
-            <teacherFault></teacherFault>
-        </swiper-item>
-        <!-- 故障报修界面 -->
-        <!-- 我的界面 -->
-        <swiper-item capture-catch:touchmove="catchTouchMove">
-            <myInfo></myInfo>
-        </swiper-item>
-        <!-- 我的界面 -->
-    </swiper>
+    <view style="width: 100%; height: 100%;">
+        <teacherMonitor wx:if="{{currPageIndex==0}}"></teacherMonitor>
+        <teacherFile wx:if="{{currPageIndex==1}}"></teacherFile>
+        <teacherFault wx:if="{{currPageIndex==2}}"></teacherFault>
+        <myInfo wx:if="{{currPageIndex==3}}"></myInfo>
+    </view>
+
     <!-- 根据选项卡选择的index显示界面 -->
     <!-- 选项卡tab -->
     <tabBar bind:selectItemIndex="selectItemIndex" tabItemJson="{{tabJson}}" initTabIndex="{{0}}"></tabBar>

+ 8 - 0
miniprogram/pages/teacher/index/index.wxss

@@ -3,4 +3,12 @@
 .swiper {
     width: 100%;
     height: 100%;
+}
+
+.swiper-disabled::after {
+    position: absolute;
+    content: '';
+    top: 0;
+    left: 0;
+    width: 100%;
 }

+ 72 - 0
miniprogram/utils/restful.ts

@@ -0,0 +1,72 @@
+const APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";
+const APPLICATION_JSON_UTF8_FORM = 'application/x-www-form-urlencoded;charset=UTF-8';
+const RESPONSE_OK = 20000;
+const TOKEN_BEOVERDUE = 40001;
+const TOKEN = wx.getStorageSync('accessToken') == null ? '' : wx.getStorageSync('accessToken');
+
+//测试环境
+// const HOST = 'http://192.168.1.106:9901';
+
+//正式环境
+const HOST = 'http://wordpad-api-test.efunbox.cn';
+
+//API接口
+const interfaces = {
+    //这里边放入请求的接口
+    //根据userId获取用户信息
+    getUserById: '/tch/user/getUserById'
+}
+
+function fun(url: String, type: any, data: any, otherType: any) {
+    if (!TOKEN) {
+        //这里可以做一个请求的拦截 看有没有携带token
+        console.log("Token:", TOKEN)
+    }
+    let promise = new Promise((resolve, reject) => {
+        wx.request({
+            url: HOST + url,
+            method: type,
+            data: type == 'GET' ? data : JSON.stringify(data),
+            header: {
+                'content-type': otherType ? APPLICATION_JSON_UTF8_FORM : APPLICATION_JSON_UTF8_VALUE,
+                'access-token': wx.getStorageSync('accessToken') == null ? '' : wx.getStorageSync('accessToken'),
+                'userId': TOKEN
+            },
+            success: function (res: any) {
+                wx.stopPullDownRefresh();
+                if (res) {
+                    resolve(res)
+                } else {
+                    wx.showToast({
+                        title: res.data.subMsg ? res.data.subMsg : res.data.msg,
+                        icon: 'none',
+                        duration: 2000
+                    })
+                }
+            },
+            fail: function (res: any) {
+                wx.stopPullDownRefresh();
+                reject(res)
+            }
+        })
+    })
+    return promise
+}
+export const httpUtil = {
+    interfaces,
+    wxGet: function (url: String, data: any) {
+        return fun(url, 'GET', data, null)
+    },
+    wxPost: function (url: String, data: any) {
+        return fun(url, 'POST', data, null)
+    },
+    wxFormPost: function (url: String, data: any) {
+        return fun(url, 'POST', data, 'formPost')
+    },
+    wxPut: function (url: String, data: any) {
+        return fun(url, 'PUT', data, null)
+    },
+    wxDel: function (url: String, data: any) {
+        return fun(url, 'DELETE', data, null)
+    }
+}