!(function () { require("/towxml/main"); var e = require("we7/resource/js/util.js"); App({ siteInfo: require("siteinfo.js"), data: { appscene: 123 }, globalData: { wzchack: "", texchack: "", picchack: "", code: "", words: "", files: "", showPrivacy: !1, myDevice: wx.getSystemInfoSync(), }, util: require("we7/resource/js/util.js"), onLaunch: function (e) { (this.data.appscene = e.scene), this.gengxin(); }, wxlogin: function () { var e = this; return new Promise((t, n) => { e.util.getUserInfo(function (n) { n.memberInfo && wx.setStorageSync("uid", n.memberInfo.uid), console.log("自动登录", wx.getStorageSync("uid")), (e.globalData.showPrivacy = !1), t(e.globalData.showPrivacy); }); }); }, appdengl: function (e) { wx.getStorageSync("uid") || wx.showModal({ title: "温馨提示", content: "请先登录授权使用", success: function (e) { e.confirm ? wx.navigateTo({ url: "/pages/login/login" }) : console.log("点击取消回调"); }, }); }, xcxlogo: function (e) { console.log("uid", wx.getStorageSync("uid")), wx.getStorageSync("uid") || wx.showModal({ title: "温馨提示", content: "请去个人中心授权登录用户信息", success: function (e) { e.confirm ? wx.reLaunch({ url: "/pages/mine/index" }) : console.log("点击取消回调"); }, }); }, gengxin: function () { if (wx.canIUse("getUpdateManager")) { const e = wx.getUpdateManager(); e.onCheckForUpdate(function (t) { t.hasUpdate && (e.onUpdateReady(function () { wx.showModal({ title: "更新提示", content: "新版本已经准备好,是否重启应用?", success: function (t) { t.confirm && e.applyUpdate(); }, }); }), e.onUpdateFailed(function () { wx.showModal({ title: "已经有新版本了哟~", content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~", }); })); }); } else wx.showModal({ title: "提示", content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。", }); }, getuid: function (t) { var n = wx.getStorageSync("uid"); if (n) return n; e.getUserInfo(function (e) { if (e.memberInfo) { var t = e.memberInfo.uid; return wx.setStorageSync("uid", t), t; } return ""; }); }, showToast: function (e) { wx.showToast({ title: e, icon: "none", duration: 2e3 }); }, getAttr: function (e, t) { return e.currentTarget.dataset[t]; }, back: !1, toDate: function (e) { var t = new Date(1e3 * e); return ( t.getFullYear() + "." + (t.getMonth() + 1 < 10 ? "0" + (t.getMonth() + 1) : t.getMonth() + 1) + "." + (t.getDate() < 10 ? "0" + t.getDate() : t.getDate()) ); }, upimgs: function (e) { var t = this, n = e || {}; if ((wx.showLoading({ title: "正在上传..." }), n == {} || !n)) { if (!e.fail || "function" != typeof e.fail) return !1; e.fail({ errno: 500, message: "缺少必要参数" }); } var i = n.scannums ? n.scannums : 1, a = n.filename ? n.filename : "images", o = t.util.url("entry/wxapp/Api", { m: "monai_market", uid: t.getuid(), r: "upimg", }); wx.chooseImage({ count: i, sizeType: ["compressed"], sourceType: ["album", "camera"], success: function (n) { wx.showLoading({ title: "正在上传..." }); var i = n.tempFilePaths, s = (n.tempFiles, new Array(i.length)), c = 0; for (var u in i) !(function (n) { wx.uploadFile({ url: o, filePath: i[n], name: "file", formData: { names: a }, success: function (a) { var o = JSON.parse(a.data); return 0 != o.errno ? (t.util.message({ title: o.message, type: "error" }), void wx.hideLoading()) : (c++, (s[n] = o.data), c == i.length && e.success && "function" == typeof e.success ? (e.success(s), void wx.hideLoading()) : void 0); }, fail: function (t) { wx.hideLoading(); var n = JSON.parse(t.data); e.fail && "function" == typeof e.fail && e.fail(n); }, }); })(u); setTimeout(function () { wx.hideLoading(); }, 5e3); }, fail: function () { wx.hideLoading(), e.fail && "function" == typeof e.fail && e.fail(); }, }); }, upimg: function (e) { var t = this, n = t.util.url("entry/wxapp/Api", { m: "monai_market", uid: t.getuid(), r: "upimg", }), i = e.filename ? e.filename : "images"; wx.uploadFile({ url: n, filePath: e.img, name: "file", formData: { names: i }, success: function (n) { console.log(n); var i = JSON.parse(n.data); return 0 != i.errno ? (t.util.message({ title: i.message, type: "error" }), void wx.hideLoading()) : i.data && e.success && "function" == typeof e.success ? (e.success(i.data), void wx.hideLoading()) : void 0; }, fail: function (t) { console.log(t), wx.hideLoading(); var n = JSON.parse(t.data); e.fail && "function" == typeof e.fail && e.fail(n); }, }); }, gengxin: function () { if (wx.canIUse("getUpdateManager")) { const e = wx.getUpdateManager(); e.onCheckForUpdate(function (t) { t.hasUpdate && (e.onUpdateReady(function () { wx.showModal({ title: "更新提示", content: "新版本已经准备好,是否重启应用?", success: function (t) { t.confirm && e.applyUpdate(); }, }); }), e.onUpdateFailed(function () { wx.showModal({ title: "已经有新版本了哟~", content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~", }); })); }); } else wx.showModal({ title: "提示", content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。", }); }, picchack: function (e) { var t = this, n = util.url("entry/wxapp/imgup") + "&m=" + this.siteInfo.m; return ( wx.showLoading({ title: "图片检测..." }), new Promise((i, a) => { wx.uploadFile({ url: n, filePath: e, name: "file", success: function (e) { wx.hideLoading(), e && ((t.globalData.picchack = e.data), i(t.globalData.picchack)); }, }); }) ); }, getdata: function (e, t) { var n = this; return new Promise((i, a) => { n.util.request({ url: "entry/wxapp/" + t, data: e, dataType: "json", success: function (e) { e && ((n.globalData.wzchack = e.data), i(n.globalData.wzchack)); }, }); }); }, delimg: function (e) { var t = e.uid ? e.uid : ""; if ("" == t) return ( e.fail && "function" == typeof e.fail && e.fail({ errno: 500, message: "请允许获取用户信息" }), !1 ); var n = e.url ? e.url : ""; if ("" == n) return ( e.fail && "function" == typeof e.fail && e.fail({ errno: 500, message: "图片路径错误" }), !1 ); this.util.request({ url: "entry/wxapp/Api", data: { m: "monai_market", uid: t, imgurl: n, r: "upimg.delImg" }, cachetime: "0", success: function (t) { e.success && "function" == typeof e.success && e.success(); }, fail: function () { e.fail && "function" == typeof e.fail && e.fail(); }, }); }, delseverimg: function (e) { this.util.request({ url: "entry/wxapp/Api", data: { m: "monai_sharing", imgurl: e, r: "Upimg.delserverImg" }, }); }, getSystemPlatform: function () { var e = ""; return ( wx.getSystemInfo({ success: function (t) { e = t.platform; }, fail: function () {}, }), e ); }, }); })();