Browse Source

青创赛修改

chengjunhui 1 month ago
parent
commit
812bf8a183

+ 0 - 0
1.txt


+ 0 - 1
app.json

@@ -42,7 +42,6 @@
     "pages/quality/index/index",
     "pages/quality/detail/index",
     "pages/match/index",
-    "pages/match/details/index",
     "pages/checkin/index_1874359642"
   ],
   "subPackages": [

pages/match/details/index.js → pages/match copy/details/index.js


pages/match/details/index.json → pages/match copy/details/index.json


pages/match/details/index.wxml → pages/match copy/details/index.wxml


pages/match/details/index.wxss → pages/match copy/details/index.wxss


+ 269 - 0
pages/match copy/index.js

@@ -0,0 +1,269 @@
+// pages/match/index.js
+const app = getApp();
+var util = require("../../utils/util.js");
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    appAssetsUrl2: app.appAssetsUrl2,
+    matchList: [],
+    statusBarHeightTop: 0,
+    statusBarHeight: 0,
+    // 分页相关数据
+    pageNum: 1,
+    pageSize: 10,
+    total: 0,
+    hasMore: true,
+    isLoading: false,
+    imglist: [],
+    current: 0,
+    activeTitle: false,
+    nodata: util.nodata(),
+  },
+
+  /**
+   * 赛事项目点击事件
+   */
+  onMatchItemTap(e) {
+    const index = e.currentTarget.dataset.index;
+    const matchItem = this.data.matchList[index];
+    console.log('点击赛事项目:', matchItem);
+
+    // 跳转到详情页面
+    wx.navigateTo({
+      url: `/pages/match/details/index?id=${matchItem.id}`
+    });
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.height();
+    this.loadImg();
+    // 加载赛事数据
+    this.loadMatchData();
+  },
+  changeSwiper(e) {
+    let {
+      current,
+      source
+    } = e.detail;
+    if (source === "autoplay" || source === "touch") {
+      this.setData({
+        current: current,
+      });
+    }
+    // this.setData({
+    // 	current: e.detail.current
+    // })
+  },
+  //banner跳转
+  imgJump(v) {
+    // console.log(v);
+    // console.log(v.currentTarget.dataset.item.jumpAddressType);
+    if (v.currentTarget.dataset.item.jumpAddressType == 0) {
+      //内部跳转
+      wx.navigateTo({
+        url: v.currentTarget.dataset.item.linkUrl,
+      });
+    } else if (v.currentTarget.dataset.item.jumpAddressType == 1) {
+      //公众号跳转 'https://www.kujiale.cn/design/3FO4EQWQJF0M/show'
+      wx.setStorageSync("gzurl", v.currentTarget.dataset.item.linkUrl);
+      wx.navigateTo({
+        url: "./gz/gz",
+      });
+    }
+  },
+
+  // 首页banner
+  loadImg: function () {
+    let _this = this;
+    let params = {
+      type: "03",
+      area: "",
+    };
+    app._post_form("img/mylist", "application/json", params, function (res) {
+      if (res.code == 0) {
+        _this.setData({
+          imglist: res.data,
+        });
+      }
+    });
+  },
+
+  /**
+   * 加载赛事数据
+   */
+  loadMatchData() {
+    // 如果正在加载或没有更多数据,则不执行
+    if (this.data.isLoading || !this.data.hasMore) {
+      return;
+    }
+    
+    this.setData({
+      isLoading: true
+    });
+    
+    wx.showLoading({
+      title: this.data.pageNum === 1 ? '加载中...' : '加载更多...'
+    });
+
+    // 调用API获取赛事数据
+    const params = {
+      page: this.data.pageNum,
+      pageSize: this.data.pageSize
+    };
+    
+    // 使用项目中已有的请求方法
+    app._get('news/page', params, (res) => {
+      wx.hideLoading();
+      this.setData({
+        isLoading: false
+      });
+      
+      if (res.code === 0) {
+        // 处理返回的数据
+        const newList = res.page.list || [];
+        const total = res.page.totalCount || 0;
+        
+        // 如果是第一页,直接设置数据;否则追加数据
+        const matchList = this.data.pageNum === 1 ? newList : [...this.data.matchList, ...newList];
+        
+        this.setData({
+          matchList: matchList,
+          total: total,
+          hasMore: matchList.length < total
+        });
+      } else {
+        wx.showToast({
+          title: '数据加载失败',
+          icon: 'none'
+        });
+      }
+    }, (fail) => {
+      wx.hideLoading();
+      this.setData({
+        isLoading: false
+      });
+      wx.showToast({
+        title: '请求失败',
+        icon: 'none'
+      });
+    });
+  },
+  
+  /**
+   * 重置并重新加载数据
+   */
+  reloadMatchData() {
+    this.setData({
+      pageNum: 1,
+      matchList: [],
+      hasMore: true
+    });
+    this.loadMatchData();
+  },
+  
+  height() {
+    const {
+      platform,
+      statusBarHeight
+    } = wx.getSystemInfoSync();
+    let statusBarHeightTop = statusBarHeight;
+    let height = statusBarHeight + 4; //ios 24px
+    let mH = statusBarHeight + 4;
+    if (platform.toLowerCase() == "android") {
+      height += 4; //android 28px
+      mH += 4;
+    }
+    height = height + 60;
+    // height = height + 38 + 118;
+    // 胶囊高度 32px 下边框6px height 状态栏高度
+    this.setData({
+      statusBarHeightTop: statusBarHeightTop + "px",
+      statusBarHeight: height + "px",
+      statusBarMH: mH + "px",
+    });
+  },
+  
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+    // 页面渲染完成
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+    // 页面显示时刷新数据
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+    // 页面隐藏
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+    // 页面卸载
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+    this.loadImg();
+    // 下拉刷新
+    this.reloadMatchData();
+    wx.stopPullDownRefresh();
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+    // 上拉加载更多
+    console.log('加载更多赛事数据');
+    if (this.data.hasMore && !this.data.isLoading) {
+      this.setData({
+        pageNum: this.data.pageNum + 1
+      });
+      this.loadMatchData();
+    }
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+    
+  },
+  onPageScroll: function (e) {
+    if (
+      e.scrollTop >= 10 &&
+      this.data.activeTitle == false
+    ) {
+      this.setData({
+        activeTitle: true,
+      });
+    }
+    if (
+      e.scrollTop < 10 &&
+      this.data.activeTitle == true
+    ) {
+      this.setData({
+        activeTitle: false,
+      });
+    }
+  },
+});

+ 8 - 0
pages/match copy/index.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "青创赛",
+  "navigationBarBackgroundColor": "#4A90E2",
+  "navigationBarTextStyle": "white",
+  "enablePullDownRefresh": true,
+  "navigationStyle": "custom",
+  "usingComponents": {}
+}

+ 36 - 0
pages/match copy/index.wxml

@@ -0,0 +1,36 @@
+<!-- pages/match/index.wxml -->
+<view class="match-container">
+    <!-- 头部横幅区域 -->
+    <view class="header-banner">
+        <view class="title {{activeTitle ? 'activeTitle' : ''}}" style="padding-top:{{statusBarHeightTop}};color: {{imglist.length ? '' : '#000000'}}">青创赛</view>
+        <view class="banner-bg" wx:if="{{imglist.length}}">
+            <swiper autoplay="{{true}}" current="{{current}}" bindchange="changeSwiper" interval="{{2000}}" duration="{{500}}" class="bg">
+                <block wx:for="{{imglist}}" wx:key="index">
+                    <swiper-item>
+                        <image class="character-image" mode="scaleToFill" data-item="{{item}}" bindtap='imgJump' src="{{item.picture}}?x-oss-process=style/w_720"></image>
+                    </swiper-item>
+                </block>
+            </swiper>
+        </view>
+    </view>
+    <!-- 赛事列表区域 -->
+    <view class="match-list" style="padding-top: {{imglist.length ? 0 : statusBarHeight}}">
+        <!-- <view class="section-title">2025年夏季创业大赛季创业大赛</view> -->
+        <view class="match-items">
+            <view class="match-item" wx:for="{{matchList}}" wx:key="index" bindtap="onMatchItemTap" data-index="{{index}}">
+                <view class="item-image">
+                    <image wx:if="{{item.fileUrl}}" src="{{item.fileUrl}}?x-oss-process=style/w_300" mode="widthFix"></image>
+                </view>
+                <view class="item-content">
+                    <view class="item-title">{{item.title}}</view>
+                    <view class="item-desc">{{item.introduction || ''}}</view>
+                </view>
+            </view>
+            <block wx:if="{{matchList.length<=0}}">
+                <view class='tc h100'>
+                    <image src="{{nodata}}" class='nodata-img'></image>
+                </view>
+            </block>
+        </view>
+    </view>
+</view>

+ 117 - 0
pages/match copy/index.wxss

@@ -0,0 +1,117 @@
+/* pages/match/index.wxss */
+.match-container {
+  min-height: calc(100vh - 4rpx);
+  display: flex;
+  flex-direction: column;
+}
+
+/* 头部横幅区域 */
+.header-banner {
+  position: relative;
+  /* height: 486rpx; */
+  overflow: hidden;
+  flex-shrink: 0;
+}
+.header-banner .title.activeTitle{
+  background-color: #ffffff;
+  color: #1a1a1a;
+}
+.header-banner .title{
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 100;
+    width: 750rpx;
+    text-align: center;
+    height: 80rpx;
+    line-height: 80rpx;
+    font-size: 36rpx;
+    color: #ffffff;
+}
+
+.banner-bg {
+  position: relative;
+  width: 100%;
+  height: 100%;
+}
+.bg{
+  height: 486rpx;
+}
+.character-image {
+  width: 100%;
+  height: 486rpx;
+}
+
+/* 赛事列表区域 */
+.match-list {
+  flex: 1;
+  padding: 40rpx 30rpx;
+  margin-top: -40rpx;
+  background: #ffffff;
+  border-radius: 50rpx 50rpx 0 0;
+  position: relative;
+  z-index: 1;
+}
+
+.section-title {
+  font-size: 34rpx;
+  font-weight: bold;
+  color: #1a1a1a;
+  text-align: left;
+}
+
+.match-item {
+  display: flex;
+  background: #ffffff;
+  border-radius: 20rpx;
+  padding: 30rpx 0;
+  border-bottom: 1rpx solid #f2f2f2;
+}
+
+.match-item:last-of-type {
+  border-bottom: none;
+}
+
+.item-image {
+  width: 248rpx;
+  height: 160rpx;
+  flex-shrink: 0;
+  border-radius: 16rpx;
+  overflow: hidden;
+  margin-right: 20rpx;
+}
+
+.item-image image {
+  width: 100%;
+  height: 100%;
+  border-radius: 16rpx;
+}
+
+.item-content {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+}
+
+.item-title {
+  font-size: 30rpx;
+  font-weight: 600;
+  color: #333333;
+  margin-bottom: 16rpx;
+  line-height: 1.3;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+}
+
+.item-desc {
+  font-size: 26rpx;
+  color: #666666;
+  line-height: 1.5;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+}

+ 16 - 204
pages/match/index.js

@@ -1,6 +1,4 @@
 // pages/match/index.js
-const app = getApp();
-var util = require("../../utils/util.js");
 
 Page({
 
@@ -8,186 +6,20 @@ Page({
    * 页面的初始数据
    */
   data: {
-    appAssetsUrl2: app.appAssetsUrl2,
-    matchList: [],
-    statusBarHeightTop: 0,
-    statusBarHeight: 0,
-    // 分页相关数据
-    pageNum: 1,
-    pageSize: 10,
-    total: 0,
-    hasMore: true,
-    isLoading: false,
-    imglist: [],
-    current: 0,
-    activeTitle: false,
-    nodata: util.nodata(),
-  },
-
-  /**
-   * 赛事项目点击事件
-   */
-  onMatchItemTap(e) {
-    const index = e.currentTarget.dataset.index;
-    const matchItem = this.data.matchList[index];
-    console.log('点击赛事项目:', matchItem);
-
-    // 跳转到详情页面
-    wx.navigateTo({
-      url: `/pages/match/details/index?id=${matchItem.id}`
-    });
+    webViewUrl: '',
+    token: '',
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-    this.height();
-    this.loadImg();
-    // 加载赛事数据
-    this.loadMatchData();
-  },
-  changeSwiper(e) {
-    let {
-      current,
-      source
-    } = e.detail;
-    if (source === "autoplay" || source === "touch") {
-      this.setData({
-        current: current,
-      });
-    }
-    // this.setData({
-    // 	current: e.detail.current
-    // })
-  },
-  //banner跳转
-  imgJump(v) {
-    // console.log(v);
-    // console.log(v.currentTarget.dataset.item.jumpAddressType);
-    if (v.currentTarget.dataset.item.jumpAddressType == 0) {
-      //内部跳转
-      wx.navigateTo({
-        url: v.currentTarget.dataset.item.linkUrl,
-      });
-    } else if (v.currentTarget.dataset.item.jumpAddressType == 1) {
-      //公众号跳转 'https://www.kujiale.cn/design/3FO4EQWQJF0M/show'
-      wx.setStorageSync("gzurl", v.currentTarget.dataset.item.linkUrl);
-      wx.navigateTo({
-        url: "./gz/gz",
-      });
-    }
-  },
-
-  // 首页banner
-  loadImg: function () {
-    let _this = this;
-    let params = {
-      type: "03",
-      area: "",
-    };
-    app._post_form("img/mylist", "application/json", params, function (res) {
-      if (res.code == 0) {
-        _this.setData({
-          imglist: res.data,
-        });
-      }
-    });
-  },
-
-  /**
-   * 加载赛事数据
-   */
-  loadMatchData() {
-    // 如果正在加载或没有更多数据,则不执行
-    if (this.data.isLoading || !this.data.hasMore) {
-      return;
-    }
-    
-    this.setData({
-      isLoading: true
-    });
-    
-    wx.showLoading({
-      title: this.data.pageNum === 1 ? '加载中...' : '加载更多...'
-    });
-
-    // 调用API获取赛事数据
-    const params = {
-      page: this.data.pageNum,
-      pageSize: this.data.pageSize
-    };
-    
-    // 使用项目中已有的请求方法
-    app._get('news/page', params, (res) => {
-      wx.hideLoading();
-      this.setData({
-        isLoading: false
-      });
-      
-      if (res.code === 0) {
-        // 处理返回的数据
-        const newList = res.page.list || [];
-        const total = res.page.totalCount || 0;
-        
-        // 如果是第一页,直接设置数据;否则追加数据
-        const matchList = this.data.pageNum === 1 ? newList : [...this.data.matchList, ...newList];
-        
-        this.setData({
-          matchList: matchList,
-          total: total,
-          hasMore: matchList.length < total
-        });
-      } else {
-        wx.showToast({
-          title: '数据加载失败',
-          icon: 'none'
-        });
-      }
-    }, (fail) => {
-      wx.hideLoading();
+    let token = wx.getStorageSync('token');
+    if (!token) {
       this.setData({
-        isLoading: false
-      });
-      wx.showToast({
-        title: '请求失败',
-        icon: 'none'
-      });
-    });
-  },
-  
-  /**
-   * 重置并重新加载数据
-   */
-  reloadMatchData() {
-    this.setData({
-      pageNum: 1,
-      matchList: [],
-      hasMore: true
-    });
-    this.loadMatchData();
-  },
-  
-  height() {
-    const {
-      platform,
-      statusBarHeight
-    } = wx.getSystemInfoSync();
-    let statusBarHeightTop = statusBarHeight;
-    let height = statusBarHeight + 4; //ios 24px
-    let mH = statusBarHeight + 4;
-    if (platform.toLowerCase() == "android") {
-      height += 4; //android 28px
-      mH += 4;
+        webViewUrl: 'http://192.168.0.193:5173/'
+      })
     }
-    height = height + 60;
-    // height = height + 38 + 118;
-    // 胶囊高度 32px 下边框6px height 状态栏高度
-    this.setData({
-      statusBarHeightTop: statusBarHeightTop + "px",
-      statusBarHeight: height + "px",
-      statusBarMH: mH + "px",
-    });
   },
   
   /**
@@ -201,7 +33,15 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
+    let token = wx.getStorageSync('token');
     // 页面显示时刷新数据
+    if (this.data.token != token) {
+      this.setData({
+        token,
+        webViewUrl: `http://192.168.0.193:5173/?token=${token}`,
+      });
+    }
+    
   },
 
   /**
@@ -222,24 +62,14 @@ Page({
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh() {
-    this.loadImg();
-    // 下拉刷新
-    this.reloadMatchData();
-    wx.stopPullDownRefresh();
+
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom() {
-    // 上拉加载更多
-    console.log('加载更多赛事数据');
-    if (this.data.hasMore && !this.data.isLoading) {
-      this.setData({
-        pageNum: this.data.pageNum + 1
-      });
-      this.loadMatchData();
-    }
+    
   },
 
   /**
@@ -248,22 +78,4 @@ Page({
   onShareAppMessage() {
     
   },
-  onPageScroll: function (e) {
-    if (
-      e.scrollTop >= 10 &&
-      this.data.activeTitle == false
-    ) {
-      this.setData({
-        activeTitle: true,
-      });
-    }
-    if (
-      e.scrollTop < 10 &&
-      this.data.activeTitle == true
-    ) {
-      this.setData({
-        activeTitle: false,
-      });
-    }
-  },
 });

+ 1 - 33
pages/match/index.wxml

@@ -1,36 +1,4 @@
 <!-- pages/match/index.wxml -->
 <view class="match-container">
-    <!-- 头部横幅区域 -->
-    <view class="header-banner">
-        <view class="title {{activeTitle ? 'activeTitle' : ''}}" style="padding-top:{{statusBarHeightTop}};color: {{imglist.length ? '' : '#000000'}}">青创赛</view>
-        <view class="banner-bg" wx:if="{{imglist.length}}">
-            <swiper autoplay="{{true}}" current="{{current}}" bindchange="changeSwiper" interval="{{2000}}" duration="{{500}}" class="bg">
-                <block wx:for="{{imglist}}" wx:key="index">
-                    <swiper-item>
-                        <image class="character-image" mode="scaleToFill" data-item="{{item}}" bindtap='imgJump' src="{{item.picture}}?x-oss-process=style/w_720"></image>
-                    </swiper-item>
-                </block>
-            </swiper>
-        </view>
-    </view>
-    <!-- 赛事列表区域 -->
-    <view class="match-list" style="padding-top: {{imglist.length ? 0 : statusBarHeight}}">
-        <!-- <view class="section-title">2025年夏季创业大赛季创业大赛</view> -->
-        <view class="match-items">
-            <view class="match-item" wx:for="{{matchList}}" wx:key="index" bindtap="onMatchItemTap" data-index="{{index}}">
-                <view class="item-image">
-                    <image wx:if="{{item.fileUrl}}" src="{{item.fileUrl}}?x-oss-process=style/w_300" mode="widthFix"></image>
-                </view>
-                <view class="item-content">
-                    <view class="item-title">{{item.title}}</view>
-                    <view class="item-desc">{{item.introduction || ''}}</view>
-                </view>
-            </view>
-            <block wx:if="{{matchList.length<=0}}">
-                <view class='tc h100'>
-                    <image src="{{nodata}}" class='nodata-img'></image>
-                </view>
-            </block>
-        </view>
-    </view>
+   <web-view src="{{webViewUrl}}"></web-view>
 </view>

+ 0 - 117
pages/match/index.wxss

@@ -1,117 +0,0 @@
-/* pages/match/index.wxss */
-.match-container {
-  min-height: calc(100vh - 4rpx);
-  display: flex;
-  flex-direction: column;
-}
-
-/* 头部横幅区域 */
-.header-banner {
-  position: relative;
-  /* height: 486rpx; */
-  overflow: hidden;
-  flex-shrink: 0;
-}
-.header-banner .title.activeTitle{
-  background-color: #ffffff;
-  color: #1a1a1a;
-}
-.header-banner .title{
-    position: fixed;
-    top: 0;
-    left: 0;
-    z-index: 100;
-    width: 750rpx;
-    text-align: center;
-    height: 80rpx;
-    line-height: 80rpx;
-    font-size: 36rpx;
-    color: #ffffff;
-}
-
-.banner-bg {
-  position: relative;
-  width: 100%;
-  height: 100%;
-}
-.bg{
-  height: 486rpx;
-}
-.character-image {
-  width: 100%;
-  height: 486rpx;
-}
-
-/* 赛事列表区域 */
-.match-list {
-  flex: 1;
-  padding: 40rpx 30rpx;
-  margin-top: -40rpx;
-  background: #ffffff;
-  border-radius: 50rpx 50rpx 0 0;
-  position: relative;
-  z-index: 1;
-}
-
-.section-title {
-  font-size: 34rpx;
-  font-weight: bold;
-  color: #1a1a1a;
-  text-align: left;
-}
-
-.match-item {
-  display: flex;
-  background: #ffffff;
-  border-radius: 20rpx;
-  padding: 30rpx 0;
-  border-bottom: 1rpx solid #f2f2f2;
-}
-
-.match-item:last-of-type {
-  border-bottom: none;
-}
-
-.item-image {
-  width: 248rpx;
-  height: 160rpx;
-  flex-shrink: 0;
-  border-radius: 16rpx;
-  overflow: hidden;
-  margin-right: 20rpx;
-}
-
-.item-image image {
-  width: 100%;
-  height: 100%;
-  border-radius: 16rpx;
-}
-
-.item-content {
-  flex: 1;
-  display: flex;
-  flex-direction: column;
-  justify-content: center;
-}
-
-.item-title {
-  font-size: 30rpx;
-  font-weight: 600;
-  color: #333333;
-  margin-bottom: 16rpx;
-  line-height: 1.3;
-  display: -webkit-box;
-  -webkit-line-clamp: 2;
-  -webkit-box-orient: vertical;
-  overflow: hidden;
-}
-
-.item-desc {
-  font-size: 26rpx;
-  color: #666666;
-  line-height: 1.5;
-  display: -webkit-box;
-  -webkit-line-clamp: 2;
-  -webkit-box-orient: vertical;
-  overflow: hidden;
-}