提交 2b78a85b 编写于 作者: Q qiang

fix: 调整模板页按钮位置

上级 6377e856
......@@ -12,7 +12,7 @@ import {
} from '../../constants'
import {
registerPlusMessage,
registerPlusMessage,
consumePlusMessage
} from '../../framework/plus-message'
......@@ -89,19 +89,19 @@ export function scanCode ({
const buttons = []
if (!onlyFromCamera) {
buttons.push({
'float': 'right',
'text': '相册',
'fontSize': '17px',
'width': '60px',
'onclick': function () {
float: 'right',
text: '相册',
fontSize: '17px',
width: '60px',
onclick: function () {
plus.gallery.pick(file => {
barcode.scan(file, (type, code) => {
if (isDark) {
plus.navigator.setStatusBarStyle('isDark')
}
result = {
type,
code
}
result = {
type,
code
}
webview.close('auto')
}, () => {
......@@ -152,10 +152,10 @@ export function scanCode ({
path: '',
errMsg: 'scanCode:ok'
})
} else {
invoke(callbackId, {
errMsg: 'scanCode:fail cancel'
})
} else {
invoke(callbackId, {
errMsg: 'scanCode:fail cancel'
})
}
consumePlusMessage(MESSAGE_TYPE)
})
......
......@@ -6,14 +6,14 @@ import {
showPage
} from '../page.js'
function getStatusBarStyle () {
let style = plus.navigator.getStatusBarStyle()
if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
style = 'light'
} else if (style === 'UIStatusBarStyleDefault') {
style = 'dark'
}
return style
function getStatusBarStyle () {
let style = plus.navigator.getStatusBarStyle()
if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
style = 'light'
} else if (style === 'UIStatusBarStyleDefault') {
style = 'dark'
}
return style
}
export function scanCode (options, callbackId) {
......@@ -37,6 +37,7 @@ export function scanCode (options, callbackId) {
buttons: !options.onlyFromCamera ? [{
text: options.albumText || '相册',
fontSize: '17px',
width: '60px',
onclick: () => {
page.sendMessage({
type: 'gallery'
......
......@@ -11,12 +11,12 @@ import {
} from '../../constants'
import {
registerPlusMessage,
registerPlusMessage,
consumePlusMessage
} from '../../framework/plus-message'
const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html'
const CHOOSE_LOCATION_PATH = '_www/__uniappchooselocation.html'
const MESSAGE_TYPE = 'chooseLocation'
export function chooseLocation (params, callbackId) {
......@@ -34,6 +34,7 @@ export function chooseLocation (params, callbackId) {
float: 'right',
text: '完成',
fontSize: '17px',
width: '60px',
onclick: function () {
webview.evalJS('__chooseLocationConfirm__()')
}
......@@ -59,39 +60,39 @@ export function chooseLocation (params, callbackId) {
plus.navigator.setStatusBarStyle('light')
}
})
}
let index = 0
let onShow = function () {
index++
if (index === 2) {
webview.evalJS(`__chooseLocation__(${JSON.stringify(params)})`)
}
}
let index = 0
let onShow = function () {
index++
if (index === 2) {
webview.evalJS(`__chooseLocation__(${JSON.stringify(params)})`)
}
}
webview.addEventListener('loaded', onShow)
webview.show('slide-in-bottom', ANI_DURATION, onShow)
let result
webview.addEventListener('close', () => {
if (result) {
invoke(callbackId, {
name: result.poiname,
address: result.poiaddress,
latitude: result.latlng.lat,
longitude: result.latlng.lng,
errMsg: 'chooseLocation:ok'
})
} else {
consumePlusMessage(MESSAGE_TYPE)
invoke(callbackId, {
errMsg: 'chooseLocation:fail cancel'
})
}
})
webview.show('slide-in-bottom', ANI_DURATION, onShow)
let result
webview.addEventListener('close', () => {
if (result) {
invoke(callbackId, {
name: result.poiname,
address: result.poiaddress,
latitude: result.latlng.lat,
longitude: result.latlng.lng,
errMsg: 'chooseLocation:ok'
})
} else {
consumePlusMessage(MESSAGE_TYPE)
invoke(callbackId, {
errMsg: 'chooseLocation:fail cancel'
})
}
})
registerPlusMessage(MESSAGE_TYPE, function (res) {
if (res && 'latlng' in res) {
result = res
if (res && 'latlng' in res) {
result = res
}
}, false)
}
......@@ -6,14 +6,14 @@ import {
showPage
} from '../page.js'
function getStatusBarStyle () {
let style = plus.navigator.getStatusBarStyle()
if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
style = 'light'
} else if (style === 'UIStatusBarStyleDefault') {
style = 'dark'
}
return style
function getStatusBarStyle () {
let style = plus.navigator.getStatusBarStyle()
if (style === 'UIStatusBarStyleBlackTranslucent' || style === 'UIStatusBarStyleBlackOpaque' || style === 'null') {
style = 'light'
} else if (style === 'UIStatusBarStyleDefault') {
style = 'dark'
}
return style
}
export function chooseLocation (options, callbackId) {
......@@ -44,6 +44,7 @@ export function chooseLocation (options, callbackId) {
}, {
text: options.doneText || '完成',
fontSize: '17px',
width: '60px',
onclick: () => {
page.sendMessage({
type: 'done'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册