Commit 8127fd2b by 谢中龙

修改视频图片

parent 8db28035
......@@ -27,7 +27,7 @@
<video id="myVideo"
class="item-img video-cover"
src="{{indexUrl}}"
muted
muted="{{true}}"
wx:if="{{utils.isVideo(indexUrl)}}"></video>
<view class="item-title-box">
......
......@@ -85,8 +85,9 @@ wxService.page({
wxService.post(`/member/minaLogin`, param).then(response=>{
let dataResp = response.data.data
wx.setStorageSync('token', dataResp.token)
dataResp.memberActivateStatus = true;
wx.setStorageSync('_baseUserInfo', dataResp)
this.goUserCenter()
this.goUserCenter();
return Promise.resolve({ response })
}).catch(err=>{
this.goUserCenter()
......
......@@ -48,7 +48,7 @@
</view>
</view>
<view class="consumption-tips">-香烟与服务类商品不计分-</view>
<!-- <view class="consumption-tips">-香烟与服务类商品不计分-</view> -->
</view>
<!--goHome-->
......
......@@ -25,6 +25,7 @@ wxService.page({
currentShareContent: null,
fromZc: false,
scene:'', //触点参数
autoplay : true
},
handelToHome() {
wx.reLaunch({
......@@ -81,11 +82,7 @@ wxService.page({
}
},
swiperChange(e) {
this.setData({
swiperCurrent: e.detail.current
})
},
// 立即开通plus
openPlus(){
......@@ -374,6 +371,46 @@ wxService.page({
}
})
},
//点击播放
onVideoPlay(e){
this.setData({
autoplay : false,
})
},
//视频暂停
onVideoPause(e){
this.setData({
autoplay : true,
})
},
//swiper改变
swiperChange(e) {
this.setData({
swiperCurrent: e.detail.current
});
this.swiperChangePauseVideo();
},
//切换的时候
swiperChangePauseVideo(){
this.videoContext = [];
this.data.productInfo.listUrls.forEach((item,index) => {
let isVideo = utils.isVideo(item);
if(isVideo){
this.videoContext.push(wx.createVideoContext('myVideo' + index, this));
}
});
setTimeout(() => {
this.videoContext.forEach(item => {
item.pause();
});
this.setData({
autoplay : true,
})
});
},
/**
* 用户点击右上角分享
*/
......
......@@ -11,7 +11,7 @@
<view>
<!-- <buy-image-swiper image-data="{{imageData}}"/>
-->
<swiper autoplay="true" style="height: 750rpx;line-height: 100rpx;" bindchange="swiperChange">
<swiper autoplay="{{autoplay}}" style="height: 750rpx;line-height: 100rpx;" bindchange="swiperChange">
<block wx:for="{{productInfo.listUrls}}" wx:key="index">
<swiper-item>
<image class="swiper-image"
......@@ -22,7 +22,10 @@
<video id="myVideo{{index}}"
class="swiper-image video-cover"
src="{{item}}"
muted
play-btn-position="center"
enable-play-gesture="{{true}}"
data-index="{{index}}"
bindplay="onVideoPlay"
wx:if="{{utils.isVideo(item)}}"></video>
</swiper-item>
</block>
......
......@@ -149,7 +149,7 @@
"id": 16,
"name": "商品详情页",
"pathName": "pages/productDetail/productDetail",
"query": "id=693123742469066752",
"query": "id=694920880513486848",
"scene": null
},
{
......@@ -623,6 +623,13 @@
"pathName": "subPackageA/page/pages/pointExchangeGoods/pointExchangeGoods",
"query": "",
"scene": null
},
{
"id": -1,
"name": "选择商品",
"pathName": "shoppingGuid/page/pages/selectProductList/selectProductList",
"query": "",
"scene": null
}
]
}
......
// shoppingGuid/page/pages/home/home.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
const app = getApp();
......@@ -125,15 +126,22 @@ wxService.page({
title: '获取商品信息中..',
});
wxService.post(`/sale/product/listPage?pageNo=1&pageSize=10000`,{
productIds : proIds
productIds : proIds,
showListUrls : true,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
this.data.goods.goodsList = list;
list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl :defaultGoodsImg;
item.productImgUrl = item.productImgUrl ? item.productImgUrl :defaultGoodsImg;
item.listUrls = item.listUrls ? item.listUrls : [];
if(!this.isVideoUrl(item.indexUrl)){
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
else{
item.indexUrl = utils.getFirstImgUrl(item.listUrls);
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
});
this.setData({
......
<!--shoppingGuid/page/pages/home/home.wxml-->
<wxs src="../../../../wxs/utils.wxs" module="utils" />
<!-- 常用工具 -->
<view class='top-items'>
<view class='header'>常用工具</view>
......@@ -83,11 +84,13 @@
wx:for="{{goods.goodsList}}"
wx:for-item="item"
wx:for-index="idx"
wx:key="goodslist{{idx}}"
wx:key="*this"
data-item="{{item}}"
bindtap='onTapToGoodsDetail'
data-index="{{idx}}">
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<image class='goods-lf-icon' src='{{item.productImgUrl}}'
mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>{{item.productName}}</view>
<view class='goods-second-title'>{{item.subtitle}}</view>
......@@ -118,7 +121,7 @@
<view class='half-item {{item.isActive ? "active" : ""}}'
wx:for="{{navBar}}"
wx:for-item="item"
wx:key="topbar{{idx}}"
wx:key="*this"
wx:for-index="idx"
bindtap='onTopBarTap'
data-index="{{idx}}"
......@@ -133,7 +136,7 @@
<!-- 招募榜 -->
<view wx:if="{{current == 1}}">
<view class='rank-list' wx:if="{{rankList.length}}">
<block wx:for="{{rankList}}" wx:key="{{index}}" wx:for-item="item">
<block wx:for="{{rankList}}" wx:key="*this" wx:for-item="item">
<view class='rank-item'>
<image class='u-logo' src='{{item.member.avatar? item.member.avatar : defaultAvatar}}' mode='aspectFit'></image>
<view class='rank-u-info'>
......@@ -149,7 +152,7 @@
<!-- 门店榜 -->
<view wx:if="{{current == 2}}">
<view class='rank-list' wx:if="{{storeList.length}}">
<block wx:for="{{storeList}}" wx:key="{{index}}" wx:for-item="item">
<block wx:for="{{storeList}}" wx:key="*this" wx:for-item="item">
<view class='rank-item'>
<image class='u-logo' src='{{item.member.avatar? item.member.avatar : defaultAvatar}}' mode='aspectFit'></image>
<view class='rank-u-info'>
......
// shoppingGuid/page/pages/moreProducts/moreProducts.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
let defaultUrl = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
const defaultGoodsImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
const app = getApp();
wxService.page({
......@@ -120,15 +122,22 @@ wxService.page({
title: '获取商品信息中..',
});
wxService.post(`/sale/product/listPage?pageNo=1&pageSize=10000`,{
productIds : proIds
productIds : proIds,
showListUrls : true,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
this.data.goods.goodsList = list;
list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl : defaultUrl;
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultUrl;
item.listUrls = item.listUrls ? item.listUrls : [];
if(!utils.isVideo(item.indexUrl)){
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
else{
item.indexUrl = utils.getFirstImgUrl(item.listUrls);
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
});
this.setData({
......
......@@ -24,7 +24,7 @@
wx:for-index="idx"
data-item="{{item}}"
bindtap='onTapToGoodsDetail'
wx:key="{{idx}}">
wx:key="*this">
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>{{item.productName}}</view>
......
......@@ -3,6 +3,8 @@ const app = getApp()
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
const envInfo = require('../../../../config/index').envInfo;
const defaultGoodsImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
wxService.page({
/**
......@@ -45,16 +47,24 @@ wxService.page({
},
//获取商品列表
getProductList(refresh){
wxService.post(`/sale/product/buyer/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, {
wxService.post(`/sale/product/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, {
productName: this.data.productName,
productStatus : 2,
showListUrls : true,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
list.forEach(item => {
item.checked = false;
item.minSalePriceText = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.indexUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl : 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg'
item.listUrls = item.listUrls ? item.listUrls : [];
if(!utils.isVideo(item.indexUrl)){
item.indexUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
else{
item.indexUrl = utils.getFirstImgUrl(item.listUrls);
item.indexUrl = item.indexUrl ? item.indexUrl : defaultGoodsImg;
}
});
this.data.productList = this.data.productList.concat(list);
......@@ -73,21 +83,7 @@ wxService.page({
}
});
},
//获取数组中第一个图片格式的url
isVideoUrl(url){
if(url){
let lastIndexOfPoint = url.lastIndexOf('.');
let extd = url.substring(lastIndexOfPoint).toUpperCase();
if(extd != '.MP4' && extd != '.MP3' && extd != ".MOV"){
return false;
}
else{
return true;
}
}
return false;
},
//处理选中
handlerChecked(){
let checkedProduct = wx.getStorageSync('guiderReleaseProducts') ? wx.getStorageSync('guiderReleaseProducts') : [];
......
// shoppingGuid/page/pages/taskNotice/taskNotice.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
let defaultImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
const app = getApp();
const defaultGoodsImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
wxService.page({
/**
* 页面的初始数据
......@@ -79,15 +81,22 @@ wxService.page({
title: '获取商品信息中..',
});
wxService.post(`/sale/product/listPage?pageNo=1&pageSize=10000`,{
productIds : proIds
productIds : proIds,
showListUrls : true,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
this.data.goods.goodsList = list;
list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl : defaultImg ;
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultImg ;
item.listUrls = item.listUrls ? item.listUrls : [];
if(!this.isVideoUrl(item.indexUrl)){
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
else{
item.indexUrl = utils.getFirstImgUrl(item.listUrls);
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
});
this.setData({
......
......@@ -19,7 +19,7 @@
data-item="{{item}}"
bindtap='onTapToGoodsDetail'
wx:key="{{idx}}">
<image class='goods-lf-icon' src='{{item.indexUrl}}' mode='aspectFit'></image>
<image class='goods-lf-icon' src='{{item.productImgUrl}}' mode='aspectFit'></image>
<view class='goods-rg-info'>
<view class='goods-title'>{{item.productName}}</view>
<view class='goods-second-title'>{{item.subtitle}}</view>
......
// shoppingGuid/page/pages/welfare/welfare.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
import { Integer } from '../../../../utils/integerDigitalConvertion'
var app = getApp()
......@@ -119,14 +120,22 @@ wxService.page({
title: '获取商品信息中..',
});
wxService.post(`/sale/product/listPage?pageNo=1&pageSize=10000`,{
productIds : proIds
productIds : proIds,
showListUrls : true,
}).then(res => {
if(res){
let list = res.data.data.content ? res.data.data.content : [];
this.data.goods.goodsList = list;
list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = item.indexUrl;
item.listUrls = item.listUrls ? item.listUrls : [];
if(!utils.isVideo(item.indexUrl)){
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
else{
item.indexUrl = utils.getFirstImgUrl(item.listUrls);
item.productImgUrl = item.indexUrl ? item.indexUrl :defaultGoodsImg;
}
});
this.setData({
......
// subPackage/page/pages/fun/fun.js
var app = getApp()
const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion'
let defaultImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
......@@ -197,6 +198,7 @@ wxService.page({
categoryIds: [],
productTagIds : [this.data.tagId],
productStatus : 2,
showListUrls : true,
// sortType : this.data.form.sortType,
// order : this.data.form.order,
}).then(res => {
......
......@@ -419,6 +419,39 @@ function configSliderBlock(app){
}
}
//判断链接是不是视频格式
function isVideo(url){
if(url){
let lastIndexOfPoint = url.lastIndexOf('.');
let extd = url.substring(lastIndexOfPoint).toUpperCase();
if(extd != '.MP4' && extd != '.MP3' && extd != ".MOV"){
return false;
}
else{
return true;
}
}
return false;
}
//获取第一个图片格式的图片
function getFirstImgUrl(urls){
let retUrl = '';
for(let i = 0 ; i < urls.length ; i ++){
let url = urls[i];
let lastIndexOfPoint = url.lastIndexOf('.');
let extd = url.substring(lastIndexOfPoint).toUpperCase();
if(extd != '.MP4' && extd != '.MP3' && extd != ".MOV"){
retUrl = url;
break;
}
}
return retUrl;
}
wxService.setGetAuthUserInfo(_getUserInfo);
module.exports = {
......@@ -435,6 +468,8 @@ module.exports = {
parseUrl,
getDateDiff,
_,
isVideo,
getFirstImgUrl,
// _: underscore,
HandlerDataOnPage,
formatTime: formatTime,
......
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