Commit e8e05b21 by fengzhaoyu

Merge branch 'dev' into release_beta/1.0.0

# Conflicts:
#	pages/index/index.js
parents 8a7b8aa5 1c04d685
...@@ -237,3 +237,19 @@ export function getZoomUrl(data) { ...@@ -237,3 +237,19 @@ export function getZoomUrl(data) {
type: "binding" type: "binding"
}); });
} }
// oss 上传 获取授权
export function getOssPermission() {
return $http({
method: "get",
data: "",
url: `/meet/meeting-log-resource/getOssUploadSignature`
});
}
// oss 上传 获取授权
export function getuploadResource(data) {
return $http({
method: "post",
data: JSON.stringify(data),
url: `/meet/meeting-log-resource/uploadResource`
});
}
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="file-title"> <view class="file-title">
<text>{{item.fileName.slice(0, item.fileName.length - 5)}}</text> <text>{{item.fileName.slice(0, item.fileName.length - 5)}}</text>
<text>{{item.fileName.slice(-5)}}</text></view> <text>{{item.fileName.slice(-5)}}</text></view>
<view class="file-size">{{(item.fileSize/1024/1024).toFixed(2)}}KB</view> <view class="file-size">{{(item.fileSize/1024/1024).toFixed(2)}}M</view>
<view a:if="{{isCanDelete}}" class="iconfont iconicon_noAgreed1" catchTap="removeFile" data-id="{{item.fileId}}"></view> <view a:if="{{isCanDelete}}" class="iconfont iconicon_noAgreed1" catchTap="removeFile" data-id="{{item.fileId}}"></view>
</view> </view>
</view> </view>
......
export const globalUrl = "https://gateway-beta.mingwork.com"; export const globalUrl = "https://gateway-beta.mingwork.com";
export const globalUrl2 = "https://third-authentication-beta.mingwork.com"; export const globalUrl2 = "https://third-authentication-beta.mingwork.com";
...@@ -879,7 +879,7 @@ create.Page({ ...@@ -879,7 +879,7 @@ create.Page({
maxClickCount--; maxClickCount--;
if (maxClickCount == 0) { if (maxClickCount == 0) {
dd.alert({ dd.alert({
content: "0.0.22" content: "0.0.23"
}); });
maxClickCount = 5; maxClickCount = 5;
} }
......
...@@ -207,6 +207,12 @@ ...@@ -207,6 +207,12 @@
<view onTap="addMeetingFile"> <view onTap="addMeetingFile">
<text class="iconfont iconicon_data"></text>文件 <text class="iconfont iconicon_data"></text>文件
</view> </view>
<view onTap="addOssFile">
<text class="iconfont iconicon_data"></text>
<view>
oss
</view>
</view>
<text class="devider"></text> <text class="devider"></text>
<view onTap="onShareAppMessage"> <view onTap="onShareAppMessage">
<text class="iconfont iconicon_share1"></text> <text class="iconfont iconicon_share1"></text>
......
import create from 'dd-store'; import create from 'dd-store';
import { checkFullScren } from "../../utils/checkFullScren"; import { checkFullScren } from "../../utils/checkFullScren";
import pageStore from './store'; import pageStore from './store';
import { getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateMeetingTask, uploadPermissions } from '../../api/request'; import { saveFileInfo, getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateMeetingTask, uploadPermissions } from '../../api/request';
import { isParticipate, deleteSchedule, getScheduleDetail, getUserScheduleInTime, modifySchedule, getMeetingRoomRepeatAffairs } from '../../api/request.js' import { getOssPermission, getuploadResource, isParticipate, deleteSchedule, getScheduleDetail, getUserScheduleInTime, modifySchedule, getMeetingRoomRepeatAffairs } from '../../api/request.js'
import { throttle, getCreateShowTime } from './../../utils/utils.js' import { throttle, getCreateShowTime, getRndInteger } from './../../utils/utils.js'
import { observer } from '/utils/observer.js' import { observer } from '/utils/observer.js'
import { resolve } from 'path'; import { resolve } from 'path';
create.Page({ create.Page({
...@@ -1608,6 +1608,74 @@ create.Page({ ...@@ -1608,6 +1608,74 @@ create.Page({
} }
}) })
}, },
// 上传oss文件
async addOssFile() {
const timestamp = new Date().getTime()
const random = getRndInteger(1000, 10000)
const permisson = await getOssPermission()
const imgInfo = await this.getOssImg()
const key = await new Promise((resolve) => { resolve(permisson.data.data.dir + timestamp + random + '.' + imgInfo.files[0].fileType) })
const fileName = await new Promise((resolve) => { resolve(timestamp + random + '.' + imgInfo.files[0].fileType) })
await this.uploadOssFile(permisson, imgInfo, key)
await this.saveOssFileInfo(permisson, imgInfo, key, fileName)
},
// 获取oss上传图片 选择图片 上传图片到oss
getOssImg() {
return new Promise((resolve, rejects) => {
dd.chooseImage({
count: 1,
success: (res) => {
resolve(res)
},
});
})
},
// 获取的图片上传到oss
uploadOssFile(permisson, imgInfo, key) {
return new Promise(resolve => {
dd.uploadFile({
url: permisson.data.data.host,
fileType: 'image',
fileName: 'file',
filePath: imgInfo.filePaths[0],
formData: {
key: key,
policy: permisson.data.data.policy,
OSSAccessKeyId: permisson.data.data.accessId,
success_action_status: 200,
signature: permisson.data.data.signature
},
success: () => {
resolve()
}
})
})
},
// 上传oss文件
saveOssFileInfo(permisson, imgInfo, key, fileName) {
const data = {
resourceType: 'accessory',
creatorId: getApp().globalData.userid,
category: '2',
scheduleId: this.store.data.scheduleId,
groupId: this.store.data.groupId,
creatorInfo: getApp().globalData.userInfo,
description: '',
logType: 'schedule_accessory_add',
fileInfos: JSON.stringify({
fileId: key,
fileName: fileName,
fileType: imgInfo.files[0].fileType,
fileSize: imgInfo.files[0].size
})
}
saveFileInfo(data).then(result => {
dd.alert({
title: '上传成功',
content: JSON.stringify(result)
})
})
},
//隐藏文件操作浮窗 //隐藏文件操作浮窗
hideFileOperate() { hideFileOperate() {
this.store.data.logId = ''; this.store.data.logId = '';
......
...@@ -134,7 +134,7 @@ export function getCreateShowTime(createdTime) { ...@@ -134,7 +134,7 @@ export function getCreateShowTime(createdTime) {
if (leftDay < 1) { if (leftDay < 1) {
timeResule = (leftDay * 24).toFixed(0) + '小时前' timeResule = (leftDay * 24).toFixed(0) + '小时前'
} else { } else {
timeResule = letDay.toFixed(0) + '天前' timeResule = leftDay.toFixed(0) + '天前'
} }
} else { } else {
timeResule = `${creatTime.substring(5, 7)}${creatTime.substring(8, 10)}${creatTime.substring(11, 16)}` timeResule = `${creatTime.substring(5, 7)}${creatTime.substring(8, 10)}${creatTime.substring(11, 16)}`
...@@ -150,4 +150,14 @@ export function getCreateShowTime(createdTime) { ...@@ -150,4 +150,14 @@ export function getCreateShowTime(createdTime) {
export function padZero(val) { export function padZero(val) {
return ("00" + val).slice(-2); return ("00" + val).slice(-2);
}
/*
获取随机数
min = 0 区间范围 默认0
max = 100 区间范围 默认100
[min, max)
*/
export function getRndInteger(min = 0, max = 100) {
return Math.floor(Math.random() * (max - min)) + min;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment