Commit 8db28035 by 谢中龙

优化功能

parent 209423dc
...@@ -16,11 +16,20 @@ ...@@ -16,11 +16,20 @@
<template name="water-list"> <template name="water-list">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}"> <navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}">
<view class="item"> <view class="item">
<!-- 图片主图时 -->
<image class="item-img" <image class="item-img"
src="{{indexUrl}}" src="{{indexUrl}}"
mode="widthFix" lazy-load mode="widthFix" lazy-load
wx:if="{{!utils.isVideo(indexUrl)}}"
binderror="imgLoadError" binderror="imgLoadError"
data-index="{{index}}"></image> data-index="{{index}}"></image>
<video id="myVideo"
class="item-img video-cover"
src="{{indexUrl}}"
muted
wx:if="{{utils.isVideo(indexUrl)}}"></video>
<view class="item-title-box"> <view class="item-title-box">
<view class="item-title">{{productName}}</view> <view class="item-title">{{productName}}</view>
</view> </view>
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
border-top-left-radius: 10rpx; border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx; border-top-right-radius: 10rpx;
} }
.video-cover{
max-height: 188px;
}
.item-title{ .item-title{
font-size: 25rpx; font-size: 25rpx;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -4,7 +4,16 @@ ...@@ -4,7 +4,16 @@
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{item.productId}}"> <navigator hover-class="none" url="/pages/productDetail/productDetail?id={{item.productId}}">
<view class="hot-item border_box" > <view class="hot-item border_box" >
<view class="hot-img-box"> <view class="hot-img-box">
<image class="hot-img" src="{{item.indexUrl}}" mode="widthFix" lazy-load /> <image class="hot-img"
src="{{item.indexUrl}}"
mode="aspectFit" lazy-load
wx:if="{{!utils.isVideo(item.indexUrl)}}"/>
<video id="myVideo"
class="hot-img"
src="{{item.indexUrl}}"
muted
wx:if="{{utils.isVideo(item.indexUrl)}}"></video>
</view> </view>
<view class="hot-item-desc border_box"> <view class="hot-item-desc border_box">
<view class="item-name">{{item.productName}}</view> <view class="item-name">{{item.productName}}</view>
......
<!--component/scrollDel/scrollDel.wxml--> <!--component/scrollDel/scrollDel.wxml-->
<!--<scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px'>--> <!--<scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px'>-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<scroll-view scroll-y="{{isScroll}}"> <scroll-view scroll-y="{{isScroll}}">
<block class="cart-item" wx:key="item" wx:for="{{cartList}}"> <block class="cart-item" wx:key="item" wx:for="{{cartList}}">
<view data-index='{{index}}' <view data-index='{{index}}'
...@@ -16,7 +17,17 @@ ...@@ -16,7 +17,17 @@
<!-- productStatus 0未发布1下架2上架3删除 --> <!-- productStatus 0未发布1下架2上架3删除 -->
<view class="pro-info" bindtap="bindTapItem" data-id="{{item.productId}}" <view class="pro-info" bindtap="bindTapItem" data-id="{{item.productId}}"
style='border-bottom:{{index == (cartList.length -1) ? "none" : "1rpx solid #eeeeee" }};opacity:{{(item.productStatus == 1 || item.productStatus == 1 || item.productStatus == 3) ? 0.2 : 1}};'> style='border-bottom:{{index == (cartList.length -1) ? "none" : "1rpx solid #eeeeee" }};opacity:{{(item.productStatus == 1 || item.productStatus == 1 || item.productStatus == 3) ? 0.2 : 1}};'>
<image class="pro-img" src="{{item.skuImgUrl}}" mode="widthFix"></image>
<image class="pro-img" src="{{item.skuImgUrl}}"
wx:if="{{!utils.isVideo(item.skuImgUrl)}}"
mode="widthFix"></image>
<video id="myVideo"
class="hot-img"
src="{{item.skuImgUrl}}"
muted
wx:if="{{utils.isVideo(item.skuImgUrl)}}"></video>
<view class="pro-right-info"> <view class="pro-right-info">
<view class="pro-name">{{item.productName}}</view> <view class="pro-name">{{item.productName}}</view>
<view class="pro-sku">{{item.skuSpec}}</view> <view class="pro-sku">{{item.skuSpec}}</view>
......
...@@ -6,11 +6,20 @@ ...@@ -6,11 +6,20 @@
<image <image
class="popup-close" class="popup-close"
mode="widthFix" mode="widthFix"
src="/images/close.png" src="/assets/imgs/close.png"
bindtap="hidePopup" bindtap="hidePopup"
/> />
<view class="top-info clearfix"> <view class="top-info clearfix">
<image mode="widthFix" src="{{picUrl && picUrl != 'undefined' ? picUrl : indexImg}}" /> <image mode="widthFix"
wx:if="{{!utils.isVideo(picUrl && picUrl != 'undefined' ? picUrl : indexImg)}}"
src="{{picUrl && picUrl != 'undefined' ? picUrl : indexImg}}" />
<video
style="width:210rpx;height:210rpx;"
src="{{picUrl && picUrl != 'undefined' ? picUrl : indexImg}}"
muted
wx:if="{{utils.isVideo(picUrl && picUrl != 'undefined' ? picUrl : indexImg)}}"></video>
<view class="top-text"> <view class="top-text">
<!-- <view class="price-text" wx:if="{{exchangePrice <= 0}}">¥{{price / 100}}</view> --> <!-- <view class="price-text" wx:if="{{exchangePrice <= 0}}">¥{{price / 100}}</view> -->
<view class="price-text">¥{{utils.numberFormat(salePrice /100)}}</view> <view class="price-text">¥{{utils.numberFormat(salePrice /100)}}</view>
......
...@@ -13,23 +13,7 @@ ...@@ -13,23 +13,7 @@
/> />
</view> </view>
<!-- 失效宝贝 -->
<view class="overdue-pro" wx:if="{{outGoods.length}}">
<view class="clear-btn">清除失效商品</view>
<view class="overdue-list clearflex">
<view class="overdue-status">失效</view>
<view class="pro-info">
<image class="pro-img" src="https://img3.bigaka.com/prd/3001/202003/20200331/3001a1a3d3df-d083-426c-b4cd-388886e44360.png" mode="widthFix" />
<view class="pro-right-info">
<view class="pro-name overdue-name">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view>
<view class="pro-sku">规格</view>
<view class="pro-price">
<view class="price overdue-price">¥256</view>
</view>
</view>
</view>
</view>
</view>
<!-- 空状态时 --> <!-- 空状态时 -->
<view class="empty" wx-if="{{cartList !== null && cartList.length == 0}}"> <view class="empty" wx-if="{{cartList !== null && cartList.length == 0}}">
<view class="empty-img"> <view class="empty-img">
......
...@@ -248,6 +248,22 @@ wxService.page({ ...@@ -248,6 +248,22 @@ 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;
},
//获取商品详情 //获取商品详情
getProductInfoById(productId){ getProductInfoById(productId){
return wxService.get(`/sale/product/buyer/findByProductId?productId=${productId}`); return wxService.get(`/sale/product/buyer/findByProductId?productId=${productId}`);
...@@ -307,19 +323,29 @@ wxService.page({ ...@@ -307,19 +323,29 @@ wxService.page({
if (res) { if (res) {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading();
let list = data.content ? data.content : [];
list.forEach(item => {
item.productImgUrl = !this.isVideoUrl(item.productImgUrl) ? item.productImgUrl : defaultProImg;
item.productImgUrl = item.productImgUrl ? item.productImgUrl :defaultProImg;
});
if(this.data.pageNo == 1){
this.data.extendProList = list;
}
else{
this.data.extendProList = this.data.extendProList.concat(list);
}
this.setData({ this.setData({
extendProList: this.data.pageNo == 1 ? [...data.content] : [...this.data.extendProList, ...data.content], extendProList: this.data.extendProList,
totalPages: data.totalPages totalPages: data.totalPages
}, () => { });
// this.setData({
// no_data: this.data.extendProList.length ? true : false
// })
})
} }
} }
}) })
}, },
// 获取我的推广订单列表 // 获取我的推广订单列表
getMyExtendOrderList(pageNum, pageSize){ getMyExtendOrderList(pageNum, pageSize){
......
...@@ -51,9 +51,7 @@ ...@@ -51,9 +51,7 @@
<view class="buy-product-content"> <view class="buy-product-content">
<view class="buy-list" wx:if="{{extendProList.length}}" wx:for="{{extendProList}}" wx:key="{{index}}"> <view class="buy-list" wx:if="{{extendProList.length}}" wx:for="{{extendProList}}" wx:key="{{index}}">
<view class="prod-img"> <view class="prod-img">
<image <image src="{{item.productImgUrl}}" mode='aspectFit'/>
src="{{item.productImgUrl || 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg'}}"
mode='aspectFit'/>
</view> </view>
<view class="prod-info"> <view class="prod-info">
<view class="prod-name">{{item.productName}}</view> <view class="prod-name">{{item.productName}}</view>
......
...@@ -117,7 +117,7 @@ wxService.page({ ...@@ -117,7 +117,7 @@ wxService.page({
let content = { let content = {
title: this.data.productInfo.productName, title: this.data.productInfo.productName,
id: this.data.productInfo.productId, id: this.data.productInfo.productId,
url: this.data.productInfo.indexUrl url: this.getFirstImgUrl(this.data.productInfo.listUrls)
} }
let tentacleInfo = { let tentacleInfo = {
content: JSON.stringify(content), content: JSON.stringify(content),
...@@ -140,13 +140,29 @@ wxService.page({ ...@@ -140,13 +140,29 @@ wxService.page({
this.setData({ this.setData({
showCardModal: true, showCardModal: true,
cardTitle: this.data.productInfo.productName, cardTitle: this.data.productInfo.productName,
cardUrl: this.data.productInfo.indexUrl, cardUrl: this.getFirstImgUrl(this.data.productInfo.listUrls),
pagePath: path, pagePath: path,
scene: scene scene: scene
}); });
} }
}) })
}, },
//获取第一个不是视频的主图
//获取数组中第一个图片格式的url
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;
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
...@@ -323,8 +339,8 @@ wxService.page({ ...@@ -323,8 +339,8 @@ wxService.page({
let parmas = { let parmas = {
trolleySku2Buy: JSON.stringify(trolleySku2Buy) trolleySku2Buy: JSON.stringify(trolleySku2Buy)
} }
const { fromZc } = this.data const { fromZc } = this.data;
console.log('fromZc', fromZc)
//判断是否从种草商品过来购买 //判断是否从种草商品过来购买
if (fromZc) { if (fromZc) {
wxService.updateLocalTentacleInfo(); wxService.updateLocalTentacleInfo();
...@@ -376,7 +392,7 @@ wxService.page({ ...@@ -376,7 +392,7 @@ wxService.page({
return { return {
title: this.data.productInfo.productName, title: this.data.productInfo.productName,
path: path, path: path,
imageUrl: this.data.productInfo.indexUrl imageUrl: this.getFirstImgUrl(this.data.productInfo.listUrls)
} }
} else { } else {
//修改为参数memberId //修改为参数memberId
...@@ -393,7 +409,7 @@ wxService.page({ ...@@ -393,7 +409,7 @@ wxService.page({
return { return {
title: this.data.productInfo.productName, title: this.data.productInfo.productName,
path: path, path: path,
imageUrl: this.data.productInfo.indexUrl imageUrl: this.getFirstImgUrl(this.data.productInfo.listUrls)
} }
} }
......
...@@ -14,7 +14,16 @@ ...@@ -14,7 +14,16 @@
<swiper autoplay="true" style="height: 750rpx;line-height: 100rpx;" bindchange="swiperChange"> <swiper autoplay="true" style="height: 750rpx;line-height: 100rpx;" bindchange="swiperChange">
<block wx:for="{{productInfo.listUrls}}" wx:key="index"> <block wx:for="{{productInfo.listUrls}}" wx:key="index">
<swiper-item> <swiper-item>
<image class="swiper-image" mode="widthFix" src="{{item}}" lazy-load/> <image class="swiper-image"
mode="widthFix" src="{{item}}"
wx:if="{{!utils.isVideo(item)}}"
lazy-load/>
<video id="myVideo{{index}}"
class="swiper-image video-cover"
src="{{item}}"
muted
wx:if="{{utils.isVideo(item)}}"></video>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
......
...@@ -12,6 +12,12 @@ page{ ...@@ -12,6 +12,12 @@ page{
.swiper-image{ .swiper-image{
width: 100%; width: 100%;
} }
.video-cover{
width: 100%;
height: 100%;
}
.product-price { .product-price {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
......
...@@ -132,7 +132,8 @@ wxService.page({ ...@@ -132,7 +132,8 @@ wxService.page({
this.data.goods.goodsList = list; this.data.goods.goodsList = list;
list.forEach(item => { list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2); item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = item.indexUrl; item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl :defaultGoodsImg;
item.productImgUrl = item.productImgUrl ? item.productImgUrl :defaultGoodsImg;
}); });
this.setData({ this.setData({
...@@ -141,6 +142,21 @@ wxService.page({ ...@@ -141,6 +142,21 @@ 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;
},
//跳转到商品详情 //跳转到商品详情
onTapToGoodsDetail(e){ onTapToGoodsDetail(e){
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
......
// shoppingGuid/page/pages/moreProducts/moreProducts.js // shoppingGuid/page/pages/moreProducts/moreProducts.js
const wxService = require('../../../../utils/wxService') const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion' import { Integer } from '../../../../utils/integerDigitalConvertion'
let defaultUrl = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
const app = getApp(); const app = getApp();
wxService.page({ wxService.page({
...@@ -126,7 +127,8 @@ wxService.page({ ...@@ -126,7 +127,8 @@ wxService.page({
this.data.goods.goodsList = list; this.data.goods.goodsList = list;
list.forEach(item => { list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2); item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = item.indexUrl; item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl : defaultUrl;
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultUrl;
}); });
this.setData({ this.setData({
...@@ -136,6 +138,21 @@ wxService.page({ ...@@ -136,6 +138,21 @@ 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;
},
//跳转到商品详情 //跳转到商品详情
onTapToGoodsDetail(e) { onTapToGoodsDetail(e) {
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
......
...@@ -54,6 +54,7 @@ wxService.page({ ...@@ -54,6 +54,7 @@ wxService.page({
list.forEach(item => { list.forEach(item => {
item.checked = false; item.checked = false;
item.minSalePriceText = parseFloat(item.minSalePrice/10/10).toFixed(2); 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'
}); });
this.data.productList = this.data.productList.concat(list); this.data.productList = this.data.productList.concat(list);
...@@ -72,6 +73,21 @@ wxService.page({ ...@@ -72,6 +73,21 @@ 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(){ handlerChecked(){
let checkedProduct = wx.getStorageSync('guiderReleaseProducts') ? wx.getStorageSync('guiderReleaseProducts') : []; let checkedProduct = wx.getStorageSync('guiderReleaseProducts') ? wx.getStorageSync('guiderReleaseProducts') : [];
......
// shoppingGuid/page/pages/taskNotice/taskNotice.js // shoppingGuid/page/pages/taskNotice/taskNotice.js
const wxService = require('../../../../utils/wxService') const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion' 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 app = getApp();
wxService.page({ wxService.page({
/** /**
...@@ -85,7 +86,8 @@ wxService.page({ ...@@ -85,7 +86,8 @@ wxService.page({
this.data.goods.goodsList = list; this.data.goods.goodsList = list;
list.forEach(item => { list.forEach(item => {
item.price = parseFloat(item.minSalePrice/10/10).toFixed(2); item.price = parseFloat(item.minSalePrice/10/10).toFixed(2);
item.productImgUrl = item.indexUrl; item.productImgUrl = !this.isVideoUrl(item.indexUrl) ? item.indexUrl : defaultImg ;
item.productImgUrl = item.productImgUrl ? item.productImgUrl : defaultImg ;
}); });
this.setData({ this.setData({
...@@ -95,6 +97,22 @@ wxService.page({ ...@@ -95,6 +97,22 @@ 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;
},
//定向发送 //定向发送
//定向转发商品给用户 分享功能 //定向转发商品给用户 分享功能
onTapToShare(e) { onTapToShare(e) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
var app = getApp() var app = getApp()
const wxService = require('../../../../utils/wxService') const wxService = require('../../../../utils/wxService')
import { Integer } from '../../../../utils/integerDigitalConvertion' import { Integer } from '../../../../utils/integerDigitalConvertion'
let defaultImg = 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg';
wxService.page({ wxService.page({
...@@ -145,7 +146,7 @@ wxService.page({ ...@@ -145,7 +146,7 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content]; this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
this.data.proData.forEach(item => { this.data.proData.forEach(item => {
item.indexUrl = item.indexUrl ? item.indexUrl : 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg'; item.indexUrl = item.indexUrl ? item.indexUrl : defaultImg;
}); });
this.setData({ this.setData({
proData: this.data.proData, proData: this.data.proData,
...@@ -165,6 +166,24 @@ wxService.page({ ...@@ -165,6 +166,24 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
}) })
}, },
//找到第一个是图片的主图
//获取数组中第一个图片格式的url
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;
},
//获取商品列表 通过tagid //获取商品列表 通过tagid
getProductListByTagId(refresh){ getProductListByTagId(refresh){
wx.showLoading({ wx.showLoading({
......
...@@ -53,6 +53,21 @@ function hanlerLinkNeedAuth(link){ ...@@ -53,6 +53,21 @@ function hanlerLinkNeedAuth(link){
return flag return flag
} }
//判断是否是视频格式
function isVideo(url){
if(url){
var lastIndexOfPoint = url.lastIndexOf('.');
var extd = url.substring(lastIndexOfPoint).toUpperCase();
if(extd != '.MP4' && extd != '.MP3' && extd != ".MOV"){
return false;
}
return true;
}
return false;
}
module.exports = { module.exports = {
toPercent:toPercent, toPercent:toPercent,
...@@ -61,5 +76,6 @@ module.exports = { ...@@ -61,5 +76,6 @@ module.exports = {
numberFormat: numberFormat, numberFormat: numberFormat,
date: date, date: date,
handerNickName: handerNickName, handerNickName: handerNickName,
hanlerLinkNeedAuth: hanlerLinkNeedAuth hanlerLinkNeedAuth: hanlerLinkNeedAuth,
isVideo : isVideo,
} }
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