抽奖活动 调整奖品图片大小
parent
2769ef550f
commit
e85f87d859
|
|
@ -1,7 +1,6 @@
|
|||
<script>
|
||||
// import { checkUpdate } from '@/utils/check-update';
|
||||
import { strToParams } from '@/utils/tools';
|
||||
import { wxMnpLogin } from '@/utils/login';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -14,10 +13,6 @@ export default {
|
|||
this.$store.dispatch('app/getSys');
|
||||
this.$store.dispatch('app/getArticle');
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
wxMnpLogin()
|
||||
/* #endif */
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// const clientInfo = plus.push.getClientInfo()
|
||||
// console.log(clientInfo);
|
||||
|
|
|
|||
|
|
@ -441,6 +441,8 @@
|
|||
let prizeCount = this.prizeList.length
|
||||
let baseAngle = Math.PI * 2 / prizeCount
|
||||
|
||||
ctx.font = "bold 28px sans-serif";
|
||||
|
||||
// 设置字体
|
||||
ctx.setFontSize(this.higtFontSize)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
<template>
|
||||
<view class="h-full">
|
||||
<loading-view v-if="isFirstLoading && isLogin"></loading-view>
|
||||
<view class="bg min-h-full overflow-hidden" v-else-if="isLogin"
|
||||
:style="{ backgroundImage: `url(${draw_activity.bg_image})`, backgroundColor: draw_activity.bg_color }">
|
||||
<loading-view v-if="isFirstLoading"></loading-view>
|
||||
<view v-else class="bg min-h-full overflow-hidden" :style="{ backgroundImage: `url(${draw_activity.bg_image})`, backgroundColor: draw_activity.bg_color }">
|
||||
<view class="">
|
||||
<view class="fixed top-0 left-0 w-full bg z-10" :style="{ backgroundImage: `url(${draw_activity.bg_image})` }">
|
||||
<view :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
|
|
@ -32,52 +31,34 @@
|
|||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- <view v-for="item in logs" :key="item.id" class="opacity">
|
||||
<view class="bg-hex-000 bg-opacity-30 text-white rounded-full px-20px h-44rpx leading-44rpx text-28rpx mb-10rpx inline-block">
|
||||
<text
|
||||
>恭喜{{ item.user.nickname }}抽中<text class="text-hex-ffde58">{{ item.prize.name }}</text></text
|
||||
>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<almost-lottery pointer-position="edge" :lottery-size="lotteryConfig.lotterySize"
|
||||
:action-size="lotteryConfig.actionSize" :ring-count="8" :duration="8" :prize-list="prizeList"
|
||||
:prize-index="prizeIndex" @reset-index="prizeIndex = -1" @draw-start="handleDrawStart"
|
||||
@draw-end="handleDrawEnd" @finish="handleDrawFinish" v-if="prizeList.length" stroke-color="#ffffff"
|
||||
:strFontSize="28" :strMaxLen="10" :strFontColors="['#fb6056']" :colors="['#ffeaa7', '#ffeaa7']"
|
||||
:strFontSize="36" :strMaxLen="10"
|
||||
:colors="prizeBgColors"
|
||||
:strFontColors="['#FFFFFF']"
|
||||
:stroked="true" :img-width="120" :img-height="120" :imgMarginStr="30" :strMarginOutside="32"
|
||||
:canvasCached="true"
|
||||
:lotteryBg="lotteryBg"
|
||||
:actionBg="actionBg"
|
||||
:imgDrawed="false"
|
||||
strDirection="vertical"
|
||||
/>
|
||||
<view class="text-center mt-40rpx">今天还可以抽 <text class="text-error">{{ freeNum }}</text> 次</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="p-30rpx">
|
||||
<u-parse :html="draw_activity.desc"></u-parse>
|
||||
</view>
|
||||
<u-mask :show="show">
|
||||
<view class="flex items-center justify-center h-full">
|
||||
<view class="">
|
||||
<view class="pr-30rpx text-right">
|
||||
<image src="/static/images/app/app_update_close.png" alt="" srcset="" class="w-48rpx h-48rpx"
|
||||
@click="show = false"></image>
|
||||
</view>
|
||||
<view class="w-600rpx h-600rpx relative" v-if="prizeData.prize">
|
||||
<image v-if="prizeData.prize.type == 0" :src="results.goods" class="w-full h-full"></image>
|
||||
<block v-if="prizeData.prize.type != 0">
|
||||
<view class="absolute top-178rpx left-0 right-0 text-center mx-auto mx-auto w-300rpx h-290rpx">
|
||||
<view class="prize-result" v-if="prizeData.prize">
|
||||
<view class="prize-title text-center h-42rpx leading-40rpx text-30rpx text-hex-f74a2c bg-gradient-to-t to-hex-fff4e5 from-hex-ffd4b2 w-240rpx rounded-full mx-auto">{{ results.name }}</view>
|
||||
<view class="prize-image text-center mx-auto mx-auto w-500rpx h-800rpx" style="margin: 30rpx 0">
|
||||
<image :src="results.goods" alt="" class="w-full h-full"></image>
|
||||
</view>
|
||||
<view class="absolute top-116rpx left-0 right-0 text-center h-42rpx leading-40rpx text-30rpx text-hex-f74a2c bg-gradient-to-t to-hex-fff4e5 from-hex-ffd4b2 w-240rpx rounded-full mx-auto">
|
||||
{{ results.name }}
|
||||
</view>
|
||||
<view v-if="!!results.btn" @click="onResults" class="absolute top-486rpx left-0 right-0 text-center h-54rpx leading-54rpx text-28rpx text-white bg-img w-280rpx mx-auto">
|
||||
{{ results.btn }}
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-if="results.btn" @click="onResults" class="prize-btn text-center h-54rpx leading-54rpx text-28rpx text-white bg-img w-280rpx mx-auto">{{ results.btn }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-mask>
|
||||
|
|
@ -125,9 +106,9 @@ export default {
|
|||
show: false,
|
||||
prizeData: {},
|
||||
results: {
|
||||
name: '50元消费体验价',
|
||||
btn: '充值账户余额内',
|
||||
goods: 'https://ystmp.oss-cn-beijing.aliyuncs.com/wechart/lucky/hb.png',
|
||||
name: '',
|
||||
btn: '确定',
|
||||
goods: '',
|
||||
},
|
||||
// 开启调试模式
|
||||
isDev: process.env.NODE_ENV === 'development',
|
||||
|
|
@ -142,9 +123,9 @@ export default {
|
|||
|
||||
// 以下是转盘 UI 配置
|
||||
// 转盘外环图,如有需要,请参考替换为自己的设计稿
|
||||
lotteryBg: "/static/images/almost-lottery__bg.png",
|
||||
lotteryBg: "https://jiqu-library.peidikeji.cn/uniapp/almost-lottery/almost-lottery__bg.png",
|
||||
// 抽奖按钮图
|
||||
actionBg: "/static/images/almost-lottery__action.png",
|
||||
actionBg: "https://jiqu-library.peidikeji.cn/uniapp/almost-lottery/almost-lottery__action.png",
|
||||
// 奖品数据
|
||||
prizeList: [],
|
||||
// 奖品是否设有库存
|
||||
|
|
@ -184,6 +165,10 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
// 抽奖转盘 奖品的背景色 ['#ffeaa7', '#ffeaa7']
|
||||
prizeBgColors: [],
|
||||
// 抽奖转盘 奖品的字体颜色 ['#FFFFFF']
|
||||
prizeFontColors: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -202,17 +187,19 @@ export default {
|
|||
},
|
||||
async onLoad({ id }) {
|
||||
this.id = id;
|
||||
setTimeout(() => {
|
||||
if (!this.isLogin) {
|
||||
this.$u.route({
|
||||
type: 'redirectTo',
|
||||
url: `/pages/login/index?redirec=${encodeURIComponent(`/pageB/lucky/index?id=${id}`)}`
|
||||
})
|
||||
} else {
|
||||
this.getConfig();
|
||||
this.getLuckyLog();
|
||||
}
|
||||
}, 300)
|
||||
// setTimeout(() => {
|
||||
// if (!this.isLogin) {
|
||||
// this.$u.route({
|
||||
// type: 'redirectTo',
|
||||
// url: `/pages/login/index?redirec=${encodeURIComponent(`/pageB/lucky/index?id=${id}`)}`
|
||||
// })
|
||||
// } else {
|
||||
// this.getConfig();
|
||||
// this.getLuckyLog();
|
||||
// }
|
||||
// }, 300)
|
||||
},
|
||||
|
||||
//微信分享
|
||||
|
|
@ -257,6 +244,14 @@ export default {
|
|||
if (prize.type == 1) {
|
||||
this.show = false;
|
||||
this.showAddress = true;
|
||||
}
|
||||
// 优惠券
|
||||
else if (prize.type == 6) {
|
||||
this.show = false;
|
||||
// 跳转查看我的优惠券
|
||||
uni.navigateTo({
|
||||
url: '/pageA/coupon/coupon'
|
||||
});
|
||||
} else {
|
||||
this.show = false;
|
||||
}
|
||||
|
|
@ -292,6 +287,18 @@ export default {
|
|||
return { prizeId: e.id, prizeName: e.name, prizeStock: 10, prizeWeight: 200, prizeImage: e.icon, ...e };
|
||||
});
|
||||
|
||||
// 配置奖品的背景色 和 字体颜色
|
||||
const prizeBgColors = []
|
||||
const prizeFontColors = []
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
const item = data[i]
|
||||
|
||||
prizeBgColors.push(item.other?.bgColor ?? "#22292f")
|
||||
prizeFontColors.push(item.other?.textColor ?? "#FFFFFF")
|
||||
}
|
||||
this.prizeBgColors = prizeBgColors
|
||||
this.prizeFontColors = prizeFontColors
|
||||
|
||||
this.draw_log_id = this.config.draw_log_id;
|
||||
this.prizeList = data;
|
||||
if (!!this.draw_log_id && !this.showAddress) {
|
||||
|
|
@ -344,14 +351,19 @@ export default {
|
|||
// 旋转结束后,开始处理拿到结果后的逻辑
|
||||
let prize = this.prizeList[this.prizeIndex];
|
||||
|
||||
// type = 1 实物奖品
|
||||
// type = 6 优惠券奖品
|
||||
const { type, prizeImage, name, amount } = prize;
|
||||
this.draw_log_id = this.prizeData.id;
|
||||
this.results.name = name;
|
||||
this.results.btn = '';
|
||||
this.results.btn = '确定';
|
||||
if (type == 1) {
|
||||
// this.showAddress = true
|
||||
this.results.btn = '填写地址';
|
||||
}
|
||||
if (type == 6) {
|
||||
this.results.btn = '查看我的优惠券';
|
||||
}
|
||||
this.results.goods = prizeImage;
|
||||
this.show = true;
|
||||
this.prizeing = false;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
<!-- 导航栏 -->
|
||||
<u-navbar :border-bottom="false" :is-back="false" :background="{ background: '#ffffff' }">
|
||||
<view class="pl-base w-full" @tap="$u.route('/pages/search/search')">
|
||||
<u-search class="w-full" :disabled="true" placeholder="搜索商品名称" v-model="searchText" :show-action="false"></u-search>
|
||||
<u-search class="w-full" :disabled="true" placeholder="搜索商品名称" v-model="searchText"
|
||||
:show-action="false"></u-search>
|
||||
</view>
|
||||
<template #right>
|
||||
<view class="mx-base relative" @tap="$u.routeAuth('/pageA/news/index')">
|
||||
|
|
@ -14,39 +15,28 @@
|
|||
</view>
|
||||
</template>
|
||||
</u-navbar>
|
||||
<mescroll-body :bottombar="false" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
|
||||
<mescroll-body :bottombar="false" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||
:down="downOption" :up="upOption">
|
||||
<view class="px-base">
|
||||
<!-- 轮播图 -->
|
||||
<view>
|
||||
<swiper
|
||||
class="swipers h-400rpx text-center mt-base m-auto rounded15rpx overflow"
|
||||
circular="true"
|
||||
autoplay="true"
|
||||
indicator-dots="true"
|
||||
indicator-color="#ffffff"
|
||||
indicator-active-color="#378264"
|
||||
>
|
||||
<swiper-item class="flex justify-center w-full h-full" v-for="(item, index) in bannerList['wechat_mini_top_banner']" :key="index">
|
||||
<image
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`"
|
||||
mode="aspectFill"
|
||||
class="w-full h-full"
|
||||
@tap="jumpByOption(item)"
|
||||
/>
|
||||
<swiper class="swipers h-400rpx text-center mt-base m-auto rounded15rpx overflow" circular="true"
|
||||
autoplay="true" indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#378264">
|
||||
<swiper-item class="flex justify-center w-full h-full"
|
||||
v-for="(item, index) in bannerList['wechat_mini_top_banner']" :key="index">
|
||||
<image :src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`" mode="aspectFill"
|
||||
class="w-full h-full" @tap="jumpByOption(item)" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- tabs -->
|
||||
<block v-if="!isVerify">
|
||||
<view class="grid grid-cols-5">
|
||||
<view
|
||||
@tap="jumpByOption(item)"
|
||||
class="py-25rpx flex flex-col justify-center items-center"
|
||||
v-for="(item, index) in bannerList['wechat_mini_top_navigation_banner']"
|
||||
:key="index"
|
||||
>
|
||||
<view @tap="jumpByOption(item)" class="py-25rpx flex flex-col justify-center items-center"
|
||||
v-for="(item, index) in bannerList['wechat_mini_top_navigation_banner']" :key="index">
|
||||
<view class="flex items-end">
|
||||
<u-image width="70rpx" height="70rpx" :src="`${item.image}?x-oss-process=image/resize,w_70/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<u-image width="70rpx" height="70rpx"
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_70/quality,q_90`" :lazy-load="true"></u-image>
|
||||
</view>
|
||||
<view class="text-md mt-14rpx text-hex-txBase">{{ item.name }}</view>
|
||||
</view>
|
||||
|
|
@ -58,20 +48,11 @@
|
|||
<indexTitle></indexTitle>
|
||||
<!-- 第一张广告图 -->
|
||||
<view class="grid grid-cols-2 gap-x-20rpx mt-10rpx">
|
||||
<view
|
||||
v-for="(item, index) in bannerList['wechat_mini_recommend_banner']"
|
||||
:key="index"
|
||||
:class="index == 0 ? 'col-start-1 col-span-2' : ''"
|
||||
class="mt-20rpx"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="100%"
|
||||
height="260rpx"
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
@tap="jumpByOption(item)"
|
||||
></u-image>
|
||||
<view v-for="(item, index) in bannerList['wechat_mini_recommend_banner']" :key="index"
|
||||
:class="index == 0 ? 'col-start-1 col-span-2' : ''" class="mt-20rpx">
|
||||
<u-image border-radius="15rpx" width="100%" height="260rpx"
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`" :lazy-load="true"
|
||||
@tap="jumpByOption(item)"></u-image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -82,19 +63,10 @@
|
|||
<!-- 左右滑动 -->
|
||||
<view class="px-base">
|
||||
<scroll-view scroll-x="true" class="mt-base scroll pb-10rpx">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in recommendList"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in recommendList"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -107,32 +79,17 @@
|
|||
</view>
|
||||
<!-- 第四张广告图 -->
|
||||
<view class="mt-base" v-for="(item, index) in bannerList['wechat_mini_floor_banner']" :key="index">
|
||||
<u-image
|
||||
@tap="jumpByOption(item)"
|
||||
border-radius="15rpx"
|
||||
width="100%"
|
||||
height="220rpx"
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<u-image @tap="jumpByOption(item)" border-radius="15rpx" width="100%" height="220rpx"
|
||||
:src="`${item.image}?x-oss-process=image/resize,w_750/quality,q_90`" :lazy-load="true"></u-image>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="bg-white m-auto shdow mt-base px-base">
|
||||
<indexTitle name="热销商品"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in hotList"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in hotList"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -146,19 +103,10 @@
|
|||
<view class="bg-white m-auto shdow mt-base px-base" v-if="boutique_books.length">
|
||||
<indexTitle name="精品书籍"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in boutique_books"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in boutique_books"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -172,19 +120,10 @@
|
|||
<view class="bg-white m-auto shdow mt-base px-base" v-if="natural_water_feature.length">
|
||||
<indexTitle name="自然水景"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in natural_water_feature"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in natural_water_feature"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -198,19 +137,10 @@
|
|||
<view class="bg-white m-auto shdow mt-base px-base" v-if="ornamental_creatures.length">
|
||||
<indexTitle name="观赏生物"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in ornamental_creatures"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in ornamental_creatures"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -224,19 +154,10 @@
|
|||
<view class="bg-white m-auto shdow mt-base px-base" v-if="coral_aquatic_plants.length">
|
||||
<indexTitle name="珊瑚水草"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in coral_aquatic_plants"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in coral_aquatic_plants"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -250,19 +171,10 @@
|
|||
<view class="bg-white m-auto shdow mt-base px-base" v-if="equipment_consumables.length">
|
||||
<indexTitle name="设备耗材"></indexTitle>
|
||||
<scroll-view scroll-x="true" class="mt-base scroll">
|
||||
<view
|
||||
class="scroll-item mt-10rpx mr-20rpx"
|
||||
v-for="(item, index) in equipment_consumables"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })"
|
||||
:key="index"
|
||||
>
|
||||
<u-image
|
||||
border-radius="15rpx"
|
||||
width="260rpx"
|
||||
height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`"
|
||||
:lazy-load="true"
|
||||
></u-image>
|
||||
<view class="scroll-item mt-10rpx mr-20rpx" v-for="(item, index) in equipment_consumables"
|
||||
@tap="$u.route('/pages/product_details/index', { skuId: item.id })" :key="index">
|
||||
<u-image border-radius="15rpx" width="260rpx" height="260rpx"
|
||||
:src="`${item.cover}?x-oss-process=image/resize,w_260/quality,q_90`" :lazy-load="true"></u-image>
|
||||
<view class="text-md w-240rpx line-1 text-hex-bgBase h-40rpx">{{ item.name }}</view>
|
||||
<view class="text-md text-txBase">¥{{ item.sell_price }}</view>
|
||||
<view class="flex items-center" v-if="item.vip_price">
|
||||
|
|
@ -297,6 +209,8 @@ import popupView from './components/popup-view.vue';
|
|||
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
|
||||
import { checkUpdate } from '@/utils/check-update';
|
||||
import CartMixin from '@/pages/shop_cart/mixin';
|
||||
import { wxMnpLogin } from '@/utils/login'
|
||||
|
||||
const defaultBanner = {
|
||||
wechat_mini_top_banner: [],
|
||||
wechat_mini_recommend_banner: [],
|
||||
|
|
@ -331,11 +245,11 @@ export default {
|
|||
},
|
||||
noMoreSize: 1,
|
||||
},
|
||||
boutique_books:[],//精品书籍
|
||||
natural_water_feature:[],//自然水景
|
||||
ornamental_creatures:[],//观赏生物
|
||||
coral_aquatic_plants:[],//珊瑚水草
|
||||
equipment_consumables:[]//设备耗材
|
||||
boutique_books: [],//精品书籍
|
||||
natural_water_feature: [],//自然水景
|
||||
ornamental_creatures: [],//观赏生物
|
||||
coral_aquatic_plants: [],//珊瑚水草
|
||||
equipment_consumables: []//设备耗材
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -356,23 +270,25 @@ export default {
|
|||
return shareObj;
|
||||
},
|
||||
onLoad(e) {
|
||||
/* #ifdef MP-WEIXIN */
|
||||
wxMnpLogin()
|
||||
/* #endif */
|
||||
this.init();
|
||||
this.getpopAdver();
|
||||
this.$store.dispatch('user/getUserInfo');
|
||||
this.$store.dispatch('user/getNewsNum');
|
||||
},
|
||||
methods: {
|
||||
//新增开始-精品书籍
|
||||
async getrecGoods(){
|
||||
async getrecGoods() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$api
|
||||
.get('/v1/product/part', {
|
||||
params: {
|
||||
part:'boutique_books',
|
||||
part: 'boutique_books',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.boutique_books=res.data
|
||||
this.boutique_books = res.data
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -381,16 +297,16 @@ export default {
|
|||
});
|
||||
},
|
||||
//自然水景
|
||||
async getnatural_water_feature(){
|
||||
async getnatural_water_feature() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$api
|
||||
.get('/v1/product/part', {
|
||||
params: {
|
||||
part:'natural_water_feature',
|
||||
part: 'natural_water_feature',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.natural_water_feature=res.data
|
||||
this.natural_water_feature = res.data
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -399,16 +315,16 @@ export default {
|
|||
});
|
||||
},
|
||||
//观赏生物
|
||||
async getornamental_creatures(){
|
||||
async getornamental_creatures() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$api
|
||||
.get('/v1/product/part', {
|
||||
params: {
|
||||
part:'ornamental_creatures',
|
||||
part: 'ornamental_creatures',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.ornamental_creatures=res.data
|
||||
this.ornamental_creatures = res.data
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -417,16 +333,16 @@ export default {
|
|||
});
|
||||
},
|
||||
//珊瑚水草
|
||||
async getcoral_aquatic_plants(){
|
||||
async getcoral_aquatic_plants() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$api
|
||||
.get('/v1/product/part', {
|
||||
params: {
|
||||
part:'coral_aquatic_plants',
|
||||
part: 'coral_aquatic_plants',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.coral_aquatic_plants=res.data
|
||||
this.coral_aquatic_plants = res.data
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -435,16 +351,16 @@ export default {
|
|||
});
|
||||
},
|
||||
//设备耗材
|
||||
async getequipment_consumables(){
|
||||
async getequipment_consumables() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$api
|
||||
.get('/v1/product/part', {
|
||||
params: {
|
||||
part:'equipment_consumables',
|
||||
part: 'equipment_consumables',
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.equipment_consumables=res.data
|
||||
this.equipment_consumables = res.data
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -454,7 +370,7 @@ export default {
|
|||
},
|
||||
//新增结束
|
||||
init() {
|
||||
return Promise.all([this.getHot(), this.getBanner(), this.getRecommend(),this.getrecGoods(),this.getnatural_water_feature(),this.getornamental_creatures(),this.getcoral_aquatic_plants(),this.getequipment_consumables()]);
|
||||
return Promise.all([this.getHot(), this.getBanner(), this.getRecommend(), this.getrecGoods(), this.getnatural_water_feature(), this.getornamental_creatures(), this.getcoral_aquatic_plants(), this.getequipment_consumables()]);
|
||||
},
|
||||
async downCallback() {
|
||||
await this.init();
|
||||
|
|
@ -553,14 +469,14 @@ export default {
|
|||
return this.bannerList[key] ?? [];
|
||||
},
|
||||
jumpByOption(e) {
|
||||
const whiteRouter = ['/pages/user_sign/index', '/pageA/user_sign/index','/pages/points/swap','/pageB/lucky/index'];
|
||||
const whiteRouter = ['/pages/user_sign/index', '/pageA/user_sign/index', '/pages/points/swap', '/pageB/lucky/index'];
|
||||
const tabRouter = ['/pages/sort/index', '/pages/shop_cart/index', '/pages/healthy/index', '/pages/me/me'];
|
||||
if (!!e.jump_link) {
|
||||
if (e.jump_type == 1) {
|
||||
if (tabRouter.findIndex((el) => e.jump_link?.includes(el)) >= 0) {
|
||||
const params = this.getParams(e.jump_link);
|
||||
// console.log(params);
|
||||
if(Object.keys(params.params).length>0) {
|
||||
if (Object.keys(params.params).length > 0) {
|
||||
uni.$emit('jumpTab', params.params)
|
||||
uni.switchTab({
|
||||
url: params.path
|
||||
|
|
@ -579,9 +495,9 @@ export default {
|
|||
|
||||
getParams(str) {
|
||||
var result = {};
|
||||
const arr =str.split('?')
|
||||
const arr = str.split('?')
|
||||
const url = arr[0];
|
||||
if(arr.length>1){
|
||||
if (arr.length > 1) {
|
||||
var strParams = arr[1];
|
||||
var arrParams = strParams.split('&');
|
||||
arrParams.forEach((item) => {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
</template>
|
||||
<script>
|
||||
// import { getWxCode } from '@/utils/login';
|
||||
import { wxMnpLogin,getWxCode } from '@/utils/login'
|
||||
import { getWxCode } from '@/utils/login'
|
||||
import { mapMutations } from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -115,9 +115,6 @@ export default {
|
|||
const { code } = e.detail;
|
||||
if(!code) return
|
||||
const invite_code = uni.getStorageSync('INVITE_CODE');
|
||||
// if(!this.$store.getters.token){
|
||||
// await wxMnpLogin(invite_code)
|
||||
// }
|
||||
const params = {
|
||||
openid: uni.getStorageSync("openid"),
|
||||
invite_code: invite_code
|
||||
|
|
|
|||
|
|
@ -5,19 +5,20 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
strToParams
|
||||
} from '@/utils/tools';
|
||||
import {
|
||||
wxMnpLogin
|
||||
} from '@/utils/login'
|
||||
export default {
|
||||
import { strToParams } from '@/utils/tools';
|
||||
import { wxMnpLogin } from '@/utils/login'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scene: null
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
async onLoad(e) {
|
||||
// 先登录
|
||||
/* #ifdef MP-WEIXIN */
|
||||
wxMnpLogin()
|
||||
/* #endif */
|
||||
|
||||
const scene = strToParams(decodeURIComponent(e.scene))
|
||||
console.log(scene)
|
||||
this.scene = scene
|
||||
|
|
@ -63,6 +64,12 @@
|
|||
url: `/pageB/svip/index`
|
||||
});
|
||||
}
|
||||
// 抽奖活动 scene=draw%3D1
|
||||
else if (scene.draw) {
|
||||
uni.reLaunch({
|
||||
url: '/pageB/lucky/index?id=' + scene.draw
|
||||
});
|
||||
}
|
||||
// 默认跳转首页
|
||||
else {
|
||||
uni.switchTab({
|
||||
|
|
@ -70,5 +77,5 @@
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
|
|
@ -1,6 +1,4 @@
|
|||
import {
|
||||
http
|
||||
} from '@/utils/request'
|
||||
import { http } from '@/utils/request'
|
||||
|
||||
import store from '@/store'
|
||||
|
||||
|
|
@ -19,28 +17,22 @@ export function getWxCode() {
|
|||
}
|
||||
|
||||
//小程序静默登录
|
||||
export async function wxMnpLogin(invite_code){
|
||||
export async function wxMnpLogin(invite_code) {
|
||||
// 判断是否有 auth_token
|
||||
var token = store.getters.token
|
||||
if (token) {
|
||||
// 获取 当前用户信息
|
||||
await store.dispatch('user/getUserInfo', false)
|
||||
return;
|
||||
}
|
||||
// 没有 auth_token, 再调用 wx.login 登录
|
||||
store.commit('user/LOGOUT')
|
||||
const code = await getWxCode()
|
||||
invite_code=invite_code?invite_code: uni.getStorageSync('INVITE_CODE')
|
||||
await silentLogin({code,invite_code})
|
||||
}
|
||||
invite_code = invite_code ? invite_code : uni.getStorageSync('INVITE_CODE')
|
||||
|
||||
|
||||
async function silentLogin(data){
|
||||
// const provider = 'wechat-mini'
|
||||
// const resData = await http.post(`/v1/socialite/code-auth/${provider}`,data,{
|
||||
// custom:{
|
||||
// toast:false
|
||||
// }
|
||||
// })
|
||||
const resData = await http.post(`/v1/wechat-mini/login`,data,{
|
||||
custom:{
|
||||
toast:false
|
||||
}
|
||||
})
|
||||
const resData = await http.post(`/v1/wechat-mini/login`, { code, invite_code }, { custom: { toast: false } })
|
||||
uni.setStorageSync("openid", resData.openid)
|
||||
if (resData.token) {
|
||||
store.commit('user/LOGIN', resData.token)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue