Commit c0414228 authored by ziyu's avatar ziyu

improvement: 页面优化,bug修改

parent 23423d6d
...@@ -27,6 +27,7 @@ function checkUpdateVersion() { ...@@ -27,6 +27,7 @@ function checkUpdateVersion() {
const updateManager = wx.getUpdateManager(); const updateManager = wx.getUpdateManager();
//检测版本更新 //检测版本更新
updateManager.onCheckForUpdate(function(res) { updateManager.onCheckForUpdate(function(res) {
console.log(res,'版本更新');
// 请求完新版本信息的回调 // 请求完新版本信息的回调
if (res.hasUpdate) { if (res.hasUpdate) {
//监听小程序有版本更新事件 //监听小程序有版本更新事件
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
<div class="content"> <div class="content">
<div class="des">恭喜您!</div> <div class="des">恭喜您!</div>
<image class="image" src="/static/images/gold@2x.png"></image> <image class="image" src="/static/images/gold@2x.png"></image>
<div class="info">通过邀请以下好友,您获得{{goldNum}}克币</div> <div class="info" v-if="showFriends">通过邀请以下好友,您获得{{goldNum}}克币</div>
<div class="user" :class="{'one-user': inviteinfo.length === 1 }"> <div class="info padding" v-if="!showFriends">购买成功,获得{{goldNum}}克币</div>
<div class="user" :class="{'one-user': inviteinfo.length === 1 }" v-if="showFriends">
<image class="user-img" v-for="item in users" :src="item.avatarUrl"></image> <image class="user-img" v-for="item in users" :src="item.avatarUrl"></image>
<span class="user-rest" v-if="inviteinfo.length > 3">...</span> <span class="user-rest" v-if="inviteinfo.length > 3">...</span>
</div> </div>
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
props: { props: {
inviteinfo: { inviteinfo: {
type: Array type: Array
} },
type: String,
}, },
computed: { computed: {
goldNum() { goldNum() {
...@@ -56,8 +58,17 @@ ...@@ -56,8 +58,17 @@
p.push(n.accountItemId); p.push(n.accountItemId);
return p; return p;
}, []); }, []);
},
showFriends() {
if (this.type === 'buy') {
return false;
} else {
return true;
}
} }
}, },
created() {
},
methods: { methods: {
getGold: function() { getGold: function() {
this.$emit('getSharedGold', { this.$emit('getSharedGold', {
...@@ -230,6 +241,9 @@ ...@@ -230,6 +241,9 @@
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: @font-middle; font-size: @font-middle;
text-align: center; text-align: center;
&.padding {
padding-bottom:25rpx;
}
} }
.user { .user {
height: 84rpx; height: 84rpx;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
duration="600" duration="600"
circular="{{circular}}" circular="{{circular}}"
vertical vertical
current="1" current="0"
bindchange="moveSwiper" bindchange="moveSwiper"
bindanimationfinish="animationfinish"> bindanimationfinish="animationfinish">
<swiper-item wx:for="{{curQueue}}" wx:key="index"> <swiper-item wx:for="{{curQueue}}" wx:key="index">
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
object-fit="contain" object-fit="contain"
data-index="{{index}}" data-index="{{index}}"
@tap="videoTap" @tap="videoTap"
bindplay="videoPlay"
wx:if="{{item.showType && item.showType.value ==2}}" wx:if="{{item.showType && item.showType.value ==2}}"
> >
<video-pause :pause="videoPause"></video-pause> <video-pause :pause="videoPause"></video-pause>
...@@ -49,7 +48,7 @@ ...@@ -49,7 +48,7 @@
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import { getProbability } from '../../common/raffleProbability'; import { getProbability } from '../../common/raffleProbability';
import { getAwardsDetail } from '../../common/api.js'; import { getAwardsDetail, getPrizeList } from '../../common/api.js';
wepy.component({ wepy.component({
props: { props: {
videoList: { videoList: {
...@@ -68,12 +67,12 @@ ...@@ -68,12 +67,12 @@
nextQueue: [], nextQueue: [],
prevQueue: [], prevQueue: [],
curQueue: [], curQueue: [],
circular: true, circular: false,
_last: 1, _last: 0,
_invalidUp: 0, _invalidUp: 0,
_invalidDown: 0, _invalidDown: 1,
_videoContexts: [], _videoContexts: [],
currentIndex:1, currentIndex:0,
videoPause: false, videoPause: false,
videoLoading: false, videoLoading: false,
}, },
...@@ -99,7 +98,15 @@ ...@@ -99,7 +98,15 @@
this.curQueue.forEach(v => { this.curQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity); v.probability = getProbability(+newVal, +v.coinQuantity);
}); });
this.nextQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
});
this.prevQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
});
this.prevQueue = [...this.prevQueue];
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
this.nextQueue = [...this.nextQueue];
this.updateAwardsInfo(this.currentIndex); this.updateAwardsInfo(this.currentIndex);
}, },
_videoListChanged (newVal) { _videoListChanged (newVal) {
...@@ -112,9 +119,14 @@ ...@@ -112,9 +119,14 @@
_this.nextQueue.push(item); _this.nextQueue.push(item);
} }
}); });
this.playCurrent(1); this.playCurrent(0);
}else{ }else{
newVal.forEach(function (item) { //新进入的数组要去重
const curIds = this.curQueue.map(item => item.id);
const nextIds = _this.nextQueue.map(item => item.id);
const allIds = [...curIds, ...nextIds];
const theList = newVal.filter(item => (allIds.indexOf(item.id) === -1));
theList.forEach(function (item) {
_this.nextQueue.push(item); _this.nextQueue.push(item);
}); });
} }
...@@ -175,9 +187,11 @@ ...@@ -175,9 +187,11 @@
} }
} }
//如果next中如果就剩下4个了,请求下一页 //如果next中如果就剩下4个了,请求下一页
/*if(nextQueue.length <= 4) { if(nextQueue.length === 4) {
getPrizeList().then(data=>{
}*/ this._videoListChanged(data);
})
}
//当滑动到头时,circular改成false //当滑动到头时,circular改成false
let circular = true; let circular = true;
if (nextQueue.length === 0 && current !== 0) { if (nextQueue.length === 0 && current !== 0) {
...@@ -209,9 +223,6 @@ ...@@ -209,9 +223,6 @@
this.videoPause = true; this.videoPause = true;
} }
}, },
videoPlay() {
// this.videoLoading = false;
},
updateAwardsInfo(current) { updateAwardsInfo(current) {
const { id, photoUrl, name, probability } = this.curQueue[current]; const { id, photoUrl, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', { this.$emit('getAwardsInfo', {
......
...@@ -170,6 +170,9 @@ ...@@ -170,6 +170,9 @@
margin-top:10rpx; margin-top:10rpx;
} }
} }
.img-wrapper{
padding:30rpx;
}
</style> </style>
<template> <template>
<view class="video-wrapper"> <view class="video-wrapper">
...@@ -198,12 +201,14 @@ ...@@ -198,12 +201,14 @@
<network v-if="isConnected === false"/> <network v-if="isConnected === false"/>
<open-animation v-if="showModal === 2" :joinRecord="mainInfo && mainInfo.joinRecord"/> <open-animation v-if="showModal === 2" :joinRecord="mainInfo && mainInfo.joinRecord"/>
<shared-popup v-if="showModal === 1" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"/> <shared-popup v-if="showModal === 1" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"/>
<shared-popup v-if="showModal === 4" :inviteinfo="mainInfo && mainInfo.buyRecord" type="buy" @getSharedGold="getSharedGold"/>
<popup @showMenu="showMenu" :showMenus="showModal === 3"/> <popup @showMenu="showMenu" :showMenus="showModal === 3"/>
<!--商品推荐列表--> <!--商品推荐列表-->
<goods-list></goods-list> <goods-list></goods-list>
<van-dialog id="van-dialog"/> <van-dialog id="van-dialog"/>
<van-notify id="van-notify"/> <van-notify id="van-notify"/>
<van-popup show="{{ cornModal }}" bind:close="cornModalClose" custom-style="background-color:transparent"> <!--克币充值弹窗-->
<van-popup show="{{ cornModal }}" bind:close="ModalClose" custom-style="background-color:transparent">
<view class="corn-cont"> <view class="corn-cont">
<image src="/static/images/cornback.png" class="imgs"></image> <image src="/static/images/cornback.png" class="imgs"></image>
<view class="corn-title">请输入充值码</view> <view class="corn-title">请输入充值码</view>
...@@ -213,6 +218,14 @@ ...@@ -213,6 +218,14 @@
<button class="corn-button" bindtap="checkCode">确定</button> <button class="corn-button" bindtap="checkCode">确定</button>
</view> </view>
</van-popup> </van-popup>
<!--活动图片弹窗-->
<van-popup show="{{ avtivityModal }}" bind:close="ModalClose" round closeable>
<view class="img-wrapper">
<van-image use-loading-slot src="https://luckiistatic.q-gp.com/product-1.png" width="400rpx" fit="widthFix" radius="10rpx">
<van-loading slot="loading" type="spinner" size="30" vertical />
</van-image>
</view>
</van-popup>
</view> </view>
</template> </template>
...@@ -235,13 +248,14 @@ ...@@ -235,13 +248,14 @@
sign: true, sign: true,
inviter: '', inviter: '',
mainInfo: null, mainInfo: null,
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗 showModal: 0, // 1: 邀请好友金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗 4: 购买获得金币弹窗
isReceive: false, // 是否显示领取克币动画 isReceive: false, // 是否显示领取克币动画
cornModal: false, cornModal: false,
cornCode: '', // 克币充值码 cornCode: '', // 克币充值码
cornText: '', cornText: '',
cornTextShow: false, cornTextShow: true,
searchStyle:'', searchStyle:'',
avtivityModal: false, //展示活动弹窗
}, },
computed: { computed: {
...@@ -371,6 +385,7 @@ ...@@ -371,6 +385,7 @@
this.showModal = v ? 3 : 0; this.showModal = v ? 3 : 0;
}, },
getSharedGold: async function(v) { getSharedGold: async function(v) {
let modal = this.showModal;
this.showModal = 0; this.showModal = 0;
await addGold(v); await addGold(v);
this.showActivity(); this.showActivity();
...@@ -379,6 +394,10 @@ ...@@ -379,6 +394,10 @@
this.mainInfo.account.quantity = quantity + v.quantity; this.mainInfo.account.quantity = quantity + v.quantity;
this.isReceive = true; this.isReceive = true;
setTimeout(() => { setTimeout(() => {
if(this.mainInfo.buyRecord && this.mainInfo.buyRecord.length && modal !== 4) {
this.showModal = 4;
return;
}
if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) { if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
this.showModal = 2; this.showModal = 2;
} }
...@@ -395,6 +414,9 @@ ...@@ -395,6 +414,9 @@
} }
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) { if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showModal = 1; this.showModal = 1;
} else if (this.mainInfo.buyRecord && this.mainInfo.buyRecord.length) {
//购买获得金币
this.showModal = 4;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) { } else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
this.showModal = 2; this.showModal = 2;
} }
...@@ -426,8 +448,9 @@ ...@@ -426,8 +448,9 @@
this.cornCode = ''; this.cornCode = '';
this.cornModal = true; this.cornModal = true;
}, },
cornModalClose() { ModalClose() {
this.cornModal = false; this.cornModal = false;
this.avtivityModal = false;
}, },
checkCode() { checkCode() {
if (this.cornCode === '') { if (this.cornCode === '') {
...@@ -512,7 +535,6 @@ ...@@ -512,7 +535,6 @@
navigationBarTitleText: '主页', navigationBarTitleText: '主页',
usingComponents: { usingComponents: {
'van-button': '../components/vant/button/index', 'van-button': '../components/vant/button/index',
'prize-list': '~@/components/custom/prizeList',
'van-icon': '../components/vant/icon/index', 'van-icon': '../components/vant/icon/index',
'sign': '~@/components/custom/sign', 'sign': '~@/components/custom/sign',
'gold': '~@/components/custom/sign', 'gold': '~@/components/custom/sign',
...@@ -527,7 +549,9 @@ ...@@ -527,7 +549,9 @@
'goods-list': '../components/custom/goodsList', 'goods-list': '../components/custom/goodsList',
'activity-list': '../components/custom/activityList', 'activity-list': '../components/custom/activityList',
'van-popup':'../components/vant/popup/index', 'van-popup':'../components/vant/popup/index',
'video-list':'../components/custom/video' 'video-list':'../components/custom/video',
"van-image": "../components/vant/image/index",
"van-loading": "../components/vant/loading/index",
}, },
navigationStyle: "custom", navigationStyle: "custom",
disableScroll: true disableScroll: true
......
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
import Dialog from '../components/vant/dialog/dialog'; import Dialog from '../components/vant/dialog/dialog';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api'; import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';
import store from '../store'; import store from '../store';
let innerActivity= '', batchId = null; let innerActivity= '';
wepy.page({ wepy.page({
store, store,
data: { data: {
...@@ -271,6 +271,7 @@ ...@@ -271,6 +271,7 @@
errorText: '', errorText: '',
errorBtn: '确定', errorBtn: '确定',
hasPhone: false, hasPhone: false,
batchId: null,
}, },
methods: { methods: {
check() { check() {
...@@ -318,12 +319,12 @@ ...@@ -318,12 +319,12 @@
await register(store.state.userInfo); await register(store.state.userInfo);
wx.setStorageSync('isRegister', true); wx.setStorageSync('isRegister', true);
} }
if (!batchId) { if (!this.batchId) {
Notify({message: '数据加载中,请稍后重试!'}); Notify({message: '数据加载中,请稍后重试!'});
return; return;
} }
this.btnfont = '参与中...'; this.btnfont = '参与中...';
confirmRaffle({batchId: batchId}).then(data => { confirmRaffle({batchId: this.batchId}).then(data => {
this.btnfont = '立即参与'; this.btnfont = '立即参与';
let code = data.joinCode; let code = data.joinCode;
if (code === undefined) code = 3; if (code === undefined) code = 3;
...@@ -358,7 +359,7 @@ ...@@ -358,7 +359,7 @@
async getProgress(id) { async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {}; detail = detail || {};
batchId = detail.id; this.batchId = detail.id;
if (detail.quantity) { if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity; if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity * 100; const progressFloat = detail.join / detail.quantity * 100;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="search-last" v-show="isLoading"><van-loading type="spinner" text-size="26rpx">加载中</van-loading></view>
<view class="search-last" v-show="isDone">没有更多了~</view> <view class="search-last" v-show="isDone">没有更多了~</view>
</view> </view>
</template> </template>
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
data: { data: {
list:[], list:[],
isDone:false, isDone:false,
isLoading:false,
}, },
methods:{ methods:{
backUrl() { backUrl() {
...@@ -52,14 +54,16 @@ ...@@ -52,14 +54,16 @@
this.getList(val); this.getList(val);
}, },
getList(val) { getList(val) {
this.isLoading = true;
getSearchList({keyword:val,page:page}).then(data=>{ getSearchList({keyword:val,page:page}).then(data=>{
this.isLoading = false;
if(!data.hasMore) { if(!data.hasMore) {
this.isDone = true; this.isDone = true;
} }
this.list = [...this.list,...data.items]; this.list = [...this.list,...data.items];
}).catch(()=>{ }).catch(()=>{
this.isLoading = false;
}); });
}, },
toJingdong(event) { toJingdong(event) {
...@@ -182,6 +186,11 @@ ...@@ -182,6 +186,11 @@
color:@maincolor; color:@maincolor;
} }
} }
.search-item:last-child {
.cont-wrap {
border-bottom: none;
}
}
.search-last { .search-last {
text-align: center; text-align: center;
padding:30rpx 0; padding:30rpx 0;
......
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