微信小程序输入姓名判断然后获取手机号码并发送到web-view页面
wxml页面代码:
<view class="section__ctn">
<image style="width: 100%; height: 200px; background-color: #eeeeee;" mode="{{mode}}" src="{{src}}"></image>
</view>
<view class='title'><text>****微信预约中心</text></view>
<input type="text" bindinput="inputvalue" class='bk' placeholder="请输入您的姓名" />
<button wx:if="{{name.length>0}}" class="gettel" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">授权获取手机号码</button>
<view class='title3'><text>***·预约步骤:</text></view>
<view class='title2'><text>① 输入姓名 ② 点击授权获取手机号码 ③ 选择门店,日期,时间段 ④ 确定预约</text></view>
<web-view src="{{uurl}}" wx:if="{{yes_ok==true}}" ></web-view>
<button bindtap='buttonListener' wx:if="{{yes_ok==true}}">您的手机号码是{{name}}-{{mobile}}跳转</button>
<view class="banquan">**** © Copyright 版权所有</view>
js页面代码:
// pages/yuyue/yuyue.js
Page({
/**
* 页面的初始数据
*/
data: {
yes_ok: false,
src: "https://md.lackeeden.com/images/yy_top_pic.jpg",
mode: "aspectFill"
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
inputvalue: function (e) {
this.setData({
name: e.detail.value
})
},
getPhoneNumber(e) {
var that = this;
wx.cloud.callFunction({
name: 'getMobile',
data: {
weRunData: wx.cloud.CloudID(e.detail.cloudID),
}
}).then(res => {
that.setData({
mobile: res.result,
name: that.data.name,
yes_ok:true,
uurl: 'https://md.lackeeden.com/md/index.php?shouji=' + res.result + '&xingming=' + that.data.name
})
}).catch(err => {
console.error(err);
});
},
buttonListener: function () {
var that = this
wx.navigateTo({
url: '/pages/tiaozhuang/tiaozhuang?shouji=' + that.data.mobile + '&ageData=' + that.data.username
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
版权声明:若无特殊注明,本文皆为《
傲世零零 》原创,转载请保留文章出处。
本文链接:微信小程序输入姓名判断然后获取手机号码并发送到web-view页面 http://www.wangjunjiang.com/?post=102
正文到此结束
发表吐槽
你肿么看?