Commit 60a22386 by 张立顺

提示合并至wxapi里面

1 parent 36fbfd31
import { commonApi, equityApi } from '../api/api' import { commonApi } from '../api/api'
// import {
// sopApi,
// commonApi,
// bigdatautilApi,
// equityApi
// } from '../api/api'
import $router from '../router/index' import $router from '../router/index'
/** /**
......
/** /**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: 'error',
title: '请输入手机号'
},
username: {
icon: 'error',
title: '请输入用户名'
},
password: {
icon: 'error',
title: '请输入密码'
}
}
/**
* 禁止滑动 * 禁止滑动
*/ */
const noScroll = () => {} const noScroll = () => {}
...@@ -51,6 +70,26 @@ const showToast = val => { ...@@ -51,6 +70,26 @@ const showToast = val => {
} }
return wx.showToast(obj) return wx.showToast(obj)
} }
/**
*
* @param {* string | object} name 信息名称
* @param {* object | null} [params] 信息名称参数
*/
const wxShowToast = (name, params) => {
if (arguments.length == 2) {
wx.showToast({
title: tipsObj[name]['title'],
icon: tipsObj[name]['icon'],
...params
})
} else {
wx.showToast({
...params
})
}
}
/**获取设备信息 */ /**获取设备信息 */
const getSystemInfo = callBack => { const getSystemInfo = callBack => {
wx.getSystemInfo({ wx.getSystemInfo({
...@@ -82,6 +121,7 @@ const wxApi = { ...@@ -82,6 +121,7 @@ const wxApi = {
setCopyData, setCopyData,
showToast, showToast,
phoneCall, phoneCall,
noScroll noScroll,
wxShowToast
} }
export default wxApi export default wxApi
/**
* 微信校验通知类工具封装
*/
const tipsObj = {
phone: {
icon: "error",
title: "请输入手机号",
},
username: {
icon: "error",
title: "请输入用户名",
},
password: {
icon: "error",
title: "请输入密码",
},
};
/**
*
* @param {* string | object} name 信息名称
* @param {* object | null} [params] 信息名称参数
*/
const wxShowToast = (name, params) => {
if (arguments.length == 2) {
wx.showToast({
title: tipsObj[name]["title"],
icon: tipsObj[name]["icon"],
...params,
});
} else {
wx.showToast({
...params,
});
}
};
export default wxShowToast;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!