소스 검색

已上传图片

YY 3 년 전
부모
커밋
70ef2036ec
3개의 변경된 파일87개의 추가작업 그리고 76개의 파일을 삭제
  1. 42 30
      pages/photo/index.js
  2. 6 17
      pages/photo/index.wxml
  3. 39 29
      pages/photo/index.wxss

+ 42 - 30
pages/photo/index.js

@@ -11,27 +11,18 @@ Page({
         // 主体高度
         infoHeight: '',
         frameStyle: { useTop: true, name: '已上传图片', leftArrow: true, useBar: false },
-        list: [
-
-            {
-                id: '1', name: '朝阳沟第三节力气大赛', time: '2020.11.12', shop1: '/image/shop1.png', shop2: '/image/shop2.png', shop3: '/image/shop3.png',
-
-            },
-            {
-                id: '1', name: '朝阳沟第三节力气大赛', time: '2020.11.12', shop1: '/image/shop1.png', shop2: '/image/shop2.png', shop3: '/image/shop3.png',
-
-            }
-        ],
+        //赛程列表
+        photoList: [],
+        //比赛列表
+        match: []
 
     },
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
     },
-    //提交
+    //保存
     formSubmit: function (e) {
     },
-
-    //实现全选的点击事件,首先要定义一个全局变量isAll=false,让复选框默认为不勾选状态
     checkq: function () {
         var list = this.data.list;
         isAll = !isAll;
@@ -55,10 +46,8 @@ Page({
     //删除
     delList: function () {
         var list = this.data.list;
-        list.pop();    
-        this.setData({
-            list: list,
-        })
+        list.pop();
+        this.setData({ list: list, })
     },
     //删除图片
     deleteImg: function (e) {
@@ -68,19 +57,42 @@ Page({
      */
     onLoad: function (options) {
         // 计算高度
-        this.searchHeight()
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            success: async res => {
+                const arr = await app.$get('/courtAdmin/api/match');
+                if (arr.errcode === 0) {
+                    for (const val of arr.data) {
+                        const arrs = await app.$get('/courtAdmin/api/schedule', { match_id: val._id });
+                        if (arrs.errcode === 0) val.photoList = arrs.data;
+                        that.setData({ photoList: val.photoList })
+                    }
+                    that.setData({ match: arr.data })
+                }
+            },
+            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 })
-},
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 6 - 17
pages/photo/index.wxml

@@ -4,25 +4,15 @@
             <text class="text1" bindtap="checkq" checked="{{isAll}}">多选</text>
             <text class="text2" bindtap="delList">删除</text>
         </view>
-        <view class="two" wx:key="item" wx:for="{{list}}" bindtap="chlik">
+        <view class="two" wx:key="item" wx:for="{{match}}" bindtap="chlik">
             <view class="two_text">
                 <text class="text3">{{item.name}}</text>
-                <text class="text4">{{item.time}}</text>
+                <text class="text4">{{item.single_time}}</text>
             </view>
-            <view class="two_shop">
-                <view class="photo1">
-                    <image class="shop" src="{{item.shop1}}"></image>
-                    <checkbox class="check" checked="{{item.isCheck}}"></checkbox>
-                    <image class="del" bindtap="deleteImg" src="/image/del.png"></image>
-                </view>
-                <view class="photo1">
-                    <image class="shop" src="{{item.shop2}}"></image>
-                    <checkbox class="check" checked="{{item.isCheck}}"></checkbox>
-                    <image class="del" bindtap="deleteImg" src="/image/del.png"></image>
-                </view>
-                <view class="photo1">
-                    <image class="shop" src="{{item.shop3}}"></image>
-                    <checkbox class="check" checked="{{item.isCheck}}"></checkbox>
+            <view class="two_shop" wx:for="{{item.photoList}}" wx:for-item="tag" wx:key="tag">
+                <view class="photo">
+                    <image class="shop" src="{{tag.match_file[0].url}}"></image>
+                    <checkbox class="check" checked="{{isCheck}}"></checkbox>
                     <image class="del" bindtap="deleteImg" src="/image/del.png"></image>
                 </view>
             </view>
@@ -30,6 +20,5 @@
         <view class="btn-area">
             <button class="button">保存</button>
         </view>
-
     </view>
 </mobile-main>

+ 39 - 29
pages/photo/index.wxss

@@ -1,7 +1,7 @@
 .main {
   position: relative;
   width: 100%;
-  background-color: #f8f8f8;
+  background-color: #d4d4d4;
 }
 
 .one {
@@ -19,43 +19,44 @@
 }
 
 .two_text {
-  margin: 0 0 10px 0;
+  height: 20px;
 }
 
 .text3 {
+  width: 50%;
+  float: left;
   font-size: 12px;
   color: #999;
 }
 
 .text4 {
-  position: relative;
-  left: 150px;
+  width: 50%;
+  float: left;
+  text-align: right;
   font-size: 12px;
   color: #999;
 }
 
 .two_shop {
+  /* background-color: #fff; */
   width: 100%;
-  background-color: #ffffff;
-  padding: 10px 0;
-  height: 170px;
 }
 
 .photo1 {
-  width: 50%;
+  width: 45%;
   float: left;
-  height: 90px;
 }
 
 .shop {
-  width: 162px;
+  width: 145px;
   height: 80px;
   margin: 0px 5px 10px 0;
 }
+
 .check {
   position: relative;
-  left: 0px;
-  top: -100px;
+  left: -145px;
+  top: -74px;
   z-index: 99999;
 }
 
@@ -77,34 +78,43 @@
   width: 20px;
   height: 20px;
   position: relative;
-  top: -92px;
-  left: 112px;
+  top: -66px;
+  left: -54px;
   background-color: #ffffff;
   border-radius: 10px
 }
 
 /* 重写 checkbox 样式 */
- /* 未选中的 背景样式 */
- checkbox .wx-checkbox-input{
-  border-radius: 50%;/* 圆角 */
-  width: 17px; /* 背景的宽 */
-  height: 17px; /* 背景的高 */
+/* 未选中的 背景样式 */
+checkbox .wx-checkbox-input {
+  border-radius: 50%;
+  /* 圆角 */
+  width: 17px;
+  /* 背景的宽 */
+  height: 17px;
+  /* 背景的高 */
 }
+
 /* 选中后的 背景样式*/
-checkbox .wx-checkbox-input.wx-checkbox-input-checked{
+checkbox .wx-checkbox-input.wx-checkbox-input-checked {
   border: 1rpx solid #17c911;
   background: #17c911;
 }
+
 /* 选中后的 对勾样式 */
-checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{
-  border-radius: 50%; 
-  width: 40rpx;/* 选中后对勾大小,不要超过背景的尺寸 */
-  height: 40rpx;/* 选中后对勾大小,不要超过背景的尺寸 */
+checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
+  border-radius: 50%;
+  width: 40rpx;
+  /* 选中后对勾大小,不要超过背景的尺寸 */
+  height: 40rpx;
+  /* 选中后对勾大小,不要超过背景的尺寸 */
   line-height: 40rpx;
   text-align: center;
-  font-size:30rpx; /* 对勾大小 30rpx */
-  color:#fff; /* 对勾颜色 白色 */
+  font-size: 30rpx;
+  /* 对勾大小 30rpx */
+  color: #fff;
+  /* 对勾颜色 白色 */
   background: transparent;
-  transform:translate(-50%, -50%) scale(1);
-  -webkit-transform:translate(-50%, -50%) scale(1);
-}
+  transform: translate(-50%, -50%) scale(1);
+  -webkit-transform: translate(-50%, -50%) scale(1);
+}