fix: 移动端查看分享错误

This commit is contained in:
fit2cloud-chenyw 2022-05-27 12:05:11 +08:00
parent b9562dd9c0
commit 7ebbf09dda
3 changed files with 14 additions and 8 deletions

View File

@ -1,10 +1,11 @@
package io.dataease.commons.utils;
import static io.dataease.commons.constants.StaticResourceConstants.*;
import cn.hutool.core.codec.Base64Encoder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
import sun.misc.BASE64Encoder;
import java.io.FileInputStream;
import java.io.IOException;
@ -91,7 +92,8 @@ public class StaticResourceUtils {
}
// Encode byte array as Base64
if(buffer!=null){
return new BASE64Encoder().encode(buffer);
return Base64Encoder.encode(buffer);
}else{
return null;
}

View File

@ -1,5 +1,6 @@
package io.dataease.service.staticResource;
import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import io.dataease.commons.utils.FileUtils;
@ -10,11 +11,8 @@ import io.dataease.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.Base64Utils;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.nio.file.Files;
@ -65,7 +63,7 @@ public class StaticResourceService {
String content = entry.getValue();
if(StringUtils.isNotEmpty(content)){
Files.createFile(uploadPath);
FileCopyUtils.copy(new BASE64Decoder().decodeBuffer(content),Files.newOutputStream(uploadPath));
FileCopyUtils.copy(Base64Decoder.decode(content),Files.newOutputStream(uploadPath));
}
}
}catch (Exception e){

View File

@ -170,10 +170,16 @@
})
},
loadLinkUrl() {
this.url = process.env.VUE_APP_BASE_API + 'tempMobileLink/' + this.banner.id + "/" + getToken()
const baseUrl = process.env.VUE_APP_BASE_API + 'tempMobileLink/'
let resource = this.banner.id
const token = getToken()
if (this.banner.index && this.banner.index === 2 && this.banner.userId) {
this.url = process.env.VUE_APP_BASE_API + 'tempMobileLink/' + this.banner.id + '|' + this.banner.userId + "/" + getToken()
resource = this.banner.id + '|' + this.banner.userId
//this.url = process.env.VUE_APP_BASE_API + 'tempMobileLink/' + this.banner.id + '|' + this.banner.userId + "/" + getToken()
}
this.url = baseUrl + encodeURIComponent(encodeURIComponent(resource)) + "/" + encodeURIComponent(token)
const url = this.url
/* uni.hideLoading() */