123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = {
- data() {
- return {
- formData: {
- name: "",
- phone: "",
- email: ""
- }
- };
- },
- methods: {
- goHome() {
- common_vendor.index.navigateBack({
- delta: 1
- });
- },
- submitForm() {
- if (!this.formData.name.trim()) {
- common_vendor.index.showToast({
- title: "请输入姓名",
- icon: "none"
- });
- return;
- }
- if (!this.formData.phone.trim()) {
- common_vendor.index.showToast({
- title: "请输入手机号",
- icon: "none"
- });
- return;
- }
- if (!/^1\d{10}$/.test(this.formData.phone)) {
- common_vendor.index.showToast({
- title: "请输入正确的手机号",
- icon: "none"
- });
- return;
- }
- if (this.formData.email && !/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(this.formData.email)) {
- common_vendor.index.showToast({
- title: "请输入正确的邮箱",
- icon: "none"
- });
- return;
- }
- console.log("提交的表单数据:", this.formData);
- common_vendor.index.showLoading({
- title: "提交中..."
- });
- setTimeout(() => {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({
- title: "提交成功",
- icon: "success",
- duration: 1500,
- success: () => {
- setTimeout(() => {
- common_vendor.index.navigateTo({
- url: "/pages/success/success",
- // 修改为成功页面的路径
- fail: (err) => {
- console.error("页面跳转失败:", err);
- common_vendor.index.showToast({
- title: "页面跳转失败",
- icon: "none"
- });
- }
- });
- }, 1500);
- }
- });
- }, 1e3);
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: $data.formData.name,
- b: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
- c: $data.formData.phone,
- d: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
- e: $data.formData.email,
- f: common_vendor.o(($event) => $data.formData.email = $event.detail.value),
- g: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|