Commit 48eaf8d7 authored by 郝聪敏's avatar 郝聪敏

新增摇奖动画;新增分享、推送授权

parent 9265aac3
This diff is collapsed.
<template> <template>
<div class="icon-container"> <div class="icon-container">
<div class="sign" v-if="type === 'sign'" @tap="signIn"> <div class="sign" v-if="type === 'sign'" @tap="signIn">
<image class="sign-in" :src="signNotCompletedUrl" v-if="!signComplete" :class="{'jump': !signing, 'fly': signing}" ></image> <image class="sign-in" :src="signNotCompletedUrl" v-if="!signComplete" :class="{'jump': !sign, 'fly': sign}" ></image>
<image class="sign-comlete" :src="signCompletedUrl" v-if="sign"></image> <image class="sign-comlete" :src="signCompletedUrl" v-if="sign"></image>
<div class="sign-shine" v-if="!sign"></div> <div class="sign-shine" v-if="!sign"></div>
<div class="sign-shadow" v-if="!signComplete"></div> <div class="sign-shadow" v-if="!signComplete"></div>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
let timeout = null; let timeout = null, timeout1 = null;
const images = { const images = {
sign: { sign: {
notComplete: '/static/images/sign@2x.png', notComplete: '/static/images/sign@2x.png',
...@@ -56,8 +56,6 @@ ...@@ -56,8 +56,6 @@
showAnimation: false, showAnimation: false,
addGold: false, addGold: false,
addsunshine: false, addsunshine: false,
signNot: true,
signing: false,
signComplete: false, signComplete: false,
signNotCompletedUrl: '/static/images/sign@2x.png', signNotCompletedUrl: '/static/images/sign@2x.png',
signCompletedUrl: '/static/images/sign-completed@2x-70_70px.png', signCompletedUrl: '/static/images/sign-completed@2x-70_70px.png',
...@@ -116,24 +114,24 @@ ...@@ -116,24 +114,24 @@
}, },
watch: { watch: {
gold(v) { gold(v) {
console.log('gold', v, this.addsunshine); if (!v) {
this.addsunshine = false; this.addsunshine = false;
if (v) { timeout1 = null;
setTimeout(() => { } else {
timeout1 = setTimeout(() => {
this.addsunshine = true; this.addsunshine = true;
console.log('addsunshine', this.addsunshine);
}, 1500); }, 1500);
} }
}, },
sign(v) { sign(v) {
this.signNot = false;
this.signing = v;
if (!v) {
this.signComplete = false; this.signComplete = false;
console.log(v, this.signComplete);
if (!v) {
timeout = null; timeout = null;
} else { } else {
timeout = setTimeout(() => { timeout = setTimeout(() => {
this.signComplete = true; this.signComplete = true;
console.log('signComplete');
}, 1300); }, 1300);
} }
} }
...@@ -148,7 +146,6 @@ ...@@ -148,7 +146,6 @@
}, },
showAnimation: function() { showAnimation: function() {
this.addGold = !this.addGold; this.addGold = !this.addGold;
// this.addsunshine = !this.addsunshine;
} }
}, },
created() { created() {
...@@ -372,11 +369,13 @@ ...@@ -372,11 +369,13 @@
.sunshine { .sunshine {
position: absolute; position: absolute;
top: 20rpx;
box-shadow: 0 0 30rpx 66rpx yellow; box-shadow: 0 0 30rpx 66rpx yellow;
background: yellow;
border-radius: 50%; border-radius: 50%;
width: 10rpx; width: 5rpx;
height: 15rpx; height: 7.5rpx;
z-index: 2; z-index: 1;
animation: addsunshine 2s linear forwards; animation: addsunshine 2s linear forwards;
} }
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
height:100%; height:100%;
background-color: #FF5D15; background-color: #FF5D15;
} }
.images {
width: 100%;
} }
</style> </style>
<template> <template>
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 --> <!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<swiper-item wx:for="{{curQueue}}" wx:key="index"> <swiper-item wx:for="{{curQueue}}" wx:key="index">
<view class="video-wrapper"> <view class="video-wrapper">
<video <!-- <video
id="video_{{index}}" id="video_{{index}}"
class="video_item" class="video_item"
loop loop
...@@ -77,7 +79,7 @@ ...@@ -77,7 +79,7 @@
@tap="videoTap" @tap="videoTap"
> >
<video-pause :pause="pause"></video-pause> <video-pause :pause="pause"></video-pause>
</video> </video> < !-->
<view class="rightcont"> <view class="rightcont">
<view class="info">奖品库存: 1/8</view> <view class="info">奖品库存: 1/8</view>
<view class="info">中奖概率: {{item.id}}/3000</view> <view class="info">中奖概率: {{item.id}}/3000</view>
...@@ -86,7 +88,9 @@ ...@@ -86,7 +88,9 @@
<view class="orange" style="{{progressStyle}}"></view> <view class="orange" style="{{progressStyle}}"></view>
</view> </view>
</view> </view>
<video-loading v-if="item.time === 0"/> <!-- <video-loading v-if="item.time === 0"/> -->
<image class="images" :src="item.url" mode="widthFix"></image>
<slot></slot>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -165,8 +169,6 @@ ...@@ -165,8 +169,6 @@
this.circular = false; this.circular = false;
setTimeout(() => { setTimeout(() => {
const direction = diff === 1 || diff === -2 ? 'up' : 'down'; const direction = diff === 1 || diff === -2 ? 'up' : 'down';
if (direction === 'up') { if (direction === 'up') {
if (this._invalidDown === 0) { if (this._invalidDown === 0) {
......
...@@ -441,30 +441,49 @@ ...@@ -441,30 +441,49 @@
} }
}, },
signIn: function(v) { signIn: function(v) {
// wx.requestSubscribeMessage({ let that = this;
// tmplIds: [ const tmplIds = [
// 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4', 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
// '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY', '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',
// '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ' '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
// ], ];
// success (res) { wx.requestSubscribeMessage({
// console.log('requestSubscribeMessage', res); tmplIds: [
// } 'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
// }); '_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',
this.sign = v; '7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
if (!this.sign) { ],
this.showAnimation = false; success (res) {
console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') {
const rs = tmplIds.some(v => res[v] === 'accept');
if (rs) {
that.sign = v;
if (!that.sign) {
that.showAnimation = false;
timeout = null; timeout = null;
timeout1 = null; timeout1 = null;
} else { } else {
timeout = setTimeout(() => { timeout = setTimeout(() => {
this.showAnimation = this.sign; that.showAnimation = that.sign;
timeout1 = setTimeout(() => { timeout1 = setTimeout(() => {
const num = [1, 2, 4, 501, 2501, 5001]; const num = [1, 2, 4, 501, 2501, 5001];
this.goldNum = num[Math.floor(Math.random() * 6)]; that.goldNum = num[Math.floor(Math.random() * 6)];
}, 1000); }, 1000);
}, 1300); }, 1300);
} }
} else {
Dialog.alert({
title: '订阅通知',
message: '签到必须同意推送提醒!'
});
}
}
},
fail (res) {
console.log('requestSubscribeMessage fail', res);
}
});
}, },
onShareAppMessage: function(res) { onShareAppMessage: function(res) {
if (res.from === 'button') { if (res.from === 'button') {
...@@ -519,15 +538,24 @@ ...@@ -519,15 +538,24 @@
{value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc:'/static/images/peo2.jpg', price:'¥1399.67',people:2200,sku:'100004549235'} {value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc:'/static/images/peo2.jpg', price:'¥1399.67',people:2200,sku:'100004549235'}
]; ];
let urls = [ let urls = [
'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4', // 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4',
'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4' // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4'
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151556813&di=44964ab823b5fb5f3fadcf9ceb87553b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201503%2F07%2F20150307113019_FSEFE.thumb.700_0.png',
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg',
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151520979&di=beba310e6bc314f7dd7ede841d068f68&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201610%2F05%2F20161005092600_jCmSx.thumb.700_0.jpeg'
]; ];
this.videoList = urls.map((url, index) => ({ id: index + 1, url })); this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' }));
}, },
onLoad (options) { onLoad (options) {
let that = this; let that = this;
if (options.openid) {
Dialog.alert({
title: 'openidShared',
message: options.openid
});
}
this.adlist = [ this.adlist = [
{imgsrc: '/static/images/test1.jpg', text: '小明刚刚参与了抽奖'}, {imgsrc: '/static/images/test1.jpg', text: '小明刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小2刚刚参与了抽奖'}, {imgsrc: '/static/images/test1.jpg', text: '小2刚刚参与了抽奖'},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment