# scanCode
打开扫码
# 请求参数
Prop | Type | Required | Default | Description |
---|---|---|---|---|
desc | String | N | 扫描提示语 | |
params | Object | N | 配置项 | |
-codeType | String | N | 类型 | |
-navTitle | String | N | 标题 | |
-maunallyTitle | String | N | 手动选择标题 |
# 接口请求示例
nativeService.getLanguageString()
# 返回参数
Prop | Type | Default | Description |
---|---|---|---|
-- | Promise | 获取值之后的回调 | |
-code | Number | 状态标志位(逻辑详见示例) |
# 接口返回示例
this.$bridge.scanCode({
desc: this.TEXT.service_request_productInfo_scan_desc,
params: {
codeType: '2',
navTitle: this.TEXT.service_request_productInfo_scan_navTitle,
maunallyTitle: this.TEXT.service_request_productInfo_scan_maunallyTitle
},
}).then(res => {
// res为空时代表iOS触发返回,不做操作
if (res) {
const { code, data } = res;
// code不为0: 安卓触发返回,不做操作; iOS扫码异常,弹窗重扫
if (code == 0) {
// data为空代表双端触发手动选择产品,跳转产品页
if (!data) {
router.push({ name: 'RegistrationProduct' });
} else {
partSerial(data, true);
}
} else {
if (isAndroid()) return
scanError.value = true;
}
}
})