realName.js 4.9 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
if (!Array) {
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_form_item2 = common_vendor.resolveComponent("up-form-item");
  const _easycom_up_form2 = common_vendor.resolveComponent("up-form");
  (_easycom_up_input2 + _easycom_up_form_item2 + _easycom_up_form2)();
}
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_form_item = () => "../../uni_modules/uview-plus/components/u-form-item/u-form-item.js";
const _easycom_up_form = () => "../../uni_modules/uview-plus/components/u-form/u-form.js";
if (!Math) {
  (_easycom_up_input + _easycom_up_form_item + _easycom_up_form)();
}
const _sfc_main = {
  __name: "realName",
  setup(__props) {
    const logForm = common_vendor.ref({
      name: "",
      identificationNumber: "",
      phone: ""
    });
    const logFormRef = common_vendor.ref(null);
    const rules = {
      name: [
        { required: true, message: "请输入姓名", trigger: ["blur", "change"] },
        { min: 2, max: 6, message: "名字应在2到6个字", trigger: ["blur", "change"] },
        {
          validator: (rule, value, callback) => {
            return common_vendor.index.$u.test.chinese(value);
          },
          message: "请输入中文",
          // 触发器可以同时用blur和change
          trigger: ["change", "blur"]
        }
      ],
      identificationNumber: [
        { required: true, message: "请输入身份证号", trigger: ["blur", "change"] },
        {
          validator: (rule, value, callback) => {
            return common_vendor.index.$u.test.idCard(value);
          },
          message: "身份证号码不正确",
          // 触发器可以同时用blur和change
          trigger: ["change", "blur"]
        }
      ],
      phone: [
        { required: true, message: "请输入手机号", trigger: ["blur", "change"] },
        {
          validator: (rule, value, callback) => {
            return common_vendor.index.$u.test.mobile(value);
          },
          message: "手机号码不正确",
          // 触发器可以同时用blur和change
          trigger: ["change", "blur"]
        }
      ]
    };
    const customStyle = {
      height: "80rpx",
      backgroundColor: "#F9F9F9",
      paddingLeft: "40rpx"
    };
    const placeholderStyle = {
      color: "#bbb",
      fontSize: "28rpx"
    };
    common_vendor.onReady(() => {
      logFormRef.value.setRules(rules);
    });
    const goPrivacy = () => {
      common_vendor.index.navigateTo({
        url: "/pages/privacy/privacy"
      });
    };
    const submit = () => {
      logFormRef.value.validate().then(async (valid) => {
        if (valid) {
          common_vendor.index.$u.toast("登录成功");
          common_vendor.index.switchTab({
            url: "/pages/index/index"
          });
        } else {
          common_vendor.index.$u.toast("校验失败");
        }
      }).catch(() => {
        common_vendor.index.$u.toast("校验失败");
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_assets._imports_0,
        b: common_vendor.o(($event) => logForm.value.name = $event),
        c: common_vendor.p({
          shape: "circle",
          border: "none",
          fontSize: "28rpx",
          color: "#bbb",
          placeholderStyle,
          customStyle,
          placeholder: "请输入真实姓名",
          modelValue: logForm.value.name
        }),
        d: common_vendor.p({
          prop: "name"
        }),
        e: common_assets._imports_1,
        f: common_vendor.o(($event) => logForm.value.identificationNumber = $event),
        g: common_vendor.p({
          shape: "circle",
          border: "none",
          fontSize: "28rpx",
          color: "#bbb",
          placeholderStyle,
          customStyle,
          placeholder: "请输入身份证号",
          modelValue: logForm.value.identificationNumber
        }),
        h: common_vendor.p({
          prop: "identificationNumber"
        }),
        i: common_assets._imports_2,
        j: common_vendor.o(($event) => logForm.value.phone = $event),
        k: common_vendor.p({
          shape: "circle",
          border: "none",
          fontSize: "28rpx",
          color: "#bbb",
          placeholderStyle,
          customStyle,
          placeholder: "请输入手机号码",
          modelValue: logForm.value.phone
        }),
        l: common_vendor.p({
          prop: "phone"
        }),
        m: common_vendor.sr(logFormRef, "f2ff8f80-0", {
          "k": "logFormRef"
        }),
        n: common_vendor.p({
          model: logForm.value
        }),
        o: common_vendor.o(goPrivacy),
        p: common_vendor.o(submit)
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f2ff8f80"]]);
wx.createPage(MiniProgramPage);