// @ts-ignore import { useStore } from '@/store/modules/user' const store = useStore() /** * 获取请求参数 */ export function getHeader(){ try { // @ts-ignore const header = window.android.getHeader(); const user=JSON.parse(header) user.token=user.Authorization store.setToken(user); }catch (e){ // router.push('/login') } } /** * 登出 */ export function logout(){ try { // @ts-ignore window.android.logout() // store.removeToken() }catch (e){ // showToast(JSON.stringify(e)) } } /** * 关闭当前页面方法(回到首页) */ export function goBack(){ try { // @ts-ignore window.android.goBack() // store.removeToken() }catch (e){ history.back(); } } /** * 播报拣货数量 * 播报:需要拣货number * @param number */ export function playVoicePickNum(number: number) { try { // @ts-ignore window.android.playVoicePickNum(number) }catch (e){ // showToast(JSON.stringify(e)) } } /** * 播报格口 * 播报:格口:number * @param number */ export function playVoiceBin(number: number) { try { // @ts-ignore window.android.playVoiceBin(number) }catch (e){ } } /** * 第一次进入页面获取焦点 */ export function androidFocus(){ try { // @ts-ignore window.android.focus() }catch (e){ } } /** * 扫描成功语音 */ export function scanSuccess(){ try { // @ts-ignore window.android.scanSuccessVib() }catch (e){ } } /** * 扫描失败语音 */ export function scanError(){ try { // @ts-ignore window.android.scanErrorVib() }catch (e){ } } /** * 保存mac地址 - piece */ export function saveMacAddress(mac : string) : boolean { try { // @ts-ignore return window.android.saveMacAddress(mac) }catch (e){ return false } } /** * 读取mac地址 - piece */ export function readMacAddress(): string { try { // @ts-ignore return window.android.readMacAddress() }catch (e){ return '' } }