fix: use /api/ path for export endpoints (ahserver url2file compatibility)
This commit is contained in:
parent
d98ef560c0
commit
bf97672677
@ -92,9 +92,9 @@ PATHS = [
|
||||
# DingTalk
|
||||
f"/{MOD}/api/submit_approval.dspy",
|
||||
f"/{MOD}/api/dingtalk_callback.dspy",
|
||||
# Export
|
||||
f"/{MOD}/api/export_leads.dspy",
|
||||
f"/{MOD}/api/export_content.dspy",
|
||||
# Export (in portal wwwroot/api/, not /cms/ prefix)
|
||||
f"/api/export_leads.dspy",
|
||||
f"/api/export_content.dspy",
|
||||
]
|
||||
|
||||
def run(role, paths):
|
||||
|
||||
@ -344,7 +344,7 @@
|
||||
"event": "click",
|
||||
"actiontype": "script",
|
||||
"options": {
|
||||
"code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/cms/api/export_leads.dspy',btn)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var bin=atob(d.data);var bytes=new Uint8Array(bin.length);for(var i=0;i<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出商机线索')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出商机线索')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出商机线索')},2000)})"
|
||||
"code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/api/export_leads.dspy',btn)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var bin=atob(d.data);var bytes=new Uint8Array(bin.length);for(var i=0;i<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出商机线索')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出商机线索')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出商机线索')},2000)})"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -362,7 +362,7 @@
|
||||
"event": "click",
|
||||
"actiontype": "script",
|
||||
"options": {
|
||||
"code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/cms/api/export_content.dspy',btn)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var bin=atob(d.data);var bytes=new Uint8Array(bin.length);for(var i=0;i<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出内容列表')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出内容列表')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出内容列表')},2000)})"
|
||||
"code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/api/export_content.dspy',btn)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var bin=atob(d.data);var bytes=new Uint8Array(bin.length);for(var i=0;i<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出内容列表')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出内容列表')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出内容列表')},2000)})"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user