|
@@ -24,10 +24,6 @@
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
- image {
|
|
|
- width: 44rpx;
|
|
|
- height: 10rpx;
|
|
|
- }
|
|
|
.file {
|
|
|
display: flex;
|
|
|
image {
|
|
@@ -66,31 +62,29 @@
|
|
|
<view class="container">
|
|
|
<view class="file-title">文档资料</view>
|
|
|
<view class="file-box">
|
|
|
- <repeat for="{{fileList}}" key="index" index="index" item="item">
|
|
|
- <view class="file-item">
|
|
|
+ <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/EXCEL.png"></image>
|
|
|
+ <image src="../static/img/{{listType[index]}}.png"></image>
|
|
|
<view class="file-explain">
|
|
|
- <text class="title">双十一,庆功会讨论</text>
|
|
|
- <text class="time">2018-10-11 10:00</text>
|
|
|
+ <text class="title">{{item.fileName}}</text>
|
|
|
+ <text class="time">{{localFileTime[index]}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <image src="../static/img/dian.png"></image>
|
|
|
</view>
|
|
|
</repeat>
|
|
|
</view>
|
|
|
<view class="file-title">白板截图</view>
|
|
|
<view class="file-box">
|
|
|
- <repeat for="{{fileList}}" key="index" index="index" item="item">
|
|
|
- <view class="file-item">
|
|
|
+ <repeat for="{{screenshot}}" key="index" index="index" item="item">
|
|
|
+ <view class="file-item" @tap="previewImg({{item.path}}, {{index}})">
|
|
|
<view class="file">
|
|
|
- <image src="../static/img/EXCEL.png"></image>
|
|
|
+ <image src="{{item.path}}" style="width: 104rpx;height: 76rpx;"></image>
|
|
|
<view class="file-explain">
|
|
|
- <text class="title">双十一,庆功会讨论</text>
|
|
|
- <text class="time">2018-10-11 10:00</text>
|
|
|
+ <text class="title">{{item.fileName}}</text>
|
|
|
+ <text class="time">{{screenshotTime[index]}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <image src="../static/img/dian.png"></image>
|
|
|
</view>
|
|
|
</repeat>
|
|
|
</view>
|
|
@@ -102,6 +96,7 @@
|
|
|
|
|
|
<script>
|
|
|
import wepy from 'wepy'
|
|
|
+ import { httpRequestApi } from '../util/httpRequestApi'
|
|
|
|
|
|
export default class Detail extends wepy.page {
|
|
|
components = {
|
|
@@ -109,16 +104,11 @@
|
|
|
}
|
|
|
|
|
|
data = {
|
|
|
- fileList: [
|
|
|
- {
|
|
|
- id: '0',
|
|
|
- title: 'loading'
|
|
|
- },
|
|
|
- {
|
|
|
- id: '0',
|
|
|
- title: 'loading'
|
|
|
- }
|
|
|
- ]
|
|
|
+ localFile: [],
|
|
|
+ screenshot: [],
|
|
|
+ localFileTime: [],
|
|
|
+ screenshotTime: [],
|
|
|
+ listType: []
|
|
|
}
|
|
|
|
|
|
computed = {
|
|
@@ -130,15 +120,72 @@
|
|
|
this.$redirect({
|
|
|
url: './index'
|
|
|
})
|
|
|
+ },
|
|
|
+ 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('添加文档')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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('添加文档')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
events = {
|
|
|
}
|
|
|
|
|
|
- onLoad() {
|
|
|
+ CompileTime (list, type) {
|
|
|
+ let arr = []
|
|
|
+ list.forEach(item => {
|
|
|
+ if (type) {
|
|
|
+ arr.push(item.path.substr(item.path.lastIndexOf('.') + 1))
|
|
|
+ } else {
|
|
|
+ arr.push(new Date(item.gmtCreated).toLocaleString())
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+
|
|
|
+ onLoad(params) {
|
|
|
wepy.setNavigationBarTitle({
|
|
|
- title: '当前页面'
|
|
|
+ title: params.title
|
|
|
+ })
|
|
|
+ httpRequestApi.getTaskFile(params.id).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()
|
|
|
})
|
|
|
}
|
|
|
}
|