Commit a08d618c by fengzhaoyu

fix: 修改上传图片没有添加上问题

parent 7bcbc03e
...@@ -885,7 +885,7 @@ create.Page({ ...@@ -885,7 +885,7 @@ create.Page({
maxClickCount--; maxClickCount--;
if (maxClickCount == 0) { if (maxClickCount == 0) {
dd.alert({ dd.alert({
content: "0.0.29" content: "0.0.30"
}); });
maxClickCount = 5; maxClickCount = 5;
} }
......
...@@ -1639,7 +1639,14 @@ create.Page({ ...@@ -1639,7 +1639,14 @@ create.Page({
// 上传oss文件 // 上传oss文件
async addOssFile() { async addOssFile() {
uploadOss().then(res => { uploadOss().then(res => {
dd.navigateTo({ url: `./../uploadFile/uploadFile` }) if (!!res) {
this.store.data.fileInfos = res
this.update()
dd.navigateTo({ url: `./../uploadFile/uploadFile` })
}
// dd.alert({
// content: JSON.stringify(res)
// })
}) })
}, },
......
...@@ -34,7 +34,7 @@ function getOssImg() { ...@@ -34,7 +34,7 @@ function getOssImg() {
}) })
} }
// 获取的图片上传到oss // 获取的图片上传到oss
function sendOss(permisson, imgInfo, key) { function sendOss(permisson, imgInfo, key, fileName) {
return new Promise(resolve => { return new Promise(resolve => {
dd.uploadFile({ dd.uploadFile({
headers: { headers: {
...@@ -53,7 +53,12 @@ function sendOss(permisson, imgInfo, key) { ...@@ -53,7 +53,12 @@ function sendOss(permisson, imgInfo, key) {
}, },
success: (res) => { success: (res) => {
console.log(JSON.stringify(res)) console.log(JSON.stringify(res))
resolve(imgInfo) resolve([{
fileId: key,
fileName: fileName,
fileType: imgInfo.files[0].fileType,
fileSize: imgInfo.files[0].size
}])
} }
}) })
}) })
...@@ -100,12 +105,5 @@ export async function uploadOss() { ...@@ -100,12 +105,5 @@ export async function uploadOss() {
const imgInfo = await getOssImg() const imgInfo = await getOssImg()
const key = await new Promise((resolve) => { resolve(permisson.data.data.dir + timestamp + random + '.' + imgInfo.files[0].fileType) }) 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) }) const fileName = await new Promise((resolve) => { resolve(timestamp + random + '.' + imgInfo.files[0].fileType) })
await sendOss(permisson, imgInfo, key) return await sendOss(permisson, imgInfo, key, fileName)
pageStore.data.fileInfos.push(...[{
fileId: key,
fileName: fileName,
fileType: imgInfo.files[0].fileType,
fileSize: imgInfo.files[0].size
}]);
pageStore.update()
} }
...@@ -36,7 +36,10 @@ create.Page({ ...@@ -36,7 +36,10 @@ create.Page({
}, 100), }, 100),
//添加会议文件 //添加会议文件
add() { add() {
uploadOss() uploadOss().then(res => {
this.store.data.fileInfos.push(...res)
this.update();
})
// const data = { // const data = {
// ddUserId: getApp().globalData.userid, // ddUserId: getApp().globalData.userid,
// type: 'add', // type: 'add',
......
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