app.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  3. const common_vendor = require("./common/vendor.js");
  4. const common_api = require("./common/api.js");
  5. const config = require("./config.js");
  6. const common_share = require("./common/share.js");
  7. if (!Math) {
  8. "./pages/index/index.js";
  9. "./pages/home/index.js";
  10. "./pages/teacher/index.js";
  11. "./pages/my/index.js";
  12. "./pagesHome/agree/index.js";
  13. "./pagesMy/order/index.js";
  14. "./pagesMy/course/index.js";
  15. "./pagesMy/follow/index.js";
  16. "./pagesMy/account/index.js";
  17. "./pagesMy/opinion/index.js";
  18. }
  19. const _sfc_main = {
  20. onLaunch: function() {
  21. const that = this;
  22. that.forceUpdate();
  23. },
  24. onShow: function() {
  25. console.log("App Show");
  26. },
  27. onHide: function() {
  28. console.log("App Hide");
  29. },
  30. methods: {
  31. // 强制更新
  32. forceUpdate() {
  33. let system = common_vendor.index.getSystemInfoSync();
  34. if (system.uniPlatform == "mp-weixin") {
  35. const updateManager = common_vendor.index.getUpdateManager();
  36. updateManager.onCheckForUpdate(function(res) {
  37. console.log(res.hasUpdate);
  38. });
  39. updateManager.onUpdateReady(function(res) {
  40. common_vendor.index.showModal({
  41. title: "更新提示",
  42. content: "新版本已经准备好,是否重启应用?",
  43. success(res2) {
  44. if (res2.confirm) {
  45. common_vendor.index.clearStorage();
  46. updateManager.applyUpdate();
  47. }
  48. }
  49. });
  50. });
  51. updateManager.onUpdateFailed(function(res) {
  52. console.log(res);
  53. console.log("更新失败");
  54. });
  55. }
  56. }
  57. }
  58. };
  59. const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/project/学吧/learn_applet/App.vue"]]);
  60. function createApp() {
  61. const app = common_vendor.createSSRApp(App);
  62. app.use(common_vendor.uviewPlus);
  63. app.provide("$api", common_api.requestBase);
  64. app.provide("$app", common_api.requestApp);
  65. app.provide("$apifile", common_api.requestFile);
  66. app.provide("$config", config.configInfo);
  67. app.provide("$share", common_share.share);
  68. return {
  69. app
  70. };
  71. }
  72. createApp().app.mount("#app");
  73. exports.createApp = createApp;