Prechádzať zdrojové kódy

1.文件夹tab下搜索框实现
2.文件夹点击更多搜索框压在上层问题

FailedToRead 2 rokov pred
rodič
commit
f17b5ce1c5

+ 4 - 4
miniprogram/component/fileBottomPop/fileBottomPop.ts

@@ -20,7 +20,7 @@ Component({
         pageWidth: 0,
         windowType: -1,
         hideModal: true,
-        itemData: null,
+        itemData: { id: '', lessonId: '', url: '', lessId: '' },
         fileName: '',
         uploadTime: '',
         expireTime: '',
@@ -77,7 +77,7 @@ Component({
         // 隐藏遮罩层 
         hideModal: function () {
             var that = this;
-
+            this.triggerEvent("hideWindow")
             that.setData({
                 hideModal: true
             })
@@ -161,7 +161,7 @@ Component({
                 let params = {
                     id: this.data.itemData.id
                 }
-                httpUtil.wxDel(httpUtil.interfaces.createLess, params).then((res) => {
+                httpUtil.wxDel(httpUtil.interfaces.createLess, params).then(() => {
                     this.delVoer()
                 }).catch((res) => {
                     console.log("删除失败:", res)
@@ -172,7 +172,7 @@ Component({
                     id: this.data.itemData.id,
                     lessonId: this.data.itemData.lessonId
                 }
-                httpUtil.wxDel(httpUtil.interfaces.getDocumentFile, params).then((res) => {
+                httpUtil.wxDel(httpUtil.interfaces.getDocumentFile, params).then(() => {
                     this.delVoer()
                 }).catch((res) => {
                     console.log("删除失败:", res)

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

@@ -1,7 +1,7 @@
 <!--component/fileBottomPop/fileBottomPop.wxml-->
 <view catchtap="" class="container" hidden="{{hideModal}}">
     <view style="height: {{pageHeight}}px; width: {{pageWidth}}px;background: rgba(0,0,0,0.70);" catchtap="hideModal">
-        <view class="layout" catchtap="none">
+        <view id="actionLayout" class="layout" catchtap="none">
             <view class="content_layout">
                 <view class="toplayout">
                     <view class="img_name_layout">

+ 1 - 3
miniprogram/component/fileBottomPop/fileBottomPop.wxss

@@ -1,9 +1,7 @@
 /* component/fileBottomPop/fileBottomPop.wxss */
 
 
-.topclick_layout{
-    
-}
+
 
 .layout {
     height: 70%;

+ 24 - 2
miniprogram/component/teacher/teacherFile/teacherFile.ts

@@ -12,7 +12,9 @@ Component({
      * 组件的初始数据
      */
     data: {
-        fileList: []
+        fileList: [],
+        hiddenInput: false,
+        inputText: ''
     },
     lifetimes: {
         attached: function () {
@@ -33,7 +35,8 @@ Component({
         getLessAll: function () {
             let params = {
                 pageNo: 1,
-                pageSize: 10000
+                pageSize: 10000,
+                title: this.data.inputText
             }
             httpUtil.wxGet(httpUtil.interfaces.createLess, params).then((res: any) => {
                 console.log("获取所有文件库成功", res)
@@ -46,12 +49,31 @@ Component({
                 console.log("获取所有文件库失败:", res)
             })
         },
+
+        inputSearch: function (e) {
+            let content = e.detail.value['search - input'] ? e.detail.value['search - input'] : e.detail.value
+            this.setData({
+                inputText: content
+            })
+            console.log(" this.data.inputText:", this.data.inputText)
+            this.getLessAll()
+        },
         showWindow: function (event: any) {
             // console.log("点击了更多的按钮:", event)
             this.triggerEvent("showWindow", { item: event.detail.item })
+            this.setData({
+                hiddenInput: true
+            })
+        },
+        hideWindow: function () {
+            console.log("hideWindow-- -- -- --")
+            this.setData({
+                hiddenInput: false
+            })
         },
         realod: function () {
             this.getLessAll()
+
         }
     }
 })

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

@@ -3,7 +3,7 @@
         <!--搜索框-->
         <view class="search_layout">
             <image class="search_layout_icon" src="../../../image/teacher/search_icon.png"></image>
-            <input class="search_layout_input" placeholder="输入关键词搜索" />
+            <input class="search_layout_input" placeholder="输入关键词搜索" hidden="{{hiddenInput}}" value="{{inputText}}" confirm-type="search" bindconfirm="inputSearch" />
         </view>
         <!--搜索框-->
         <view class="all_text_bg">
@@ -13,7 +13,7 @@
 
     <scroll-view scroll-y="true" class="scrollview">
         <view wx:for="{{fileList}}" class="scroll_item_bg" wx:key="index">
-            <fileItem itemData="{{item}}" bind:showWindow="showWindow"> </fileItem>
+            <fileItem itemData="{{item}}" bind:showWindow="showWindow" bind:hideWindow="hideWindow"> </fileItem>
         </view>
     </scroll-view>
 

+ 5 - 0
miniprogram/pages/teacher/index/index.ts

@@ -101,8 +101,13 @@ Page({
         window.showModal(event.detail.item, 0);
     },
 
+    hideWindow: function () {
+        this.selectComponent("#teacherFile").hideWindow();
+    },
+
     fileDel: function () {
         console.log("有文件被删除了")
         this.selectComponent("#teacherFile").realod();
     }
+
 })

+ 2 - 2
miniprogram/pages/teacher/index/index.wxml

@@ -6,7 +6,7 @@
 
 
         <teacherMonitor wx:if="{{currPageIndex==0}}" bind:canChangeIndex="canChangeIndex"></teacherMonitor>
-        <teacherFile wx:if="{{currPageIndex==1}}" bind:showWindow="showWindow" id="teacherFile"></teacherFile>
+        <teacherFile wx:if="{{currPageIndex==1}}" bind:showWindow="showWindow" id="teacherFile" bind:hideWindow="hideWindow"></teacherFile>
         <teacherFault wx:if="{{currPageIndex==2}}"></teacherFault>
         <myInfo wx:if="{{currPageIndex==3}}"></myInfo>
 
@@ -26,5 +26,5 @@
 </view>
 
 <!--文件夹弹出框-->
-<fileBottomPop id="popupwindow" style="position: absolute; left: 0;" bind:fileDel="fileDel"></fileBottomPop>
+<fileBottomPop id="popupwindow" style="position: absolute; left: 0;" bind:fileDel="fileDel" bind:hideWindow="hideWindow"></fileBottomPop>
 <!--文件夹弹出框-->