瀏覽代碼

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

guhongwei 2 年之前
父節點
當前提交
76e2821af8
共有 5 個文件被更改,包括 11 次插入18 次删除
  1. 9 14
      pages/match/project.js
  2. 0 1
      pages/match/project.less
  3. 1 1
      pages/match/project.wxml
  4. 0 1
      pages/match/project.wxss
  5. 1 1
      pages/match/projectadd.js

+ 9 - 14
pages/match/project.js

@@ -7,18 +7,18 @@ Page({
      */
     data: {
         frameStyle: { useTop: true, name: '比赛管理', leftArrow: true, useBar: false },
-        //查询条件
-        searchName: '',
-        list: [{
-            name: '测试',
-            explain: '比赛说明',
-            num: 1
-        }]
+        searchInfo: {},
+        list: []
     },
     // 跳转菜单
     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/projectadd` })
@@ -49,12 +49,6 @@ Page({
             }
         })
     },
-    // 查询信息
-    onSearch: function (e) {
-        const that = this;
-        that.setData({ searchName: e.detail });
-        that.watchLogin();
-    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -67,11 +61,12 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let searchInfo = that.data.searchInfo;
         wx.getStorage({
             key: 'user',
             success: async res => {
                 let info = {};
-                if (that.data.searchName) info.name = that.data.searchName;
+                if (searchInfo && searchInfo.name) info.name = searchInfo.name;
                 const arr = await app.$get(`/newCourt/api/matchProject/`, { ...info });
                 if (arr.errcode == '0') {
                     that.setData({ list: arr.data });

+ 0 - 1
pages/match/project.less

@@ -67,7 +67,6 @@
                         margin: 0 0 2vw 0;
 
                         .list_2 {
-                            width: 80vw;
                             padding: 0 0 0 2vw;
 
                             .name {

+ 1 - 1
pages/match/project.wxml

@@ -2,7 +2,7 @@
     <view slot="info" class="container main">
         <view class="zero one">
             <view class="one_1">
-                <input type="text" value="{{searchInfo.name}}" placeholder="请输入比赛名称" />
+                <input type="text" value="{{searchInfo.name}}" bindconfirm="search" placeholder="请输入比赛名称" />
             </view>
             <view class="one_2">
                 <button type="primary" size="mini" bindtap="toAdd">添加</button>

+ 0 - 1
pages/match/project.wxss

@@ -60,7 +60,6 @@
   margin: 0 0 2vw 0;
 }
 .main .two .scroll-view .list-scroll-view .list .info .list_2 {
-  width: 80vw;
   padding: 0 0 0 2vw;
 }
 .main .two .scroll-view .list-scroll-view .list .info .list_2 .name {

+ 1 - 1
pages/match/projectadd.js

@@ -15,7 +15,7 @@ Page({
         id: ''
     },
     initValidate() {
-        const rules = { name: { required: true }, type: { required: true }, explain: { required: true }, num: { required: true } }
+        const rules = { name: { required: true }, type: { required: true }, explain: { required: true }, num: { required: true, digits: true } }
         // 验证字段的提示信息,若不传则调用默认的信息
         const messages = { name: { required: '请输入比赛项目名称', }, type: { required: '请选择类型', }, explain: { required: '请输入比赛项目说明', }, num: { required: '请输入比赛人数' } };
         this.WxValidate = new WxValidate(rules, messages)