浏览代码

修改赛程详情页 上传比分

zs 3 年之前
父节点
当前提交
58f3708e1e
共有 5 个文件被更改,包括 216 次插入12 次删除
  1. 10 8
      pages/list/index.wxss
  2. 60 2
      pages/match/detail.js
  3. 34 1
      pages/match/detail.wxml
  4. 112 0
      pages/match/detail.wxss
  5. 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;

+ 60 - 2
pages/match/detail.js

@@ -15,7 +15,30 @@ 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)
+  },
+  //显示对话框
+  clickme: function () {
+    this.setData({
+      showModal: true
+    })
+  },
+  //关闭弹窗
+  go: function () {
+    this.setData({
+      showModal: false
+    })
   },
   //上传图片
   imgUpload: function (e) {
@@ -34,14 +57,47 @@ Page({
   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;
 }

+ 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,