xy vor 1 Jahr
Ursprung
Commit
b903a04c25

+ 68 - 0
xs-app/unpackage/dist/dev/mp-toutiao/framework/util.js

@@ -53,5 +53,73 @@ class util {
       framework_log.log.Debug("WEIXIN", v);
     }
   }
+  // Loadding
+  static showLoading(title = "加载中...", mask = false) {
+    common_vendor.index.showLoading({
+      title,
+      mask
+    });
+  }
+  static hideLoading() {
+    common_vendor.index.hideLoading();
+  }
+  // Toast
+  static showInfoToast(title, duration = 1500, mask = false) {
+    common_vendor.index.showToast({
+      title,
+      icon: "none",
+      duration,
+      mask
+    });
+  }
+  static showSuccessToast(title, duration = 1500, mask = false) {
+    common_vendor.index.showToast({
+      title,
+      icon: "success",
+      duration,
+      mask
+    });
+  }
+  static showErrorToast(title, duration = 1500, mask = false) {
+    common_vendor.index.showToast({
+      title,
+      icon: "error",
+      duration,
+      mask
+    });
+  }
+  // Modal
+  static showModal(title, content, confirm_cb = null, cancel_cb = null, confirmText = "确定", showCancel = true, cancelText = "取消") {
+    common_vendor.index.showModal({
+      title,
+      content,
+      confirmText,
+      showCancel,
+      cancelText,
+      success: function(res) {
+        if (res.confirm) {
+          confirm_cb && confirm_cb();
+        } else if (res.cancel) {
+          cancel_cb && cancel_cb();
+        }
+      }
+    });
+  }
+  static showModalNoCancel(title, content, confirm_cb = null, cancel_cb = null, confirmText = "确定") {
+    this.showModal(title, content, confirm_cb, cancel_cb, confirmText, false);
+  }
+  // ActionSheet
+  static showActionSheet(alertText, itemList, confirm_cb, cancel_cb = null) {
+    common_vendor.index.showActionSheet({
+      alertText,
+      itemList,
+      success: function(res) {
+        confirm_cb && confirm_cb(res.tapIndex);
+      },
+      fail: function(err) {
+        cancel_cb && cancel_cb();
+      }
+    });
+  }
 }
 exports.util = util;

+ 20 - 3
xs-app/unpackage/dist/dev/mp-toutiao/pages/bookstore/bookstore.js

@@ -1,8 +1,25 @@
 "use strict";
+const framework_util = require("../../framework/util.js");
 const common_vendor = require("../../common/vendor.js");
-const _sfc_main = {};
-function _sfc_render(_ctx, _cache) {
-  return {};
+const _sfc_main = {
+  data() {
+    return {};
+  },
+  onLoad() {
+  },
+  methods: {
+    onClickTest() {
+      framework_util.util.showLoading();
+      setTimeout(() => {
+        framework_util.util.hideLoading();
+      }, 1500);
+    }
+  }
+};
+function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
+  return {
+    a: common_vendor.o((...args) => $options.onClickTest && $options.onClickTest(...args))
+  };
 }
 const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/xy/Desktop/uni_app_project/xs/xs-app/pages/bookstore/bookstore.vue"]]);
 tt.createPage(MiniProgramPage);

+ 1 - 1
xs-app/unpackage/dist/dev/mp-toutiao/pages/bookstore/bookstore.ttml

@@ -1 +1 @@
-<view> 书城 </view>
+<view> 书城 </view><view style="display:flex;margin-top:30px;height:50px;font-size:30px;background-color:red;justify-content:center;align-items:center" bindtap="{{a}}"> 测试 </view>