186 lines
3.8 KiB
Vue
186 lines
3.8 KiB
Vue
<template>
|
|
<view class="main">
|
|
<view class="top">
|
|
<view>
|
|
<view class="goods-name bold lg">{{item.title}}</view>
|
|
<view class="goods-name m-t-10" v-if="item.intro">{{item.intro}}</view>
|
|
|
|
<view class="goods-video" v-if="item.video">
|
|
<video :src="item.video" :poster="item.video + '?x-oss-process=video/snapshot,t_1000,m_fast'"></video>
|
|
</view>
|
|
|
|
<view v-if="item.image" class="m-l-20 m-t-20">
|
|
<scroll-view style="height: 200rpx; white-space: nowrap;" scroll-x="true"
|
|
scroll-with-animation="true">
|
|
<view class="flex">
|
|
<u-image @click="previewImage(index)" :src="val" width="200rpx" height="200rpx"
|
|
class="m-r-20" v-for="(val, index) in item.image" :key="index"></u-image>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
|
|
<view class="m-l-20 m-t-20" v-if="item.file">
|
|
<view class="bold">文件列表</view>
|
|
<view v-for="(val, index) in item.file" class="m-t-20">
|
|
<view class="bold">{{val.name}}</view>
|
|
<view class="flex m-t-20">
|
|
<view class="lg bold" @click="previewFile(val.src)">预览</view>
|
|
<view class="m-l-20 lg bold" @click="downloadFile(val.src)">下载</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="m-t-40 m-l-20 m-r-20" v-if="item.content">
|
|
<view class="bold text-center m-b-20">
|
|
<u-divider color="#000">
|
|
<view class="bold">内容详情</view>
|
|
</u-divider>
|
|
</view>
|
|
<view>
|
|
<u-parse :html="item.content" :lazy-load="true" :show-with-animation="true"></u-parse>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
businessSchoolDetail
|
|
} from '@/api/user';
|
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
|
|
export default {
|
|
mixins: [MescrollMixin],
|
|
data() {
|
|
return {
|
|
id: 0,
|
|
item: [],
|
|
top: [],
|
|
type: '',
|
|
price_type: 0
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.id = this.$Route.query.id;
|
|
this.getDetail()
|
|
},
|
|
methods: {
|
|
previewImage(index) {
|
|
uni.previewImage({
|
|
urls: this.item.image,
|
|
current: index
|
|
});
|
|
},
|
|
|
|
previewFile(src) {
|
|
uni.downloadFile({
|
|
url: src,
|
|
success: function(res) {
|
|
var filePath = res.tempFilePath;
|
|
uni.openDocument({
|
|
filePath: filePath,
|
|
showMenu: true,
|
|
success: function(res) {
|
|
console.log('打开文档成功');
|
|
}
|
|
});
|
|
},
|
|
fail: function() {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
mask: true,
|
|
title: '失败请重新下载'
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
downloadFile(src) {
|
|
uni.downloadFile({
|
|
url: src,
|
|
success: (res) => {
|
|
if (res.statusCode === 200) {
|
|
//隐藏加载框
|
|
uni.hideLoading();
|
|
uni.saveImageToPhotosAlbum({
|
|
filePath: res.tempFilePath,
|
|
success: function(res) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
mask: true,
|
|
title: '文件已保存',
|
|
duration: 3000
|
|
});
|
|
|
|
},
|
|
fail: function() {
|
|
console.log('保存失败');
|
|
}
|
|
});
|
|
}
|
|
},
|
|
fail: function() {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
mask: true,
|
|
title: '失败请重新下载'
|
|
});
|
|
}
|
|
})
|
|
},
|
|
|
|
async getDetail() {
|
|
const {
|
|
code,
|
|
data,
|
|
msg
|
|
} = await businessSchoolDetail({
|
|
id: this.id
|
|
});
|
|
if (code == 1) {
|
|
this.item = data
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
height: 100%;
|
|
}
|
|
|
|
.main {
|
|
|
|
.top>view,
|
|
.list>view {
|
|
background-color: #fff;
|
|
padding: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.thumb {
|
|
margin-right: 20rpx;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.thumb-video {
|
|
width: 100%;
|
|
margin-top: 20rpx;
|
|
}
|
|
}
|
|
|
|
.goods-name {
|
|
margin: 20rpx 20rpx 0 20rpx;
|
|
}
|
|
|
|
.goods-video {
|
|
margin: 20rpx 20rpx 0 20rpx;
|
|
|
|
video {
|
|
width: 100%;
|
|
height: 375rpx;
|
|
}
|
|
}
|
|
</style> |