修改:移动端打开文件的方法

This commit is contained in:
jmal 2021-03-17 17:57:30 +08:00
parent 08cb3f0c3c
commit 4b3ce450f9
2 changed files with 14 additions and 10 deletions

View File

@ -10,7 +10,6 @@ NProgress.configure({ showSpinner: false }) // NProgress配置
const whiteList = ['/login','/s','/s/','/s_m','/s_m/'] // 白名单
router.beforeEach(async(to, from, next) => {
console.log(to)
// 开始进度条
NProgress.start()
// 设置页面标题
@ -80,7 +79,6 @@ function setMenuList(next, to){
}
})
} else {
console.log('next(to)', to)
next(to)
}
}

View File

@ -230,7 +230,8 @@
<van-checkbox v-if="selectStatus" v-model="isShowCheckContext" slot="right-icon" :name="rowContextData"></van-checkbox>
</van-cell>
</van-overlay>
<!--为了不受右键区域的影响, 把弹窗之类的提取出来-->
<image-viewer :fileList="fileList" :file="imagePreviewRow" :status.sync="imagePreviewVisible"></image-viewer>
</div>
</template>
<script>
@ -242,10 +243,11 @@
import Bus from '@/assets/js/bus'
import {getPath, getPathList, removePath, setPath} from '@/utils/path'
import fileConfig from "@/utils/file-config";
import ImageViewer from "@/components/preview/ImageViewer";
let pinyin = require("pinyin");
export default {
components: {IconFile},
components: {ImageViewer, IconFile},
computed: {
...mapGetters([
'name',
@ -323,7 +325,9 @@
sortableProp: null,
order: null,
grid: false,
vmode: 'list'
vmode: 'list',
imagePreviewRow: {},
imagePreviewVisible: false,
};
},
mounted(){
@ -957,12 +961,14 @@
setPath(this.path, this.pathList)
this.getFileList()
} else {
if(row.contentType.includes('text')){
this.$router.push(`/public/articles/article?mark=${row.id}`)
}else{
// 打开文件
fileConfig.preview(this.$store.state.user.token, row, this.$store.getters.token)
if (row.contentType.startsWith('image')) {
// 图片
this.imagePreviewVisible = true
this.imagePreviewRow = row
return
}
// 通用打开文件的方法
fileConfig.preview(this.$store.state.user.name, row, this.$store.getters.token)
}
}
},