Commit 9eb69e37 by 前端

案例

1 parent 5bbe555c
......@@ -86,6 +86,13 @@
}
},
{
"path": "pages/boutique/preview",
"style": {
"navigationStyle": "custom",
"disableSwipeBack": true
}
},
{
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
"style": {
"disableScroll": true,
......
......@@ -6,10 +6,18 @@
type="text"
class="input"
:value="name"
placeholder="搜索图片/视频名称"
maxlength="50"
@blur="input($event)"
@focus="focus"
/>
<view class="input-tips" v-if="!isSearch"
>搜索图片/视频名称<uni-icons
type="search"
class="icon"
color="#999"
size="20"
></uni-icons
></view>
</view>
<scroll-view
......@@ -22,9 +30,10 @@
<template v-if="list.length">
<template v-for="item in list">
<view class="item" :key="item.id">
<view class="item-autio">
<view class="item-autio" @click="playVideo(item)">
<image :src="item.detailUrl" class="cover-box"></image>
<image
v-if="item.sourceType == 2"
src="../../assets/images/boutique/play.png"
class="play-box"
></image>
......@@ -42,6 +51,17 @@
</view>
</scroll-view>
</view>
<view class="popup-box" v-if="popupShow">
<view class="nav-bar">
<view class="back" @click="back">
<uni-icons type="left" :size="24" color="#fff"></uni-icons>
</view>
<view class="title">{{ title }}</view>
</view>
<view class="popup-body">
<video ref="videoPlayer" :src="videoSrc" controls></video>
</view>
</view>
</view>
</template>
<script type="text/ecmascript-6">
......@@ -50,8 +70,11 @@ export default {
name: '',
data () {
return {
name:'',
name:'',
list: [],
popupShow:false,
isSearch:false,
videoSrc: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
}
},
props: {
......@@ -60,14 +83,29 @@ export default {
default: () => []
}
},
beforeDestroy() {
this.popupShow = false
},
mounted() {
// this.list = utils.deepClone(this.views)
console.log(this.views)
this.list = this.views
},
methods: {
playVideo(item) {
const {tabName,sourceType,detailUrl} = item
uni.navigateTo({
url: `/pages/boutique/preview?tabName=${tabName}&sourceType=${sourceType}&detailUrl=${detailUrl}`
})
},
focus() {
this.isSearch = true
},
input(e) {
this.name = e.detail.value
if(this.name == '')
this.isSearch = false
this.list = this.views.filter(i=>i.tabName.includes(this.name))
},
},
......@@ -86,14 +124,33 @@ export default {
padding: 64rpx;
margin-top: 120rpx;
.input-box {
position: relative;
.input {
padding-left: 30rpx;
text-align: center;
height: 80rpx;
background: #ffffff;
border: 3rpx solid #a8c1ff;
border-radius: 16rpx;
width: 100%;
line-height: 80rpx;
z-index: 1;
}
.input-tips {
color: #999999;
position: absolute;
left: 0;
top: 0;
height: 80rpx;
width: 100%;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
.icon {
margin-left: 12rpx;
}
}
}
.list {
......@@ -132,6 +189,44 @@ export default {
}
}
}
.popup-box {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: #000;
padding: 100rpx 0rpx;
z-index: 100;
.nav-bar {
width: 100%;
height: 96rpx;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
}
}
.popup-body {
width: 100%;
height: 100%;
video {
width: 100%;
height: 100%;
}
}
}
.nothing {
width: 100vw;
flex-direction: column;
......
......@@ -6,10 +6,18 @@
type="text"
class="input"
:value="customerNameOrPhone"
placeholder="搜索客户姓名/电话"
maxlength="11"
@blur="input($event)"
@focus="focus"
/>
<view class="input-tips" v-if="!isSearch"
>搜索客户姓名/电话<uni-icons
type="search"
class="icon"
color="#999"
size="20"
></uni-icons
></view>
</view>
<scroll-view
......@@ -63,7 +71,8 @@ export default {
mixins:[Record],
data () {
return {
customerNameOrPhone:'',
customerNameOrPhone:'',
isSearch:false,
list: [{
id:1,
carModel:1,
......@@ -96,9 +105,15 @@ export default {
},
input(e) {
this.customerNameOrPhone = e.detail.value
if(this.customerNameOrPhone == '')
this.isSearch = false
this.pageNum = 1
this.getRecordList()
},
focus() {
this.isSearch = true
},
getRecordList() {
const { pageNum, pageSize,customerNameOrPhone } = this,
userInfo = uni.$storage.get("userInfo"),
......@@ -154,6 +169,7 @@ export default {
padding: 64rpx;
margin-top: 120rpx;
.input-box {
position: relative;
.input {
padding-left: 30rpx;
height: 80rpx;
......@@ -164,6 +180,22 @@ export default {
line-height: 80rpx;
text-align: center;
}
.input-tips {
color: #999999;
position: absolute;
left: 0;
top: 0;
height: 80rpx;
width: 100%;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
.icon {
margin-left: 12rpx;
}
}
}
.record-box {
height: calc(100vh - 300rpx);
......
<template>
<view class="popup-box">
<view class="nav-bar">
<view class="back" @click="back">
<uni-icons type="left" :size="24" color="#fff"></uni-icons>
</view>
<view class="title">{{ title }}</view>
</view>
<view class="popup-body">
<video
ref="videoPlayer"
:src="videoSrc"
controls
v-if="sourceType == 2"
></video>
<view class="img-detail" v-else
><image :src="detailUrl" :style="{ width: width + 'px' }"
/></view>
</view>
</view>
</template>
<script type="text/ecmascript-6">
export default {
data () {
return {
width:0,
videoSrc: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
title: '11',
sourceType: '',
detailUrl: ''
}
},
onLoad (options) {
const {tabName,sourceType,detailUrl} = options
this.title = tabName
this.sourceType = sourceType
this.detailUrl = detailUrl
const img = new Image()
img.onload = ()=> {
this.width = document.querySelector('.img-detail').offsetHeight*img.height/img.width
console.log(this.width)
}
img.src = detailUrl
},
methods: {
back() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.popup-box {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: #000;
padding: 100rpx 0rpx;
z-index: 100;
.nav-bar {
width: 100%;
height: 96rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
}
.title {
color: #fff;
flex: 1;
font-size: 32rpx;
text-align: center;
}
}
.popup-body {
width: 100%;
height: calc(100% - 200rpx);
video {
width: 100%;
height: 100%;
}
.img-detail {
height: 100%;
text-align: center;
image {
height: 100%;
width: auto;
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!