xiaohaizhao 2 gadi atpakaļ
vecāks
revīzija
1a1139b336

+ 2 - 1
app.json

@@ -158,7 +158,8 @@
                 "contacts/index",
                 "contacts/group",
                 "contacts/insert",
-                "contacts/detail"
+                "contacts/detail",
+                "select/group/select"
             ]
         }
     ],

+ 5 - 2
packageA/contacts/insert.js

@@ -133,13 +133,14 @@ Page({
             error: false,
             errMsg: "",
             type: "route",
-            url: "/packageA/project/modules/contacts/select/index",
+            url: "/packageA/select/group/select",
             value: "",
             query: "&radio=true",
             placeholder: "选择群组",
             valueName: "group",
             required: false,
-            checking: "base"
+            checking: "base",
+            interrupt: false
         }, {
             label: "备注",
             error: false,
@@ -299,6 +300,8 @@ Page({
             this.setData({
                 form
             })
+        } else if (data.label == '群组') {
+            console.log(data,form)
         }
     },
     /* 表单是否填写完成 */

+ 67 - 0
packageA/select/group/select.js

@@ -0,0 +1,67 @@
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+        condition: "",
+        defaultGroup: [],
+        myGroup: []
+    },
+    onLoad(options) {
+        this.getList()
+    },
+    getList(init = false) {
+        _Http.basic({
+            "id": "20220831164303",
+            "content": {
+                nocache: true,
+                type: 99,
+                pageSize: 9999,
+                where: {
+                    condition: this.data.condition
+                }
+            }
+        }).then(res => {
+            console.log("群组", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            });
+            this.setData({
+                defaultGroup: [res.data.find(v => v.groupname == '默认群组')],
+                myGroup: res.data.filter(v => v.sys_phonebookgroupid)
+            })
+        })
+    },
+    onSelected(e) {
+        let {
+            item
+        } = e.currentTarget.dataset;
+        console.log(item)
+        getApp().globalData.handleSelect && getApp().globalData.handleSelect({
+            id: [item.sys_phonebookgroupid],
+            item,
+            value: [item.groupname, [item.sys_phonebookgroupid]]
+        })
+    },
+    /* 开始搜索 */
+    startSearch({
+        detail
+    }) {
+        let condition = this.data.condition;
+        if (detail == condition) return;
+        this.setData({
+            condition: detail,
+        });
+        this.getList(true);
+    },
+    /* 取消搜索 */
+    onClear() {
+        this.setData({
+            condition: "",
+        });
+        this.getList(true);
+    },
+    onUnload() {
+        getApp().globalData.handleSelect = null;
+    }
+})

+ 4 - 0
packageA/select/group/select.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "选择群组"
+}

+ 84 - 0
packageA/select/group/select.scss

@@ -0,0 +1,84 @@
+page {
+    height: 100vh !important;
+    overflow: hidden !important;
+}
+
+.insert-group {
+    width: 100vw;
+    height: 100rpx;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0 30rpx;
+    background: #FFFFFF;
+    overflow: hidden;
+    box-sizing: border-box;
+
+    .title {
+        display: flex;
+        align-items: center;
+
+        .iconfont {
+            color: #52C41A;
+            font-size: 44rpx;
+        }
+
+        .text {
+            font-size: 28rpx;
+            font-family: PingFang SC, PingFang SC;
+            color: #333333;
+            margin-left: 30rpx;
+        }
+    }
+}
+
+.label {
+    font-size: 30rpx;
+    font-weight: bold;
+    color: #333333;
+    padding: 24rpx 30rpx;
+}
+
+.group {
+    display: flex;
+    align-items: center;
+    width: 750rpx;
+    height: 120rpx;
+    padding: 20rpx 30rpx;
+    background: #FFFFFF;
+    box-sizing: border-box;
+
+    .icon-box {
+        width: 80rpx;
+        height: 80rpx;
+        border-radius: 16rpx;
+        text-align: center;
+        line-height: 80rpx;
+        flex-shrink: 0;
+        margin-right: 20rpx;
+
+        .iconfont {
+            font-size: 38rpx;
+            color: #fff;
+        }
+    }
+
+    .text-box {
+        width: 0;
+        flex: 1;
+        height: 80rpx;
+
+        .title {
+            line-height: 40rpx;
+            font-size: 28rpx;
+            color: #333333;
+        }
+
+        .count {
+            line-height: 34rpx;
+            font-size: 24rpx;
+            color: #999999;
+            margin-top: 6rpx;
+        }
+    }
+}

+ 30 - 0
packageA/select/group/select.wxml

@@ -0,0 +1,30 @@
+<block wx:if="{{defaultGroup.length}}">
+    <view class="label">
+        系统群组
+    </view>
+    <navigator class="group" url="#" wx:for="{{defaultGroup}}" wx:key="rowindex" data-item="{{item}}" bindtap="onSelected">
+        <view class="icon-box" style="background-color: #FA8C16;">
+            <text class="iconfont icon-xiaochengxu_qunzu" />
+        </view>
+        <view class="text-box">
+            <view class="title">{{item.groupname}}</view>
+            <view class="count">已有{{item.count}}人</view>
+        </view>
+    </navigator>
+</block>
+
+<block wx:if="{{myGroup.length}}">
+    <view class="label">
+        自定义群组
+    </view>
+
+    <navigator class="group" url="#" wx:for="{{myGroup}}" wx:key="rowindex" data-item="{{item}}" bindtap="onSelected">
+        <view class="icon-box" style="background-color: #52C41A;">
+            <text class="iconfont icon-xiaochengxu_qunzu" />
+        </view>
+        <view class="text-box">
+            <view class="title line-1">{{item.groupname}}</view>
+            <view class="count">已有{{item.count}}人</view>
+        </view>
+    </navigator>
+</block>