提交 0b44f6e5 authored 作者: 钟是志's avatar 钟是志

31986 分配宿舍时选择层级有时选择不上,2001010256 123456

上级 6df1790a
...@@ -3,55 +3,49 @@ import { getToken } from '@/webPublic/one_stop_public/utils/token'; ...@@ -3,55 +3,49 @@ import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getInfo, transformApi } from '@/highOrderComponent/Service'; import { getInfo, transformApi } from '@/highOrderComponent/Service';
import urlTransform from '@/webPublic/zyd_public/request/urlTransform'; import urlTransform from '@/webPublic/zyd_public/request/urlTransform';
export function hrefWithToken(
url,
arg = {
justOpenUrl: false,
params: {},
fileName: '导出',
method: 'GET',
ext: 'xlsx',
prexUrl: '',
},
) {
const { justOpenUrl, params, fileName, method, ext, prexUrl } = arg;
if (!getIsBei_Dian()) {
if (url.indexOf('?') > -1) {
url = `${url}&token=${getToken()}`;
} else {
url = `${url}?token=${getToken()}`;
}
}
const hrefUrl = prexUrl ? prexUrl : transformApi(url);
let u = `${hrefUrl}${url}`;
u = urlTransform(u);
if (justOpenUrl) {
window.open(u);
}
console.log('hrefWithToken', u);
if (getIsBei_Dian()) {
// 这里如果换成POST请求 会需要小心接口报错
downloadFile(u, params, fileName, ext, method);
// downloadFile(u, {}, '', '', 'GET');
return;
}
export function hrefWithToken(url, arg = { getInfo({}, '/InstructorConfigApi/getCurrentDate').then((response) => {
justOpenUrl: false, if (response) {
params: {}, window.open(`${u}`); // 存在问题 浏览器会自动切换内核到IE 内核导致 文件名称乱码.
fileName: '导出', return true;
method: 'GET', } else {
ext: 'xlsx', return false;
prexUrl: '' }
}) { });
const {
justOpenUrl,
params,
fileName,
method,
ext,
prexUrl
} = arg;
if (!getIsBei_Dian()) {
if (url.indexOf('?') > -1) {
url = `${url}&token=${getToken()}`;
} else {
url = `${url}?token=${getToken()}`;
}
}
const hrefUrl = prexUrl?prexUrl:transformApi(url);
let u = `${hrefUrl}${url}`;
u = urlTransform(u);
if (justOpenUrl) {
window.open(u);
}
console.log('hrefWithToken', u);
if (getIsBei_Dian()) {
// 这里如果换成POST请求 会需要小心接口报错
downloadFile(u, params, fileName, ext, method);
// downloadFile(u, {}, '', '', 'GET');
return;
}
getInfo({}, '/InstructorConfigApi/getCurrentDate')
.then((response) => {
if (response) {
window.open(`${u}`); // 存在问题 浏览器会自动切换内核到IE 内核导致 文件名称乱码.
return true;
} else {
return false;
}
});
} }
export function hrefWithTokenSg(url = '', arg = {}) { export function hrefWithTokenSg(url = '', arg = {}) {
return hrefWithToken(url, arg); return hrefWithToken(url, arg);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论