12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import { patientUpdate } from "../patient-detail/service";
- import getEncryptStr from "../../utils/getEncryptStr";
- import EventHub from "../../../abMall/utils/eventEmitter";
- Component({
- props: {},
- data: {
- phone: "",
- },
- didMount() {},
- methods: {
- onInput(e) {
- this.setData({
- phone: e.detail.value,
- });
- },
- async onSave() {
- const {
- query = {
- id: "",
- },
- } = this.$page.data;
- const phoneNumber = this.data.phone;
- if (/^[1]([3-9])[0-9]{9}$/.test(phoneNumber)) {
- patientUpdate({
- id: query.id,
- phoneNumber: await getEncryptStr(this.data.phone),
- }).then(() => {
- EventHub.dispatchEvent("onPatienDetailUpdate", true);
- my.navigateBack();
- });
- } else {
- my.showToast({
- type: "fail",
- content: "手机号错误",
- duration: 3000,
- success: () => {
- this.setData({
- phone: "",
- });
- },
- });
- }
- },
- },
- });
|