Commit 222b8d49 authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/animation' into 'master'

Feature/animation

See merge request !15
parents 43e1d87e 353f78d4
......@@ -3744,6 +3744,14 @@
"tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
}
}
}
}
......@@ -5113,10 +5121,9 @@
"dev": true
},
"qs": {
"version": "6.5.2",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
"version": "6.9.4",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
},
"rc": {
"version": "1.2.8",
......@@ -5343,6 +5350,12 @@
"uuid": "^3.3.2"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "http://npmprivate.quantgroups.com/tough-cookie/-/tough-cookie-2.5.0.tgz",
......
......@@ -19,7 +19,8 @@
"dependencies": {
"@wepy/core": "^2.0.0-alpha.16",
"@wepy/use-promisify": "^2.0.6",
"@wepy/x": "^2.0.2"
"@wepy/x": "^2.0.2",
"qs": "^6.9.4"
},
"devDependencies": {
"@wepy/cli": "^2.0.0-alpha.28",
......
......@@ -35,8 +35,8 @@ wepy.app({
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openId);
wx.setStorageSync('isRegister', userInfo.isRegister);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
}
// wx.checkSession({
// success () {
......
import http from './wxRequest';
import qs from 'qs';
module.exports = {
login(code) {
return http.post(`/api/user/login?code=1235`);
return http.post(`/api/user/login?code=${code}`);
},
register(params) {
return http.post('/api/user/register', params, { 'content-type': 'application/json' });
......@@ -14,10 +15,10 @@ module.exports = {
return http.post('/api/prize/list', params);
},
getAwardsDetail(params) {
return http.post('/api/prize/batch', params);
return http.post('/api/prize/batch', qs.stringify(params));
},
getActivityFeed(params) {
return http.post('/api/activity/feed', params);
return http.post('/api/prize/feed', qs.stringify(params));
},
addGold(params) {
return http.post('/api/user/book', params);
......@@ -32,18 +33,18 @@ module.exports = {
return http.post('/api/user/join/list');
},
getOneRaffle(params) {
return http.post('/api/user/join/list',params);
return http.post('/api/user/join/list', params);
},
getUserPhone() {
return http.post('/api/user/get/phone');
},
confirmRaffle(params) {
return http.post('/api/user/join/confirm',params);
return http.post('/api/user/join/confirm', params);
},
updateUserPhone(params) {
return http.post('/api/user/update/phone',params);
return http.post('/api/user/update/phone', params);
},
getPrize(params){
return http.post('/api/user/price/receive',params);
return http.post('/api/user/price/receive', params);
}
};
......@@ -8,7 +8,7 @@ const request = async (url, options) => {
const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false;
const defaultOptions = {
method: 'post',
header: { 'content-type': 'applicction/x-www-form-urlencoded' }
header: { 'content-type': 'application/x-www-form-urlencoded' }
};
options = { ...defaultOptions, ...options };
options.header = {
......
......@@ -57,7 +57,6 @@
},
computed: {
isWin() {
if (!this.joinRecord.id) return false;
return +this.joinRecord.status.value === 3;
}
},
......@@ -83,17 +82,16 @@
}, 500);
}, 2000);
},
hideAnimation (){
hideAnimation() {
this.showAnimation = false;
},
go() {
this.showAnimation = false;
//如果得奖了走
if(this.isWin) {
let id = 7;
wx.navigateTo({url:'/pages/prize?joinRecordId='+id})
// 如果得奖了去领奖,否则去我的抽奖页面
if (this.isWin) {
wx.navigateTo({url: '/pages/prize?joinRecordId=' + this.joinRecord.id});
} else {
wx.navigateTo({url:'/pages/myraffles'})
wx.navigateTo({url: '/pages/myraffles'});
}
}
},
......@@ -318,6 +316,9 @@
border: 1rpx solid #FF5D15;
z-index: 11;
border-radius: 10rpx;
&:after {
border: none;
};
&:nth-child(1) {
background: #fff;
color: #FF5D15;
......
......@@ -13,7 +13,7 @@
<image class="add-gold-image" :src="addGoldUrl"></image>
<span class="add-gold-num">+{{addGoldNum}}</span>
</div>
<div class="show-gold" @tap="showAnimation">
<div class="show-gold">
<div class="sunshine" v-if="addsunshine"></div>
<image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl"></image>
<span class="show-gold-num">
......@@ -35,7 +35,6 @@
</template>
<script>
import wepy from '@wepy/core';
let timeout = null, timeout1 = null;
const images = {
sign: {
notComplete: '/static/images/sign@2x.png',
......@@ -96,9 +95,6 @@
}
},
computed: {
signUrl() {
return this.sign ? images['sign'].completed : images['sign'].notComplete;
},
goldUrl() {
let result = images['gold'].goldOne;
if (this.des === 2) {
......@@ -152,23 +148,18 @@
}
if (v) {
setTimeout(() => {
this.signComplete = true;
this.flyAnimation = true;
}, 1100);
setTimeout(() => {
this.signComplete = true;
}, 50);
}, 1000);
}
}
},
methods: {
handleTaps: function() {
this.showAnimation = !this.showAnimation;
[this.bgColor, this.fontColor] = [this.fontColor, this.bgColor];
},
signIn: function() {
if (this.sign) return;
this.$emit('sign-in', true);
},
showAnimation: function() {
this.addGold = !this.addGold;
}
},
created() {
......@@ -238,7 +229,7 @@
position: absolute;
width: 78rpx;
height: 78rpx;
z-index: 1;
z-index: 3;
}
.jump {
animation: jump 1.2s infinite ease;
......
......@@ -36,23 +36,23 @@
height: 0;
// border: 2rpx solid #000;
z-index: 10;
transform: rotateZ(-2deg)
// transform: rotateZ(-2deg)
}
.star {
position: absolute;
left: -3rpx;
left: -8rpx;
// bottom: -220rpx;
top: -4rpx;
top: -12rpx;
// left: -43%;
height: 10rpx;
width: 150rpx;
// width: 100rpx;
background: linear-gradient(-45deg,rgba(255,255,255,0),yellow);
transform: translateX(605rpx);
// background: -webkit-linear-gradient(-45deg,rgba(255,255,255,0),yellow);
/*此处为下一步的添加动画*/
// -webkit-animation: tail 1s ease-in forwards, shooting 1s ease-in forwards;
// -o-animation: tail 1s ease-in forwards, shooting 1s ease-in forwards;
animation: tail .6s ease-in forwards, shooting .6s ease-in forwards;
animation: tail .7s .1s ease-in forwards, shooting .7s .1s ease-in forwards;
}
.star::before{
content: "";
......@@ -61,6 +61,7 @@
left: -52rpx;
width: 78rpx;
height: 78rpx;
// transform: scale(0.5);
// top: calc(100% - 1px);
// left: 100%;
background: url('http://activitystatic.xyqb.com/sign@2x.png') 0 0/contain no-repeat;
......@@ -68,10 +69,10 @@
/*此处为下一步的添加动画*/
// -webkit-animation: shining 3s ease-in-out infinite;
// -o-animation: shining 3s ease-in-out infinite;
animation: shining .6s ease-in-out forwards;
animation: shining .7s .1s ease-in-out forwards;
}
.star:before {
transform: rotateZ(-2deg);
// transform: rotateZ(-2deg);
// transform: -webkit-translateX(-50%) -webkit-rotateZ(-45deg);
}
.star:after {
......@@ -85,9 +86,9 @@
// 100% {width: 0;}
// }
@keyframes shining {
0% {transform: scale(1);}
0% {transform: scale(1);top: -29rpx;}
// 50% {transform: scale(0.8);}
99% {transform: scale(0.3);}
99% {transform: scale(0.5);top: -33rpx;}
100% {transform: scale(0);}
}
// @-webkit-keyframes tail {
......@@ -97,9 +98,10 @@
// }
@keyframes tail {
0% {width: 0;}
10% {width: 0;}
50% {width: 150rpx;}
65% {width: 50rpx;}
// 10% {width: 0;}
20% {width: 100rpx;}
40% {width: 150rpx;}
60% {width: 100rpx;}
80% {width: 150rpx;}
100% {width: 0;}
}
......
......@@ -43,7 +43,7 @@
.orange {
width: 0;
height:100%;
transition:all 1s;
transition:all .6s;
background-color: #FF5D15;
}
}
......@@ -179,7 +179,7 @@
this.prevQueue = [...this.prevQueue];
},
async getProgress(id) {
const detail = await getAwardsDetail();
const detail = await getAwardsDetail({ prizeId: id });
const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.nextQueue.forEach(v => {
if (v.id === id) {
......
......@@ -187,8 +187,8 @@
<swiper class="list-wrapper" vertical="true" circular="true" display-multiple-items="2" autoplay="true" interval="1500">
<swiper-item wx:for="{{adlist}}" wx:key="index" catch:touchmove>
<view class="imgwrap">
<image class="img" src="{{item.imgsrc}}"></image>
<view class="text">{{item.text}}</view>
<image class="img" src="{{item.avatarUrl}}"></image>
<view class="text">{{item.content}}</view>
</view>
</swiper-item>
</swiper>
......@@ -238,13 +238,11 @@
<script>
let touchDotX = 0, touchDotY = 0;
let timeout = null;
let timeout1 = null;
import store from '../store';
import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
import { register, getUserInfo, addGold, getPrizeList, signIn } from '../common/api.js';
import { register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
wepy.page({
store,
hooks: {
......@@ -408,6 +406,7 @@
this.setUserInfo(e.$wx.detail.userInfo);
await this.getMainInfo();
this.authmodal = false;
console.log('isRegister', wx.getStorageSync('isRegister'));
if (wx.getStorageSync('isRegister') === false) {
const userInfo = {
...e.$wx.detail.userInfo,
......@@ -415,6 +414,7 @@
inviter: this.inviter
};
await register(userInfo);
wx.setStorageSync('isRegister', true);
}
}
},
......@@ -500,14 +500,15 @@
});
},
onShareAppMessage: function(res) {
console.log(this.$wepy.userInfo, this.$wepy.awardsInfo);
if (res.from === 'button') {
console.log('onShareAppMessage2', res.target);
}
const openid = '提示:请注意 encodeURIComponent() 函数 与 encodeURI() 函数的区别之处,前者假定它的参数是 URI 的一部分(比如协议、主机名、路径或查询字符串)。因此 encodeURIComponent() 函数将转义用于分隔 URI 各个部分的标点符号。';
const openid = wx.getStorageSync('openId');
return {
title: '自定义转发标题',
title: `${this.$wepy.userInfo.nickName || '您的好朋友'}邀请您来抽奖啦~`,
path: `/pages/index?openid=${openid}`,
imageUrl: '',
imageUrl: this.$wepy.awardsInfo.photoUrl,
success: function(res) {
let shareId = res.shareTickets[0];
console.log('shareId', shareId);
......@@ -522,6 +523,7 @@
},
getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
if (!batchId) return;
wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
});
......@@ -566,84 +568,54 @@
}
});
}
this.list = [
{value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'},
{value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'},
{value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'},
{value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'},
{value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'},
{value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'},
{value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'},
{value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'},
{value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'},
{value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'}
];
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://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.list = [
// {value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'},
// {value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'},
// {value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'},
// {value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'},
// {value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'},
// {value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'},
// {value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'},
// {value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'},
// {value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'},
// {value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'}
// ];
// 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://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 = await getPrizeList();
// this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' }));
},
async onLoad (options) {
let that = this;
if (options.openid) {
this.inviter = options.openid;
}
this.adlist = [
{imgsrc: '/static/images/test1.jpg', text: '小明刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小2刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小3刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小4刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小5刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小6刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小7刚刚参与了抽奖'},
{imgsrc: '/static/images/test1.jpg', text: '小8刚刚参与了抽奖'}
];
// console.log(this.$app.$options.globalData.info,111)
// 如果已经存在store里就不用再获取用户信息了
this.adlist = await getActivityFeed({ count: 50 });
if (!this.userInfo) {
const setting = await wepy.wx.getSetting();
if (setting.authSetting['scope.userInfo']) {
const { userInfo } = wepy.wx.getUserInfo();
const { userInfo } = await wepy.wx.getUserInfo();
this.setUserInfo(userInfo);
this.getMainInfo();
if (wx.getStorageSync('isRegister') === false) {
const params = {
...userInfo,
inviter: this.inviter
};
await register(params);
wx.setStorageSync('isRegister', true);
}
await this.getMainInfo();
} else {
this.authmodal = true;
}
}
// if (this.userInfo) return;
// wx.getSetting({
// success: res => {
// if (res.authSetting['scope.userInfo']) {
// // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
// wx.getUserInfo({
// success: res => {
// // 可以将 res 发送给后台解码出 unionId
// if (res.userInfo) {
// that.setUserInfo(res.userInfo);
// // that.userInfo = res.userInfo;
// }
// // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// // 所以此处加入 callback 以防止这种情况
// if (that.userInfoReadyCallback) {
// that.userInfoReadyCallback(res => {
// that.setUserInfo(res.userInfo || {});
// // that.userInfo = res.userInfo||{};
// });
// }
// }
// });
// } else {
// that.authmodal = true;
// }
// }
// });
},
onShow() {
// 从其他小程序回来可以在当前生命周期检测到,但是这个方法,自己的小程序页面返回也会进入
......
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