Bladeren bron

Merge branch 'master' of http://git.cc-lotus.info/ball-court/court-badminton

zs 2 jaren geleden
bovenliggende
commit
9583b61899
9 gewijzigde bestanden met toevoegingen van 159 en 6 verwijderingen
  1. 1 0
      app.json
  2. 9 0
      commpents/form/index.js
  3. 7 0
      commpents/form/index.wxml
  4. 47 1
      pages/match/mess.js
  5. 3 2
      pages/match/mess.json
  6. 36 1
      pages/match/mess.less
  7. 26 1
      pages/match/mess.wxml
  8. 29 0
      pages/match/mess.wxss
  9. 1 1
      pages/register/index.js

+ 1 - 0
app.json

@@ -1,5 +1,6 @@
 {
     "pages": [
+ 
         "pages/index/index",
         "pages/register/index",
         "pages/home/index",

+ 9 - 0
commpents/form/index.js

@@ -47,6 +47,15 @@ Component({
             data[model] = value;
             this.setData({ form: data })
         },
+        onOChange(event) {
+            const data = this.data.form;
+            const model = event.target?.dataset?.model;
+            const value = event?.detail?.value;
+            if (!model) return;
+            data[model] = value;
+            this.setData({ form: data })
+
+        },
         uploadIcon(event) {
             const data = event?.detail;
             if (!data) return;

+ 7 - 0
commpents/form/index.wxml

@@ -10,6 +10,13 @@
                 <f-upload list="{{form[f.model]}}" bind:imgUpload="uploadIcon" bind:imgDel="deleteImg"></f-upload>
             </view>
         </view>
+        <view wx:elif="{{f.type==='idCard'}}">
+            <van-field label="{{f.label}}">
+                <view slot="input">
+                    <input type="idcard" bind:input="onOChange" data-model="{{f.model}}" />
+                </view>
+            </van-field>
+        </view>
         <view wx:else>
             <van-field label="{{f.label}}" value="{{form[f.model]}}" bind:change="onChange" data-model="{{f.model}}">
             </van-field>

+ 47 - 1
pages/match/mess.js

@@ -1,4 +1,6 @@
+import { match_status } from '../../utils/dict';
 const app = getApp()
+
 Page({
 
     /**
@@ -7,28 +9,36 @@ Page({
     data: {
         frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
         list: [],
-        searchInfo: {}
+        searchInfo: {},
+        dialog: { title: '赛事状态', show: false, type: '1' },
+        form: {},
+        statusList: match_status
     },
     // 跳转菜单
     back(e) {
         wx.navigateBack({ delta: 1 })
     },
+    // 查询
     search: function (e) {
         const that = this;
         that.setData({ 'searchInfo.name': e.detail.value });
         that.watchLogin()
     },
+    // 添加
     toAdd: function () {
         wx.navigateTo({ url: `/pages/match/matchadd` })
     },
+    // 详情
     toView: function (e) {
         const { item } = e.currentTarget.dataset;
         console.log(item);
     },
+    // 修改
     toEdit: function (e) {
         const { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/match/matchadd?id=${item._id}` })
     },
+    // 删除
     toDel: async function (e) {
         const { item } = e.currentTarget.dataset;
         wx.showModal({
@@ -47,6 +57,42 @@ Page({
             }
         })
     },
+    // 赛事组别
+    toGroup: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.navigateTo({ url: `/pages/match/matchgroup?id=${item._id}` })
+    },
+    // 赛事状态
+    toStatus: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        that.setData({ form: item });
+        that.setData({ dialog: { title: '赛事状态', show: true, type: '1' } });
+    },
+    // 选择状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        that.setData({ 'form.status': data.label })
+        that.setData({ 'form.status_name': data.value })
+    },
+    // 提交
+    onSubmit: async function (e) {
+        const that = this;
+        const arr = await app.$post(`/newCourt/api/match/${e.detail.value._id}`, e.detail.value)
+        if (arr.errcode == '0') {
+            wx.showToast({ title: `信息维护成功`, icon: 'success', duration: 2000 });
+            that.watchLogin();
+            that.toClose();
+        } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '赛事状态', show: false, type: '1' } })
+    },
+
     /**
      * 生命周期函数--监听页面加载
      */

+ 3 - 2
pages/match/mess.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+        "mobile-main": "/commpents/mobile-frame/index",
+        "e-dialog": "/commpents/dialog/index"
     }
-  }
+}

+ 36 - 1
pages/match/mess.less

@@ -34,7 +34,7 @@
 
             button {
                 font-size: 14px;
-            
+
             }
         }
     }
@@ -128,4 +128,39 @@
             }
         }
     }
+}
+
+.dialog_1 {
+    width: 80vw;
+
+    .content {
+        background-color: #ffffff;
+        border-bottom: 1px solid #cccccc;
+        display: flex;
+        flex-direction: row;
+        justify-content: space-between;
+        padding: 2vw;
+        width: 76vw;
+
+        .label {
+            width: 25vw;
+            text-align: left;
+            font-size: 14px;
+        }
+
+        .value {
+            width: 65vw;
+            text-align: right;
+            font-size: 14px;
+
+            textarea {
+                width: 65vw;
+            }
+        }
+    }
+
+    .btn {
+        margin: 2vw 0 0 0;
+        text-align: center;
+    }
 }

+ 26 - 1
pages/match/mess.wxml

@@ -49,4 +49,29 @@
             </scroll-view>
         </view>
     </view>
-</mobile-main>
+</mobile-main>
+<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">赛事状态</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="statusChange" value="{{form.status}}" name="status" range-key='value' range="{{statusList}}">
+                            <view class="input">{{form.status_name||'请选择赛事状态'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" form-type="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</e-dialog>

+ 29 - 0
pages/match/mess.wxss

@@ -105,3 +105,32 @@
   margin: 0 2vw 2vw 2vw;
   font-size: 14px;
 }
+.dialog_1 {
+  width: 80vw;
+}
+.dialog_1 .content {
+  background-color: #ffffff;
+  border-bottom: 1px solid #cccccc;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding: 2vw;
+  width: 76vw;
+}
+.dialog_1 .content .label {
+  width: 25vw;
+  text-align: left;
+  font-size: 14px;
+}
+.dialog_1 .content .value {
+  width: 65vw;
+  text-align: right;
+  font-size: 14px;
+}
+.dialog_1 .content .value textarea {
+  width: 65vw;
+}
+.dialog_1 .btn {
+  margin: 2vw 0 0 0;
+  text-align: center;
+}

+ 1 - 1
pages/register/index.js

@@ -11,7 +11,7 @@ Page({
         fields: [
             { label: '头像', model: 'icon', type: "upload" },
             { label: '姓名', model: 'name' },
-            { label: '身份证号', model: 'card' },
+            { label: '身份证号', model: 'card', type:'idCard' },
             { label: '性别', model: 'gender', type: 'select' },
             { label: '手机号', model: 'phone' },
             { label: '邮箱', model: 'email' },