Browse Source

线索池

zhaoxiaohai 3 năm trước cách đây
mục cha
commit
58f869e7db

+ 41 - 41
pages/threadedTree/index.js

@@ -12,11 +12,45 @@ Page({
         },
         list: [],
         sort: null,
-        tagColor: '#FA8C16'
+        tagColor: '#FA8C16',
+        sheetTitle: '',
+        scrollHeight: 0, //滚动区域高度
+        initInsert: true, //用于初始化新建组件
     },
     onLoad(options) {
         this.getList()
     },
+    /* 打开弹窗 */
+    openSheet(e) {
+        const {
+            title
+        } = e.target.dataset;
+        this.setData({
+            sheetTitle: title
+        })
+    },
+    /* 结束新建 */
+    endInsert() {
+        this.sheetClose();
+        this.setData({
+            initInsert: false
+        })
+        setTimeout(() => {
+            this.setData({
+                initInsert: true
+            })
+        }, 10);
+        wx.showToast({
+            title: '保存成功!'
+        });
+        this.getList(true);
+    },
+    /* 关闭弹窗 */
+    sheetClose() {
+        this.setData({
+            sheetTitle: ""
+        })
+    },
     /* 查询列表 */
     getList(init = false) {
         if (init.detail != undefined) init = init.detail;
@@ -101,46 +135,12 @@ Page({
                 scrollHeight: res
             })
         })
-    },
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
+        const that = this;
+        wx.getSystemInfo({
+            success: (res => that.setData({
+                scrollHeight: res.windowHeight
+            }))
+        });
 
     },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
 })

+ 2 - 1
pages/threadedTree/index.json

@@ -3,6 +3,7 @@
     "usingComponents": {
         "Search": "./modules/search/search",
         "List": "./modules/list/list",
-        "FloatingButton": "./modules/FloatingButton/index"
+        "FloatingButton": "./modules/FloatingButton/index",
+        "Insert": "./modules/insert/insert"
     }
 }

+ 15 - 0
pages/threadedTree/index.scss

@@ -9,4 +9,19 @@ page {
     font-family: PingFang SC-Bold, PingFang SC !important;
     font-weight: bold !important;
     color: #999999;
+}
+
+/* 弹窗 */
+.popup {
+    .header {
+        width: 100%;
+        height: 90rpx;
+        line-height: 90rpx;
+        text-align: center;
+        border-bottom: 1px solid #EEEEEE;
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
 }

+ 10 - 2
pages/threadedTree/index.wxml

@@ -11,11 +11,19 @@
 
 <!-- 浮动按钮 -->
 <FloatingButton>
-    <image style="width: 100rpx; height: 100rpx; transform: translate(-50%,-50%);" src='../../static/image/add.png' />
+    <image style="width: 100rpx; height: 100rpx; transform: translate(-50%,-50%);" src='../../static/image/add.png' data-title="新建线索" bindtap="openSheet" />
 </FloatingButton>
 
 <My_listBox id='ListBox' bindgetlist="getList" height='{{scrollHeight}}'>
     <List list='{{list}}' tagColor='{{tagColor}}' />
     <My_empty wx:if="{{list.length==0}}" />
     <view style="height: 50px;" />
-</My_listBox>
+</My_listBox>
+
+<!-- 抽屉 -->
+<van-popup class="popup" show="{{ sheetTitle }}" custom-style="height: 100vh;" position="bottom" round closeable bind:close='sheetClose'>
+    <view class="header">{{sheetTitle}}</view>
+    <scroll-view scroll-y style="height:{{scrollHeight}}rpx;">
+        <Insert wx:if="{{initInsert}}" bind:endInsert='endInsert' />
+    </scroll-view>
+</van-popup>