Commit b7bb886d authored by ziyu's avatar ziyu

improvement: 优化

parent f4d6e876
...@@ -76,7 +76,6 @@ wepy.app({ ...@@ -76,7 +76,6 @@ wepy.app({
'pages/myraffles', 'pages/myraffles',
'pages/help', 'pages/help',
'pages/morehelp', 'pages/morehelp',
'pages/awards',
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
<image class="star-image" src="/static/images/star@2x.png"></image> <image class="star-image" src="/static/images/star@2x.png"></image>
</div> </div>
<div class="fail-content" v-if="!isWin"> <div class="fail-content" v-if="!isWin">
<div class="des">很遗憾,未中奖</div> <div class="des">很遗憾,未中奖</div>
<div class="des">感谢您的参与!</div> <div class="des">感谢您的参与!</div>
</div> </div>
<div class="success-content" v-if="isWin"> <div class="success-content" v-if="isWin">
<div class="des">恭喜您中奖!</div> <div class="des">恭喜您中奖!</div>
<image class="image" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590418868788&di=5f7d14c51ea4d224c68d2f84b528c6f0&imgtype=0&src=http%3A%2F%2Fimg2.imgtn.bdimg.com%2Fit%2Fu%3D2413142997%2C2945797382%26fm%3D214%26gp%3D0.jpg"></image> <image class="image" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590418868788&di=5f7d14c51ea4d224c68d2f84b528c6f0&imgtype=0&src=http%3A%2F%2Fimg2.imgtn.bdimg.com%2Fit%2Fu%3D2413142997%2C2945797382%26fm%3D214%26gp%3D0.jpg"></image>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</div> </div>
<div class="dialog-footer"> <div class="dialog-footer">
<button class="btn" @tap="go">立即查看</button> <button class="btn" @tap="go">立即查看</button>
<button class="btn" @tap="go">再次挑战</button> <button class="btn" @tap="hideAnimation">再次挑战</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -84,9 +84,15 @@ ...@@ -84,9 +84,15 @@
}, 500); }, 500);
}, 2000); }, 2000);
}, },
hideAnimation (){
this.showAnimation = false;
},
go() { go() {
this.showAnimation = false; this.showAnimation = false;
//如果得奖了走
wx.navigateTo({url:'/pages/prize'}) wx.navigateTo({url:'/pages/prize'})
//如果没得奖走
//wx.navigateTo({url:'/pages/myraffles'})
} }
}, },
created() { created() {
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
}, },
data: { data: {
menus: [ menus: [
{ img: '/static/images/awards@2x.png', title: '我的抽奖', path: '/pages/awards' }, { img: '/static/images/awards@2x.png', title: '我的抽奖', path: '/pages/myraffles' },
{ img: '/static/images/feedback@2x.png', title: '规则与帮助', path: '/pages/feedback' }, { img: '/static/images/feedback@2x.png', title: '规则与帮助', path: '/pages/help' },
{ img: '/static/images/help@2x.png', title: '问题反馈', path: '/pages/help' } { img: '/static/images/help@2x.png', title: '问题反馈', path: '/pages/help' }
], ],
show: false, show: false,
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
} }
100% { 100% {
transform: translate3d(0, -5%, 0); transform: translate3d(0, -5%, 0);
opacity: 0; opacity: 0;
} }
} }
......
<style lang="less">
</style>
<template>
<view>我的抽奖</view>
</template>
<script>
import wepy from '@wepy/core';
wepy.page({
});
</script>
<style lang="less">
</style>
<template>
<view>问题反馈</view>
</template>
<script>
import wepy from '@wepy/core';
wepy.page({
});
</script>
...@@ -168,7 +168,6 @@ ...@@ -168,7 +168,6 @@
</wxs> </wxs>
<template> <template>
<view class="video-wrapper"> <view class="video-wrapper">
<van-dialog id="van-dialog" />
<view id="myvideo"> <view id="myvideo">
<van-notify id="van-notify" /> <van-notify id="van-notify" />
<video-list :videoList.sync="videoList" :total="total" bindchange="changeVideo"> <video-list :videoList.sync="videoList" :total="total" bindchange="changeVideo">
...@@ -244,7 +243,6 @@ ...@@ -244,7 +243,6 @@
import store from '../store'; import store from '../store';
import { mapState, mapActions } from '@wepy/x'; import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import Dialog from '../components/vant/dialog/dialog';
import Notify from '../components/vant/notify/notify'; import Notify from '../components/vant/notify/notify';
wepy.page({ wepy.page({
store, store,
...@@ -521,6 +519,10 @@ ...@@ -521,6 +519,10 @@
url: '/pages/raffle?id=1&progress=70&chance=1/780&corn=50000&imgsrc=/static/images/test2.png&goods=Nintendo Switch任天堂游戏机任天堂游戏机' url: '/pages/raffle?id=1&progress=70&chance=1/780&corn=50000&imgsrc=/static/images/test2.png&goods=Nintendo Switch任天堂游戏机任天堂游戏机'
}); });
// this.awards = !this.awards; // this.awards = !this.awards;
},
showMenu: function(v) {
console.log(v);
this.showMenus = v;
} }
}, },
...@@ -623,7 +625,6 @@ ...@@ -623,7 +625,6 @@
'van-button': '../components/vant/button/index', 'van-button': '../components/vant/button/index',
'video-list': '~@/components/custom/videolist', 'video-list': '~@/components/custom/videolist',
'van-icon': '../components/vant/icon/index', 'van-icon': '../components/vant/icon/index',
'van-dialog': '../components/vant/dialog/index',
'video-sign': '~@/components/custom/sign', 'video-sign': '~@/components/custom/sign',
'video-gold': '~@/components/custom/sign', 'video-gold': '~@/components/custom/sign',
'video-share': '~@/components/custom/sign', 'video-share': '~@/components/custom/sign',
......
<style lang="less"> <style lang="less">
.raffles-list{
padding-bottom:30rpx;
}
.raffle-item{ .raffle-item{
background-color: #fff; background-color: #fff;
padding:30rpx 0 0 30rpx; padding:30rpx 0 0 30rpx;
...@@ -63,45 +66,27 @@ ...@@ -63,45 +66,27 @@
} }
} }
</style> </style>
<wxs module="prize">
function computClass (status) {
var cls=['','green','grey','','red','red'];
var index = status.value || 0;
console.log(status)
return cls[index]
};
module.exports = {
computClass:computClass
}
</wxs>
<template> <template>
<view class="raffles-list"> <view class="raffles-list">
<view class="raffle-item"> <view class="raffle-item" wx:for="{{list}}" wx:key="index">
<image src="/static/images/test1.jpg" class="item-img"></image> <image src="{{item.prize.photoUrl}}" class="item-img"></image>
<view class="item-right">
<view class="item-title">Nintendo Switch任天堂游戏机任天堂游戏机</view>
<view class="item-corn">花费: 500克币</view>
<view class="item-status">
<button class="item-button">领取</button>
</view>
</view>
</view>
<view class="raffle-item">
<image src="/static/images/test1.jpg" class="item-img"></image>
<view class="item-right">
<view class="item-title">Nintendo Switch任天堂游戏机任天堂游戏机</view>
<view class="item-corn">花费: 500克币</view>
<view class="item-status">
<text class="grey">未中奖</text>
</view>
</view>
</view>
<view class="raffle-item">
<image src="/static/images/test1.jpg" class="item-img"></image>
<view class="item-right">
<view class="item-title">Nintendo Switch任天堂游戏机任天堂游戏机</view>
<view class="item-corn">花费: 500克币</view>
<view class="item-status">
<text class="red">已发货</text>
</view>
</view>
</view>
<view class="raffle-item">
<image src="/static/images/test1.jpg" class="item-img"></image>
<view class="item-right"> <view class="item-right">
<view class="item-title">Nintendo Switch任天堂游戏机任天堂游戏机</view> <view class="item-title">{{item.prize.name}}</view>
<view class="item-corn">花费: 500克币</view> <view class="item-corn">花费: {{item.quantity}}克币</view>
<view class="item-status"> <view class="item-status">
<text class="green">待开奖</text> <button data-id="{{item.id}}" class="item-button" bindtap="goprize" v-if="item.status.value==3">领取</button>
<text class="{{prize.computClass(item.status)}}" v-else>{{item.status.name}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -114,10 +99,20 @@ ...@@ -114,10 +99,20 @@
list:[] list:[]
}, },
methods: { methods: {
goprize(event) {
let detail = event.$wx.currentTarget;
let id = detail.dataset.id || ''
wx.navigateTo({url:'/pages/prize?prizeid='+id});
}
}, },
onLoad (query) { onLoad (query) {
this.list = [
{id:1,status:{name:'待开奖',value:1},quantity:500,prize:{name:'Nintendo Switch任天堂游戏机任天堂游戏机',photoUrl:'/static/images/test1.jpg'}},
{id:2,status:{name:'未中奖',value:2},quantity:200,prize:{name:'Nintendo Switch任天堂游戏机任天堂游戏机',photoUrl:'/static/images/test1.jpg'}},
{id:3,status:{name:'待领取',value:3},quantity:300,prize:{name:'Nintendo Switch任天堂游戏机任天堂游戏机',photoUrl:'/static/images/test1.jpg'}},
{id:4,status:{name:'未发货',value:4},quantity:400,prize:{name:'Nintendo Switch任天堂游戏机任天堂游戏机',photoUrl:'/static/images/test1.jpg'}},
{id:5,status:{name:'已发货',value:5},quantity:500,prize:{name:'Nintendo Switch任天堂游戏机任天堂游戏机',photoUrl:'/static/images/test1.jpg'}},
];
}, },
}); });
</script> </script>
......
...@@ -58,6 +58,9 @@ ...@@ -58,6 +58,9 @@
font-size: 30rpx; font-size: 30rpx;
} }
} }
.van-picker .van-picker__cancel,.van-picker .van-picker__confirm{
color:#FF5D15;
}
</style> </style>
<template> <template>
<view class="prize-wrapper"> <view class="prize-wrapper">
...@@ -83,11 +86,14 @@ ...@@ -83,11 +86,14 @@
<view class="footer"> <view class="footer">
<button class="getprize" bindtap="goprize">领取</button> <button class="getprize" bindtap="goprize">领取</button>
</view> </view>
<van-dialog id="van-dialog" confirmButtonColor="#FF5D15"/>
<van-notify id="van-notify" />
</view> </view>
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import Dialog from '../components/vant/dialog/dialog'; import Dialog from '../components/vant/dialog/dialog';
import Notify from '../components/vant/notify/notify';
var area = require('../components/custom/china.js'); var area = require('../components/custom/china.js');
wepy.page({ wepy.page({
data: { data: {
...@@ -101,6 +107,29 @@ ...@@ -101,6 +107,29 @@
}, },
methods: { methods: {
goprize() { goprize() {
if(!this.name){
Notify({message: '请填写收货人', background:'#FF5D15'});
return;
}
if(!this.phone){
Notify({message: '请填写手机号码', background:'#FF5D15'});
return;
}
if(!this.city){
Notify({message: '请选择所在地区', background:'#FF5D15'});
return;
}
if(!this.address){
Notify({message: '请填写详细地址', background:'#FF5D15'});
return;
}
Dialog.alert({
title: '领取成功',
message: '您所领取的奖品我们将在3到5个工作日内寄出,请您耐心等待,感谢您的参与!',
}).then(() => {
wx.reLaunch({url:'/pages/index'})
// on confirm
});
console.log(this.name,this.phone,this.address); console.log(this.name,this.phone,this.address);
}, },
onClose() { onClose() {
...@@ -132,7 +161,9 @@ ...@@ -132,7 +161,9 @@
"van-field": "../components/vant/field/index", "van-field": "../components/vant/field/index",
"van-cell": "../components/vant/cell/index", "van-cell": "../components/vant/cell/index",
"van-area": "../components/vant/area/index", "van-area": "../components/vant/area/index",
"van-popup": "../components/vant/popup/index" "van-popup": "../components/vant/popup/index",
'van-dialog': '../components/vant/dialog/index',
"van-notify": "../components/vant/notify/index"
} }
} }
</config> </config>
...@@ -157,20 +157,15 @@ ...@@ -157,20 +157,15 @@
let detail = e.$wx.detail || {}; let detail = e.$wx.detail || {};
//调用接口将加密数据传给后端,e.$wx.detail整体都传过去 //调用接口将加密数据传给后端,e.$wx.detail整体都传过去
//如果数据得到了就跳转 //如果数据得到了就跳转
console.log(detail,111)
if(detail.encryptedData) { if(detail.encryptedData) {
Notify({message: '恭喜您参与成功!',background:'rgba(0,0,0,0.7)'}) Notify({message: '恭喜您参与成功!',background:'#FF5D15'})
}else { }else {
Notify({message: '参与失败,请重新授权!',background:'rgba(0,0,0,0.7)'}) Notify({message: '参与失败,请重新授权!',background:'#FF5D15'})
} }
}, },
joinin() { joinin() {
if(!this.isCheck) { if(!this.isCheck) {
Notify({message: '请先勾选协议!', background:'#999'}) Notify({message: '请先勾选协议!', background:'#FF5D15'})
/*Dialog.alert({
message: '请先勾选协议!',
})*/
} }
} }
}, },
......
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