// @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){ } } export function openCamera(){ try { // @ts-ignore const path = window.android.openCamera() console.log(path) return path }catch (e){ } } export function openGallery(){ try { // @ts-ignore const header = window.android.openGallery() console.log(header) }catch (e){ } } export function openImageEditor(imagePath: string){ try { // @ts-ignore const header = window.android.openImageEditor(imagePath) console.log(header) }catch (e){ } }