| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- // @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 ''
- }
- }
|