Commit c0414228 authored by ziyu's avatar ziyu

improvement: 页面优化,bug修改

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