Merge branch 'master' of http://gitea.sczysoft.com/ganzi/daofu-applet
This commit is contained in:
commit
40b6064392
|
|
@ -63,7 +63,43 @@ Page({
|
||||||
const name = e.currentTarget.dataset.name;
|
const name = e.currentTarget.dataset.name;
|
||||||
this.data.postData[name] = e.detail.value;
|
this.data.postData[name] = e.detail.value;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 阅览文件
|
||||||
|
*/
|
||||||
|
openread: function (e) {
|
||||||
|
const item = e.currentTarget.dataset.item;
|
||||||
|
const extension = item.filepath.split('.').pop().toLowerCase();
|
||||||
|
if(extension == 'jpg' || extension == 'png' ){
|
||||||
|
wx.previewImage({
|
||||||
|
urls: [app.FILE_SERVER_URL + item.filepath] // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(extension == 'mp4'){
|
||||||
|
this.setData({
|
||||||
|
videoSrc:app.FILE_SERVER_URL + item.filepath,
|
||||||
|
video: true
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.downloadFile({
|
||||||
|
url: app.FILE_SERVER_URL + item.filepath, //仅为示例,并非真实的资源
|
||||||
|
success(res) {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
fail: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '不支持此格式',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 选择文件
|
* 选择文件
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,21 @@
|
||||||
|
|
||||||
<text wx:if="{{!readonly}}" catchtap="chooseMessageFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;margin-left: 20rpx;">文件上传</text>
|
<text wx:if="{{!readonly}}" catchtap="chooseMessageFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;margin-left: 20rpx;">文件上传</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid">
|
<view style="width: 100%;">
|
||||||
|
<view style="display: flex;margin: 10px 0;align-items: center;" wx:for="{{ files }}">
|
||||||
|
<text style="width: 90%;Word-break:break-all" catchtap="openread" data-item="{{item}}">
|
||||||
|
<text>{{ index + 1 }}</text>
|
||||||
|
<text>{{ item.realfilename }}</text>
|
||||||
|
</text>
|
||||||
|
<text catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="grid">
|
||||||
<view class="img" wx:for="{{files}}" style="position: relative;">
|
<view class="img" wx:for="{{files}}" style="position: relative;">
|
||||||
<text wx:if="{{!readonly}}" catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
<text wx:if="{{!readonly}}" catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
||||||
<image class="img" src="{{baseUrl+item.filepath}}" catchtap="filePre" data-url="{{item.filepath}}" />
|
<image class="img" src="{{baseUrl+item.filepath}}" catchtap="filePre" data-url="{{item.filepath}}" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="space"></view>
|
<view class="space"></view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,43 @@ Page({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 阅览文件
|
||||||
|
*/
|
||||||
|
openread: function (e) {
|
||||||
|
const item = e.currentTarget.dataset.item;
|
||||||
|
const extension = item.filepath.split('.').pop().toLowerCase();
|
||||||
|
if(extension == 'jpg' || extension == 'png' ){
|
||||||
|
wx.previewImage({
|
||||||
|
urls: [app.FILE_SERVER_URL + item.filepath] // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(extension == 'mp4'){
|
||||||
|
this.setData({
|
||||||
|
videoSrc:app.FILE_SERVER_URL + item.filepath,
|
||||||
|
video: true
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.downloadFile({
|
||||||
|
url: app.FILE_SERVER_URL + item.filepath, //仅为示例,并非真实的资源
|
||||||
|
success(res) {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
fail: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '不支持此格式',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 获取工作类型
|
* 获取工作类型
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,21 @@
|
||||||
<text catchtap="chooseFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;">添加图片</text>
|
<text catchtap="chooseFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;">添加图片</text>
|
||||||
<text catchtap="chooseMessageFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;margin-left: 20rpx;">文件上传</text>
|
<text catchtap="chooseMessageFile" class="title cuIcon-roundadd" style="font-weight: normal;color: #5DA6F4;margin-left: 20rpx;">文件上传</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid">
|
<view style="width: 100%;">
|
||||||
|
<view style="display: flex;margin: 10px 0;align-items: center;" wx:for="{{ files}}">
|
||||||
|
<text style="width: 90%;Word-break:break-all" catchtap="openread" data-item="{{item}}">
|
||||||
|
<text>{{ index + 1 }}</text>
|
||||||
|
<text>{{ item.realfilename }}</text>
|
||||||
|
</text>
|
||||||
|
<text catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="grid">
|
||||||
<view class="img" wx:for="{{files}}" style="position: relative;">
|
<view class="img" wx:for="{{files}}" style="position: relative;">
|
||||||
<text catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
<text catchtap="deleteFile" data-id="{{item.sysdocumentid}}" class="cuIcon-delete del" style="color:red;"></text>
|
||||||
<image class="img" src="{{baseUrl+item.filepath}}" catchtap="filePre" data-url="{{item.filepath}}" />
|
<image class="img" src="{{baseUrl+item.filepath}}" catchtap="filePre" data-url="{{item.filepath}}" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="space"></view>
|
<view class="space"></view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user