Ver código fonte

项目优化

yanj 1 mês atrás
pai
commit
98a74447ec

+ 2 - 1
api/checkIn.js

@@ -1,4 +1,5 @@
 import { get, post, link, upload } from '@/utils/request'
 
-export const routeList = get('/api/activity/route/list')
+export const getRouteList = get('/api/activity/route/list')
 export const getActivityInfo = get('/api/activity/info')
+export const qrcodeDecode =  post('/api/activity/qrcode/decode')

+ 5 - 1
components/common/u-scroll-view/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<scroll-view class="u-scroll-view" :scroll-y="true" style="height: 100%" @scrolltolower="onScrollToLower" @scroll="onScroll">
+	<scroll-view class="u-scroll-view" :scroll-y="true" style="height: 100%" @scrolltolower="onScrollToLower" @scroll="onScroll" :scroll-into-view="scrollIntoViewId">
 		<slot></slot>
 		<view v-if="loadMore" class="load-more"><van-loading>加载中...</van-loading></view>
 	</scroll-view>
@@ -17,6 +17,10 @@
 			VanLoading
 		},
 		props: {
+      scrollIntoViewId: {
+        type: String,
+        default: ''
+      },
 			tabbarConflict: Boolean,
 			showEmpty: {
 				type: Boolean,

+ 8 - 1
pages.json

@@ -115,6 +115,12 @@
 				"navigationBarTitleText": "我的投票"
 			}
 		},
+		{
+			"path": "pages/user/award",
+			"style": {
+				"navigationBarTitleText": "我的奖品"
+			}
+		},
 		//APP协议模块
 		{
 			"path": "pages/disclaimer/index",
@@ -180,7 +186,8 @@
 			"van-icon": "/wxcomponents/vant/icon/index",
 			"van-empty": "/wxcomponents/vant/empty/index",
 			"van-button": "/wxcomponents/vant/button/index",
-			"van-dialog": "/wxcomponents/vant/dialog/index"
+			"van-dialog": "/wxcomponents/vant/dialog/index",
+			"van-overlay": "/wxcomponents/vant/overlay/index"
 		}
 	},
 	"uniIdRouter": {},

Diferenças do arquivo suprimidas por serem muito extensas
+ 452 - 296
pages/checkIn/checkInRoute.vue


+ 18 - 56
pages/checkIn/index.vue

@@ -9,7 +9,7 @@
                    src="https://www.productronicachina.com.cn/resources/files/0221/67b7db116d845/主画面.png"></image>
           </view>
           <view class="theme-title">
-            <text class="title">逛展福利等您揭秘</text>
+            <text class="title">{{ activityInfo.name }}</text>
             <image mode="aspectFit" class="title-bg"
                    src="https://www.productronicachina.com.cn/resources/files/0221/67b7dd27b30b7/标题星星.png"></image>
           </view>
@@ -17,62 +17,28 @@
             <view class="track-list">
               <view class="track">
                 <view class="num">1</view>
-                <view class="text">选择挑战级别</view>
+                <view class="text">{{ activityInfo.content.step1 }}</view>
               </view>
               <view class="iconfont icon-Left-1"></view>
               <view class="track">
                 <view class="num">2</view>
-                <view class="text">前往展位扫码打卡</view>
+                <view class="text">{{ activityInfo.content.step2 }}</view>
               </view>
               <view class="iconfont icon-Left-1"></view>
               <view class="track">
                 <view class="num">3</view>
-                <view class="text">领取福利大礼包</view>
+                <view class="text">{{ activityInfo.content.step3 }}</view>
               </view>
             </view>
             <view class="way-grid">
-              <view @click="gotoRoute()" class="way-item">
-                <image mode="aspectFill"
-                       src="https://www.productronicachina.com.cn/resources/files/0221/67b7ea017dda7/路线图片01.jpg"></image>
+              <view @click="gotoRoute()" class="way-item" v-for="item in activityInfo.content.card_image_text">
+                <image mode="aspectFill" :src="item.img_url"></image>
                 <view class="text">
-                  <view class="way">挑战
-                    <text class="num">2</text>
-                    条路线
+                  <view class="way">
+                    <!--挑战<text class="num">6</text>条路线-->
+                    {{ item.title }}
                   </view>
-                  <view class="button">即刻打卡</view>
-                </view>
-              </view>
-              <view @click="gotoRoute()" class="way-item">
-                <image mode="aspectFill"
-                       src="https://www.productronicachina.com.cn/resources/files/0221/67b7ea017dda7/路线图片01.jpg"></image>
-                <view class="text">
-                  <view class="way">挑战
-                    <text class="num">4</text>
-                    条路线
-                  </view>
-                  <view class="button">即刻打卡</view>
-                </view>
-              </view>
-              <view @click="gotoRoute()" class="way-item">
-                <image mode="aspectFill"
-                       src="https://www.productronicachina.com.cn/resources/files/0221/67b7ea017dda7/路线图片01.jpg"></image>
-                <view class="text">
-                  <view class="way">挑战
-                    <text class="num">6</text>
-                    条路线
-                  </view>
-                  <view class="button">即刻打卡</view>
-                </view>
-              </view>
-              <view @click="gotoRoute()" class="way-item">
-                <image mode="aspectFill"
-                       src="https://www.productronicachina.com.cn/resources/files/0221/67b7ea017dda7/路线图片01.jpg"></image>
-                <view class="text">
-                  <view class="way">挑战
-                    <text class="num">8</text>
-                    条路线
-                  </view>
-                  <view class="button">即刻打卡</view>
+                  <view class="button">{{ item.btn_text }}</view>
                 </view>
               </view>
             </view>
@@ -100,7 +66,7 @@
 </template>
 
 <script>
-import {routeList, getActivityInfo} from '@/api/checkIn';
+import {getActivityInfo} from '@/api/checkIn';
 import PageLayout from "@/components/layout/page-layout";
 import NavBar from "@/components/layout/nav-bar";
 import UScrollView from "@/components/common/u-scroll-view";
@@ -113,22 +79,23 @@ export default {
   },
   data() {
     return {
+      routeInfo: {},
+      activityInfo: {}
     };
   },
   mounted() {
-    this.getRouteList()
+    this.getActivityInfoEvent()
   },
   methods: {
     getActivityInfoEvent() {
+      this.showLoading()
       getActivityInfo().then(res => {
-
+          this.activityInfo = res.data
+        this.hideLoading()
       })
     },
     gotoRoute(id) {
-      uni.navigateTo({
-        url: '/pages/checkIn/checkInRoute?id=' + id,
-
-      })
+      uni.navigateTo({url: '/pages/checkIn/checkInRoute?id=' + id})
     },
     onShareAppMessage() {
       return {
@@ -147,11 +114,6 @@ export default {
       uni.navigateTo({
         url: '/pages/checkIn/myPrizes'
       })
-    },
-    getRouteList() {
-      routeList().then(res => {
-        console.log(res)
-      })
     }
   },
   onLoad() {

+ 14 - 0
utils/index.js

@@ -5,7 +5,21 @@ export const getLocale = function() {
 	const language = uni.getStorageSync('language')
 	return language || 'zh-cn'
 }
+export const scrollToElement = (selector) => {
+	// 创建选择器查询
+	const query = uni.createSelectorQuery().in(this);
 
+	// 获取目标元素的位置信息
+	query.select('#targetElement').boundingClientRect(data => {
+		if (data) {
+			// 滚动到目标元素的位置
+			uni.pageScrollTo({
+				scrollTop: data.top, // 目标元素距离页面顶部的距离
+				duration: 300 // 滚动动画的持续时间,单位 ms
+			});
+		}
+	}).exec();
+}
 
 /**
  * 返回格式化的时间字符串

+ 1 - 1
wxcomponents/vant/collapse-item/index.wxml

@@ -1,6 +1,6 @@
 <wxs src="../wxs/utils.wxs" module="utils" />
 
-<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
+<view class="van-collapse-item custom-class">
   <van-cell
     size="{{ size }}"
     title="{{ title }}"