const app = getApp() export default { loading (title) { wx.showLoading({ title: title || '加载中...', mask: true }) }, errorToast (title) { wx.showToast({ title: title || '请先登录', icon: 'error' }) }, navigateTo (url,permissionTitle) { if (url) { if (app.globalData.userInfo.login) { wx.navigateTo({ url: 'url' }) } else { wx.showToast({ title: permissionTitle || '请先登录', icon: 'error' }) } } else { wx.showToast({ title: '地址错误', icon: 'error' }) } }, loginAuth () { return app.globalData.userInfo.login }, // UUID getUUID () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16) }) } }