Commit 4692889f by fengzhaoyu

Merge branch 'dev' into release/1.0.0

# Conflicts:
#	config.js
parents af61ab7b ae97d638
export const globalUrl = "https://gateway2.mingwork.com"; export const globalUrl = "https://gateway2.mingwork.com";
export const globalUrl2 = "https://third-authentication.mingwork.com"; export const globalUrl2 = "https://third-authentication.mingwork.com";
/*
isShowOss 控制oss上传是否展示
true 展示
false 不能展示
测试环境为 true
线上环境为 false
*/
export const isShowOss = false
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
<text class="iconfont iconicon_task1"></text>任务 <text class="iconfont iconicon_task1"></text>任务
</view> </view>
<!--<view onTap="addMeetingFile"><text class="iconfont iconicon_data"></text>文件</view> --> <!--<view onTap="addMeetingFile"><text class="iconfont iconicon_data"></text>文件</view> -->
<view onTap="addOssFile" a:if="{{isShowOss}}"> <view onTap="addOssFile">
<text class="iconfont iconicon_data"></text> <text class="iconfont iconicon_data"></text>
<view> <view>
文件 文件
......
...@@ -6,7 +6,6 @@ import { getOssPermission, getuploadResource, isParticipate, deleteSchedule, get ...@@ -6,7 +6,6 @@ import { getOssPermission, getuploadResource, isParticipate, deleteSchedule, get
import { throttle, getCreateShowTime } from './../../utils/utils.js' import { throttle, getCreateShowTime } from './../../utils/utils.js'
import { observer } from '/utils/observer.js' import { observer } from '/utils/observer.js'
import { resolve } from 'path'; import { resolve } from 'path';
import { isShowOss } from '../../config.js';
import { getFileInfoFromOss } from './uploadFile'; import { getFileInfoFromOss } from './uploadFile';
import { comShareData } from './const.js'; import { comShareData } from './const.js';
create.Page({ create.Page({
...@@ -114,7 +113,6 @@ create.Page({ ...@@ -114,7 +113,6 @@ create.Page({
isExpand: false, isExpand: false,
placeholder: '', placeholder: '',
mrReserveStatus: '', mrReserveStatus: '',
isShowOss: isShowOss
}, },
onShow() { onShow() {
// this.conflictPeople() // this.conflictPeople()
...@@ -1681,7 +1679,8 @@ create.Page({ ...@@ -1681,7 +1679,8 @@ create.Page({
const res = await getFileInfoFromOss(); const res = await getFileInfoFromOss();
if (res.code === -1) { if (res.code === -1) {
dd.alert({ dd.alert({
content: res.msg content: res.msg,
buttonText: '确定'
}) })
return return
} }
......
...@@ -12,7 +12,7 @@ function getImg() { ...@@ -12,7 +12,7 @@ function getImg() {
resolve(res) resolve(res)
}, },
fail: (err) => { fail: (err) => {
rejects({ code: -1, ...err }) rejects({ code: -1, msg: '选择图片失败', ...err })
} }
}); });
}) })
...@@ -39,7 +39,6 @@ async function uploadImg(imgInfo) { ...@@ -39,7 +39,6 @@ async function uploadImg(imgInfo) {
signature: permisson.data.data.signature signature: permisson.data.data.signature
}, },
success: (res) => { success: (res) => {
console.log(JSON.stringify(res))
resolve([{ resolve([{
fileId: key, fileId: key,
fileName: fileName, fileName: fileName,
...@@ -48,24 +47,18 @@ async function uploadImg(imgInfo) { ...@@ -48,24 +47,18 @@ async function uploadImg(imgInfo) {
}]) }])
}, },
fail: (err) => { fail: (err) => {
rejects({ code: -1, ...err }) rejects({ code: -1, msg: '选上传图片失败', ...err })
} }
}) })
}) })
} }
// 从OSS获取fileInfo // 从OSS获取fileInfo
export async function getFileInfoFromOss() { export async function getFileInfoFromOss() {
// 选择图片 try {
const imgInfo = await getImg() const imgInfo = await getImg();
if (imgInfo.code === -1) { const fileInfo = await uploadImg(imgInfo);
return { code: -1, msg: '选择图片失败' } return { code: 0, msg: 'success', data: fileInfo }
} catch (err) {
return err
} }
// 上传图片
const fileInfo = await uploadImg(imgInfo)
if (fileInfo.code === -1) {
return { code: -1, msg: '选上传图片失败' }
}
// 返回fileInfo
return { code: 0, msg: 'success', data: fileInfo }
} }
\ 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