gengx
This commit is contained in:
+1
-164
@@ -1,165 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const common_vendor = require("./common/vendor.js");
|
||||
if (!Math) {
|
||||
"./tongji/pages/weekly.js";
|
||||
"./pages/user/user.js";
|
||||
"./pages/user/userinfo.js";
|
||||
"./pages/Card/Card.js";
|
||||
"./pages/Card/edit_card.js";
|
||||
"./pages/Card/contact.js";
|
||||
"./tongji/pages/index.js";
|
||||
"./tongji/pages/more.js";
|
||||
"./tongji/endless-game/index.js";
|
||||
"./training/pages/grip-ring.js";
|
||||
"./training/pages/pilates-ring.js";
|
||||
"./training/pages/foot-pedal.js";
|
||||
"./training/pages/dumbbell.js";
|
||||
"./training/pages/metronome.js";
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "App",
|
||||
setup(__props) {
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
common_vendor.onLaunch(() => {
|
||||
try {
|
||||
common_vendor.index.setInnerAudioOption({
|
||||
obeyMuteSwitch: false,
|
||||
mixWithOther: true
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("warn", "at App.vue:16", "setInnerAudioOption failed:", e);
|
||||
}
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
success: function(loginRes) {
|
||||
if (common_vendor.index.getStorageSync("token")) {
|
||||
userinfo(loginRes.code);
|
||||
} else {
|
||||
wxcode(loginRes.code);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
const wxcode = async (code) => {
|
||||
try {
|
||||
const res = await proxy.apiUrl(
|
||||
{
|
||||
url: "/api/login/mnpLogin",
|
||||
method: "POST",
|
||||
data: {
|
||||
code
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
if (res && res.data && res.data.token) {
|
||||
common_vendor.index.setStorageSync("token", res.data.token);
|
||||
common_vendor.index.setStorageSync("userData", res.data);
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
};
|
||||
const userinfo = async (code) => {
|
||||
try {
|
||||
const res = await proxy.apiUrl(
|
||||
{
|
||||
url: "/api/user/info",
|
||||
method: "POST"
|
||||
},
|
||||
false
|
||||
);
|
||||
if (res.code == -1) {
|
||||
wxcode(code);
|
||||
return;
|
||||
}
|
||||
if (res && res.data) {
|
||||
common_vendor.index.setStorageSync("userData", res.data);
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
};
|
||||
return () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
var baseUrl = "https://admin.zhenyangtang.com.cn/";
|
||||
function joinApiUrl(base, path) {
|
||||
const b = String(base || "").replace(/\/+$/, "");
|
||||
const p = String(path || "").replace(/^\/+/, "");
|
||||
return p ? `${b}/${p}` : b;
|
||||
}
|
||||
function apiUrl(promise, Loading = true) {
|
||||
const token = common_vendor.index.getStorageSync("token");
|
||||
const header = {
|
||||
token,
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
...promise.header || {}
|
||||
};
|
||||
const data = promise.data || {};
|
||||
const url = joinApiUrl(baseUrl, promise.url || "");
|
||||
return new Promise((resolve, reject) => {
|
||||
if (Loading) {
|
||||
common_vendor.index.showLoading({ title: "加载中...", mask: true });
|
||||
}
|
||||
common_vendor.index.request({
|
||||
url,
|
||||
data,
|
||||
timeout: promise.timeout != null ? promise.timeout : 15e3,
|
||||
method: promise.method || "POST",
|
||||
header,
|
||||
sslVerify: false,
|
||||
success: (res) => {
|
||||
const data2 = res.data;
|
||||
if (data2.code === -1) {
|
||||
common_vendor.index.removeStorageSync("token");
|
||||
}
|
||||
resolve(data2);
|
||||
},
|
||||
fail: (e) => {
|
||||
reject(e);
|
||||
},
|
||||
complete: (e) => {
|
||||
if (Loading) {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function parsePageParams(options) {
|
||||
const params = {};
|
||||
if (!options)
|
||||
return params;
|
||||
if (options.scene) {
|
||||
try {
|
||||
const decodedScene = decodeURIComponent(options.scene);
|
||||
decodedScene.split("&").forEach((item) => {
|
||||
const [key, value] = item.split("=");
|
||||
if (key && value) {
|
||||
params[key] = value;
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at main.js:126", "解析scene参数失败:", error);
|
||||
}
|
||||
}
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (key !== "scene" && options[key]) {
|
||||
params[key] = options[key];
|
||||
}
|
||||
});
|
||||
return params;
|
||||
}
|
||||
function createApp() {
|
||||
const app = common_vendor.createSSRApp(_sfc_main);
|
||||
app.config.globalProperties.$url = baseUrl;
|
||||
app.config.globalProperties.apiUrl = apiUrl;
|
||||
app.config.globalProperties.$parsePageParams = parsePageParams;
|
||||
return {
|
||||
app
|
||||
};
|
||||
}
|
||||
createApp().app.mount("#app");
|
||||
exports.createApp = createApp;
|
||||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./common/vendor.js"),l={__name:"App",setup(e){const{proxy:o}=n.getCurrentInstance();n.onLaunch(()=>{try{n.index.setInnerAudioOption({obeyMuteSwitch:!1,mixWithOther:!0})}catch(r){n.index.__f__("warn","at App.vue:16","setInnerAudioOption failed:",r)}n.index.login({provider:"weixin",success:function(r){n.index.getStorageSync("token")?i(r.code):a(r.code)}})});const a=async r=>{try{const t=await o.apiUrl({url:"/api/login/mnpLogin",method:"POST",data:{code:r}},!1);t&&t.data&&t.data.token&&(n.index.setStorageSync("token",t.data.token),n.index.setStorageSync("userData",t.data))}catch{}},i=async r=>{try{const t=await o.apiUrl({url:"/api/user/info",method:"POST"},!1);if(t.code==-1){a(r);return}t&&t.data&&n.index.setStorageSync("userData",t.data)}catch{}};return()=>{}}};var d="https://admin.zhenyangtang.com.cn/";function f(e,o){const a=String(e||"").replace(/\/+$/,""),i=String(o||"").replace(/^\/+/,"");return i?`${a}/${i}`:a}function m(e,o=!0){const i={token:n.index.getStorageSync("token"),"content-type":"application/x-www-form-urlencoded",...e.header||{}},r=e.data||{},t=f(d,e.url||"");return new Promise((g,u)=>{o&&n.index.showLoading({title:"加载中...",mask:!0}),n.index.request({url:t,data:r,timeout:e.timeout!=null?e.timeout:15e3,method:e.method||"POST",header:i,sslVerify:!1,success:s=>{const c=s.data;c.code===-1&&n.index.removeStorageSync("token"),g(c)},fail:s=>{u(s)},complete:s=>{o&&n.index.hideLoading()}})})}function S(e){const o={};if(!e)return o;if(e.scene)try{decodeURIComponent(e.scene).split("&").forEach(i=>{const[r,t]=i.split("=");r&&t&&(o[r]=t)})}catch(a){n.index.__f__("error","at main.js:126","解析scene参数失败:",a)}return Object.keys(e).forEach(a=>{a!=="scene"&&e[a]&&(o[a]=e[a])}),o}function p(){const e=n.createSSRApp(l);return e.config.globalProperties.$url=d,e.config.globalProperties.apiUrl=m,e.config.globalProperties.$parsePageParams=S,{app:e}}p().app.mount("#app");exports.createApp=p;
|
||||
//# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map
|
||||
|
||||
Reference in New Issue
Block a user