123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- var businessType = require('business-type.js')
- var _debug = false
- function isDebug() {
- return _debug
- }
- function debugLog(e) {
- if (_debug) {
- console.log(e)
- }
- }
- function action(f, t) {
- var after = t || 500
- return function () {
- var app = getApp()
- if (app.globalData.isClicked) {
- return
- }
- app.globalData.isClicked = true
- f.apply(this, arguments)
- setTimeout(function () {
- app.globalData.isClicked = false
- }, after)
- }
- }
- function showFailTips(err, p) {
- if (err.code == businessType.NetworkErrorCode.netwrokMiss) {
- wx.showToast({
- title: err.msg,
- icon: 'none'
- })
- } else if (err.code == businessType.NetworkErrorCode.connectErrorMessage) {
- wx.showToast({
- title: err.msg,
- icon: 'none'
- })
- } else if (p) {
- wx.showToast({
- title: p,
- icon: 'none'
- })
- }
- }
- module.exports = {
- debugLog: debugLog,
- action: action,
- showFailTips: showFailTips,
- isDebug: isDebug
- }
|