123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <style lang="less">
- .log {
- width: 100%;
- height: 100%;
- }
- .file-box {
- width: 100%;
- background: #fff;
- padding: 0 59rpx 0 35rpx;
- box-sizing: border-box;
- }
- .file-title {
- height: 80rpx;
- width: 100%;
- font-size: 32rpx;
- line-height: 80rpx;
- color: #848993;
- margin-left: 33rpx;
- }
- .file-item {
- width: 100%;
- height: 140rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .file {
- display: flex;
- image {
- width:74rpx;
- height: 76rpx;
- margin-right: 26rpx;
- }
- .file-explain {
- display: flex;
- flex-direction: column;
- justify-content: center;
- .title {
- font-size:28rpx;
- font-weight: bolder;
- }
- .time {
- font-size: 24rpx;
- color: #909090;
- }
- }
- }
- }
- .back {
- position: fixed;
- left: 40rpx;
- bottom: 32rpx;
- width:77rpx;
- height: 76rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- </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>
- <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}})">
- <view class="file">
- <image src="{{item.path}}" style="width: 104rpx;height: 76rpx;"></image>
- <view class="file-explain">
- <text class="title">{{item.fileName}}</text>
- <text class="time">{{screenshotTime[index]}}</text>
- </view>
- </view>
- </view>
- </repeat>
- </view>
- </view>
- </template>
- <script>
- import wepy from 'wepy'
- import { httpRequestApi } from '../util/httpRequestApi'
- export default class Detail extends wepy.page {
- components = {
- }
- data = {
- localFile: [],
- screenshot: [],
- localFileTime: [],
- screenshotTime: [],
- listType: []
- }
- computed = {
- }
- 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('添加文档')
- })
- }
- })
- }
- })
- },
- 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 = {
- }
- 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) {
- 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>
|