|
|
|
|
@ -69,7 +69,6 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
isExchangeBinding: false,
|
|
|
|
|
|
|
|
|
|
/** INPUT序列号:拎出来,防止上传图片被清空bug */
|
|
|
|
|
serialCodeValue: "",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
$instance = Taro.getCurrentInstance();
|
|
|
|
|
@ -100,6 +99,7 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log("params", params);
|
|
|
|
|
console.log("channelInfo", this.state.channelInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidHide() {}
|
|
|
|
|
@ -108,7 +108,9 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
onSerial = (event) => {
|
|
|
|
|
const { value } = event.detail;
|
|
|
|
|
this.setState({ serialCodeValue: value });
|
|
|
|
|
let { channelInfo } = this.state;
|
|
|
|
|
channelInfo.serialCode = value;
|
|
|
|
|
this.setState({ channelInfo });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onTipShow = () => {
|
|
|
|
|
@ -166,7 +168,7 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onChangeImg = async () => {
|
|
|
|
|
async onChangeImg() {
|
|
|
|
|
Taro.chooseMedia({
|
|
|
|
|
count: 1,
|
|
|
|
|
mediaType: ["image"],
|
|
|
|
|
@ -174,25 +176,32 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
sizeType: ["compressed"],
|
|
|
|
|
camera: "back",
|
|
|
|
|
success: async (res) => {
|
|
|
|
|
console.log("success", res);
|
|
|
|
|
const tempFilePath = res.tempFiles[0].tempFilePath;
|
|
|
|
|
let img = await getImgInfo(tempFilePath);
|
|
|
|
|
console.log("img", img);
|
|
|
|
|
let compressImage = await contraction(img, "compressImage");
|
|
|
|
|
console.log("compressImage", compressImage);
|
|
|
|
|
// 压缩后文件地址
|
|
|
|
|
let compressTempFilePath = compressImage.tempFilePath;
|
|
|
|
|
|
|
|
|
|
console.log("tempFilePath", tempFilePath);
|
|
|
|
|
console.log("compressTempFilePath", compressTempFilePath);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
let { channelInfo } = this.state;
|
|
|
|
|
channelInfo.serialImage = compressTempFilePath;
|
|
|
|
|
this.setState({ channelInfo });
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
fail: async (fail) => {
|
|
|
|
|
console.log("fail", fail);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSubmit = () => {
|
|
|
|
|
const { serialImage } = this.state.channelInfo;
|
|
|
|
|
const { serialImage, serialCode } = this.state.channelInfo;
|
|
|
|
|
|
|
|
|
|
if (!this.state.serialCodeValue?.trim()) return msg("请填写序列号");
|
|
|
|
|
if (!serialCode?.trim()) return msg("请填写序列号");
|
|
|
|
|
if (!serialImage) return msg("请上传序列号照片");
|
|
|
|
|
this.manualCodeBinding();
|
|
|
|
|
};
|
|
|
|
|
@ -210,7 +219,6 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
...item,
|
|
|
|
|
},
|
|
|
|
|
isVideo: this.isVideo(item.banner),
|
|
|
|
|
serialCodeValue: "",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -276,7 +284,7 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
let { channelInfo } = this.state;
|
|
|
|
|
|
|
|
|
|
let res = await InstrumentInfo.manualCodeBinding({
|
|
|
|
|
serial: this.state.serialCodeValue,
|
|
|
|
|
serial: channelInfo.serialCode,
|
|
|
|
|
serialImage: channelInfo.serialImage,
|
|
|
|
|
instrumentId: channelInfo.id,
|
|
|
|
|
});
|
|
|
|
|
@ -371,7 +379,7 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
customBack = () => {
|
|
|
|
|
Taro.switchTab({ url: "/pages/index/index" });
|
|
|
|
|
Taro.reLaunch({ url: "/pages/index/index" });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 打开绑定弹窗
|
|
|
|
|
@ -404,7 +412,6 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
isVisibleBinding,
|
|
|
|
|
isRegisterBoolean,
|
|
|
|
|
isExchangeBinding,
|
|
|
|
|
serialCodeValue,
|
|
|
|
|
} = this.state;
|
|
|
|
|
return (
|
|
|
|
|
<Block>
|
|
|
|
|
@ -425,35 +432,37 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
customBack={this.customBack}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupBinding
|
|
|
|
|
type={channelInfo.bindingStatus}
|
|
|
|
|
isShow={isVisibleBinding}
|
|
|
|
|
isRegisterBoolean={isRegisterBoolean}
|
|
|
|
|
isExchangeBinding={isExchangeBinding}
|
|
|
|
|
data={channelInfo}
|
|
|
|
|
close={this.closeBinding}
|
|
|
|
|
confirm={this.confirmBinding}
|
|
|
|
|
/>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isBindingError}
|
|
|
|
|
title="提示"
|
|
|
|
|
content="序列号库仍在更新,请联系微信助手"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.onBindErrorClose}
|
|
|
|
|
confirm={this.onBindErrorConfirm}
|
|
|
|
|
></PopupAlert>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isBindingCheckError}
|
|
|
|
|
title="提示"
|
|
|
|
|
content="您选择的仪器有误,请重新选择确认"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.onBindCheckErrorClose}
|
|
|
|
|
confirm={this.onBindCheckErrorClose}
|
|
|
|
|
></PopupAlert>
|
|
|
|
|
<View catchMove>
|
|
|
|
|
<PopupBinding
|
|
|
|
|
type={channelInfo.bindingStatus}
|
|
|
|
|
isShow={isVisibleBinding}
|
|
|
|
|
isRegisterBoolean={isRegisterBoolean}
|
|
|
|
|
isExchangeBinding={isExchangeBinding}
|
|
|
|
|
data={channelInfo}
|
|
|
|
|
close={this.closeBinding}
|
|
|
|
|
confirm={this.confirmBinding}
|
|
|
|
|
/>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isBindingError}
|
|
|
|
|
title="提示"
|
|
|
|
|
content="序列号库仍在更新,请联系微信助手"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.onBindErrorClose}
|
|
|
|
|
confirm={this.onBindErrorConfirm}
|
|
|
|
|
></PopupAlert>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isBindingCheckError}
|
|
|
|
|
title="提示"
|
|
|
|
|
content="您选择的仪器有误,请重新选择确认"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.onBindCheckErrorClose}
|
|
|
|
|
confirm={this.onBindCheckErrorClose}
|
|
|
|
|
></PopupAlert>
|
|
|
|
|
</View>
|
|
|
|
|
<Canvas
|
|
|
|
|
style="height: 0"
|
|
|
|
|
style="position: fixed;left:-10000px;max-width: 1024px;max-height: 768px;"
|
|
|
|
|
id="compressImage"
|
|
|
|
|
canvasId="compressImage"
|
|
|
|
|
type="2d"
|
|
|
|
|
@ -590,7 +599,7 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
placeholder="例如:FR10*********1"
|
|
|
|
|
placeholder-style={style}
|
|
|
|
|
onInput={this.onSerial}
|
|
|
|
|
value={serialCodeValue}
|
|
|
|
|
value={channelInfo.serialCode}
|
|
|
|
|
></Input>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
@ -603,7 +612,10 @@ export default class Instrument extends Component<any, any> {
|
|
|
|
|
</Text>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className="photo_box" onClick={this.onChangeImg}>
|
|
|
|
|
<View
|
|
|
|
|
className="photo_box"
|
|
|
|
|
onClick={this.onChangeImg.bind(this)}
|
|
|
|
|
>
|
|
|
|
|
{channelInfo.serialImage && (
|
|
|
|
|
<Image
|
|
|
|
|
src={channelInfo.serialImage}
|
|
|
|
|
|