wkw 3 тижнів тому
батько
коміт
9912e9bb7c

+ 5 - 2
pages/index/index.wxml

@@ -36,7 +36,7 @@
           </view>
           <!-- 日历 -->
           <block wx:if="{{start_time && end_time}}">
-            <view class="countdown">倒计时开跑时间</view>
+            <view class="countdown">距离活动开跑剩余</view>
             <countdown end-time="{{start_time}}" />
           </block>
         </view>
@@ -53,7 +53,10 @@
             <button wx:if="{{!loggedIn}}" class="cover-btn" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber" data-action="invite"></button>
           </view>
         </view>
-        <image class="ad-img" wx:if="{{ad_img}}" src="{{ad_img}}" mode="widthFix"/>
+        <view class="ad-img" bindtap="goRegister" data-action="register">
+          <image class="ad-img" wx:if="{{ad_img}}" src="{{ad_img}}" mode="widthFix"/>
+          <button wx:if="{{!loggedIn}}" class="cover-btn-ad" open-type="getPhoneNumber"      bindgetphonenumber="onGetPhoneNumber" data-action="register"></button>
+        </view>
         <rich-text style="width: 100%;" nodes="{{introduction}}" />
       </view>
     </view>

+ 13 - 2
pages/index/index.wxss

@@ -84,6 +84,7 @@
 }
 .ad-img{
   width: 100%;
+  position: relative;
 }
 .countdown{
   margin: 20rpx 0 30rpx;
@@ -99,6 +100,15 @@
   opacity: 0; /* 完全透明 */
   z-index: 10;
 }
+.cover-btn-ad{
+  position: absolute;
+  width: 100% !important;
+  height: 100%;
+  top: 0;
+  left: 0;
+  opacity: 0; /* 完全透明 */
+  z-index: 10;
+}
 
 /* 分享样式 */
 .share-container {
@@ -117,8 +127,9 @@
   background: transparent;
   border: none;
   padding: 0;
-  margin: 0;
-  width: 100% !important;
+  margin-left: 0 !important;
+  margin-right: 0 !important;
+  width: 100rpx !important;
 }
 .share-icon {
   width: 76rpx;

+ 4 - 4
pages/mine/mine.js

@@ -12,7 +12,7 @@ Page({
       { icon: '/static/image/me-3.png', title: '报名记录' },
       { icon: '/static/image/me-4.png', title: '优惠券' },
       { icon: '/static/image/me-5.png', title: '设置' },
-      // { icon: '/static/image/me-5.png', title: '参赛管理' },
+      { icon: '/static/image/me-3.png', title: '参赛管理' },
       { icon: '/static/image/me-6.png', title: '联系客服' }
     ],
     userInfo: {},
@@ -44,11 +44,11 @@ Page({
       2: `/pages/registrationRecords/registrationRecords`,
       3: `/pages/coupon/coupon`,
       4: `/pages/setting/setting`,
-      // 5:`/pages/registrationRecordList/registrationRecordList`,
+      5:`/pages/registrationRecordList/registrationRecordList`,
     };
     if (pageMap[index]) {
       wx.navigateTo({ url: pageMap[index] });
-    } else if (index === 5) {
+    } else if (index === 6) {
       const tabbar = this.getTabBar && this.getTabBar();
       if (tabbar && tabbar.openShowAgreementModal) {
         tabbar.openShowAgreementModal()
@@ -82,7 +82,7 @@ Page({
 
   handleActionWithLogin(e) {
     const index = e.currentTarget.dataset.index;
-    if (index >= 2 && index <= 4 && !isLoggedIn()) {
+    if (index >= 2 && index <= 5 && !isLoggedIn()) {
       return;
     }
     this.doAction(index);

+ 1 - 1
pages/mine/mine.wxml

@@ -27,7 +27,7 @@
 
             <!-- 未登录覆盖授权按钮 -->
             <button 
-              wx:if="{{!loggedIn && index >= 2 && index <= 4}}" 
+              wx:if="{{!loggedIn && index >= 2 && index <= 5}}" 
               class="cover-btn" 
               open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
               data-index="{{index}}"></button>

+ 81 - 6
pages/registrationRecordList/registrationRecordList.js

@@ -1,13 +1,15 @@
 import { enrollRecord } from '../../api/other';
-
+import { uploadImage } from '../../utils/upload.js';
 Page({
   data: {
     cardList: [],
     page: 1,
-    pageSize: 2,
+    pageSize: 10,
     loadingMore: false,
     noMore: false,
-    refreshing: false
+    refreshing: false,
+    filePath: '',  // 上传成功的文件路径
+    fileType: '',   // image / pdf
   },
 
   onLoad() {
@@ -31,8 +33,7 @@ Page({
       let allList = isRefresh ? newList : [...this.data.cardList, ...newList];
       allList = allList.map(item => ({
         ...item,
-        img: statusImgMap[item.status],
-        genderText: item.gender == 0 ? '女' : '男'
+        img: statusImgMap[item.status]
       }));
 
       this.setData({
@@ -63,5 +64,79 @@ Page({
     if (this.data.refreshing) return;
     this.setData({ refreshing: true, noMore: false, page: 1 });
     this.loadData(true);
-  }
+  },
+  // 点击上传区域
+  chooseFile() {
+    wx.showActionSheet({
+      itemList: ['图片', 'PDF'],
+      success: res => {
+        if (res.tapIndex === 0) {
+          this.chooseImage();
+        } else {
+          this.choosePdf();
+        }
+      }
+    });
+  },
+  // 选择图片
+  chooseImage() {
+    wx.chooseImage({
+      count: 1,
+      sizeType: ['original', 'compressed'],
+      sourceType: ['album', 'camera'],
+      success: res => {
+        const path = res.tempFilePaths[0];
+        this.uploadFile(path, 'image');
+      }
+    });
+  },
+  // 选择 PDF
+  choosePdf() {
+    wx.chooseMessageFile({
+      count: 1,
+      type: 'file',
+      success: res => {
+        const file = res.tempFiles[0];
+        if (file.name.endsWith('.pdf')) {
+          this.uploadFile(file.path, 'pdf');
+        } else {
+          wx.showToast({ title: '请选择 PDF 文件', icon: 'none' });
+        }
+      }
+    });
+  },
+  // 上传文件
+  async uploadFile(path, type) {
+    if (!path) {
+      wx.showToast({ title: '文件路径错误', icon: 'none' });
+      return;
+    }
+    try {
+      const res = await uploadImage(path);
+      console.log('上传成功:', res);
+      this.setData({
+        filePath: res.url,
+        fileType: type,
+        "formData.competition_image": res.path
+      });
+    } catch (err) {
+      console.error('上传失败:', err);
+    }
+  },
+  // 删除文件
+  removeFile() {
+    this.setData({
+      filePath: '',
+      fileType: '',
+      "formData.competition_image": ''
+    });
+  },
+  //预览图片
+  previewImage(e){
+    const current = e.currentTarget.dataset.src;
+    wx.previewImage({
+      current,
+      urls: [current]
+    });
+  },
 });

+ 2 - 1
pages/registrationRecordList/registrationRecordList.json

@@ -2,7 +2,8 @@
   "usingComponents": {
     "header": "/components/Header/Header",
     "van-cell": "@vant/weapp/cell/index",
-    "van-empty": "@vant/weapp/empty/index"
+    "van-empty": "@vant/weapp/empty/index",
+    "van-icon": "@vant/weapp/icon/index"
   },
   "navigationStyle": "custom"
 }

+ 40 - 5
pages/registrationRecordList/registrationRecordList.wxml

@@ -20,11 +20,46 @@
           <image class="card-img" src="{{item.img}}" mode="aspectFit"/>
         </view>
         <view class="cell-box">
-          <van-cell title="参赛姓名" value="{{item.nickname}}" border="{{ false }}" />
-          <van-cell title="手机号" value="{{item.phone}}" border="{{ false }}" />
-          <van-cell title="性别" value="{{item.genderText}}" border="{{ false }}" />
-          <van-cell title="身份证号" value="{{item.race_number}}" border="{{ false }}" />
-          <van-cell custom-class="cell-list" title="报名号码" value="{{item.competition_no}}" border="{{ false }}" />
+          <view>
+            <view class="cell-item">
+              <image class="cell-img" src="/static/image/register/cshm.png" mode="aspectFit"/>
+              <view class="cell-bg"></view>
+            </view>
+            <view class="cell-text">9810201902</view>
+          </view>
+          <view>
+            <view class="cell-item">
+              <image class="cell-img" src="/static/image/register/zm.png" mode="aspectFit"/>
+              <view class="cell-bg"></view>
+            </view>
+            <view class="uploader">
+              <!-- 已选择文件 -->
+              <block wx:if="{{filePath}}">
+                <block wx:if="{{fileType === 'image'}}">
+                  <view class="preview-wrap">
+                    <image src="{{filePath}}" class="preview-img" mode="aspectFill" data-src="{{filePath}}" bindtap="previewImage"/>
+                    <view class="delete-btn" bindtap="removeFile">
+                      <van-icon name="cross" color="#fff" size="16" class="delete-btn-icon"/>
+                    </view>
+                  </view>
+                </block>
+                <block wx:elif="{{fileType === 'pdf'}}">
+                  <view class="preview-wrap-pdf">
+                    <view class="pdf-preview">📄 已选择 PDF 文件</view>
+                    <text class="delete-btn-pdf" bindtap="removeFile">✖</text>
+                  </view>
+                </block>
+              </block>
+
+              <!-- 未选择文件 -->
+              <block wx:if="{{!filePath}}">
+                <view class="uploader-text" bindtap="chooseFile">
+                  <image class="uploader-img" src="/static/image/xj.png" mode="aspectFit"/>
+                  <view>完赛证明上传</view>
+                </view>
+              </block>
+            </view>
+          </view>
         </view>
       </view>
     </block>

+ 75 - 21
pages/registrationRecordList/registrationRecordList.wxss

@@ -42,33 +42,87 @@
   top: 0;
   right: 0;
 }
-.cell-box{
-  padding: 0 32rpx 22rpx;
-}
-.van-cell{
-  padding: 32rpx 0 !important;
-  border-bottom: 1px solid #EDEDED;
-}
-.van-cell__title{
-  font-family: PingFangSC, PingFang SC;
-  font-weight: 400 !important;
-  font-size: 28rpx !important;
-  color: #6F6F6F !important;
-  line-height: 40rpx;
+.cell-item{
+  position: relative;
+  width: 154rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: flex-end;
 }
-.van-cell__value{
-  font-family: PingFangSC, PingFang SC;
-  font-weight: 500 !important;
-  font-size: 28rpx !important;
-  color: #000000 !important;
-  line-height: 40rpx;
+.cell-bg{
+  margin-top: -20rpx;
+  width: 154rpx;
+  height: 30rpx;
+  background: linear-gradient( 270deg, rgba(255,230,0,0) 0%, #FFC800 100%);
+  opacity: 0.26;
 }
-.cell-list{
-  border-bottom: 0 !important;
+.cell-img{
+  width: 112rpx;
+  height: 40rpx;
+  margin-right: 10rpx;
+}
+.cell-text{
+  margin: 20rpx 32rpx 34rpx;
+  font-weight: 400;
+  font-size: 28rpx;
+  color: #000000;
+  line-height: 40rpx;
 }
 .loading{
   color: #969799;
   font-size:24rpx;
   text-align: center;
   padding-bottom: 32rpx;
+}
+.uploader{
+  padding: 18rpx 32rpx 124rpx;
+}
+.preview-wrap{
+  position: relative;
+  display: flex;
+  width: 160rpx;
+}
+.preview-wrap-pdf{
+  display: flex;
+}
+.preview-img{
+  width: 160rpx;
+  height: 160rpx;
+}
+.delete-btn{
+  position: absolute;
+  right: 0;
+  top: 0;
+  background: rgba(0,0,0,0.6);
+  border-radius: 0 0 0 12px;
+  width:28rpx;
+  height: 28rpx;
+}
+.delete-btn-pdf{
+  margin-left: 20rpx;
+}
+.delete-btn-icon{
+  position: absolute;
+  top: -2px;
+  right: -2px;
+  transform: scale(0.5);
+}
+.uploader-text{
+  width: 328rpx;
+  height: 190rpx;
+  background: #F3F3F3;
+  border-radius: 16rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-weight: 400;
+  font-size: 28rpx;
+  color: #4A4A4A;
+  line-height: 40rpx;
+}
+.uploader-img{
+  width: 48rpx;
+  height: 42.85rpx;
+  margin-bottom: 20rpx;
 }

+ 1 - 1
pages/registrationRecords/registrationRecords.js

@@ -4,7 +4,7 @@ Page({
   data: {
     cardList: [],
     page: 1,
-    pageSize: 2,
+    pageSize: 10,
     loadingMore: false,
     noMore: false,
     refreshing: false

BIN
static/image/register/zm.png