index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "index",
  5. setup(__props) {
  6. var _a, _b, _c;
  7. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  8. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$app;
  9. (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$config;
  10. const config = common_vendor.ref({ logoUrl: [] });
  11. common_vendor.onLoad(async () => {
  12. await searchConfig();
  13. await search();
  14. });
  15. const searchConfig = async () => {
  16. config.value = common_vendor.index.getStorageSync("config");
  17. };
  18. const search = async () => {
  19. common_vendor.index.getStorage({
  20. key: "openid",
  21. success: function(res) {
  22. common_vendor.index.reLaunch({
  23. url: `/pages/home/index`
  24. });
  25. },
  26. fail: function(err) {
  27. common_vendor.index.login({
  28. success: async function(res) {
  29. if (res.code) {
  30. common_vendor.index.reLaunch({
  31. url: `/pages/home/index`
  32. });
  33. } else {
  34. common_vendor.index.showToast({
  35. title: res.errMsg,
  36. icon: "none"
  37. });
  38. }
  39. }
  40. });
  41. }
  42. });
  43. };
  44. return (_ctx, _cache) => {
  45. return {
  46. a: config.value.logoUrl || "/static/logo.png"
  47. };
  48. };
  49. }
  50. });
  51. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"], ["__file", "D:/project/二手车/car_applet/pages/index/index.vue"]]);
  52. wx.createPage(MiniProgramPage);