token问题
This commit is contained in:
parent
23d1f4c504
commit
daf1e9e363
|
@ -0,0 +1 @@
|
||||||
|
.main-title-color[data-v-23b209fd]{color:#d14328}
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
.main-title-color[data-v-0dc5dc82]{color:#d14328}
|
|
|
@ -1 +1 @@
|
||||||
var t=Object.defineProperty,e=Object.defineProperties,a=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(e,a,n)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,i=(t,e)=>{for(var a in e||(e={}))s.call(e,a)&&l(t,a,e[a]);if(n)for(var a of n(e))o.call(e,a)&&l(t,a,e[a]);return t},c=(t,n)=>e(t,a(n)),r=(t,e,a)=>new Promise(((n,s)=>{var o=t=>{try{i(a.next(t))}catch(e){s(e)}},l=t=>{try{i(a.throw(t))}catch(e){s(e)}},i=t=>t.done?n(t.value):Promise.resolve(t.value).then(o,l);i((a=a.apply(t,e)).next())}));import{r as u,s as d,d as p,g as m,a as y,b as v,u as f,n as _,o as g,c as O,e as b,f as w,h,i as j,w as I,j as x,k as P,l as $,m as T,p as k,q as D,_ as q}from"./index-CA78ydAR.js";const L=t=>new Promise(((e,a)=>{u(c(i({},t),{dataType:"json",header:{"content-type":"application/json"},responseType:"json",success(t){var n,s,o;(null==(n=t.data)?void 0:n.code)>=200&&(null==(s=t.data)?void 0:s.code)<300?e(t.data):401===(null==(o=t.data)?void 0:o.code)?(window.parent.postMessage({data:{type:"logout"}},"*"),a(t)):e(t.data)},fail(t){d({icon:"none",title:"网络错误,换个网络试试"}),a(t)}}))}));L.get=(t,e)=>L({url:t,query:e,method:"GET"}),L.post=(t,e,a,n=!1)=>L({url:t,query:a,data:e,method:"POST",hideErrorToast:n});const E=t=>L.get("/v1/content",t),S=q(p(c(i({},{name:"Home"}),{__name:"index",setup(t){const{safeAreaInsets:e}=m(),a=y({}),n=v(""),s=v(""),o=f();let l="activity",i=null;const c={Interface:"api_code",lottery:"lottery_code",activity:"activity_code"},u=y({url:"",title:""});window.parent.addEventListener("message",(function(t){let e={};const s=(new Date).getTime();if("login"===t.data.data.type)e={url:a.content_templates.source+`?activity_code=${n.value}`,title:a.content_templates.moduledesc};else if("coupon"===t.data.data.type)e={url:a.user_content_templates.source+`?activity_code=${n.value}`,title:a.user_content_templates.moduledesc};else if("product"===t.data.data.type){const s=`product_id=${t.data.data.product_id}&id=${t.data.data.id}&activity_code=${n.value}`,o=encodeURIComponent(s);e={url:a.user_content_templates.source+`#/pages/coupon/product?url=${o}`,title:a.user_content_templates.moduledesc}}else"couponBack"===t.data.data.type?e={url:a.content_templates.source+`?activity_code=${n.value}`,title:a.content_templates.moduledesc}:"logout"===t.data.data.type&&(e={url:a.login_content_templates.source,title:a.login_content_templates.moduledesc});u.url=u.url+(u.url.includes("?")?"×tamp=":"?timestamp=")+s,_((()=>{Object.assign(u,e),O({title:u.title}),o.setUserInfo({srcList:u,contentData:a,query:n.value})}))}));const p=()=>r(this,null,(function*(){const t={};t[c[l]]=s.value||"";const e=yield E(t);q(e)})),q=t=>{if(200===t.code){const{login_content_template:e,login_content_templates:s,content_templates:l}=t.data;n.value=t.data.activity_code,Object.assign(a,t.data),1===e.validate_login?Object.assign(u,{url:L(s.source),title:s.moduledesc}):2===e.validate_login&&Object.assign(u,{url:L(l.source+`?activity_code=${n.value}&token=${e.token}`),title:l.moduledesc}),O({title:u.title}),o.setUserInfo({srcList:u,contentData:a,query:n.value,token:e.token})}else d({title:t.message,icon:"none"})};function L(t){const e=(new Date).getTime();return t+(t.includes("?")?"×tamp=":"?timestamp=")+e}const S=()=>{i=setInterval((()=>r(this,null,(function*(){const t={};t[c[l]]=s.value||"";const e=yield E(t);JSON.stringify(e.data)!==JSON.stringify(o.userInfo.contentData)&&(d({title:"活动发生变更",icon:"none"}),q(e))}))),6e4)};return g((()=>{s.value=(()=>{const t=window.location.href;if(-1!==t.indexOf("#/")){const e=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("/")[t.split("/").length-1];return-1===e.indexOf("/")?e||"":e.split("/")[0]}{const e=t.split("/"),a=e[e.length-1];let n="";return-1===a.indexOf("-")?(n=a,l="activity"):(l=a.split("-")[0],n=a.split("-")[1]),n}})(),S(),o.userInfo.srcList.url&&o.userInfo.query===n.value?(Object.assign(u,o.userInfo.srcList,{url:L(o.userInfo.srcList.url)}),Object.assign(a,o.userInfo.contentData),O({title:u.title})):p()})),b((()=>{clearInterval(i),i=null})),(t,a)=>{const n=k,s=D,o=w("layout-default-uni");return h(),j(o,null,{default:I((()=>{var t;return[x(s,{class:"bg-white overflow-hidden pt-2 px-4",style:T({marginTop:(null==(t=P(e))?void 0:t.top)+"px"})},{default:I((()=>[P(u).url?(h(),j(n,{key:0,src:P(u).url},null,8,["src"])):$("",!0)])),_:1},8,["style"])]})),_:1})}}})),[["__scopeId","data-v-0dc5dc82"]]);export{S as default};
|
var t=Object.defineProperty,e=Object.defineProperties,a=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(e,a,n)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,i=(t,e)=>{for(var a in e||(e={}))s.call(e,a)&&l(t,a,e[a]);if(n)for(var a of n(e))o.call(e,a)&&l(t,a,e[a]);return t},c=(t,n)=>e(t,a(n)),r=(t,e,a)=>new Promise(((n,s)=>{var o=t=>{try{i(a.next(t))}catch(e){s(e)}},l=t=>{try{i(a.throw(t))}catch(e){s(e)}},i=t=>t.done?n(t.value):Promise.resolve(t.value).then(o,l);i((a=a.apply(t,e)).next())}));import{r as u,s as d,d as p,g as m,a as y,b as v,u as f,n as _,o as g,c as O,e as b,f as w,h,i as j,w as I,j as x,k as P,l as $,m as T,p as D,q as k,_ as q}from"./index-BP-m2Gms.js";const L=t=>new Promise(((e,a)=>{u(c(i({},t),{dataType:"json",header:{"content-type":"application/json"},responseType:"json",success(t){var n,s,o;(null==(n=t.data)?void 0:n.code)>=200&&(null==(s=t.data)?void 0:s.code)<300?e(t.data):401===(null==(o=t.data)?void 0:o.code)?(window.parent.postMessage({data:{type:"logout"}},"*"),a(t)):e(t.data)},fail(t){d({icon:"none",title:"网络错误,换个网络试试"}),a(t)}}))}));L.get=(t,e)=>L({url:t,query:e,method:"GET"}),L.post=(t,e,a,n=!1)=>L({url:t,query:a,data:e,method:"POST",hideErrorToast:n});const E=t=>L.get("/v1/content",t),S=q(p(c(i({},{name:"Home"}),{__name:"index",setup(t){const{safeAreaInsets:e}=m(),a=y({}),n=v(""),s=v(""),o=f();let l="activity",i=null;const c={Interface:"api_code",lottery:"lottery_code",activity:"activity_code"},u=y({url:"",title:""});window.parent.addEventListener("message",(function(t){let e={};const s=(new Date).getTime();if("login"===t.data.data.type)e={url:a.content_templates.source+`?activity_code=${n.value}`,title:a.content_templates.moduledesc};else if("coupon"===t.data.data.type)e={url:a.user_content_templates.source+`?activity_code=${n.value}`,title:a.user_content_templates.moduledesc};else if("product"===t.data.data.type){const s=`product_id=${t.data.data.product_id}&id=${t.data.data.id}&activity_code=${n.value}`,o=encodeURIComponent(s);e={url:a.user_content_templates.source+`#/pages/coupon/product?url=${o}`,title:a.user_content_templates.moduledesc}}else"couponBack"===t.data.data.type?e={url:a.content_templates.source+`?activity_code=${n.value}`,title:a.content_templates.moduledesc}:"logout"===t.data.data.type&&(e={url:a.login_content_templates.source,title:a.login_content_templates.moduledesc});u.url=u.url+(u.url.includes("?")?"×tamp=":"?timestamp=")+s,_((()=>{Object.assign(u,e),O({title:u.title}),o.setUserInfo({srcList:u,contentData:a,query:n.value})}))}));const p=()=>r(this,null,(function*(){const t={};t[c[l]]=s.value||"";const e=yield E(t);q(e)})),q=t=>{if(200===t.code){const{login_content_template:e,login_content_templates:s,content_templates:l,token:i}=t.data;n.value=t.data.activity_code,Object.assign(a,t.data),1===e.validate_login?Object.assign(u,{url:L(s.source),title:s.moduledesc}):2===e.validate_login&&Object.assign(u,{url:L(l.source+`?activity_code=${n.value}&token=${i}`),title:l.moduledesc}),O({title:u.title}),o.setUserInfo({srcList:u,contentData:a,query:n.value,token:i})}else d({title:t.message,icon:"none"})};function L(t){const e=(new Date).getTime();return t+(t.includes("?")?"×tamp=":"?timestamp=")+e}const S=()=>{i=setInterval((()=>r(this,null,(function*(){const t={};t[c[l]]=s.value||"";const e=yield E(t);JSON.stringify(e.data)!==JSON.stringify(o.userInfo.contentData)&&(d({title:"活动发生变更",icon:"none"}),q(e))}))),6e4)};return g((()=>{s.value=(()=>{const t=window.location.href;if(-1!==t.indexOf("#/")){const e=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("/")[t.split("/").length-1];return-1===e.indexOf("/")?e||"":e.split("/")[0]}{const e=t.split("/"),a=e[e.length-1];let n="";return-1===a.indexOf("-")?(n=a,l="activity"):(l=a.split("-")[0],n=a.split("-")[1]),n}})(),S(),o.userInfo.srcList.url&&o.userInfo.query===n.value?(Object.assign(u,o.userInfo.srcList,{url:L(o.userInfo.srcList.url)}),Object.assign(a,o.userInfo.contentData),O({title:u.title})):p()})),b((()=>{clearInterval(i),i=null})),(t,a)=>{const n=D,s=k,o=w("layout-default-uni");return h(),j(o,null,{default:I((()=>{var t;return[x(s,{class:"bg-white overflow-hidden pt-2 px-4",style:T({marginTop:(null==(t=P(e))?void 0:t.top)+"px"})},{default:I((()=>[P(u).url?(h(),j(n,{key:0,src:P(u).url},null,8,["src"])):$("",!0)])),_:1},8,["style"])]})),_:1})}}})),[["__scopeId","data-v-23b209fd"]]);export{S as default};
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html build-date="2024-06-21 14:45:48">
|
<html build-date="2024-06-21 14:51:38">
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="./assets/uni.ad4bcb33.css">
|
<link rel="stylesheet" href="./assets/uni.ad4bcb33.css">
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<title>unibest</title>
|
<title>unibest</title>
|
||||||
<!--preload-links-->
|
<!--preload-links-->
|
||||||
<!--app-context-->
|
<!--app-context-->
|
||||||
<script type="module" crossorigin src="./assets/index-CA78ydAR.js"></script>
|
<script type="module" crossorigin src="./assets/index-BP-m2Gms.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-DfE4H0b6.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-DfE4H0b6.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ const initData = (res) => {
|
||||||
login_content_template: loginValid,
|
login_content_template: loginValid,
|
||||||
login_content_templates: login,
|
login_content_templates: login,
|
||||||
content_templates: baseUrl,
|
content_templates: baseUrl,
|
||||||
|
token,
|
||||||
} = res.data
|
} = res.data
|
||||||
query.value = res.data.activity_code
|
query.value = res.data.activity_code
|
||||||
Object.assign(contentData, res.data)
|
Object.assign(contentData, res.data)
|
||||||
|
@ -140,16 +141,14 @@ const initData = (res) => {
|
||||||
} else if (loginValid.validate_login === 2) {
|
} else if (loginValid.validate_login === 2) {
|
||||||
// api_code 方式
|
// api_code 方式
|
||||||
Object.assign(srcList, {
|
Object.assign(srcList, {
|
||||||
url: getTimesTamp(
|
url: getTimesTamp(baseUrl.source + `?activity_code=${query.value}&token=${token}`),
|
||||||
baseUrl.source + `?activity_code=${query.value}&token=${loginValid.token}`,
|
|
||||||
),
|
|
||||||
title: baseUrl.moduledesc,
|
title: baseUrl.moduledesc,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
})
|
})
|
||||||
useStore.setUserInfo({ srcList, contentData, query: query.value, token: loginValid.token })
|
useStore.setUserInfo({ srcList, contentData, query: query.value, token })
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
|
|
Loading…
Reference in New Issue