marketingSaaS-front_ui/dist/build/h5/assets/pages-index-index.D9B3sEbu.js

2 lines
3.5 KiB
JavaScript
Raw Normal View History

2024-06-19 13:50:08 +08:00
var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,l=(t,a,o)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,r=(e,t)=>{for(var a in t||(t={}))s.call(t,a)&&l(e,a,t[a]);if(o)for(var a of o(t))n.call(t,a)&&l(e,a,t[a]);return e},c=(e,o)=>t(e,a(o));import{r as i,s as u,d,g as p,a as m,b as _,u as v,n as y,o as f,c as g,e as b,f as w,h as j,w as O,i as h,j as I,k as P,l as x,m as T,p as $,_ as q}from"./index--GEwpD-F.js";const D=e=>new Promise(((t,a)=>{i(c(r({},e),{dataType:"json",header:{"content-type":"application/json"},responseType:"json",success(e){var o,s,n;(null==(o=e.data)?void 0:o.code)>=200&&(null==(s=e.data)?void 0:s.code)<300?t(e.data):401===(null==(n=e.data)?void 0:n.code)?(window.parent.postMessage({data:{type:"logout"}},"*"),a(e)):t(e.data)},fail(e){u({icon:"none",title:"网络错误,换个网络试试"}),a(e)}}))}));D.get=(e,t)=>D({url:e,query:t,method:"GET"}),D.post=(e,t,a,o=!1)=>D({url:e,query:a,data:t,method:"POST",hideErrorToast:o});const L=q(d(c(r({},{name:"Home"}),{__name:"index",setup(e){const{safeAreaInsets:t}=p(),a=m({}),o=_(""),s=v(),n=m({url:"",title:""});window.parent.addEventListener("message",(function(e){let t={};const l=(new Date).getTime();if("login"===e.data.data.type)t={url:a.content_templates.source+`?activity_code=${o.value}`,title:a.content_templates.moduledesc};else if("coupon"===e.data.data.type)t={url:a.user_content_templates.source+`?activity_code=${o.value}`,title:a.user_content_templates.moduledesc};else if("product"===e.data.data.type){const s=`product_id=${e.data.data.product_id}&id=${e.data.data.id}&activity_code=${o.value}`,n=encodeURIComponent(s);t={url:a.user_content_templates.source+`#/pages/coupon/product?url=${n}`,title:a.user_content_templates.moduledesc}}else"couponBack"===e.data.data.type?t={url:a.content_templates.source+`?activity_code=${o.value}`,title:a.content_templates.moduledesc}:"logout"===e.data.data.type&&(t={url:a.login_content_templates.source,title:a.login_content_templates.moduledesc});n.url=n.url+(n.url.includes("?")?"&timestamp=":"?timestamp=")+l,y((()=>{Object.assign(n,t),g({title:n.title}),s.setUserInfo({srcList:n,contentData:a,query:o.value})}))}));const l=()=>{return e=this,t=null,l=function*(){const e={activity_code:o.value||""},t=yield(e=>D.get("/v1/content",e))(e);Object.assign(a,t.data),200===(null==t?void 0:t.code)&&1===t.data.login_content_template.validate_login?(Object.assign(n,{url:t.data.login_content_templates.source,title:t.data.login_content_templates.moduledesc}),g({title:n.title})):u({title:t.message,icon:"none"}),s.setUserInfo({srcList:n,contentData:a,query:o.value})},new Promise(((a,o)=>{var s=e=>{try{r(l.next(e))}catch(t){o(t)}},n=e=>{try{r(l.throw(e))}catch(t){o(t)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(s,n);r((l=l.apply(e,t)).next())}));var e,t,l};return f((()=>{o.value=(()=>{const e=window.location.href.split("#/")[1];return-1===e.indexOf("/")?e||"":e.split("/")[0]})(),s.userInfo.srcList.url&&s.userInfo.query===o.value?(Object.assign(n,s.userInfo.srcList),Object.assign(a,s.userInfo.contentData),g({title:n.title})):l()})),(e,a)=>{const o=T,s=$,l=b("layout-default-uni");return w(),j(l,null,{default:O((()=>{var e;return[h(s,{class:"bg-white overflow-hidden pt-2 px-4",style:x({marginTop:(null==(e=I(t))?void 0:e.top)+"px"})},{default:O((()=>[I(n).url?(w(),j(o,{key:0,src:I(n).url},null,8,["src"])):P("",!0)])),_:1},8,["style"])]})),_:1})}}})),[["__scopeId","data-v-cebe08b2"]]);export{L as default};