<center id="qkqgy"><optgroup id="qkqgy"></optgroup></center>
  • <menu id="qkqgy"></menu>
    <nav id="qkqgy"></nav>
    <xmp id="qkqgy"><nav id="qkqgy"></nav>
  • <xmp id="qkqgy"><menu id="qkqgy"></menu>
    <menu id="qkqgy"><menu id="qkqgy"></menu></menu>
    <tt id="qkqgy"><tt id="qkqgy"></tt></tt>

  • 1.html結構
    <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
    <u-form-item prop="phone"> <view class="cu-form-group"> <text class="
    cuIcon-mobilefill text-green"></text> <text style="margin-left: 8px;"></text>
    <u-input class="title" placeholder="請輸入手機號" v-model="form.phone" type="text"
    confirm-type="search" @confirm="doSearch1" :focus="isFocus1" maxlength="11" />
    </view> </u-form-item> <u-form-item prop="users"> <view class="cu-form-group">
    <u-icon name="man-add-fill" size="22" color="#f29100"></u-icon><text
    style="margin-left: 3px;"></text> <u-input class="title" placeholder="請輸入聯系人"
    v-model="form.users" type="text" confirm-type="search" @confirm="doSearch1"
    :focus="isFocus1" /> </view> </u-form-item> <u-form-item prop="names"> <view
    class="cu-form-group"> <u-icon name="tags-fill" size="20"
    color="#2979ff"></u-icon><text style="margin-left: 5px;"></text> <u-input
    class="title" placeholder="請輸入公司名稱" v-model="form.names" type="text"
    confirm-type="search" @confirm="doSearch1" :focus="isFocus1" /> </view>
    </u-form-item> <u-form-item prop="email"> <view class="cu-form-group"> <u-icon
    name="email-fill" size="20" color="#82848a"></u-icon><text style="margin-left:
    5px;"></text> <u-input class="title" placeholder="請輸入電子郵箱" v-model="form.email"
    type="text" confirm-type="search" @confirm="doSearch1" :focus="isFocus1" />
    </view> </u-form-item> <u-form-item prop="check"> <view class="cu-form-group">
    <text class=" cuIcon-comment text-green" style="margin-right: 7px;"></text>
    <u-input class="title" placeholder="請輸入驗證碼" v-model="form.check" type="text"
    confirm-type="search" @confirm="doSearch1" :focus="isFocus1" /> <button
    class="cu-btn bg-blue xs" v-if="flagTime" @click="checkMsg">發送驗證碼</button>
    <text class="cu-btn bg-grey border" v-else>{{times}}秒后重新獲取</text> </view>
    </u-form-item> </u--form>
    2.?data設置rlues
    form: { phone: '', users: '', names: '', email: '', check: '' }, rules: {
    phone: [{ required: true, message: "請輸入手機號", trigger: ["blur", "change"], }, //
    uniapp自帶的手機號驗證規則 { validator: (rule, value, callback) => { if (value) { return
    this.$u.test.mobile(value); } else { return true } }, message: "手機號格式不正確",
    trigger: ["blur", "change"], }, ], users: [{ required: true, message: "請輸入聯系人",
    trigger: ["blur", "change"], }], names: [{ required: true, message: "請輸入公司名稱",
    trigger: ["blur", "change"], }], email: [{ required: true, message: "請輸入電子郵箱",
    trigger: ["blur", "change"], }, // 自己定義的郵箱驗證規則 { validator: (rule, value,
    callback) => { if (value) { var myReg =
    /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if (!myReg.test(value)) { return false } else { return true } } else { return
    true } }, message: "郵箱格式不正確", trigger: ["blur", "change"], }], check: [{
    required: true, message: "請輸入驗證碼", trigger: ["blur", "change"], }, //
    自己定義的驗證碼驗證規則 { validator: (rule, value, callback) => { if (value) { if
    (value.length > 6) { return false } else { return true } } else { return true }
    }, message: "驗證碼格式不正確", trigger: ["blur", "change"], }] }
    3.方法里整體驗證和請求接口
    // 表單整體校驗 async registerFun() { // this.$refs.uForm
    拿到ref上掛載的dom元素,也就是form,你在u--form里定義的ref等于什么,這個this.$refs.就是什么 let valid = await
    this.$refs.uForm.validate() if (valid) { //調用接口方法 this.register() } else {
    uni.showToast({ icon: 'none', position: 'bottom', title: '您輸入的信息有誤' }) } }, //
    注冊 async register() { const token = uni.getStorageSync('token') var url =
    'userRegister' var method = 'POST' var params = { token: token, company:
    this.form.names, email: this.form.email, name: this.form.users, phone:
    this.form.phone, yzm: this.form.check } await request(url, method,
    params).then((res) => { console.log(res.data) if(res.data.code!=10000){
    uni.showToast({ icon: 'none', title: res.data.message }); }else{
    uni.showToast({ title: '注冊成功' }); this.listIndex=0 } }) },

    技術
    下載桌面版
    GitHub
    百度網盤(提取碼:draw)
    Gitee
    云服務器優惠
    阿里云優惠券
    騰訊云優惠券
    華為云優惠券
    站點信息
    問題反饋
    郵箱:ixiaoyang8@qq.com
    QQ群:766591547
    關注微信
    巨胸美乳无码人妻视频