25 changed files with 347 additions and 205 deletions
Split View
Diff Options
-
4assets/image/icon_empty.svg
-
BINassets/image/list_empty.png
-
BINassets/image/video_pause.png
-
BINassets/image/video_play.png
-
4colorui/main.wxss
-
2components/backdrop/index.wxss
-
62components/landscape/index.js
-
6components/landscape/index.json
-
20components/landscape/index.wxml
-
32components/landscape/index.wxss
-
4components/popup/index.wxss
-
152components/swiper-video/index.js
-
6components/swiper-video/index.json
-
18components/swiper-video/index.wxml
-
32components/swiper-video/index.wxss
-
2pages/mall/index/index.wxml
-
20pages/mall/order-detail/index.js
-
125pages/mall/order-info/index.js
-
3pages/mall/order-info/index.json
-
17pages/mall/order-info/index.wxml
-
2pages/mall/order-list/index.wxml
-
21pages/mall/order-offer/index.js
-
2pages/mall/search-list/index.wxml
-
16pages/mall/shops/index.wxml
-
2pages/message/index.wxml
@ -0,0 +1,4 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<svg t="1590740257326" class="icon" viewBox="0 0 1764 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="14859" width="64" height="64"> |
|||
<path d="M1526.914723 60.089191S1477.697362 0 1405.864851 0L352.299574 0.435745s-72.07217 1.895489-125.015148 57.779744C227.306213 58.215489 0 406.419064 0 472.260085v422.28017c0 65.841021 54.163064 119.197957 120.984511 119.197958h1512.251915c66.821447 0 120.984511-53.378723 120.98451-119.17617V472.238298c0-65.841021-227.306213-412.170894-227.306213-412.170894zM1129.951319 439.666383c-38.018723 0-52.202213 25.077106-57.452936 41.635404 0.130723 3.028426 0.457532 5.991489 0.457532 9.06349 0 107.672511-88.042213 194.995745-196.651575 194.995744-108.631149 0-196.673362-87.323234-196.673361-194.995744 0-3.921702 0.370383-7.734468 0.588255-11.590809-13.94383-38.955574-55.949617-39.108085-55.949617-39.108085H129.307234L297.831489 147.412426s32.680851-56.385362 64.272341-55.884256h1051.560851s30.240681 13.07234 56.71217 55.884256L1634.478298 439.666383H1129.951319z" p-id="14860" fill="#8a8a8a"></path> |
|||
</svg> |
|||
@ -0,0 +1,62 @@ |
|||
import baseComponent from '../helpers/baseComponent' |
|||
import classNames from '../helpers/classNames' |
|||
|
|||
baseComponent({ |
|||
properties: { |
|||
prefixCls: { |
|||
type: String, |
|||
value: 'wux-landscape', |
|||
}, |
|||
visible: { |
|||
type: Boolean, |
|||
value: false, |
|||
}, |
|||
mask: { |
|||
type: Boolean, |
|||
value: true, |
|||
observer(newVal) { |
|||
this.setData({ showMask: newVal }) |
|||
}, |
|||
}, |
|||
maskClosable: { |
|||
type: Boolean, |
|||
value: false, |
|||
}, |
|||
closable: { |
|||
type: Boolean, |
|||
value: true, |
|||
}, |
|||
}, |
|||
data: { |
|||
showMask: true, |
|||
}, |
|||
computed: { |
|||
classes: ['prefixCls, showMask', function(prefixCls, showMask) { |
|||
const wrap = classNames(prefixCls, { |
|||
[`${prefixCls}--has-mask`]: showMask, |
|||
}) |
|||
const popup = `${prefixCls}__popup` |
|||
const popupBody = `${prefixCls}__popup-body` |
|||
const popupClose = `${prefixCls}__popup-close` |
|||
const inner = `${prefixCls}__inner` |
|||
const close = `${prefixCls}__close` |
|||
const x = `${prefixCls}__close-x` |
|||
|
|||
return { |
|||
wrap, |
|||
popup, |
|||
popupBody, |
|||
popupClose, |
|||
inner, |
|||
close, |
|||
x, |
|||
} |
|||
}], |
|||
}, |
|||
methods: { |
|||
onClose() { |
|||
this.triggerEvent('close', { visible: !this.data.visible }) |
|||
}, |
|||
}, |
|||
attached() {}, |
|||
}) |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"component": true, |
|||
"usingComponents": { |
|||
"wux-popup": "../popup/index" |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<wux-popup |
|||
wux-content-class="{{ classes.popup }}" |
|||
wux-body-class="{{ classes.popupBody }}" |
|||
wux-close-class="{{ classes.popupClose }}" |
|||
visible="{{ visible }}" |
|||
hasHeader="{{ false }}" |
|||
hasFooter="{{ false }}" |
|||
mask="{{ showMask }}" |
|||
maskClosable="{{ maskClosable }}" |
|||
bind:close="onClose" |
|||
> |
|||
<view class="wux-class {{ classes.wrap }}"> |
|||
<view class="{{ classes.inner }}"> |
|||
<slot></slot> |
|||
</view> |
|||
<view class="{{ classes.close }}" wx:if="{{ closable }}" bindtap="onClose"> |
|||
<text class="cuIcon-roundclose text-white" style="font-size:80rpx"></text> |
|||
</view> |
|||
</view> |
|||
</wux-popup> |
|||
@ -0,0 +1,32 @@ |
|||
.wux-landscape__popup { |
|||
background-color: transparent!important |
|||
} |
|||
.wux-landscape__popup-body { |
|||
padding: 0!important |
|||
} |
|||
.wux-landscape__inner { |
|||
padding: 30rpx; |
|||
font-size: 30rpx; |
|||
line-height: 1.5; |
|||
color: #666 |
|||
} |
|||
.wux-landscape__inner > image { |
|||
width: 100%; |
|||
max-width: 100% |
|||
} |
|||
.wux-landscape__close { |
|||
position: relative; |
|||
display: inline-block; |
|||
margin-top: 10rpx |
|||
} |
|||
.wux-landscape__close-x { |
|||
display: inline-block; |
|||
width: 48rpx; |
|||
height: 48rpx; |
|||
background-repeat: no-repeat; |
|||
background-size: cover; |
|||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23888' fill-rule='evenodd'%3E%3Cpath d='M1.414 0l28.284 28.284-1.414 1.414L0 1.414z'/%3E%3Cpath d='M28.284 0L0 28.284l1.414 1.414L29.698 1.414z'/%3E%3C/g%3E%3C/svg%3E") |
|||
} |
|||
.wux-landscape--has-mask .wux-landscape__close-x { |
|||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23fff' fill-rule='evenodd'%3E%3Cpath d='M1.414 0l28.284 28.284-1.414 1.414L0 1.414z'/%3E%3Cpath d='M28.284 0L0 28.284l1.414 1.414L29.698 1.414z'/%3E%3C/g%3E%3C/svg%3E") |
|||
} |
|||
@ -0,0 +1,152 @@ |
|||
const float = require('../../utils/floatObj'); |
|||
|
|||
Component({ |
|||
options: { |
|||
addGlobalClass: true |
|||
}, |
|||
properties: { |
|||
// 数据源
|
|||
imgList: { |
|||
type: Array, |
|||
value: [], |
|||
observer: "dataChange" |
|||
} |
|||
}, |
|||
data: { |
|||
videoContext: null, |
|||
imageHeight: 0, |
|||
visible: false, |
|||
videoUrl: null |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 初始化函数 |
|||
*/ |
|||
init() { |
|||
this.setData({ |
|||
imageHeight: float.accDiv(float.accMul(750, 9), 16), |
|||
}) |
|||
this.data.videoContext = wx.createVideoContext('video', this) |
|||
}, |
|||
isVideoUrl: function (url) { |
|||
if (url && url.indexOf('.mp4') >= 0) { |
|||
return true |
|||
} |
|||
return false |
|||
}, |
|||
dataChange(newVal, oldVal) { |
|||
var vindex = -1 |
|||
var vurl = null |
|||
var imgList = [] |
|||
for (let index = 0; index < newVal.length; index++) { |
|||
const element = newVal[index] |
|||
if (this.isVideoUrl(element)) { |
|||
vindex = index |
|||
vurl = element |
|||
break |
|||
} |
|||
} |
|||
|
|||
if (vindex >= 1) { |
|||
newVal.splice(vindex, 1) |
|||
imgList = newVal |
|||
imgList.unshift(vurl) |
|||
this.data.videoContext = wx.createVideoContext('video', this) |
|||
} else if (vindex == 0) { |
|||
imgList = newVal |
|||
this.data.videoContext = wx.createVideoContext('video', this) |
|||
} else { |
|||
imgList = newVal |
|||
} |
|||
this.setData({ |
|||
videoUrl: vurl, |
|||
imgList: imgList |
|||
}) |
|||
}, |
|||
// bindchange: function (event) {
|
|||
// if (this.data.videoContext && this.data.status == 1) {
|
|||
// this.data.videoContext.pause()
|
|||
// }
|
|||
// },
|
|||
// videoTouch: function () {
|
|||
|
|||
// if (this.data.timeout) {
|
|||
// return
|
|||
// }
|
|||
// if (!this.data.controls && this.data.status == 1) {
|
|||
// this.setData({
|
|||
// controls: true
|
|||
// })
|
|||
// this.data.timeout = setTimeout(() => {
|
|||
// this.setData({
|
|||
// controls: false
|
|||
// })
|
|||
// this.data.timeout = null
|
|||
// }, 1000)
|
|||
// }
|
|||
// },
|
|||
videoTap: function () { |
|||
this.setData({ |
|||
visible: true, |
|||
}) |
|||
if (this.data.videoContext) { |
|||
this.data.videoContext.play() |
|||
} |
|||
}, |
|||
onClose: function() { |
|||
this.setData({ |
|||
visible: false, |
|||
}) |
|||
if (this.data.videoContext) { |
|||
this.data.videoContext.pause() |
|||
} |
|||
}, |
|||
// bindplay: function () {
|
|||
// this.setData({
|
|||
// status: 1
|
|||
// })
|
|||
// this.data.timeout = setTimeout(() => {
|
|||
// this.setData({
|
|||
// controls: false
|
|||
// })
|
|||
// this.data.timeout = null
|
|||
// }, 1500)
|
|||
// },
|
|||
// bindpause: function () {
|
|||
// this.setData({
|
|||
// status: 0,
|
|||
// controls: true
|
|||
// })
|
|||
// if (this.data.timeout) {
|
|||
// clearTimeout(this.data.timeout)
|
|||
// this.data.timeout = null
|
|||
// }
|
|||
// },
|
|||
bindended: function () { |
|||
this.data.videoContext.exitFullScreen() |
|||
this.setData({ |
|||
visible: false |
|||
}) |
|||
}, |
|||
// 图片查看
|
|||
viewImage: function (e) { |
|||
if (e.currentTarget.dataset.url.indexOf('.mp4') >= 0) { |
|||
return |
|||
} |
|||
var imgList = [] |
|||
for (let index = 0; index < this.data.imgList.length; index++) { |
|||
if (this.data.imgList[index].indexOf('.mp4') >= 0) { |
|||
continue |
|||
} |
|||
imgList.push(this.data.imgList[index]) |
|||
} |
|||
wx.previewImage({ |
|||
urls: imgList, |
|||
current: e.currentTarget.dataset.url |
|||
}); |
|||
}, |
|||
}, |
|||
ready() { |
|||
this.init(); |
|||
} |
|||
}) |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"component": true, |
|||
"usingComponents": { |
|||
"wux-landscape": "../landscape/index" |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<wxs module="formate" src="../../pages/mall/index.wxs"></wxs> |
|||
<swiper class="screen-swiper square-dot" style="min-height:{{imageHeight}}rpx" indicator-dots="true" indicator-color="#FFFFFF" indicator-active-color="#008AFF"> |
|||
<swiper-item wx:for="{{imgList}}" wx:key="index"> |
|||
<view wx:if="{{formate.isVideoUrl(item)}}"> |
|||
<view class="video-cnt"> |
|||
<video src="{{item}}" style="width:100%;min-height:{{imageHeight}}rpx" show-center-play-btn="{{false}}" controls="{{false}}" muted /> |
|||
</view> |
|||
<text class="play-btn cuIcon-video text-white" style="font-size:80rpx" catchtap="videoTap" wx:if="{{!visible}}"></text> |
|||
</view> |
|||
<view wx:else bindtap="viewImage" style="width:100%;height:100%" data-url="{{item}}"> |
|||
<image src="{{item}}" mode="aspectFill"></image> |
|||
</view> |
|||
</swiper-item> |
|||
</swiper> |
|||
|
|||
<wux-landscape visible="{{ visible }}" bind:close="onClose"> |
|||
<video id="video" src="{{videoUrl}}" style="width:750rpx;min-height:{{imageHeight}}rpx" show-center-play-btn="{{false}}" bindended="bindended"/> |
|||
</wux-landscape> |
|||
@ -0,0 +1,32 @@ |
|||
.swiper-cnt { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
position: relative; |
|||
} |
|||
|
|||
.video-cnt { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
z-index: -1 !important; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
.play-btn { |
|||
position: absolute; |
|||
top: 150rpx; |
|||
left: 342rpx; |
|||
z-index: 100; |
|||
} |
|||
|
|||
.play-controls{ |
|||
width: 100%; |
|||
height: 80rpx; |
|||
padding: 15rpx 20rpx; |
|||
position: absolute; |
|||
display: flex; |
|||
bottom: 0px; |
|||
z-index: 100; |
|||
} |
|||
@ -1,6 +1,7 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-button": "/components/button/index", |
|||
"wux-input-number": "/components/input-number/index" |
|||
"wux-input-number": "/components/input-number/index", |
|||
"swiper-video": "/components/swiper-video/index" |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save