Commit 278bb7ae authored by 罗超's avatar 罗超

1

parent ce9f1689
<template>
<view class="box">
<view class="nodata" v-if="dataList.length===0">
暂无内容
</view>
<view v-for="(item,index) in dataList" :key="index" class="img-box" style="position: relative;" v-if="dataList.length>0">
<image :src="item.Path" mode="aspectFill" class="img" v-if="item.Type==1" @click="previewImage"></image>
<video :id="item.Id" :src="item.Path" style="width: 200rpx;height: 200rpx;"
:controls='controls'
:show-center-play-btn='false'
:show-fullscreen-btn='false'
@fullscreenchange='videoControl'
object-fit ='fill'
v-if="item.Type==2"
@click="enlarge(item.Name)"
></video>
<view
style="position: absolute;left: 50%;top: 50%;margin-top: -49rpx;margin-left: -49rpx;width: 98rpx;height: 98rpx;border-radius: 20rpx;background-color: rgba(255,255,255,.4);display: flex;align-items: center;justify-content: center;" v-if="item.Type==2">
<!-- 播放按钮 -->
<image
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1616471847000_345.png"
style="width: 37rpx;height: 44rpx;" mode=""></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
id:0,
boxOption: 0,
navsOption: 0,
titleStyle: {},
active: 0,
mainColor: '',
likeStatus: false,
controls:false,//显示默认控件
dataList:[],
preImg:[],
videoContext:null
}
},
onLoad(options) {
uni.setNavigationBarTitle({
title: '相册详情'
});
this.mainColor = this.$uiConfig.mainColor;
if(options.data){
let res = JSON.parse(decodeURIComponent(options.data))
this.dataList=res.data
this.dataList.map(e=>{
this.preImg.push(e.Path)
})
console.log(this.dataList)
}
},
methods: {
previewImage(i) {
console.log(i)
uni.previewImage({
urls: this.preImg,
current: i,
longPressActions: {
itemList: ["发送给朋友", "保存图片", "收藏"],
success: function(data) {},
fail: function(err) {
console.log(err.errMsg);
},
},
});
},
scroll(e) {
this.boxOption = Math.floor((e.detail.scrollTop - 50) / 1.5);
this.titleStyle.opacity = ((e.detail.scrollTop - 100) < 0 ? 0 : Math.floor(e.detail.scrollTop - 100)) + "%"
this.$forceUpdate()
},
goback() {
uni.navigateBack({
delta: 1,
});
},
enlarge(file) {
// 全屏
this.videoContext = uni.createVideoContext(file);
this.videoContext.requestFullScreen({
direction:0
})
console.log(this.videoContext)
},
videoControl(e){
if(e.detail.fullScreen==false){
this.videoContext.stop()
this.controls=false
}else{
this.videoContext.play()
this.controls=true
}
},
},
mounted() {
}
}
</script>
<style lang="scss" scoped>
.box{
margin: 30rpx;
display: flex;
flex-wrap: wrap;
& .img-box:nth-child(3n){
margin-right: 0rpx !important;
background-color: #000000;
}
.img-box{
width: 200rpx;
height: 200rpx;
border-radius: 12rpx;
bottom: 10px;
margin-right: 10px;
margin-bottom: 10px;
border: 1rpx solid #EEEEEE;
}
.img{
width: 200rpx;
height: 200rpx;
border-radius: 12rpx;
}
}
.nodata{
width: 100%;
text-align:center;
}
</style>
<template>
<view class="school-company">
<view class="no-data" v-if="schoolCompanyList.length===0">
暂无数据
</view>
<view class="u-radio-box" v-if="schoolCompanyList.length!==0">
<view v-for="(item, index) in schoolCompanyList" :key="item.Id" class="radio-item"
@click="goUrl(1,item.Id)">
<view class="radio-item-imgbox">
<image :src="item.CoverPhoto" mode="aspectFit"></image>
</view>
<view class="radio-item-name">
{{item.ShoolName}}
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
schoolCompanyList: [],
mainColor: "",
}
},
created() {
this.mainColor = this.$uiConfig.mainColor;
uni.setNavigationBarTitle({
title: '选择学校'
});
},
mounted() {
this.getSchoolCompanyList();
},
methods: {
getSchoolCompanyList() {
this.request2({
url: '/api/AppletEducation/GetEduSchool',
data: {}
},
(res) => {
if (res.resultCode === 1) {
this.schoolCompanyList = res.data
if(this.schoolCompanyList.length===0){
this.goUrl(1,0)
}
}
}
);
},
goUrl(type = 1, id) {
uni.navigateTo({
url: '/pages/share-qrcode/share-qrcode' + '?type=' + type + '&schoolId=' + id
});
},
}
}
</script>
<style scoped>
.school-company {
padding: 30rpx;
background-color: #FFFFFF;
}
.u-radio-box {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.radio-item {
width: 300rpx;
/* height: 300rpx; */
border-radius: 8rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-bottom: 30rpx;
box-shadow: 0px 4px 4px 0px #999999;
}
.radio-item-name {
/* white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; */
font-size: 26rpx;
color: #07090D;
padding: 10rpx;
background-color: #FFFFFF;
}
.radio-item-imgbox {
width: 100%;
height: 144rpx;
overflow: hidden;
background-color: #f3f4f6;
/* box-shadow: 0px 4px 40px 0px rgba(2, 144, 66, 0.1); */
}
.radio-item-imgbox image {
width: 100%;
height: 100%;
}
.no-data {
font-size: 26rpx;
color: #07090D;
text-align: center;
}
</style>
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