123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const modal = {
- /**
- * 消息提示
- * @param content 消息内容
- */
- msg(content) {
- common_vendor.index.showToast({
- title: content,
- icon: "none"
- });
- },
- /**
- * 错误消息
- * @param content 消息内容
- */
- msgError(content) {
- common_vendor.index.showToast({
- title: content,
- icon: "error"
- });
- },
- /**
- * 成功消息
- * @param content 消息内容
- */
- msgSuccess(content) {
- common_vendor.index.showToast({
- title: content,
- icon: "success"
- });
- },
- /**
- * 隐藏消息
- */
- hideMsg() {
- common_vendor.index.hideToast();
- },
- /**
- * 弹出提示
- * @param content 提示内容
- */
- alert(content) {
- common_vendor.index.showModal({
- title: "提示",
- content,
- showCancel: false
- });
- },
- /**
- * 确认窗体
- * @param content 提示内容
- * @returns
- */
- confirm(content) {
- return new Promise((resolve, reject) => {
- common_vendor.index.showModal({
- title: "系统提示",
- content,
- cancelText: "取消",
- confirmText: "确定",
- success: function(res) {
- if (res.confirm) {
- resolve(res.confirm);
- }
- }
- });
- });
- },
- /**
- * 提示信息
- * @param option 提示内容或者提示框配置
- */
- showToast(option) {
- if (typeof option === "object") {
- common_vendor.index.showToast(option);
- } else {
- common_vendor.index.showToast({
- title: option,
- icon: "none",
- duration: 2500
- });
- }
- },
- /**
- * 打开遮罩层,需要手动关闭遮罩层
- * @param content 遮罩层内容
- */
- loading(content) {
- common_vendor.index.showLoading({
- title: content
- });
- },
- /**
- * 关闭遮罩层
- */
- closeLoading() {
- common_vendor.index.hideLoading();
- }
- };
- exports.modal = modal;
|