加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
App.vue 9.75 KB
一键复制 编辑 原始数据 按行查看 历史
ramble 提交于 2020-09-23 13:51 . 9.23
<script>
var request = null,
api = null,
utils = null;
var iswe7 = 0;
wx.setStorage({
key: 'iswe7',
data: iswe7
});
"undefined" != typeof wx && (request = require("./utils/request.js"), api = require("./api.js"), utils = require(
"./utils/utils.js"));
"undefined" != typeof my && (_app.setRequire(), _app.setApi());
export default {
globalData: {},
onLaunch: function(e) {
console.log('11',this)
if (iswe7 == 1) {
//#ifdef MP-WEIXIN
this.$scope.globalData = {
//#endif
//#ifdef H5 || APP-PLUS
this.globalData = {
//#endif
is_on_launch: !0,
onShowData: null,
_version: "1.1.1",
query: null,
saveFormId: function(e) {
this.request({
url: api.user.save_form_id,
data: {
form_id: e
}
});
},
loginBindParent: function(e) {
if ("" == this.hj.getStorageSync("access_token")) return !0;
this.bindParent(e);
},
bindParent: function(e) {
var t = this;
if ("undefined" != e.parent_id && 0 != e.parent_id) {
var i = t.hj.getStorageSync("user_info");
if (0 < t.hj.getStorageSync("share_setting").level) 0 != e.parent_id && t.request({
url: api.share.bind_parent,
data: {
parent_id: e.parent_id
},
success: function(e) {
0 == e.code && (i.parent = e.data, t.hj.setStorageSync("user_info", i));
}
});
}
},
shareSendCoupon: function(i) {
var a = this;
a.hj.showLoading({
mask: !0
}), i.hideGetCoupon || (i.hideGetCoupon = function(e) {
var t = e.currentTarget.dataset.url || !1;
i.setData({
get_coupon_list: null
}), t && a.hj.navigateTo({
url: t
});
}), this.request({
url: api.coupon.share_send,
success: function(e) {
0 == e.code && i.setData({
get_coupon_list: e.data.list
});
},
complete: function() {
a.hj.hideLoading();
}
});
},
getauth: function(t) {
var i = this;
i.hj.showModal({
title: "是否打开设置页面重新授权",
content: t.content,
confirmText: "去设置",
success: function(e) {
e.confirm ? i.hj.openSetting({
success: function(e) {
t.success && t.success(e);
},
fail: function(e) {
t.fail && t.fail(e);
},
complete: function(e) {
t.complete && t.complete(e);
}
}) : t.cancel && i.getauth(t);
}
});
},
setApi: function() {
var a = this.siteInfo.siteroot;
a = a.replace("app/index.php", ""), // console.log(a)
a += "addons/remao_shop/api//index.php?r=", // a += "addons/remao_shop/api/index.php?r=",
// console.log(a)
this.api = function e(t) {
for (var i in t) "string" == typeof t[i] ? t[i] = t[i].replace("{$_api_root}", a) : t[i] = e(t[i]);
return t;
}(this.api);
var e = this.api.default.index;
},
webRoot: null,
siteInfo: require("./siteinfo.js"),
currentPage: null,
pageOnLoad: function(e, t) {
this.page.onLoad(e, t);
},
pageOnReady: function(e) {
this.page.onReady(e);
},
pageOnShow: function(e) {
this.page.onShow(e);
},
pageOnHide: function(e) {
this.page.onHide(e);
},
pageOnUnload: function(e) {
this.page.onUnload(e);
},
setNavigationBarColor: function() {
var e = this.hj.getStorageSync("_navigation_bar_color");
e && this.hj.setNavigationBarColor(e);
},
loginNoRefreshPage: ["pages/index/index", "mch/shop/shop"],
navigatorClick: function(e, t) {
var i = e.currentTarget.dataset.open_type;
if ("redirect" == i) return !0;
if ("wxapp" == i) {
var a = e.currentTarget.dataset.path;
"/" != a.substr(0, 1) && (a = "/" + a), this.hj.navigateToMiniProgram({
appId: e.currentTarget.dataset.appid,
path: a,
complete: function(e) {}
});
}
if ("tel" == i) {
var n = e.currentTarget.dataset.tel;
this.hj.makePhoneCall({
phoneNumber: n
});
}
return !1;
},
util: require("./we7/resource/js/util.js"),
request: request,
api: api,
utils: utils,
setRequire: function() {
this.request = require("./utils/request.js"), this.api = require("./api.js"), this.utils = require(
"./utils/utils.js");
},
getPlatform: function() {
return "undefined" != typeof my ? "my" : "undefined" != typeof wx ? "wx" : null;
}
}
} else {
//#ifdef MP-WEIXIN
this.$scope.globalData = {
//#endif
//#ifdef H5 || APP-PLUS
this.globalData = {
//#endif
is_on_launch: !0,
onShowData: null,
_version: "1.1.1",
query: null,
saveFormId: function(e) {
this.request({
url: api.user.save_form_id,
data: {
form_id: e
}
});
},
loginBindParent: function(e) {
if ("" == this.hj.getStorageSync("access_token")) return !0;
this.bindParent(e);
},
bindParent: function(e) {
var t = this;
if ("undefined" != e.parent_id && 0 != e.parent_id) {
var i = t.hj.getStorageSync("user_info");
if (0 < t.hj.getStorageSync("share_setting").level) 0 != e.parent_id && t.request({
url: api.share.bind_parent,
data: {
parent_id: e.parent_id
},
success: function(e) {
0 == e.code && (i.parent = e.data, t.hj.setStorageSync("user_info", i));
}
});
}
},
shareSendCoupon: function(i) {
var a = this;
a.hj.showLoading({
mask: !0
}), i.hideGetCoupon || (i.hideGetCoupon = function(e) {
var t = e.currentTarget.dataset.url || !1;
i.setData({
get_coupon_list: null
}), t && a.hj.navigateTo({
url: t
});
}), this.request({
url: api.coupon.share_send,
success: function(e) {
0 == e.code && i.setData({
get_coupon_list: e.data.list
});
},
complete: function() {
a.hj.hideLoading();
}
});
},
getauth: function(t) {
var i = this;
i.hj.showModal({
title: "是否打开设置页面重新授权",
content: t.content,
confirmText: "去设置",
success: function(e) {
e.confirm ? i.hj.openSetting({
success: function(e) {
t.success && t.success(e);
},
fail: function(e) {
t.fail && t.fail(e);
},
complete: function(e) {
t.complete && t.complete(e);
}
}) : t.cancel && i.getauth(t);
}
});
},
setApi: function() {
var a = this.siteInfo.siteroot;
a = a.replace("app/index.php", ""), // console.log(a)
a += "", // a += "addons/remao_shop/api/index.php?r=",
// console.log(a)
this.api = function e(t) {
for (var i in t) "string" == typeof t[i] ? t[i] = t[i].replace("{$_api_root}", a) : t[i] = e(t[i]);
return t;
}(this.api);
var e = this.api.default.index; // console.log(e)
// var t = e.substr(0, e.indexOf("/index.php"));
// this.webRoot = t;
},
webRoot: null,
siteInfo: require("./siteinfos.js"),
currentPage: null,
pageOnLoad: function(e, t) {
this.page.onLoad(e, t);
},
pageOnReady: function(e) {
this.page.onReady(e);
},
pageOnShow: function(e) {
this.page.onShow(e);
},
pageOnHide: function(e) {
this.page.onHide(e);
},
pageOnUnload: function(e) {
this.page.onUnload(e);
},
setNavigationBarColor: function() {
var e = this.hj.getStorageSync("_navigation_bar_color");
e && this.hj.setNavigationBarColor(e);
},
loginNoRefreshPage: ["pages/index/index", "mch/shop/shop"],
navigatorClick: function(e, t) {
var i = e.currentTarget.dataset.open_type;
if ("redirect" == i) return !0;
if ("wxapp" == i) {
var a = e.currentTarget.dataset.path;
"/" != a.substr(0, 1) && (a = "/" + a), this.hj.navigateToMiniProgram({
appId: e.currentTarget.dataset.appid,
path: a,
complete: function(e) {}
});
}
if ("tel" == i) {
var n = e.currentTarget.dataset.tel;
this.hj.makePhoneCall({
phoneNumber: n
});
}
return !1;
},
// util: require("we7/resource/js/util.js"),
request: request,
api: api,
utils: utils,
setRequire: function() {
this.request = require("./utils/request.js"), this.api = require("./api.js"), this.utils = require(
"./utils/utils.js");
},
getPlatform: function() {
return "undefined" != typeof my ? "my" : "undefined" != typeof wx ? "wx" : null;
}
}
}
//#ifdef MP-WEIXIN
this.$scope.globalData.setApi(), api = this.$scope.globalData.api;
//#endif
//#ifdef H5 || APP-PLUS
this.globalData.setApi(), api = this.globalData.api;
//#endif
},
onShow: function(e) {
//#ifdef MP-WEIXIN
e.scene && (this.$scope.globalData.onShowData = e), e && e.query && (this.$scope.globalData.query = e.query);
//#endif
//#ifdef H5 || APP-PLUS
e.scene && (this.globalData.onShowData = e), e && e.query && (this.globalData.query = e.query);
//#endif
},
methods: {}
};
</script>
<style>
@import "./app.css";
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化