You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
2.6 KiB
120 lines
2.6 KiB
<template>
|
|
<view class="file">
|
|
<navbar title="安装规范" :isCenter="true" :back="true"></navbar>
|
|
<view class="fileList">
|
|
<u-cell-group>
|
|
<u-cell title="产品通用文件" :isLink="true" @click="goText(1)" arrow-direction="right"></u-cell>
|
|
<u-cell title="产品选型文件" :isLink="true" @click="goText(2)" arrow-direction="right"></u-cell>
|
|
<u-cell title="产品安装文件" :isLink="true" @click="goText(3)" arrow-direction="right"></u-cell>
|
|
</u-cell-group>
|
|
</view>
|
|
<u-loading-page :loading="loading" bg-color="#e8e8e8"></u-loading-page>
|
|
<u-toast ref="uToast"></u-toast>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import navbar from '@/components/navbar.vue'
|
|
import {getFile} from '@/common/api.js'
|
|
export default {
|
|
components:{navbar},
|
|
data() {
|
|
return {
|
|
common_file:'',
|
|
selection_file:'',
|
|
install_file:'',
|
|
loading:false
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
console.log(option)
|
|
this.id=option.id
|
|
|
|
},
|
|
onShow() {
|
|
this.getFile()
|
|
this.loading = false
|
|
},
|
|
methods: {
|
|
getFile(){
|
|
getFile({wordorder_id:this.id,custom: { auth: true }}).then(res=>{
|
|
for(let i in res.data){
|
|
this[i] = res.data[i]
|
|
}
|
|
})
|
|
console.log(this)
|
|
},
|
|
goText(item){
|
|
this.loading = true
|
|
let url;
|
|
if(item==1){
|
|
url = this.common_file
|
|
// uni.navigateTo({
|
|
// url: '/pages/webview/webview?url=' + this.common_file
|
|
// })
|
|
}else if(item==2){
|
|
url = this.selection_file
|
|
// uni.navigateTo({
|
|
// url: '/pages/webview/webview?url=' + this.selection_file
|
|
// })
|
|
|
|
}else if(item==3){
|
|
url = this.install_file
|
|
// uni.navigateTo({
|
|
// url: '/pages/webview/webview?url=' + this.install_file
|
|
// })
|
|
}
|
|
if(!url){
|
|
this.$refs.uToast.show({
|
|
type:'default',
|
|
message:'暂无数据'
|
|
})
|
|
this.loading = false;
|
|
return;
|
|
}else{
|
|
|
|
uni.downloadFile({
|
|
url: url,
|
|
|
|
success: function(res) {
|
|
const filePath = res.tempFilePath;
|
|
uni.openDocument({
|
|
showMenu:true,
|
|
filePath: filePath,
|
|
success: function(res) {
|
|
console.log('打开文档成功');
|
|
this.loading = false
|
|
},
|
|
fail(){
|
|
this.loading = false
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.file{
|
|
min-height: calc(100vh);
|
|
background-color: #F4F5F7;
|
|
display: flex;
|
|
flex-direction: column;
|
|
.fileList{
|
|
flex:1;
|
|
margin:24rpx;
|
|
background-color: #ffffff;
|
|
border-radius:10px;
|
|
padding:0 24rpx;
|
|
/deep/.u-cell__body{
|
|
padding:30rpx 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
</style>
|
|
|