123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { patientUpdate } from "../patient-detail/service";
- import getEncryptStr from "../../utils/getEncryptStr";
- Component({
- props: {},
- data: {
- phone: "",
- },
- didMount() {},
- methods: {
- onInput(e) {
- this.setData({
- phone: e.detail.value,
- });
- },
- choosePhoneContact() {
- my.choosePhoneContact({
- success: (result) => {
- const { mobile } = result;
- this.setData({
- phone: mobile.replace(/(\s|-|\+)/g, ""),
- });
- },
- });
- },
- async onSave() {
- const {
- query = {
- id: "",
- relationShip: "",
- },
- } = this.$page.data;
- const phoneNumber = this.data.phone;
- if (/^[1]([3-9])[0-9]{9}$/.test(phoneNumber)) {
- patientUpdate({
- id: query.id,
- // relationShip: query.relationShip,
- phoneNumber: await getEncryptStr(this.data.phone),
- }).then(() => {
- my.navigateBack();
- });
- } else {
- my.showToast({
- type: "fail",
- content: "手机号错误",
- duration: 3000,
- success: () => {
- this.setData({
- phone: "",
- });
- },
- });
- }
- },
- },
- });
|