// pages/choose_name/choose_name.js Page({ /** * 页面的初始数据 */ data: { }, option1: function(e) { wx.setStorageSync('call_kind', '1'); wx.navigateTo({ url: '/pages/call_the_name/call_the_name', }) }, option2: function(e) { wx.setStorageSync('call_kind', '2'); wx.showModal({ editable:true,//显示输入框 placeholderText:'输入学号尾数',//显示输入框提示信息 success: res => { if (res.confirm) { //点击了确认 console.log(res.content);//用户输入的值 wx.setStorageSync("lastNum", res.content); wx.navigateTo({ url: '/pages/call_the_name/call_the_name', }) } else { console.log('用户点击了取消') } } }) }, option3: function(e) { wx.setStorageSync('call_kind', '3'); wx.showModal({ editable:true,//显示输入框 placeholderText:'输入姓氏',//显示输入框提示信息 success: res => { if (res.confirm) { //点击了确认 console.log(res.content);//用户输入的值 wx.setStorageSync("firstname", res.content); wx.navigateTo({ url: '/pages/call_the_name/call_the_name', }) } else { console.log('用户点击了取消') } } }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, })