|
@@ -17,6 +17,16 @@
|
|
|
color: #848993;
|
|
|
margin-left: 33rpx;
|
|
|
}
|
|
|
+ .no-file {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ text-align: center;
|
|
|
+ view {
|
|
|
+ white-space:nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
.file-item {
|
|
|
width: 100%;
|
|
|
height: 140rpx;
|
|
@@ -59,29 +69,20 @@
|
|
|
</style>
|
|
|
<template>
|
|
|
<view class="log">
|
|
|
- <view class="file-title">文档资料</view>
|
|
|
- <view class="file-box">
|
|
|
- <repeat for="{{localFile}}" key="index" index="index" item="item">
|
|
|
- <view class="file-item" @tap="preview({{item.path}}, {{index}})">
|
|
|
- <view class="file">
|
|
|
- <image src="../static/img/{{listType[index]}}.png"></image>
|
|
|
- <view class="file-explain">
|
|
|
- <text class="title">{{item.fileName}}</text>
|
|
|
- <text class="time">{{localFileTime[index]}}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </repeat>
|
|
|
+ <view class="file-title" wx:if="{{lookFileList.length!==0}}">文档资料</view>
|
|
|
+ <view class="no-file" wx:else>
|
|
|
+ <image src="../static/img/liulan.png" style="width: 345rpx; height: 238rpx;"/>
|
|
|
+ <view style="font-size: 32rpx; color: #444444; ">您最近还没有浏览过,快去浏览吧。</view>
|
|
|
</view>
|
|
|
- <view class="file-title">白板截图</view>
|
|
|
<view class="file-box">
|
|
|
- <repeat for="{{screenshot}}" key="index" index="index" item="item">
|
|
|
- <view class="file-item" @tap="previewImg({{item.path}}, {{index}})">
|
|
|
+ <repeat for="{{lookFileList}}" key="index" index="index" item="item">
|
|
|
+ <view class="file-item" @tap="preview({{item.taskFile.path}}, {{index}})">
|
|
|
<view class="file">
|
|
|
- <image src="{{item.path}}" style="width: 104rpx;height: 76rpx;"></image>
|
|
|
+ <image wx:if="{{listType[index] == 'jpg' || listType[index] == 'png' }}" src="{{item.taskFile.path}}"></image>
|
|
|
+ <image wx:else src="../static/img/{{listType[index]}}.png"></image>
|
|
|
<view class="file-explain">
|
|
|
- <text class="title">{{item.fileName}}</text>
|
|
|
- <text class="time">{{screenshotTime[index]}}</text>
|
|
|
+ <text class="title">{{item.taskFile.fileName}}</text>
|
|
|
+ <text class="time">{{lookFileTime[index]}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -93,6 +94,7 @@
|
|
|
<script>
|
|
|
import wepy from 'wepy'
|
|
|
import { httpRequestApi } from '../util/httpRequestApi'
|
|
|
+ import { formDate } from '../util/utils'
|
|
|
|
|
|
export default class Detail extends wepy.page {
|
|
|
components = {
|
|
@@ -100,11 +102,10 @@
|
|
|
}
|
|
|
|
|
|
data = {
|
|
|
- localFile: [],
|
|
|
- screenshot: [],
|
|
|
- localFileTime: [],
|
|
|
- screenshotTime: [],
|
|
|
- listType: []
|
|
|
+ lookFileList: [],
|
|
|
+ lookFileTime: [],
|
|
|
+ listType: [],
|
|
|
+ totalNo: 0
|
|
|
}
|
|
|
|
|
|
computed = {
|
|
@@ -113,39 +114,46 @@
|
|
|
|
|
|
methods = {
|
|
|
preview (url, index) {
|
|
|
- wx.showLoading({
|
|
|
- title: '加载中'
|
|
|
- })
|
|
|
- wx.downloadFile({
|
|
|
- url: url,
|
|
|
- success: (res) => {
|
|
|
- console.log(res.tempFilePath)
|
|
|
- wx.openDocument({
|
|
|
- filePath: res.tempFilePath,
|
|
|
- success: (res) => {
|
|
|
- wx.hideLoading()
|
|
|
- console.log('打开文档成功')
|
|
|
- const fileId = this.localFile[index].id
|
|
|
- const taskId = this.localFile[index].taskId
|
|
|
- httpRequestApi.addViewLog(fileId, taskId).success(res => {
|
|
|
- console.log('添加文档')
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ const type = this.listType[index]
|
|
|
+ if (type === 'jpg' || type === 'png') {
|
|
|
+ wx.previewImage({
|
|
|
+ current: 'url', // 当前显示图片的http链接
|
|
|
+ urls: [url], // 需要预览的图片http链接列表
|
|
|
+ success: res => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ })
|
|
|
+ wx.downloadFile({
|
|
|
+ url: url,
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res.tempFilePath)
|
|
|
+ wx.openDocument({
|
|
|
+ filePath: res.tempFilePath,
|
|
|
+ fileType: type,
|
|
|
+ success: (res) => {
|
|
|
+ wx.hideLoading()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- previewImg (url, index) {
|
|
|
- wx.previewImage({
|
|
|
- current: 'url', // 当前显示图片的http链接
|
|
|
- urls: [url], // 需要预览的图片http链接列表
|
|
|
- success: res => {
|
|
|
- const fileId = this.screenshot[index].id
|
|
|
- const taskId = this.screenshot[index].taskId
|
|
|
- httpRequestApi.addViewLog(fileId, taskId).success(res => {
|
|
|
- console.log('添加文档')
|
|
|
+ getLogList: (pageNo, pageSize, type) => {
|
|
|
+ httpRequestApi.getLogList(pageNo, pageSize).success(res => {
|
|
|
+ this.totalNo = res.data.data.totalNo
|
|
|
+ if (!type) {
|
|
|
+ res.data.data.list.forEach(item => {
|
|
|
+ this.lookFileList.push(item)
|
|
|
})
|
|
|
+ } else {
|
|
|
+ this.lookFileList = res.data.data.list
|
|
|
}
|
|
|
+ this.CompileTime(res.data.data.list)
|
|
|
+ this.CompileTime(res.data.data.list, true)
|
|
|
+ this.$apply()
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -154,27 +162,13 @@
|
|
|
}
|
|
|
|
|
|
CompileTime (list, type) {
|
|
|
- let arr = []
|
|
|
list.forEach(item => {
|
|
|
if (type) {
|
|
|
- arr.push(item.path.substr(item.path.lastIndexOf('.') + 1))
|
|
|
+ this.listType.push(item.taskFile.path.substr(item.taskFile.path.lastIndexOf('.') + 1))
|
|
|
} else {
|
|
|
- arr.push(new Date(item.gmtCreated).toLocaleString())
|
|
|
+ this.lookFileTime.push(formDate(item.viewLog.gmtCreated))
|
|
|
}
|
|
|
})
|
|
|
- return arr
|
|
|
- }
|
|
|
-
|
|
|
- onLoad(params) {
|
|
|
- httpRequestApi.getLogList().success(res => {
|
|
|
- console.log('记录', res)
|
|
|
- // this.screenshot = res.data.data.screenshot
|
|
|
- // this.localFile = res.data.data.localFile
|
|
|
- // this.localFileTime = this.CompileTime(res.data.data.localFile)
|
|
|
- // this.screenshotTime = this.CompileTime(res.data.data.screenshot)
|
|
|
- // this.listType = this.CompileTime(res.data.data.localFile, true)
|
|
|
- // this.$apply()
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
</script>
|