Browse Source

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

guhongwei 3 years ago
parent
commit
4f832d16cc
8 changed files with 311 additions and 81 deletions
  1. 10 8
      pages/list/index.wxss
  2. 62 4
      pages/match/detail.js
  3. 34 1
      pages/match/detail.wxml
  4. 112 0
      pages/match/detail.wxss
  5. 79 53
      pages/me/index.js
  6. 11 12
      pages/me/index.wxml
  7. 3 2
      pages/me/index.wxss
  8. 0 1
      pages/modify/index.js

+ 10 - 8
pages/list/index.wxss

@@ -412,15 +412,15 @@ button {
 
 .fourhead1 {
   margin-left: 25%;
-  width: 55%;
-  height: 39.2px;
+  width: 75%;
+  height: 40.09px;
   overflow: hidden;
 }
 
 .fourhead2 {
-  margin-left: 5%;
-  width: 55%;
-  height: 39.2px;
+  margin-left: 10%;
+  width: 75%;
+  height: 40.09px;
   overflow: hidden;
 }
 
@@ -450,21 +450,23 @@ button {
 }
 
 .fourright1_2 {
+  float: left;
+  width: 100%;
   margin-top: 2%;
 }
 
 .fourright1_2o {
   float: left;
-  width: 20%;
+  width: 15%;
 }
 .fourright1_2oi {
   float: left;
-  width: 20%;
+  width: 15%;
 }
 
 .fourright1_2t {
   float: left;
-  width: 23%;
+  width: 26%;
   text-align: center;
   padding: 10px 0;
   font-size: 14px;

+ 62 - 4
pages/match/detail.js

@@ -15,7 +15,33 @@ Page({
     // 主体高度
     infoHeight: '',
     id: '',
-    schedulelist: []
+    //修改比分
+    form: [],
+    //详情数据
+    schedulelist: [],
+    showModal: false,
+  },
+  //验证是否输入
+  initValidate() {
+    const rules = { blue_branch: { required: true }, red_branch: { required: true, } }
+    // 验证字段的提示信息,若不传则调用默认的信息
+    const messages = { blue_branch: { required: '请输入蓝方比分', }, red_branch: { required: '请输入红方比分', } };
+    this.WxValidate = new WxValidate(rules, messages)
+  },
+  back: function () {
+    wx.navigateBack({ url: '/pages/home/index' })
+  },
+  //显示对话框
+  clickme: function () {
+    this.setData({
+      showModal: true
+    })
+  },
+  //关闭弹窗
+  go: function () {
+    this.setData({
+      showModal: false
+    })
   },
   //上传图片
   imgUpload: function (e) {
@@ -31,17 +57,47 @@ Page({
     let arr = data.filter((i, index) => index != e.detail.index)
     that.setData({ fileList: arr })
   },
-  back: function () {
-    wx.navigateBack({ url: '/pages/home/index' })
+  // 提交登录
+  formSubmit: function (e) {
+    const that = this;
+    let id = that.data.id;
+    const params = e.detail.value;
+    params.match_file = that.data.fileList;
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0];
+      wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+      return false
+    } else {
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/schedule/${id}`, //接口地址
+        method: 'post',
+        data: params,
+        success(res) {
+          if (res.data.errcode == 0) {
+            wx.showToast({
+              title: '保存成功',
+              duration: 2000,
+              icon: 'success',
+              success: (res) => { that.back() }
+            })
+          } else {
+            wx.showToast({ title: res.data.errmsg, icon: 'error', duration: 2000 })
+          }
+        }
+      })
+    }
   },
+
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
     const that = this;
     that.setData({ id: options.id })
+    //验证规则函数
+    this.initValidate();
     // 计算高度
-    this.searchHeight()
+    this.searchHeight();
     // 监听用户是否登录
     this.watchLogin();
   },
@@ -57,8 +113,10 @@ Page({
           method: 'get',
           data: {},
           success(res) {
+            let fileList = res.data.data.match_file;
             that.setData({
               schedulelist: res.data.data,
+              fileList: fileList,
             })
           }
         })

+ 34 - 1
pages/match/detail.wxml

@@ -77,7 +77,40 @@
       </view>
     </view>
     <view class="five">
-      <button class="button" form-type="submit">上传比分</button>
+      <button class="button" bindtap="clickme">上传比分</button>
+    </view>
+    <view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
+    <view class="modal" wx:if="{{showModal}}">
+      <view class="title">
+        <view class="modal_title">上传比分</view>
+        <view class="go" bindtap="go">
+          <image class="cuo" src="/image/cuo.png"></image>
+        </view>
+      </view>
+      <form catchsubmit="formSubmit" catchreset="formReset">
+        <view class="modal_main">
+          <view class="modal_l">
+            <view class="modal_l1">
+              <image class="two_logo1" src="{{schedulelist.blue_logo[0].url}}"></image>
+              <view>{{schedulelist.blue_name}}</view>
+            </view>
+            <view class="modal_l2">
+              <image class="two_logo1" src="{{schedulelist.red_logo[0].url}}"></image>
+              <view>{{schedulelist.red_name}}</view>
+            </view>
+          </view>
+          <view class="modal_r">
+            <view class="modal_r1">
+              <input class="input" name="blue_branch" type="number" value="{{form.blue_branch}}" placeholder="" />
+              <text class="modal_text">比分</text>
+              <input class="input" name="red_branch" type="number" value="{{form.red_branch}}" placeholder="" />
+            </view>
+          </view>
+          <view class="modal_btn">
+            <button class="button" formType="submit">保存</button>
+          </view>
+        </view>
+      </form>
     </view>
   </view>
 </mobile-main>

+ 112 - 0
pages/match/detail.wxss

@@ -35,6 +35,7 @@
   width: 85%;
   height: 40.83px;
 }
+
 .imgss {
   width: 85%;
   height: 40.83px;
@@ -52,9 +53,11 @@
   width: 15%;
   background-color: #ffffff;
 }
+
 .two-9 {
   width: 70%;
 }
+
 .two2 {
   background-color: #ffffff;
 }
@@ -317,4 +320,113 @@
 .one_logo2 {
   width: 80px;
   height: 80px;
+}
+
+.mask {
+  width: 100%;
+  height: 100%;
+  position: fixed;
+  top: 0;
+  left: 0;
+  background: #000;
+  opacity: 0.2;
+  overflow: hidden;
+  z-index: 1000;
+  color: #fff;
+}
+
+/*对话框 */
+.modal {
+  height: 400px;
+  width: 100%;
+  overflow: hidden;
+  position: fixed;
+  border-radius: 30px 30px 0px 0px;
+  bottom: 0;
+  left: 0;
+  z-index: 2000;
+  background: #fff;
+  padding-top: 20rpx;
+}
+
+.title {
+  width: 100%;
+  padding: 20px;
+}
+
+.modal_title {
+  width: 40%;
+  float: left;
+  font-size: 18px;
+}
+
+.go {
+  width: 50%;
+  float: left;
+  text-align: right;
+}
+
+.cuo {
+  width: 20px;
+  height: 20px;
+}
+
+.modal_main {
+  padding: 20px;
+}
+
+.modal_l {
+  width: 30%;
+  float: left;
+}
+
+.modal_r {
+  margin-top: 15%;
+  width: 60%;
+  float: left;
+}
+
+.modal_l1 {
+  margin: 30px 0;
+}
+
+.modal_l2 {
+  margin: 30px 0;
+}
+
+.modal_r1 {
+  height: 60px;
+  padding: 0 0 0 0;
+  margin: 40px 20px;
+}
+
+.modal_r2 {
+  height: 60px;
+  padding: 0 0 0 0;
+  margin: 40px 20px;
+}
+
+.modal_text {
+  font-size: 16px;
+  float: left;
+}
+
+.input {
+  width: 50px;
+  float: left;
+  text-align: center;
+  border-bottom: 1px solid rgb(228, 228, 228);
+}
+
+.two_logo1 {
+  margin-left: 15%;
+  width: 50px;
+  height: 45px;
+}
+
+.two_logo2 {
+  align-items: center;
+  width: 45px;
+  height: 45px;
+  border: solid 1px #999;
 }

+ 79 - 53
pages/me/index.js

@@ -17,10 +17,7 @@ Page({
     infoHeight: '',
     total: '4',
     //上传比分
-    item: {
-      id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', week: '星期五', time: '13:00',
-      state: '已结束', date: '01.15', start: '未开始'
-    },
+    match: [],
     //个人信息详情
     item1: {},
     //团队列表
@@ -113,62 +110,91 @@ Page({
     wx.getStorage({
       key: 'token',
       success: res => {
-        //数据请求
-        //用户详情
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
-          method: "get",//请求方法
-          data: {},//请求参数
-          header: {},
-          success: res => {
-            that.setData({ item1: res.data.data })
-            let type = res.data.data.type;
-            let icon = res.data.data.icon[0];
-            if (icon) this.setData({ icon: icon.url })
-            else this.setData({ icon: '/image/tou.png' });
-            // 判断用户身份显示不同功能按钮
-            let jump = btn.filter((i) => i.type.includes(type));
-            if (jump) that.setData({ jumpList: jump });
-          },
-          error: err => {
-          }
-        })
-        let type = res.data.type
-        if (type == 1) {
-          //团队管理员-团队列表
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
-            method: "get",//请求方法
-            data: {},//请求参数
-            header: {},
-            success: res => {
-              that.setData({ list: res.data.data })
-            },
-            error: err => {
-            }
-          })
-        } else if (type == 2) {
-          //个人用户-所在团队列表
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`, //接口地址
-            method: "get",//请求方法
-            data: { user_id: res.data.id },//请求参数
-            header: {},
-            success: res => {
-              console.log(res);
-              that.setData({ list: res.data.data })
-            },
-            error: err => {
-            }
-          })
-        }
+        //查询用户信息
+        that.searchUser(res.data);
+        //查询团队列表
+        that.searchTeam(res.data);
       },
       fail: res => {
         wx.redirectTo({ url: '/pages/login/index', })
       }
     })
   },
+  //查询用户信息
+  searchUser: function (e) {
+    const that = this;
+    var id = e.id;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/user/${id}`,
+      method: "get",
+      data: {},
+      header: {},
+      success: res => {
+        that.setData({ item1: res.data.data })
+        let type = res.data.data.type;
+        let icon = res.data.data.icon[0];
+        if (icon) this.setData({ icon: icon.url })
+        else this.setData({ icon: '/image/tou.png' });
+        // 判断用户身份显示不同功能按钮
+        let jump = btn.filter((i) => i.type.includes(type));
+        if (jump) that.setData({ jumpList: jump });
+      },
+      error: err => {
+      }
+    })
+  },
+  //查询团队列表
+  searchTeam: function (e) {
+    let id = e.id;
+    let type = e.type
+    if (type == 1) {
+      //团队管理员-团队列表
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/team`,
+        method: "get",
+        data: {},
+        header: {},
+        success: res => {
+          this.setData({ list: res.data.data })
+          //查询比赛列表
+          this.searchMatch(res.data.data);
+        },
+        error: err => {
+        }
+      })
+    } else if (type == 2) {
+      //个人用户-所在团队列表
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`,
+        method: "get",
+        data: { user_id: id },
+        header: {},
+        success: res => {
+          this.setData({ list: res.data.data })
 
+        },
+        error: err => {
+        }
+      })
+    }
+  },
+  //查询比赛列表
+  searchMatch: function (e) {
+    let id = e[0]._id
+    console.log(e[0]._id);
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
+      method: "get",
+      data: { blue_id: id , red_id :id},
+      header: {},
+      success: res => {
+        console.log(res.data.data);
+        this.setData({ match: res.data.data })
+      },
+      error: err => {
+      }
+    })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 11 - 12
pages/me/index.wxml

@@ -35,8 +35,8 @@
       </view>
     </view>
     <!-- 上传比分 -->
-    <view class="four" wx:if="{{item1.type=='1'}}">
-      <view class="thr">
+    <view class="four" wx:if="{{item1.type=='1'}}" wx:for="{{match}}" wx:key="item">
+      <view class="thr" wx:if="{{item.status=='1'}}">
         <view class="left2">
           <text class="text4">可对正在进行的比赛上次比分</text>
         </view>
@@ -47,11 +47,10 @@
       <image src="{{src3}}" class="huang"></image>
       <view class="list1">
         <view class="left3">
-          <text class="text5">{{item.start}}</text>
+          <text class="text5">{{item.status=='1'?'进行中':item.status=='0'?'未开始':'已结束'}}</text>
         </view>
         <view class="right3">
-          <text class="text6">{{item.date}}</text>
-          <text class="text6">{{item.time}}</text>
+          <text class="text6">{{item.match_time}}</text>
         </view>
         <view class="right4">
           <view class="right1_1">
@@ -60,24 +59,24 @@
           </view>
           <view class="right1_2">
             <view class="right1_2o">
-              <image class="head1" src="{{item.head1}}"></image>
+              <image class="head1" src="{{item.red_logo[0].url}}"></image>
             </view>
-            <view class="right1_2t"><text>{{item.groupname1}}</text></view>
+            <view class="right1_2t"><text>{{item.red_name}}</text></view>
             <view class="right1_2i">
-              <text class="text6-1">{{item.fraction1}}</text>
+              <text class="text6-1">{{item.red_branch||0}}</text>
               <text class="text8-1">:</text>
-              <text class="text7-1">{{item.fraction2}}</text>
+              <text class="text7-1">{{item.blue_branch||0}}</text>
             </view>
-            <view class="right1_2t"><text>{{item.groupname2}}</text></view>
+            <view class="right1_2t"><text>{{item.blue_name}}</text></view>
             <view class="right1_2o">
-              <image class="head2" src="{{item.head2}}"></image>
+              <image class="head2" src="{{item.blue_logo[0].url}}"></image>
             </view>
           </view>
         </view>
       </view>
     </view>
     <!-- 上传比分-无比赛 -->
-    <view class="four-zan" wx:if="{{listbisai.length==0}}" wx:key="item" wx:for="{{listbisai}}">
+    <view class="four-zan" wx:if="{{item.length==0}}" >
       <view class="zan-left">
         <text>暂无比赛</text>
       </view>

+ 3 - 2
pages/me/index.wxss

@@ -136,7 +136,8 @@
   /* position: relative;
   top: -30px; */
   width: 100%;
-  height: 105px;
+  /* height: 105px; */
+  margin: 0 0 16px 0;
 }
 
 .left3 {
@@ -360,7 +361,7 @@
   margin-top: 12px;
   margin-left: 3px;
   float: left;
-  width: 55%;
+  width: 47%;
 }
 
 .date {

+ 0 - 1
pages/modify/index.js

@@ -82,7 +82,6 @@ Page({
           data: {},
           success(res) {
             let status = res.data.data.status
-            console.log(res.data.data);
             that.setData({
               form: res.data.data,
               cateIndex: status,