123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- var app = getApp();
- var that;
- import moment from 'moment' // 时间库
- Page({
- data: {
- userData: {},
- name: '',
- mobile: '',
- },
- onLoad() {
- that = this;
- dd.setNavigationBar({ title: "预约演示" });
- that.setData({
- userData: app.globalData.userData,
- })
- },
- bindKeyInput(e) {
- this.setData({
- name: e.detail.value,
- });
- },
- bindKeyInput2(e) {
- this.setData({
- mobile: e.detail.value,
- });
- },
- submit() {
- if (!this.data.name) {
- app.globalData.showToast('请输入姓名');
- return false;
- }
- if (!this.data.mobile) {
- app.globalData.showToast('请输手机号码');
- return false;
- }
- let str = /^1[345789]\d{9}$/
- if (!str.test(this.data.mobile)) {
- app.globalData.showToast('手机号码格式不正确')
- return false
- }
- let data={
- name:this.data.name,
- mobile:this.data.mobile,
- }
- app.$post('api/employee/appointment', data).then(res => {
- if (res.data.code == 1) {
- app.globalData.showToast('提交成功,我们的积分制老师将在24小时内与您联系');
- setTimeout(()=>{
- dd.navigateBack({
- delta: 1
- })
- },1000)
- }
- });
- },
- });
|