Commit d66af184 authored by JingChao's avatar JingChao

popup

parent f85c8bdf
...@@ -59,19 +59,14 @@ export default { ...@@ -59,19 +59,14 @@ export default {
showLongTop: function (content) { showLongTop: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
type: 'text', type: 'text',
time: vm.SHOW_TIMES, time: vm.SHOW_TIMES,
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'top', position: 'top',
}) })
} else {
window.plugins.toast.showLongTop(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
...@@ -81,19 +76,14 @@ export default { ...@@ -81,19 +76,14 @@ export default {
showLongCenter: function (content) { showLongCenter: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
type: 'text', type: 'text',
time: vm.SHOW_TIMES, time: vm.SHOW_TIMES,
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'middle', position: 'middle',
}) })
} else {
window.plugins.toast.showLongCenter(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
* 长时间中部提示toast * 长时间中部提示toast
...@@ -102,19 +92,14 @@ export default { ...@@ -102,19 +92,14 @@ export default {
showLongBottom: function (content) { showLongBottom: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
time: vm.SHOW_TIMES, time: vm.SHOW_TIMES,
type: 'text', type: 'text',
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'bottom', position: 'bottom',
}) })
} else {
window.plugins.toast.showLongBottom(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
* 成功提示框 * 成功提示框
...@@ -151,35 +136,19 @@ export default { ...@@ -151,35 +136,19 @@ export default {
* @param confirmObject.onConfirm 确定函数 * @param confirmObject.onConfirm 确定函数
*/ */
showConfirm: function (confirmObject) { showConfirm: function (confirmObject) {
if (!process.env.isMobilePlatform) { let def = {
let def = { title: confirmObject.title || '提示',
title: confirmObject.title || '提示', content: confirmObject.content || '',
content: confirmObject.content || '', confirmText: '确定',
confirmText: '确定', cancelText: '取消',
cancelText: '取消', onConfirm: () => {
onConfirm: () => { confirmObject.onConfirm(1)
confirmObject.onConfirm(1) },
}, onCancel: () => {
onCancel: () => { confirmObject.onConfirm(0)
confirmObject.onConfirm(0) },
},
}
Vue.$vux.confirm.show(def)
} else {
let message = confirmObject.content || ''
let onConfirm = function (index) {
confirmObject.onConfirm(index)
}
let title = confirmObject.title
navigator.notification.confirm(
message, // message
function (index) {
onConfirm(index - 1)
},
title, // title
['取消', '确定'] // buttonLabels
)
} }
Vue.$vux.confirm.show(def)
}, },
/* /*
* 弹出确认的窗口 * 弹出确认的窗口
...@@ -189,30 +158,16 @@ export default { ...@@ -189,30 +158,16 @@ export default {
* *
*/ */
showPopup: function (confirmObject) { showPopup: function (confirmObject) {
if (!process.env.isMobilePlatform) { let def = {
let def = { title: confirmObject.title || '提示',
title: confirmObject.title || '提示', content: confirmObject.content || '',
content: confirmObject.content || '', confirmText: '确定',
confirmText: '确定', showCancelButton: false,
showCancelButton: false, onConfirm: () => {
onConfirm: () => {
confirmObject.onConfirm()
},
}
Vue.$vux.confirm.show(def)
} else {
var alertDismissed = function (index) {
confirmObject.onConfirm() confirmObject.onConfirm()
} },
let title = confirmObject.title || '提示'
var message = confirmObject.content || ''
navigator.notification.alert(
message, // message
alertDismissed, // callback
title || '提示', // title
'确定' // buttonName
)
} }
Vue.$vux.confirm.show(def)
}, },
/** /**
* @param actionObject.titleText 弹出框的标题可空 * @param actionObject.titleText 弹出框的标题可空
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment