zhaoxiaohai 3 éve
szülő
commit
d334001337

+ 34 - 5
packageA/group/index.js

@@ -17,19 +17,47 @@ Page({
         result: [],
     },
     onLoad(options) {
+        //是否为单选
+        if (options.radio) this.setData({
+            radio: true
+        })
         if (options.ownertable) {
             this.setData({
-                content: {
-                    ...options
-                }
+                "content.ownertable": options.ownertable,
+                "content.ownerid": options.ownerid,
             });
             this.getList();
             console.log(this.data.content)
         };
-        if (options.radio) this.setData({
-            radio: true
+    },
+    submit() {
+        let result = this.data.result;
+        if (result.length == 0) return;
+        console.log(result)
+        _Http.basic({
+            "id": 20220930103601,
+            "content": {
+                "ownertable": this.data.content.ownertable,
+                "ownerid": this.data.content.ownerid,
+                "userids": result
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            wx.showToast({
+                title: '保存成功',
+                icon: "none"
+            });
+            setTimeout(() => {
+                const pages = getCurrentPages();
+                pages[pages.length - 2].selectComponent("#Group").getList();
+                wx.navigateBack();
+            }, 300)
         })
     },
+    /* 选中 */
     onChange(e) {
         const userid = e.currentTarget.dataset.item.userid + "";
         if (!userid) return;
@@ -49,6 +77,7 @@ Page({
             })
         }
     },
+    //获取列表
     getList(init = false) {
         let content = this.data.content;
         if (init) {

+ 1 - 1
packageA/group/index.wxml

@@ -27,7 +27,7 @@
     <view class="count">
         已选:{{result.length}}
     </view>
-    <van-button custom-class='but'>确定</van-button>
+    <van-button custom-class='but' disabled='{{result.length==0}}' bindtap="submit">确定</van-button>
 </view>
 
 <wxs module="active">

+ 3 - 9
packageA/group/modules/Yl-group/index.js

@@ -2,14 +2,8 @@ const _Http = getApp().globalData.http;
 Component({
     properties: {
         add: Boolean, //是否允许新增
-        ownertable: {
-            type: String,
-            value: "sa_itemgroup"
-        },
-        ownerid: {
-            type: String,
-            value: 11
-        }
+        ownertable: String,
+        ownerid: String
     },
     data: {
         list: [],
@@ -21,7 +15,7 @@ Component({
                 "content": {
                     ownertable: this.data.ownertable,
                     ownerid: this.data.ownerid,
-                    pageSize: this.data.add ? 8 : 9
+                    pageSize: 5
                 }
             }).then(res => {
                 console.log("团队", res)

+ 2 - 2
packageA/group/modules/Yl-group/index.scss

@@ -37,9 +37,9 @@
         align-items: center;
         justify-content: center;
         flex-shrink: 0;
-        width: 64rpx;
+        width: 80rpx;
         height: 64rpx;
-        border-radius: 50%;
+        border-radius: 32rpx;
 
         >view {
             display: flex;

+ 2 - 2
packageA/group/modules/Yl-group/index.wxml

@@ -4,9 +4,9 @@
     </view>
     <view class="list">
         <!-- 最多八个 -->
-        <block wx:for="{{8}}">
+        <block wx:for="{{list}}" wx:key="item.userid">
             <navigator url="#" class="item">
-                z
+                {{item.name[0]}}
             </navigator>
         </block>
     </view>