| | |
| | | }) |
| | | } |
| | | |
| | | export function showToast(title, icon) { |
| | | uni.showToast({ |
| | | title: title, |
| | | icon: icon ? icon : 'none' |
| | | }) |
| | | } |
| | | export function showInfo(ex){ |
| | | if( !ex) |
| | | export function showToast(ex) { |
| | | if (!ex) |
| | | return |
| | | let tip =ex |
| | | console.log(ex); |
| | | if( typeof ex !== "string" ) |
| | | { |
| | | let tip = ex |
| | | // console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg :typeof ex.message == "string" ? ex.message: exStr |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | plus.nativeUI.toast(tip , {duration:"short"}); |
| | | plus.nativeUI.toast(tip, { |
| | | duration: "short", |
| | | verticalAlign: "center" |
| | | }); |
| | | // uni.showToast({ |
| | | // title: title, |
| | | // icon: icon ? icon : 'none' |
| | | // }) |
| | | } |
| | | export function showInfo(ex) { |
| | | if (!ex) |
| | | return |
| | | let tip = ex |
| | | // console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | // plus.nativeUI.toast(tip, { |
| | | // duration: "short", |
| | | // verticalAlign:"center" |
| | | // }); |
| | | return uni.showModal({ |
| | | title: "提示", |
| | | content: tip, |
| | | showCancel: false |
| | | }); |
| | | } |
| | | |
| | | export function showError(ex, title = "错误") { |
| | | if (!ex) |
| | | return |
| | | let tip = ex |
| | | console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | //plus.nativeUI.alert(tip,title); |
| | | return uni.showModal({ |
| | | title: title || "", |
| | | content: tip, |
| | | showCancel: false |
| | | }); |
| | | } |
| | | export function showLoading(title) { |
| | | |
| | | |
| | | uni.showLoading({ |
| | | title: title, |
| | | mask: true |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | export function hexToRGBA(hex, alpha) { |
| | | const r = parseInt(hex.slice(1, 3), 16); |
| | | const g = parseInt(hex.slice(3, 5), 16); |