1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /**
- * 显示消息提示框
- * @param content 提示的标题
- */
- export function toast(content) {
- uni.showToast({
- icon: 'none',
- title: content
- })
- }
- /**
- * 显示模态弹窗
- * @param content 提示的标题
- */
- export function showConfirm(content) {
- return new Promise((resolve, reject) => {
- uni.showModal({
- title: '提示',
- content: content,
- cancelText: '取消',
- confirmText: '确定',
- success: function(res) {
- resolve(res)
- }
- })
- })
- }
- /**
- * 参数处理
- * @param params 参数
- */
- export function tansParams(params) {
- let result = ''
- // FIXME 拼接参数
- return result
- }
- /**
- * @summary 获取请求异常与正常返回
- * @param {Object} promise
- */
- export function catchError(promise) {
- return new Promise((resolve,reject) => {
- promise.then(data => {
- console.log('response =>',data.data)
- resolve([undefined, data.data])
- }).catch(err => {
- reject([err])
- })
- })
- }
|