2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
|
"use strict";var e=(e,t,o)=>new Promise(((s,r)=>{var a=e=>{try{u(o.next(e))}catch(t){r(t)}},n=e=>{try{u(o.throw(e))}catch(t){r(t)}},u=e=>e.done?s(e.value):Promise.resolve(e.value).then(a,n);u((o=o.apply(e,t)).next())}));const t=require("../../common/vendor.js"),o=require("../../utils/commUtils.js"),s=require("../../utils/http.js");require("../../store/index.js");const r=require("../../store/user.js");if(!Array){t.resolveComponent("layout-default-uni")()}const a={__name:"index",setup(a){const n=t.ref(""),u=t.ref({}),l=r.useUserStore(),i=()=>e(this,null,(function*(){if(l.userInfo.shopLoginUser)return u.value=l.userInfo.shopLoginUser,void(n.value=`http://localhost:3000/?token=${u.value.accessToken}&refresh-token=${u.value.refreshToken}`);try{const e=yield s.httpPost("/shopLogin");e&&200===e.code?(n.value=`http://localhost:3000/?token=${u.value.accessToken}&refresh-token=${u.value.refreshToken}`,u.value=e.data,l.setUserInfo({shopLoginUser:u.value}),onWebViewLoad()):o.toast(e.message||"获取商城用户信息失败, 无法跳转到商城, 请联系管理员!")}catch(e){o.toast(e.data.message||"发生错误,请稍后重试!")}}));return t.onLoad((()=>e(this,null,(function*(){yield i()})))),(e,o)=>t.e({a:n.value},n.value?{b:n.value}:{})}},n=t._export_sfc(a,[["__scopeId","data-v-87a16606"]]);wx.createPage(n);
|