tav-ui
Version:
186 lines (183 loc) • 6.75 kB
JavaScript
import '../../../../node_modules/.pnpm/jsencrypt@3.3.2/node_modules/jsencrypt/lib/index.mjs';
import { JSEncrypt } from '../../../../node_modules/.pnpm/jsencrypt@3.3.2/node_modules/jsencrypt/lib/JSEncrypt.mjs';
const __CurrentMainDomain__ = function() {
const hostnameArray = location.hostname.split(".");
return `.${hostnameArray.slice(-2).join(".")}`;
}();
function setCookie(name, val, expires, domain) {
let text = String(encodeURIComponent(val));
const date = new Date();
date.setTime(date.getTime() + Number(expires) * 1e3);
text += `; expires=${date.toUTCString()}`;
text += "; path=/";
if (typeof domain != "undefined" && domain != "") {
text += `; domain=${__CurrentMainDomain__}`;
}
document.cookie = `${name}=${text}`;
}
function getCookie(objName) {
const arrStr = document.cookie.split("; ");
for (let i = 0; i < arrStr.length; i++) {
const temp = arrStr[i].split("=");
if (temp[0] == objName)
return unescape(temp[1]);
}
}
const ai = "10001";
let at = "";
let rd = "";
const Encryptor = new JSEncrypt();
async function toLogin() {
const phone = "13999999999";
const password = "123456";
const {
data: { keyId = "1", publicKey }
} = await fetch(`/api/TIANTA-SYSTEM/login/getKey?t=${new Date().getTime()}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
ai
}
}).then((r) => {
console.log(r);
return r.json();
});
Encryptor.setPublicKey(publicKey);
await fetch(`/api/TIANTA-SYSTEM/login/enter?t=${new Date().getTime()}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
ai
},
body: JSON.stringify({
keyId,
phone,
password: Encryptor.encrypt(password)
})
}).then((r) => {
at = r.headers.get("at");
rd = r.headers.get("rd");
});
}
const address = [
"Shenzhen",
"Shanghai",
"Guangdong",
"Beijing",
"Shandong",
"Anhui",
"Zhengzhou",
"Wuhan",
"Chengdu",
"Chongqing"
];
const roles = ["Develop", "Test", "Designer", "PM", "FE", "BF", "Manger", "Boss", "Saler", "Hr"];
const ages = [24, 21, 22, 23, 26, 28, 30, 32, 27, 29];
const recordNum = 20;
const Avators = [
"http://m.imeitou.com/uploads/allimg/2019080515/he0mvtgkbu3.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/ilnzrrqglxp.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/jhzvqecaiva.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/3i1vb11cz51.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/ikyq0erbl2o.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/nhp2lycyysg.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/otllv1al21i.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/h23grtl50ah.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/2w34ercytby.jpg",
"http://m.imeitou.com/uploads/allimg/2019080515/bi5qvugt0tf.jpg"
];
function MockData() {
const data = [];
for (let i = 1; i <= recordNum; i++) {
const record = {
id: i,
name: `test${i}`,
nickname: `t${i}`,
role: roles[Math.floor(Math.random() * 10)],
sex: i % 2 === 1 ? "Man" : "Woman",
age: ages[Math.floor(Math.random() * 10)],
address: address[Math.floor(Math.random() * 10)].repeat(Math.floor(Math.random() * 10) * 5),
avator: Avators[Math.floor(Math.random() * 10)]
};
data.push(record);
}
return data;
}
async function __post(url = "", data = {}, isFormData = false) {
const options = {
method: "POST",
mode: "cors",
cache: "no-cache",
credentials: "include",
headers: {
"Content-Type": "application/json",
ai: data.appId || ai,
at,
rd
},
body: JSON.stringify(data)
};
if (isFormData) {
Reflect.deleteProperty(options.headers, "Content-Type");
options.body = data;
}
const response = await fetch(url, options);
return response.json();
}
async function __get(url = "") {
const response = await fetch(url, {
method: "GET",
mode: "cors",
cache: "no-store",
credentials: "include"
});
return response.ok;
}
async function API__POE_INVEST_ALL(data, url = "/api/STARLIGHT-POE-WEB/invesinstitution/listPager") {
return await __post(url, data);
}
async function API__POE_CUSTOM_ALL(data, url = "/api/STARLIGHT-POE-WEB/customer/listPager") {
return await __post(url, data);
}
async function API__POE_CUSTOM_ALL_LIST(data, url = "/api/STARLIGHT-POE-WEB/project/data/list") {
return await __post(url, data);
}
async function API__SYSTEM_USER_TABLE_INFO_GET(data, url = "/api/TIANTA-SYSTEM/sys/customTableFiled/load") {
return await __post(url, data);
}
async function API__SYSTEM_USER_TABLE_INFO_SET(data, url = "/api/TIANTA-SYSTEM/sys/customTableFiled/save") {
return await __post(url, data);
}
async function API__CENTER_INDUSTRY_TAG(data, url = "/api/STARLIGHT-CENTRE-WEB/baseinfo/industry/list/incl_tags") {
return await __post(url, data);
}
async function API__POE_MENU_ALL(data, url = "/api/TIANTA-SYSTEM//sys/acl/mgtTree") {
await __get("/api/TIANTA-SYSTEM/test.html");
return await __post(url, data);
}
async function API__CENTER_COMPANY_LIST(data, url = "/api/STARLIGHT-CENTRE-WEB/third/serv/search/company") {
return await __post(url, data);
}
async function API__INVEST_COMPANY_LIST(data, url = "/api/STARLIGHT-INVEST-WEB/company/information/listPager") {
return await __post(url, data);
}
async function API__INVEST_COMPANY_DELETE(data, url = "/api/STARLIGHT-INVEST-WEB/company/information/deleteBatch") {
return await __post(url, data);
}
async function API__INVEST_INVESTORS_LIST(data, url = "/api/STARLIGHT-INVEST-WEB/raise/investors/list") {
return await __post(url, data);
}
async function API__FILE_UPDATE(data, url = "/api/TIANTA-FILE/api/file/updateFile") {
const { appId, formData, instantUpdate, fileActualId } = data;
return await __post(`${url}/${appId}?fileActualId=${fileActualId}&instantUpdate=${instantUpdate}`, formData, true);
}
async function API__FILE_DELETE(data, url = "/api/TIANTA-FILE/api/file/deleteFileByActualIds") {
const { appId, actualIds } = data;
return await __post(`${url}/${appId}`, actualIds);
}
async function API__FILE_UPDATENAMEORLINK(data, url = "/api/TIANTA-FILE/api/file/updateFileNameAndAddress") {
const { appId } = data;
return await __post(`${url}/${appId}`, data);
}
export { API__CENTER_COMPANY_LIST, API__CENTER_INDUSTRY_TAG, API__FILE_DELETE, API__FILE_UPDATE, API__FILE_UPDATENAMEORLINK, API__INVEST_COMPANY_DELETE, API__INVEST_COMPANY_LIST, API__INVEST_INVESTORS_LIST, API__POE_CUSTOM_ALL, API__POE_CUSTOM_ALL_LIST, API__POE_INVEST_ALL, API__POE_MENU_ALL, API__SYSTEM_USER_TABLE_INFO_GET, API__SYSTEM_USER_TABLE_INFO_SET, MockData, __get, __post, toLogin };
//# sourceMappingURL=data2.mjs.map