You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
"use strict"; |
|
const common_vendor = require("../common/vendor.js"); |
|
const utils = { |
|
//一体机打印初始化 |
|
init: () => { |
|
}, |
|
//检查打印机状态 |
|
getstate: () => { |
|
}, |
|
//打印的内容 |
|
printxie: async (obj) => { |
|
}, |
|
// H5蓝牙打印初始化 |
|
initbl_App: () => { |
|
}, |
|
// 蓝牙打印初始化 |
|
initbl: () => { |
|
}, |
|
//给蓝牙打印机推送打印的内容 |
|
getbl: (dev, text) => { |
|
return new Promise((resolve, reject) => { |
|
try { |
|
} catch (err) { |
|
reject(null); |
|
} finally { |
|
common_vendor.index.hideLoading(); |
|
} |
|
}); |
|
}, |
|
//初始化tts语音引擎 |
|
inittts() { |
|
}, |
|
//语音播报 |
|
ttsspke: (text) => { |
|
}, |
|
//设置扫描的广播 |
|
setting: () => { |
|
}, |
|
//获取当前APP的版本信息 |
|
getversion: () => { |
|
return new Promise((relove, reject) => { |
|
}); |
|
}, |
|
//执行下载更新(apk和wgt都可以) |
|
updatefile: (file) => { |
|
}, |
|
//执行下载更新(无感)(wgt) |
|
updatefile1: (file) => { |
|
}, |
|
/** |
|
* 异步获取元素距离视口顶部的距离 |
|
* @param {String} className |
|
@return {Promise} (string) => promise |
|
*/ |
|
getViewDistanceFormTop(className) { |
|
return new Promise((resolve, reject) => { |
|
common_vendor.index.getSystemInfo({ |
|
success: (resu) => { |
|
let _height = ""; |
|
const query = common_vendor.index.createSelectorQuery(); |
|
query.select(className).boundingClientRect(); |
|
query.exec((res) => { |
|
_height = resu.windowHeight - res[0].top + "px"; |
|
console.log("页面的剩余高度", _height); |
|
resolve(_height); |
|
}); |
|
}, |
|
fail: (res) => { |
|
reject(""); |
|
} |
|
}); |
|
}); |
|
} |
|
}; |
|
exports.utils = utils;
|
|
|