|
@@ -9,7 +9,9 @@ export class textbookServer {
|
|
|
company: string = localStorage.getItem('company')!;
|
|
|
theme: boolean = false; //深色主题模式
|
|
|
profile: any = JSON.parse(localStorage.getItem('profile')!);
|
|
|
- constructor() {}
|
|
|
+ constructor(
|
|
|
+ private http:HttpClient
|
|
|
+ ) {}
|
|
|
authMobile(mobile: string): boolean {
|
|
|
let a = /^1[3456789]\d{9}$/;
|
|
|
if (!String(mobile).match(a)) {
|
|
@@ -160,10 +162,33 @@ export class textbookServer {
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
-tbookExportReport(options:{processId?:string,bookList?:any[]}){
|
|
|
+async tbookExportReport(options:{processId?:string,bookList?:any[]}){
|
|
|
|
|
|
-
|
|
|
- // return
|
|
|
+ let url = Parse.serverURL + "/api/tbook/export"
|
|
|
+ // console.log(url)
|
|
|
+ let response = await fetch(url, {
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'X-Parse-Application-Id': 'edu-textbook'
|
|
|
+ },
|
|
|
+ body: JSON.stringify(options)
|
|
|
+ })
|
|
|
+ let result = await response.json()
|
|
|
+ let zipUrl = result?.result?.zipUrl;
|
|
|
+ if(result?.code==200){
|
|
|
+ zipUrl = zipUrl.replaceAll("http://","https://");
|
|
|
+ const a = document.createElement('a'); // 创建一个<a>元素
|
|
|
+ a.href = zipUrl; // 设置链接的href属性为要下载的文件的URL
|
|
|
+ a.download = '报送流程'; // 设置下载文件的名称
|
|
|
+ document.body.appendChild(a); // 将<a>元素添加到文档中
|
|
|
+ a.click(); // 模拟点击<a>元素
|
|
|
+ document.body.removeChild(a); // 下载后移除<a>元素
|
|
|
+ }
|
|
|
+ // console.log(result)
|
|
|
+ return result
|
|
|
+
|
|
|
+
|
|
|
Parse.Cloud.run('tbookExportReport', options).then(
|
|
|
(data) => {
|
|
|
console.log(data);
|