ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:73.69KB ,
资源ID:6916691      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6916691.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(微信小程序开发项目教程慕课版教案 1211页.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

微信小程序开发项目教程慕课版教案 1211页.docx

1、微信小程序开发项目教程慕课版教案 1211页第6章 莫凡商城的注册、登录功能课时内容注册、登录功能实战1课时2教学目标掌握登录功能、“我的”界面列表式导航功能(2)的实现教学重点登录功能、“我的”界面列表式导航功能(2)的实现教学难点登录功能、“我的”界面列表式导航功能(2)的实现教学设计1.教学思路:通过实战实现登录功能、“我的”界面列表式导航功能(2)。2.教学手段:多媒体+计算机3.教学资料:教材、多媒体课件教学内容6.6 项目实战:任务3实现登录功能1任务目标通过实现莫凡商城的登录功能,学会登录功能要应用到的组件和API接口的使用方法,并能举一反三,实现其他类似的登录功能。莫凡商城登录

2、功能提供两种登录方式:账号密码登录和手机快捷登录。通过页签的切换,可以选择使用哪种方式进行登录,如图所示。 账号密码登录 手机快捷登录2任务实施下面我们一起来实现莫凡商城登录功能。 (1)在app.json文件里添加注册页面路径“pages/login/login”。(2)在login.json文件里配置导航标题,示例代码如下。 navigationBarTitleText: 登录(3) 在login.wxml页面文件里进行登录表单布局,需要使用view容器组件、form表单组件、swiper滑块视图容器组件和button按钮组件,示例代码如下。 账号密码登录 手机快捷登录 账号 密码 登录

3、没有账号?注册 tip 手机号 yzmvalue timevalues 验证码 登录 没有账号?注册 tip (4)在login.wxss样式文件里对登录表单布局进行样式渲染,示例代码如下。.loginTitle display: flex; flex-direction: row; width: 100%; font-size: 15px;.select color: #009966; width: 50%; text-align: center; height: 48px; line-height: 48px; border-bottom:5rpx solid #009966; font-

4、weight: bold;.default margin: 0 auto; padding: 15px;.hr height: 1px; width: 100%; background-color: #666666; opacity: 0.2;.account display: flex; flex-direction: row;.ac padding:15px; font-size:15px; font-weight: bold; color: #666666;.ipt padding-top:10px;.ipt input text-align: left; width: 200px; c

5、olor: #000000;.placeholder-style font-size: 14px; color: #cccccc;.login margin: 0 auto; text-align: center; padding-top:10px; .login button width: 96%; color: #ffffff; background: #009966;.fp font-size: 13px; color: #3e13da; padding:5px; text-align: right; margin-right:10px; margin-top:10px; .btn po

6、sition: absolute; right: 10px; top: 10px; width: 90px; font-size: 12px; color: #666666; background-color: #f2f2f2;.tip margin-top:10px; font-size: 12px; color: #D53E37;(5)在login.js业务逻辑处理文件中,进行登录表单切换、登录表单验证,然后将登录表单提交到后台服务器中进行登录,示例代码如下。var app = getApp();var host = app.globalData.host;var timer;var ti

7、meSecond = false, sendBolen = false;Page( data: currentTab: 0, winWidth: 0, winHeight: 0, tip: , form_info: , yzmvalue: 获取验证码, mobile: , timevalue: 60, flag: true, verifyCode: , onLoad: function (options) var userId = wx.getStorageSync(userId); if (userId = ) this.checklogin(); else wx.reLaunch( url

8、: ./index/index, ) var page = this; wx.getSystemInfo( success: function (res) console.log(res); page.setData( winWidth: res.windowWidth ); page.setData( winHeight: res.windowHeight ); ) , switchNav: function (e) var that = this; if (this.data.currentTab = e.target.dataset.current) return false; else

9、 that.setData( currentTab: e.target.dataset.current ); that.setData( tip: ); that.setData( form_info: ); , toRegister: function (e) wx.navigateTo( url: ./register/register ) , formSubmit: function (e) var that = this; var loginName = e.detail.value.loginName; var mobile = e.detail.value.mobile; var

10、loginPassword = e.detail.value.loginPassword; var verifyCode = e.detail.value.verifyCode; var loginType = that.data.currentTab; var code = app.globalData.code; /验证表单输入 var ret = that.checkLogin(loginName, mobile, loginPassword, verifyCode, loginType); if (ret) wx.request( url: host + /api/user/swxLo

11、gin, method: GET, data: loginName: loginName, mobile: mobile, loginPassword: loginPassword, verifyCode: verifyCode, loginType: loginType, code: code , header: Content-Type: application/json , success: function (res) console.log(res); var code = res.data.code; var msg = res.data.data; if (code = 0000

12、) app.globalData.userId = res.data.data.user.userId; wx.setStorageSync(userId, res.data.data.user.id); wx.setStorageSync(nickName, res.data.data.user.nickName) wx.setStorageSync(swx_session, res.data.data.swx_session); wx.setStorageSync(userMobile, res.data.data.user.mobile); wx.setStorageSync(openI

13、d, res.data.data.openId); wx.setStorageSync(token, res.data.data.token); wx.reLaunch( url: ./index/index ) console.log(2) else that.setData( tip: msg ); return false ) , checkLogin: function (loginName, mobile, loginPassword, verifyCode, loginType) var that = this; if (loginType = 0) if (loginName =

14、 ) that.setData( tip: 用户名不能为空! ); return false if (loginPassword = ) that.setData( tip: 密码不能为空! ); return false else if (mobile = ) that.setData( tip: 手机号不能为空! ); return false var myreg = /13, 4, 5, 7, 80-99$/; if (!myreg.test(mobile) that.setData( tip: 手机号不合法! ); return false; if (verifyCode = ) th

15、at.setData( tip: 验证码不能为空! ); return false that.setData( tip: ); return true , checklogin: function () /登录页面进行一次获取新的code wx.login( success: function (data) console.log(data) app.globalData.code = data.code; ) , getcode: function (e) var that = this; if (that.data.mobile = ) that.setData( tip: 请输入手机号

16、); return false; var myreg = /13, 4, 5, 7, 80-99$/; if (!myreg.test(that.data.mobile) that.setData( tip: 手机号不合法! ); return false; that.setData( tip: );/去除提示 that.setData( flag: false );/显示时间 timer = setInterval(that.settime, 1000);/验证码倒计时 wx.request( url: host + /api/user/getVerifyCode, method: GET,

17、 data: mobile: this.data.mobile , header: Content-Type: application/json , success: function (res) console.log(res); var code = res.data.code; var msg = res.data.data; if (code = 0000) clearInterval(timer); that.setData( verifyCode: msg ); else clearInterval(timer); that.setData( yzmvalue: 获取验证码, ti

18、mevalue: 60, flag: true ); that.setData( tip: msg ); return false ) , getMobile: function (e) this.setData( mobile: e.detail.value ) , settime: function () var timevalue = this.data.timevalue; if (timevalue = 0) clearInterval(timer) this.setData( yzmvalue: 重新获取, timevalue: 60, flag: true ) timeSecon

19、d = false; sendBolen = false; return; timevalue-; timeSecond = true; sendBolen = true; this.setData( timevalue: timevalue, flag: false ) , )登录功能是很常用的功能,我们可以通过莫凡商城项目学会登录功能的设计及实现方法,通过综合应用view容器组件、form表单组件、swiper滑块视图容器组件、button按钮组件进一步理解组件的使用;同时,我们还应用了wx.request网络请求API、setInterval定时器API及缓存相关API接口,这些都是常用

20、的功能。6.7 项目实战:任务4实现“我的”界面列表式导航功能(2)1任务目标通过实现莫凡商城“我的”界面列表式导航功能,学会列表式导航设计的方式。很多App都会采用列表式导航设计,本任务的实现对其他类似项目的设计都有借鉴作用。莫凡商城“我的”界面包括账号登录区域、我的订单区域、列表式导航区域,如图所示。 “我的”界面2任务实施下面我们一起来实现莫凡商城“我的”界面列表式导航功能。 (1)在app.json文件里添加我的页面路径“pages/me/me”。(2)在me.wxml页面文件里进行账号区域布局设计、我的订单区域布局设计、列表式导航布局设计,示例代码如下。 nickName 我的订单 待付款 待收货 image src=/pages/images/icon/dpj.

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1