|
@@ -0,0 +1,142 @@
|
|
|
+<template>
|
|
|
+ <view style="padding-left: 20rpx">
|
|
|
+ <view v-if="fileInfo.type == 2">
|
|
|
+ <view
|
|
|
+ @click="handelClick"
|
|
|
+ class="fl u-border-bottom"
|
|
|
+ style="height: 78rpx"
|
|
|
+ >
|
|
|
+ <u-icon name="arrow-down" color="#999" size="24" v-if="!down"></u-icon>
|
|
|
+ <u-icon name="arrow-right" color="#999" size="24" v-if="down"></u-icon>
|
|
|
+ <text class="menu_name u-line-1">{{ fileInfo.urlName }}</text>
|
|
|
+ </view>
|
|
|
+ <view v-show="!down">
|
|
|
+ <view v-for="item in fileInfo.children" :key="item.fileId">
|
|
|
+ <handouts-tree :fileInfo="item"></handouts-tree>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-if="fileInfo.type == 1">
|
|
|
+ <view class="fl_c u-border-bottom level1">
|
|
|
+ <view class="title u-line-1">
|
|
|
+ {{ fileInfo.urlName }}
|
|
|
+ </view>
|
|
|
+ <view @click="openDocument(item)">
|
|
|
+ <image
|
|
|
+ v-if="!downLoading"
|
|
|
+ src="/pages3/static/imgs/downLoad.png"
|
|
|
+ ></image>
|
|
|
+ <image
|
|
|
+ v-else
|
|
|
+ src="/pages3/static/imgs/downLoading.png"
|
|
|
+ class="loading_down"
|
|
|
+ ></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "handoutsTree",
|
|
|
+ props: {
|
|
|
+ fileInfo: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ down: true,
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {},
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ handelClick() {
|
|
|
+ this.down = !this.down;
|
|
|
+ },
|
|
|
+ openDocument(item) {
|
|
|
+ let url = this.$method.splitImgHost(item.url);
|
|
|
+ // #ifdef H5
|
|
|
+ window.location.href = url;
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ this.downLoading = true;
|
|
|
+ uni.downloadFile({
|
|
|
+ url: url,
|
|
|
+ success: (res) => {
|
|
|
+ var filePath = res.tempFilePath;
|
|
|
+ // h5不支持
|
|
|
+ uni.openDocument({
|
|
|
+ filePath: filePath,
|
|
|
+ fileType: "pdf",
|
|
|
+ showMenu: item.canDownload == 1 ? true : false,
|
|
|
+ success: (res) => {
|
|
|
+ this.downLoading = false;
|
|
|
+ uni.setStorageSync("current", this.current);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ this.downLoading = false;
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "文档地址错误",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ this.downLoading = false;
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "文档错误," + err.errMsg,
|
|
|
+ showCancel: false,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.menu_name {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 26rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+ margin-left: 14rpx;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+.level1 {
|
|
|
+ height: 78rpx;
|
|
|
+ padding-right: 20rpx;
|
|
|
+ .title {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 26rpx;
|
|
|
+ }
|
|
|
+ .loading_down {
|
|
|
+ transform: rotate(360deg);
|
|
|
+ animation: rotation 3s linear infinite;
|
|
|
+ }
|
|
|
+ image {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes rotation {
|
|
|
+ from {
|
|
|
+ -webkit-transform: rotate(0deg);
|
|
|
+ }
|
|
|
+ to {
|
|
|
+ -webkit-transform: rotate(360deg);
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|