Unverified 提交 39b1076a authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw 提交者: GitHub

Merge pull request #2330 from dataease/pr@dev@fix_mobile_url_error

fix: 移动端查看分享错误
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;
}
......
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){
......
......@@ -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() */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论