瀏覽代碼

上传比分

YY 3 年之前
父節點
當前提交
b62ab8a022
共有 3 個文件被更改,包括 104 次插入103 次删除
  1. 60 61
      pages/score/index.js
  2. 30 30
      pages/score/index.wxml
  3. 14 12
      pages/score/index.wxss

+ 60 - 61
pages/score/index.js

@@ -10,59 +10,30 @@ Page({
     // 主体高度
     infoHeight: '',
     frameStyle: { useTop: true, name: '比赛信息', leftArrow: true, useBar: false },
-    list: [{
-      logo1: '/image/logo1.png',
-      logo2: '/image/logo2.png',
-      time: '1-15 15:00',
-      ranks1: '哈拉海队幼儿园组',
-      score1: '2',
-      score2: '1',
-      ranks2: '马尼拉老年组',
-      state: '未开始',
-      match: '第二届老年组小区板王比赛'
-    }],
-    list1: [{ team: '哈拉海队', logo1: '/image/logo1.png', },],
-    lists1: [
-      { id: '1', text: '小孩1', tou: '/image/tou.png' },
-      { id: '1', text: '小孩2', tou: '/image/tou.png' },
-      { id: '1', text: '小孩3', tou: '/image/tou.png' },
-      { id: '1', text: '小孩4', tou: '/image/tou.png' },
-      { id: '1', text: '小孩5', tou: '/image/tou.png' },
-    ],
-    list2: [{ team: '马尼拉队', logo2: '/image/logo2.png', },],
-    lists2: [
-      { id: '1', text: '老头1', tou: '/image/tou.png' },
-      { id: '1', text: '老头2', tou: '/image/tou.png' },
-      { id: '1', text: '老头3', tou: '/image/tou.png' },
-      { id: '1', text: '老头4', tou: '/image/tou.png' },
-      { id: '1', text: '老头5', tou: '/image/tou.png' },
-      { id: '1', text: '老头6', tou: '/image/tou.png' },
-      { id: '1', text: '老头7', tou: '/image/tou.png' },
-      { id: '1', text: '老头8', tou: '/image/tou.png' },
-      { id: '1', text: '老头9', tou: '/image/tou.png' },
-      { id: '1', text: '老头10', tou: '/image/tou.png' },
-    ],
-    form: {
-      logo1: '/image/logo1.png',
-      team1: '哈拉海队',
-      num1: '0',
-      num2: '',
-      logo2: '/image/logo2.png',
-      team2: '马尼拉队',
-      num3: '0',
-      num4: '',
-    }
+    form: {},
+    id: ''
   },
   //提交
   formSubmit: function (e) {
-    this.setData({
-      showModal: false
-    }),
-      wx.showToast({
-        title: '保存成功',
-        icon: 'success',
-        duration: 2000
-      })
+    let value = e.detail.value;
+    let id = this.data.id;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule/${id}`,
+      method: "post",
+      data: value,
+      header: {},
+      success: res => {
+        console.log(res);
+        wx.showToast({
+          title: '上传比分成功',
+          icon: 'success',
+          duration: 2000
+        })
+        this.setData({showModal: false})
+      },
+      error: err => {
+      }
+    })
   },
   back: function () {
     wx.navigateBack({ url: '/pages/me/index' })
@@ -85,20 +56,48 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.setData({ id: options.id })
     // 计算高度
     this.searchHeight()
+    // 监听用户是否登录
+    this.watchLogin();
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    const that = this;
+    let id = that.data.id;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/schedule/${id}`,
+          method: "get",
+          data: {},
+          header: {},
+          success: res => {
+            console.log(res.data.data);
+            that.setData({ match: res.data.data })
+          },
+          error: err => {
+          }
+        })
+      },
+      fail: res => {
+        wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
+  },
+  // 计算高度
+  searchHeight: function () {
+    let frameStyle = this.data.frameStyle;
+    let client = app.globalData.client;
+    let infoHeight = client.windowHeight;
+    // 是否去掉状态栏
+    if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+    // 是否减去底部菜单
+    if (frameStyle.useBar) infoHeight = infoHeight - 50;
+    if (infoHeight) this.setData({ infoHeight: infoHeight })
   },
- // 计算高度
- searchHeight: function () {
-  let frameStyle = this.data.frameStyle;
-  let client = app.globalData.client;
-  let infoHeight = client.windowHeight;
-  // 是否去掉状态栏
-  if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-  // 是否减去底部菜单
-  if (frameStyle.useBar) infoHeight = infoHeight - 50;
-  if (infoHeight) this.setData({ infoHeight: infoHeight })
-},
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 30 - 30
pages/score/index.wxml

@@ -1,53 +1,53 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="main" style="height:{{infoHeight}}px;">
-        <view class="one" wx:key="item" wx:for="{{list}}">
+        <view class="one">
             <view class="one_1">
                 <view class="one_1_img">
-                    <image class="one_logo1" src="{{item.logo1}}"></image>
+                    <image class="one_logo1" src="{{match.blue_logo[0].url}}"></image>
                 </view>
-                <view class="one_1_text">{{item.ranks1}}</view>
+                <view class="one_1_text">{{match.blue_name}}</view>
             </view>
             <view class="one_2">
                 <view class="one_2_1">
-                    <text class="time">{{item.time}}</text>
+                    <text class="time">{{match.match_time}}</text>
                 </view>
                 <view class="one_2_2">
-                    <text class="text1">{{item.score1}}</text>
+                    <text class="text1">{{match.blue_branch||0}}</text>
                     <text class="text2">:</text>
-                    <text class="text3">{{item.score2}}</text>
+                    <text class="text3">{{match.red_branch||0}}</text>
                 </view>
                 <view class="one_2_2">
-                    <text class="text">{{item.state}}</text>
+                    <text class="text">{{match.status=='1'?'进行中':match.status=='0'?'未开始':'已结束'}}</text>
                 </view>
             </view>
             <view class="one_3">
                 <view class="one_3_img">
-                    <image class="one_logo2" src="{{item.logo2}}"></image>
+                    <image class="one_logo1" src="{{match.red_logo[0].url}}"></image>
                 </view>
-                <view class="one_3_text">{{item.ranks2}}</view>
+                <view class="one_3_text">{{match.red_name}}</view>
             </view>
-            <view class="one_4">{{item.match}}</view>
+            <view class="one_4">{{match.match_name}}</view>
         </view>
         <view class="two" style="height:{{infoHeight-250}}px;">
             <view class="two_title">参赛阵容</view>
-            <view class="two_1" wx:key="item" wx:for="{{list1}}">
+            <view class="two_1">
                 <view class="two_1_1">
-                    <image class="two_logo1" src=" {{item.logo1}}"></image>
-                    <text class="two_1_text">{{item.team}}</text>
+                    <image class="two_logo1" src=" {{match.blue_logo[0].url}}"></image>
+                    <text class="two_1_text textOver">{{match.blue_name}}</text>
                 </view>
-                <view class="two_1_2" wx:key="item" wx:for="{{lists1}}">
-                    <image class="two_logo2" src="{{item.tou}}"></image>
-                    <text class="two_1_text">{{item.text}}</text>
+                <view class="two_1_2" wx:key="item" wx:for="{{match.blue_members}}">
+                    <image class="two_logo2" src="{{item.icon[0].url}}"></image>
+                    <text class="two_1_text textOver">{{item.nickname}}</text>
                 </view>
             </view>
             <view class="two_2">
-                <view class="two_2_1" wx:key="item" wx:for="{{list2}}">
-                    <image class="two_logo1" src="{{item.logo2}}"></image>
-                    <text class="two_2_text">{{item.team}}</text>
+                <view class="two_2_1">
+                    <image class="two_logo1" src="{{match.red_logo[0].url}}"></image>
+                    <text class="two_2_text textOver">{{match.red_name}}</text>
                 </view>
-                <view class="two_2_2" wx:key="item" wx:for="{{lists2}}">
-                    <image class="two_logo2" src="{{item.tou}}"></image>
-                    <text class="two_2_text">{{item.text}}</text>
+                <view class="two_2_2" wx:key="item" wx:for="{{match.red_members}}">
+                    <image class="two_logo2" src="{{item.icon[0].url}}"></image>
+                    <text class="two_2_text textOver">{{item.nickname}}</text>
                 </view>
             </view>
         </view>
@@ -67,24 +67,24 @@
                 <view class="modal_main">
                     <view class="modal_l">
                         <view class="modal_l1">
-                            <image class="two_logo1" src="{{form.logo1}}"></image>
-                            <view>{{form.team1}}</view>
+                            <image class="two_logo1" src="{{match.blue_logo[0].url}}"></image>
+                            <view>{{match.blue_name}}</view>
                         </view>
                         <view class="modal_l2">
-                            <image class="two_logo1" src="{{form.logo2}}"></image>
-                            <view>{{form.team2}}</view>
+                            <image class="two_logo1" src="{{match.red_logo[0].url}}"></image>
+                            <view>{{match.red_name}}</view>
                         </view>
                     </view>
                     <view class="modal_r">
                         <view class="modal_r1">
-                            <input class="input" name="num1" type="number" value="{{form.num1}}" placeholder="" />
+                            <input class="input" name="blue_branch" value="{{form.blue_branch}}" type="number" placeholder="" />
                             <text class="modal_text">积分</text>
-                            <input class="input" name="num2" type="number" value="{{form.num2}}" placeholder="" />
+                            <input class="input" value="{{form.blue_integral}}" name="blue_integral" type="number" placeholder="" />
                         </view>
                         <view class="modal_r2">
-                            <input class="input" name="num3" type="number" value="{{form.num3}}" placeholder="" />
+                            <input class="input" value="{{form.red_branch}}" name="red_branch" type="number" placeholder="" />
                             <text class="modal_text">积分</text>
-                            <input class="input" name="num4" type="number" value="{{form.num4}}" placeholder="" />
+                            <input class="input" value="{{form.red_integral}}" name="red_integral" type="number" placeholder="" />
                         </view>
                     </view>
                     <view class="modal_btn">

+ 14 - 12
pages/score/index.wxss

@@ -19,12 +19,12 @@
 }
 
 .one_1_text {
-  text-align: center;
+  text-align: left;
   font-size: 14px;
 }
 
 .one_3_text {
-  text-align: center;
+  text-align: right;
   font-size: 14px;
 }
 
@@ -83,8 +83,7 @@
 }
 
 .one_4 {
-  position: relative;
-  top: 10px;
+  margin: 126px 0 0 0;
   height: 30px;
   font-size: 14px;
   color: #999;
@@ -92,12 +91,13 @@
 }
 
 .one_logo1 {
-  width: 90px;
+  border-radius: 50%;
+  width: 80px;
   height: 80px;
 }
 
 .one_3_img {
-  padding: 0 15px;
+  padding: 0 0 0 40px;
 }
 
 .one_logo2 {
@@ -125,22 +125,24 @@
 }
 
 .two_1_1 {
-  width: 56px;
+  width: 80px;
   float: left;
   margin: 0 4px 0 0;
 }
 
 .two_1_2 {
   text-align: center;
-  width: 47px;
+  width: 60px;
   float: left;
   margin: 0 8px 0 0;
 }
 
 .two_logo1 {
+  border-radius: 50%;
   align-items: center;
   width: 50px;
-  height: 45px;
+  height: 50px;
+  margin: 0 0 0 15px;
 }
 
 .two_logo2 {
@@ -165,14 +167,14 @@
 }
 
 .two_2_1 {
-  width: 56px;
+  width: 80px;
   float: left;
   margin: 0 4px 10px 0;
 }
 
 .two_2_2 {
   text-align: center;
-  width: 47px;
+  width: 60px;
   float: left;
   margin: 0 8px 0 0;
 }
@@ -287,4 +289,4 @@
   float: left;
   text-align: center;
   border-bottom: 1px solid rgb(228, 228, 228);
-}
+}