2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
import{L as e,aj as t,aF as a,ae as o,H as c,aG as n,a3 as i,s as l}from"./index-y8AadDM5.js";let s="";s=window.location.href.indexOf("//casedata.igandan.com")>-1?"https://prod-casedata.igandan.com/api":"https://dev-casedata.igandan.com/api";const d=s,p=function(e){let t=null,a=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return document.cookie&&(t=document.cookie.match(a))?unescape(t[2]):null},g=(s,g={},m="post",h=!1,x="application/x-www-form-urlencoded")=>{h&&e({title:"加载中",mask:!0});let u="";u=window.location.href.indexOf("//casedata.igandan.com")>-1?t("AUTH_TOKEN_CASEDATA"):t("DEV_AUTH_TOKEN_CASEDATA");let f={"content-type":x,Authorization:"Bearer "+u};return new Promise((function(e,t){let x=Date.now();a({data:g,url:-1!=s.indexOf("http")?s:encodeURI(d+s+"?timestamp="+x),method:m,sslVerify:!1,header:-1==s.indexOf("/manager/getSignature4bing")?f:{},timeout:1e4,success:async a=>{var d=a.header.Authorization;if(d&&o("AUTH_TOKEN_CASEDATA",d),h&&c(),200==a.data.code)e(a);else if(201==a.data.code)n({title:"提示",content:"该作品已被删除",showCancel:!1,success:function(e){e.confirm&&i()}}),t(a);else if(10007==a.data.code)t(a);else if(10005==a.data.code)l({title:a.data.message,icon:"none"}),t(a);else if(401==a.data.code||403==a.data.code||405==a.data.code||406==a.data.code){let e=p("video_token");if(console.log(e),e){let t=(await r.h5Login({token:e})).data.data;console.log(t),window.location.href.indexOf("//casedata.igandan.com")>-1?o("AUTH_TOKEN_CASEDATA",t.token):o("DEV_AUTH_TOKEN_CASEDATA",t.token),o("userInfo",{avatar:t.avatar,user_id:t.user_id,status:t.status,user_name:t.user_name,doctor_id:t.doctor_id}),window.location.reload()}else{let e="https://dev-wx.igandan.com";-1==window.location.href.indexOf("//dev-casedata.igandan.com")&&(e="https://wx.igandan.com"),window.location.href=e+"/hcp/Signup2020online_tologin?back_url="+encodeURIComponent(window.location.href)}}else if(500==a.data.code)l({title:a.data.message,icon:"none"}),t(a);else if(-1!=s.indexOf("/login/hcp")){let e="https://dev-wx.igandan.com";-1==window.location.href.indexOf("//dev-casedata.igandan.com")&&(e="https://wx.igandan.com"),window.location.href=e+"/hcp/Signup2020online_tologin?back_url="+encodeURIComponent(window.location.href)}else l({title:a.data.message,icon:"none"}),t(a)},fail:function(e){"request:fail "===e.errMsg&&msg("请求数据失败!"),t(e.data)}})}))},r={wxLogin:e=>g("/login/wechat/mobile",e,"post",!0),mobileLogin:e=>g("/login/mobile",e,"post",!0),getCode:e=>g("/code/phone",e,"post",!0),getHomeData:e=>g("/index/clinical",e,"get",!0),getHomeStatics:e=>g("/clinical/stats",e,"get",!0),getArticleDetail:e=>g("/clinical/article/"+e,{},"get",!1),getVideoDetail:e=>g("/clinical/video/"+e,{},"get",!1),collectArticle:e=>g("/clinical/article/collect/"+e,{},"post",!1),cancelCollectArticle:e=>g("/clinical/article/collect/"+e,{},"delete",!1),collectVideo:e=>g("/clinical/video/collect/"+e,{},"post",!1),cancelCollectVideo:e=>g("/clinical/video/collect/"+e,{},"delete",!1),collectExchange:e=>g("/exchange/collect/"+e,{},"post",!1),cancelCollectExchange:e=>g("/exchange/collect/"+e,{},"delete",!1),addVideoComment:(e,t)=>g("/clinical/video/comment/"+e,t,"post",!0,"application/json"),delVideoComment:e=>g("/clinical/video/comment/"+e,{},"delete",!1),topVideoComment:e=>g("/clinical/video/comment/top/"+e,{},"put",!1),cancelTopVideoComment:e=>g("/clinical/video/comment/top/"+e,{},"delete",!1),addArticleComment:(e,t)=>g("/clinical/article/comment/"+e,t,"post",!0,"application/json"),delArticleComment:e=>g("/clinical/article/comment/"+e,{},"delete",!1),topArticleComment:e=>g("/clinical/article/comment/top/"+e,{},"put",!1),cancelTopArticleComment:e=>g("/clinical/article/comment/top/"+e,{},"delete",!1),getArticleComment:e=>g("/clinical/article/comment/page",e,"post",!1,"application/json"),getVideoComment:e=>g("/clinical/video/comment/page",e,"post",!1,"application/json"),searchArticle:e=>g("/clinical/article/search",e,"post",!0,"application/json"),searchVideo:e=>g("/clinical/video/search",e,"post",!0,"application/json"),searchDoctor:e=>g("/clinical/doctor/search",e,"post",!0,"application/json"),searchHospital:e=>g("/clinical/hospital/search",e,"post",!0,"application/json"),getStaticDoctor:e=>g("/clinical/stats/doctor/"+e,{},"get",!0),getStaticSick:e=>g("/clinical/stats/label",e,"get",!1),getStaticHospital:e=>g("/clinical/stats/hospital/"+e,{},"get",!1),getUserInfo:()=>g("/user",{},"get",!1),getExchangeStatic:()=>g("/exchange/stats",{},"get",!1),getExchangeStaticUser:e=>g("/exchange/stats/user/"+e,{},"get",!1),searchExchage:e=>g("/exchange/search",e,"post",!0,"application/json"),searchExchageGood:e=>g("/exchange/list",e,"post",!0,"application/json"),getExchangeDetail:e=>g("/exchange/"+e,{},"get",!1),getExchangeVote:e=>g("/exchange/vote/"+e,{},"get",!1),exchangeCollect:e=>g("/exchange/collect/"+e,{},"post",!1),cancelExchangeCollect:e=>g("/exchange/collect/"+e,{},"delete",!1),addExchangeComment:(e,t)=>g("/exchange/comment/"+e,t,"post",!0,"application/json"),delExchangeComment:e=>g("/exchange/comment/"+e,{},"delete",!1),topExchangeComment:e=>g("/exchange/comment/top/"+e,{},"put",!1),cancleTopExchangeComment:e=>g("/exchange/comment/top/"+e,{},"delete",!1),getExchangeComment:e=>g("/exchange/comment/page",e,"post",!1,"application/json"),getExchangeCommentUser:e=>g("/exchange/user/comment/page",e,"post",!1,"application/json"),addExchange:e=>g("/exchange",e,"post",!1,"application/json"),getDraftList:e=>g("/exchange/draft/search",e,"post",!1,"application/json"),saveDraft:e=>g("/exchange/draft",e,"post",!0,"application/json"),delDraft:e=>g("/exchange/draft/"+e,{},"delete",!1),getVideoCommentUser:e=>g("/clinical/video/user/comment/page",e,"post",!1,"application/json"),getArticleCommentUser:e=>g("/clinical/article/user/comment/page",e,"post",!1,"application/json"),getMyCollect:e=>g("/user/collect/search",e,"post",!1,"application/json"),getMyRead:e=>g("/user/case/read/search",e,"post",!0,"application/json"),getOss:e=>g("/sign/oss",e,"get",!1),getCaseLabel:e=>g("/case/label",e,"get",!1),getSearchLabel:e=>g("/clinical/label/search",e,"post",!0,"application/json"),addVote:(e,t)=>g("/exchange/vote/"+e,t,"post",!0,"application/json"),ossUpload:(e,t)=>g(e,t,"post","multipart/form-data"),getUserPoint:e=>g("/user/point",e,"get"),givePoint:e=>g("/reward",e,"post",!0),h5Login:e=>g("/login/hcp",e,"post",!0),readRecord:e=>g("/user/case/read",e,"post",!1,"application/json"),updateExchange:(e,t)=>g("/exchange/"+e,t,"put",!0,"application/json"),delExchange:e=>g("/exchange/"+e,{},"delete",!0)};export{r as a};
|