Commit 8fc54288 authored by ziyu's avatar ziyu

improvement: 优化

parent e718e4cb
function computClass (current,index,length) {
var allclass = "";
// 无限循环当current为最后一个的时候,select就应该是0 例如长度为10,当current为9时,select就应该是0
// if(current+1==index || (current==length-1 && index==0) ) allclass = "select";
// 无限循环当current为最后一个/两个的时候的时候,例如长度为10,当current为8/9时,select就应该是1/0
//if(current+2 == index|| (current>=length-2 && index==current-length+2))
//allclass='subright';
if(current-1 == index||(current == 0&&index==length-1))
allclass='subleft';
if(current==index)
allclass='select';
if(current+1==index || (current==length-1 && index==0) )
allclass = "subright";
return allclass;
};
function getClass (status) {
var cls=['','green','grey','','red','red'];
var index = status.value || 0;
console.log(status)
return cls[index]
};
module.exports = {
computClass:computClass,
getClass:getClass
}
...@@ -181,27 +181,7 @@ ...@@ -181,27 +181,7 @@
} }
} }
</style> </style>
<wxs module="tools"> <wxs module="tools" src="../common/common.wxs"></wxs>
// 无限循环当current为最后一个的时候,select就应该是0 例如长度为10,当current为9时,select就应该是0
// if(current+1==index || (current==length-1 && index==0) ) allclass = "select";
// 无限循环当current为最后一个/两个的时候的时候,例如长度为10,当current为8/9时,select就应该是1/0
//if(current+2 == index|| (current>=length-2 && index==current-length+2))
//allclass='subright';
function computClass (current,index,length) {
var allclass = "";
if(current-1 == index||(current == 0&&index==length-1))
allclass='subleft';
if(current==index)
allclass='select';
if(current+1==index || (current==length-1 && index==0) )
allclass = "subright";
return allclass;
};
module.exports = {
computClass:computClass
}
</wxs>
<template> <template>
<view class="video-wrapper"> <view class="video-wrapper">
<view id="myvideo"> <view id="myvideo">
...@@ -300,17 +280,13 @@ ...@@ -300,17 +280,13 @@
current: 5, // 商品列表初次展示第几个 current: 5, // 商品列表初次展示第几个
swiperItem: 2, swiperItem: 2,
videoList: [], videoList: [],
length: 4,
circular: false, // 商品是否无限循环 circular: false, // 商品是否无限循环
topPage: 0, topPage: 0,
lastPage: 0, lastPage: 0,
currentIndex: 5, // 商品当前滑动到第几个 currentIndex: 5, // 商品当前滑动到第几个
authmodal: false, authmodal: false,
sign: true, sign: true,
showAnimation: false,
userImgStyle: '', userImgStyle: '',
goldStyle: '',
goldNum: 50000,
awards: false, awards: false,
showMenus: false, showMenus: false,
inviter: '', inviter: '',
...@@ -386,7 +362,6 @@ ...@@ -386,7 +362,6 @@
}, },
toViewPage(e) { toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item; let item = e.$wx.currentTarget.dataset.item;
// 解决长按触发tap事件的bug
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', appId: 'wx91d27dbf599dff74',
path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径 path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径
...@@ -396,9 +371,6 @@ ...@@ -396,9 +371,6 @@
// console.log('跳转成功'); // console.log('跳转成功');
} }
}); });
/* wx.navigateTo({
url: '/pages/auth'
}); */
}, },
touchStart (event) { touchStart (event) {
touchDotX = event.touches[0].pageX; // 获取触摸时的原点 touchDotX = event.touches[0].pageX; // 获取触摸时的原点
...@@ -461,11 +433,6 @@ ...@@ -461,11 +433,6 @@
}, },
changeVideo(e) { changeVideo(e) {
this.setIsConnected(); this.setIsConnected();
// if (this.length - e.activeId === 1) {
// this.videoList = [{id: e.activeId + 2, url: 'https://ip1707952229.mobgslb.tbcache.com/youku/6974c3708c0337150e1743b1c/03000801005EA2A6C8FB4C2003E8807282A547-8207-4F52-9663-969096765248.mp4?sid=158960247500010009412_00_Bac09720260d484f23ac2ccebe5206930&sign=b76f4099e108fc306d3db993d1bec0a8&ctype=50&ali_redirect_domain=vali.cp31.ott.cibntv.net&ali_redirect_ex_ftag=5898cd25832bbff232de6d9fa668e8ddf8bacc5fef3f2e7b&ali_redirect_ex_tmining_ts=1589602477&ali_redirect_ex_tmining_expire=3600&ali_redirect_ex_hot=111'}];
// this.length += 1;
// console.log('add video');
// }
}, },
deleteAnimation (current) { deleteAnimation (current) {
if (current && current.itemid !== undefined) { if (current && current.itemid !== undefined) {
...@@ -681,32 +648,6 @@ ...@@ -681,32 +648,6 @@
} }
this.getMainInfo(); this.getMainInfo();
this.videoList = await getPrizeList(); this.videoList = await getPrizeList();
// let urls = [
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: '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'},
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg'},
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: '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, idx) => {
// return {
// cash: false,
// coinQuantity: 29900,
// createdAt: 1590645948000,
// id: idx,
// name: '蓝牙音箱',
// photoUrl: url.type === 'image' ? url.url : null,
// price: 299,
// status: {name: '上架', value: 1},
// stock: 1,
// totalStock: 1,
// updatedAt: 1590741775000,
// videoUrl: url.type === 'video' ? url.url : null,
// snapshot: url.type === 'video' ? url.snapshot : null
// };
// });
this.showActivity(); this.showActivity();
}, },
async onShow() { async onShow() {
......
...@@ -70,17 +70,7 @@ ...@@ -70,17 +70,7 @@
} }
} }
</style> </style>
<wxs module="prize"> <wxs module="prize" src="../common/common.wxs"></wxs>
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" wx:for="{{list}}" wx:key="index"> <view class="raffle-item" wx:for="{{list}}" wx:key="index">
...@@ -93,7 +83,7 @@ ...@@ -93,7 +83,7 @@
<view class="item-corn">花费: {{item.quantity}}克币</view> <view class="item-corn">花费: {{item.quantity}}克币</view>
<view class="item-status"> <view class="item-status">
<button data-id="{{item.id}}" class="item-button" bindtap="goprize" v-if="item.status.value==3">领取</button> <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>{{fonts[item.status.value]}}</text> <text class="{{prize.getClass(item.status)}}" v-else>{{fonts[item.status.value]}}</text>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -327,6 +327,7 @@ ...@@ -327,6 +327,7 @@
return; return;
} }
if (this.hasPhone) { if (this.hasPhone) {
//当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) { if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
this.showModal(); this.showModal();
}else { }else {
......
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