亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

【九月打卡】第8天 多端全棧項目實戰

標簽:
SpringBoot

课程名称:多端全栈项目实战:商业级代驾全流程落地


课程章节:  华夏代驾全栈小程序实战


课程讲师: 神思者



课程内容: 

    乘客选择代驾车型和车牌


课程收获:


https://img1.sycdn.imooc.com//631ec96700017cba05560576.jpg

我们要编写前端页面 进行添加车辆类型 和车辆车牌号


手写设置好ajax的全局url路径


然后进行页面html编写

    <view class="page">
    <u-cell-group :border="false">
        <u-cell-item icon="info-circle-fill" title="车型信息" 
                     :value="carType" @click="carTypeHandle">
        </u-cell-item>
        <u-cell-item icon="info-circle-fill" title="车牌号码" 
                     :value="carPlate" @click="carPlateHandle">
        </u-cell-item>
    </u-cell-group>
    <button class="btn" @tap="saveHandle">确定保存</button>
    <view class="desc">
        保存即代表您同意华夏代驾的        <text>《隐私政策》</text>
    </view>
    <u-toast ref="uToast" /></view>

给页面内的元素添加 @click 事件

用 uni.showModal 进行设置 车牌和车型

carTypeHandle: function() {
    let that = this;
    uni.showModal({
        title: '输入车型',
        editable: true,
        placeholderText: '例如丰田卡罗拉',
        success: function(resp) {
            if (resp.confirm) {
                let carType = resp.content;
                if (that.checkValidCarType(carType, '车型')) {
                    that.carType = carType;
                }
            }
        }
    });},
carPlateHandle: function() {
    let that = this;
    uni.showModal({
        title: '输入车牌',
        editable: true,
        placeholderText: '你的车牌号',
        success: function(resp) {
            if (resp.confirm) {
                let carPlate = resp.content;
                if (that.checkValidCarPlate(carPlate, '车牌')) {
                    that.carPlate = carPlate;
                }
            }
        }
    });},

保存数据时使用 @tap="saveHandle" 

saveHandle: function() {
    let that = this;
    if (that.checkValidCarType(that.carType, '车型') && that.checkValidCarPlate(that.carPlate, '车牌')) {
        let data = {
            carType: that.carType,
            carPlate: that.carPlate        };
        that.ajax(that.url.insertCustomerCar, 'POST', data, function(resp) {
            that.$refs.uToast.show({
                title: '添加成功',
                type: 'success',
                callback: function() {
                   ...
                }
            });
        });
    }}


之后就是前后端项目启动 然后进行真机测试



https://img1.sycdn.imooc.com//631ec9ac0001a0e712950799.jpg


點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
Web前端工程師
手記
粉絲
27
獲贊與收藏
19

關注作者,訂閱最新文章

閱讀免費教程

  • 推薦
  • 1
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消