diff --git a/common/http.api.js b/common/http.api.js index 81d51b6..747d5d1 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -44,6 +44,8 @@ const install = (Vue, vm) => { let tjfk = (params={})=>vm.$u.post('index.php/api/order/payment_voucher', params);//提交付款凭证 let getCode = (id)=>vm.$u.get(`/index.php/api/login/getnum/type/mobphone/to/${id}`);//获取注册码 let register = (params={})=>vm.$u.post('/index.php/api/login/reg', params);//注册 + let getCodeRepass = (id)=>vm.$u.get(`/index.php/api/login/getpwdnum/type/mobphone/to/${id}`);//获取验证码 + let changepwd = ( params)=>vm.$u.post(`/index.php/api/login/changepwd`, params);//修改密码 vm.$u.api = { getSearch, @@ -78,6 +80,8 @@ const install = (Vue, vm) => { upFile, tjfk, getCode, + getCodeRepass, + changepwd, register}; } diff --git a/manifest.json b/manifest.json index 4d43cdc..d3e5ae0 100644 --- a/manifest.json +++ b/manifest.json @@ -64,7 +64,7 @@ /* 小程序特有相关 */ "appid" : "wxe27470b2f09a2508", "setting" : { - "urlCheck" : true + "urlCheck" : false }, "permission" : {} } diff --git a/pages/login/login.vue b/pages/login/login.vue index 5ca7b06..cc9b447 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -17,9 +17,10 @@ placeholder-style="color: rgba(255,255,255,0.8);" /> 登 录 + - - + 用户注册 + 找回密码 @@ -200,7 +201,12 @@ justify-content: space-between; align-items: center; height: 100upx; + padding:0 10px; color: rgba($color: #ffffff, $alpha: 0.8); + + .textBtn{ + text-decoration: underline; + } } } diff --git a/pages/login/register.vue b/pages/login/register.vue index 92a0de2..1ca13cb 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -6,6 +6,9 @@ + + + {{getCodeText}} @@ -31,6 +34,7 @@ data() { return { phoneNumber:"", + userName:"", code:'', passwd:"", getCodeText:'获取验证码', @@ -43,6 +47,7 @@ }, methods: { Timer(){}, + //获取验证码 getCode(){ uni.hideKeyboard() if(this.getCodeisWaiting){ @@ -59,10 +64,15 @@ setTimeout(()=>{ uni.showToast({title: '验证码已发送',icon:"none"}); //示例默认1234,生产中请删除这一句。 - this.code=1234; + // this.code=1234; + this.$u.api.getCode(this.phoneNumber).then(res=>{ + debugger; + if(res.code===0){}else{} + }) this.setTimer(); },1000) }, + //定时器 setTimer(){ let holdTime = 60; this.getCodeText = "重新获取(60)" @@ -79,61 +89,86 @@ },1000) }, + //注册 doReg(){ + let that = this; uni.hideKeyboard() //模板示例部分验证规则 - if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))){ + if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(that.phoneNumber))){ uni.showToast({title: '请填写正确手机号码',icon:"none"}); return false; } - //示例验证码,实际使用中应为请求服务器比对验证码是否正确。 - if(this.code!=1234){ - uni.showToast({title: '验证码不正确',icon:"none"}); - return false; - } uni.showLoading({ title: '提交中...' }) + uni.login({ + provider: 'weixin', + success: function (loginRes) { + let params = {username:that.userName,mobphone:that.phoneNumber,code:loginRes.code,phone_code:that.code}; + that.$u.api.register(params).then(res=>{ + uni.hideLoading(); + debugger; + if(res.code===0){ + uni.reLaunch({ + url:'/pages/tabBar/home/home' + }) + that.$u.vuex('vuex_token', res.data.token) + that.$u.api.getInfo().then(res => { + that.$u.vuex('vuex_user', res.data) + if(res.data.icon===""){ + that.$u.vuex('vuex_user.icon', '/static/img/face.jpg') + }else{ + that.$u.vuex('vuex_user.icon', that.vuex_host + 'public/' + res.data.icon) + } + }) + }else{} + console.log(res) + + }) + }, + }) + //模板示例把用户注册信息储存在本地,实际使用中请替换为上传服务器。 - setTimeout(()=>{ - uni.getStorage({ - key: 'UserList', - success:(res)=>{ - //增加记录,密码md5 - res.data.push({username:this.phoneNumber,passwd:md5(this.passwd)}) - uni.setStorage({ - key: 'UserList', - data: res.data, - success: function () { - uni.hideLoading() - uni.showToast({title: '注册成功',icon:"success"}); - setTimeout(function(){ - uni.navigateBack(); - },1000) - } - }); - }, - fail:(e)=>{ - uni.hideLoading() - console.log('error'); - //新建UserList - uni.setStorage({ - key: 'UserList', - data: [{username:this.phoneNumber,passwd:md5(this.passwd)}], - success: function () { - uni.hideLoading() - uni.showToast({title: '注册成功',icon:"success"}); - setTimeout(function(){ - uni.navigateBack(); - },1000) - }, - fail:function(e){ - console.log('set error:'+JSON.stringify(e)); - } - }); - } - }); - },1000) + // setTimeout(()=>{ + // uni.getStorage({ + // key: 'UserList', + // success:(res)=>{ + // //增加记录,密码md5 + // res.data.push({username:this.phoneNumber,passwd:md5(this.passwd)}) + // uni.setStorage({ + // key: 'UserList', + // data: res.data, + // success: function () { + // uni.hideLoading() + // uni.showToast({title: '注册成功',icon:"success"}); + // setTimeout(function(){ + // uni.navigateBack(); + // },1000) + // } + // }); + // }, + // fail:(e)=>{ + // uni.hideLoading() + // console.log('error'); + // //新建UserList + // uni.setStorage({ + // key: 'UserList', + // data: [{username:this.phoneNumber,passwd:md5(this.passwd)}], + // success: function () { + // uni.hideLoading() + // uni.showToast({title: '注册成功',icon:"success"}); + // setTimeout(function(){ + // uni.navigateBack(); + // },1000) + // }, + // fail:function(e){ + // console.log('set error:'+JSON.stringify(e)); + // } + // }); + // } + // }); + // },1000) + // }, toLogin(){ uni.hideKeyboard() diff --git a/pages/login/resetpasswd.vue b/pages/login/resetpasswd.vue index c5aac71..eb55439 100644 --- a/pages/login/resetpasswd.vue +++ b/pages/login/resetpasswd.vue @@ -14,7 +14,7 @@ - + 重置密码 @@ -30,7 +30,7 @@ return { phoneNumber:"", code:'', - passwd:"", + password:"", getCodeText:'获取验证码', getCodeBtnColor:"#ffffff", getCodeisWaiting:false @@ -55,8 +55,10 @@ //示例用定时器模拟请求效果 setTimeout(()=>{ uni.showToast({title: '验证码已发送',icon:"none"}); - //示例默认1234,生产中请删除这一句。 - this.code=1234; + this.$u.api.getCodeRepass(this.phoneNumber).then(res=>{ + debugger; + if(res.code===0){}else{} + }) this.setTimer(); },1000) @@ -79,21 +81,38 @@ },1000) }, doReset(){ + let that = this; uni.hideKeyboard() //模板示例部分验证规则 if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))){ uni.showToast({title: '请填写正确手机号码',icon:"none"}); return false; } - - //示例验证码,实际使用中应为请求服务器比对验证码是否正确。 - if(this.code!=1234){ - uni.showToast({title: '验证码不正确',icon:"none"}); - return false; - } uni.showLoading({ title: '提交中...' }) + let params = {mobphone:that.phoneNumber,password:that.password,phone_code:that.code}; + that.$u.api.changepwd(params).then(res=>{ + uni.hideLoading(); + debugger; + if(res.code===0){ + uni.reLaunch({ + url:'/pages/tabBar/home/home' + }) + that.$u.vuex('vuex_token', res.data.token) + that.$u.api.getInfo().then(res => { + that.$u.vuex('vuex_user', res.data) + if(res.data.icon===""){ + that.$u.vuex('vuex_user.icon', '/static/img/face.jpg') + }else{ + that.$u.vuex('vuex_user.icon', that.vuex_host + 'public/' + res.data.icon) + } + }) + }else{} + console.log(res) + + }) + //模板示例修改本地储存的用户信息,实际使用中请替换为上传服务器修改。 setTimeout(()=>{ uni.getStorage({ diff --git a/pages/tabBar/user/user.vue b/pages/tabBar/user/user.vue index b674352..8c413c9 100644 --- a/pages/tabBar/user/user.vue +++ b/pages/tabBar/user/user.vue @@ -84,6 +84,7 @@ {{row.text}} + 修改密码 @@ -205,6 +206,11 @@ } }, + changePwd(){ + uni.navigateTo({ + url:'/pages/login/login' + }) + }, toMyQR(){ uni.navigateTo({ url:'../../user/myQR/myQR' diff --git a/static/css/login.scss b/static/css/login.scss index 8e88340..2008ba8 100644 --- a/static/css/login.scss +++ b/static/css/login.scss @@ -54,6 +54,7 @@ page { border-radius: 45upx; background-color: #fff; font-size: 40upx; + margin-bottom: 20upx!important; } } .re { diff --git a/static/img/1.jpg b/static/img/1.jpg index d5e66d2..34dd89a 100644 Binary files a/static/img/1.jpg and b/static/img/1.jpg differ diff --git a/static/img/2.jpg b/static/img/2.jpg index e644114..58d5982 100644 Binary files a/static/img/2.jpg and b/static/img/2.jpg differ diff --git a/static/img/3.jpg b/static/img/3.jpg index 345f9c3..f60cca4 100644 Binary files a/static/img/3.jpg and b/static/img/3.jpg differ diff --git a/static/img/goods/p1.jpg b/static/img/goods/p1.jpg deleted file mode 100644 index 0b48e5a..0000000 Binary files a/static/img/goods/p1.jpg and /dev/null differ diff --git a/static/img/goods/p10.jpg b/static/img/goods/p10.jpg deleted file mode 100644 index cd82918..0000000 Binary files a/static/img/goods/p10.jpg and /dev/null differ diff --git a/static/img/goods/p2.jpg b/static/img/goods/p2.jpg deleted file mode 100644 index 9720648..0000000 Binary files a/static/img/goods/p2.jpg and /dev/null differ diff --git a/static/img/goods/p3.jpg b/static/img/goods/p3.jpg deleted file mode 100644 index 59f79be..0000000 Binary files a/static/img/goods/p3.jpg and /dev/null differ diff --git a/static/img/goods/p4.jpg b/static/img/goods/p4.jpg deleted file mode 100644 index b56faab..0000000 Binary files a/static/img/goods/p4.jpg and /dev/null differ diff --git a/static/img/goods/p5.jpg b/static/img/goods/p5.jpg deleted file mode 100644 index ed4256e..0000000 Binary files a/static/img/goods/p5.jpg and /dev/null differ diff --git a/static/img/goods/p6.jpg b/static/img/goods/p6.jpg deleted file mode 100644 index 12427ec..0000000 Binary files a/static/img/goods/p6.jpg and /dev/null differ diff --git a/static/img/goods/p7.jpg b/static/img/goods/p7.jpg deleted file mode 100644 index 095a8bc..0000000 Binary files a/static/img/goods/p7.jpg and /dev/null differ diff --git a/static/img/goods/p8.jpg b/static/img/goods/p8.jpg deleted file mode 100644 index 7ca5682..0000000 Binary files a/static/img/goods/p8.jpg and /dev/null differ diff --git a/static/img/goods/p9.jpg b/static/img/goods/p9.jpg deleted file mode 100644 index 0114a08..0000000 Binary files a/static/img/goods/p9.jpg and /dev/null differ diff --git a/static/img/im/face/face_1.jpg b/static/img/im/face/face_1.jpg deleted file mode 100644 index f60cca4..0000000 Binary files a/static/img/im/face/face_1.jpg and /dev/null differ diff --git a/static/img/im/face/face_10.jpg b/static/img/im/face/face_10.jpg deleted file mode 100644 index b4f1a02..0000000 Binary files a/static/img/im/face/face_10.jpg and /dev/null differ diff --git a/static/img/im/face/face_11.jpg b/static/img/im/face/face_11.jpg deleted file mode 100644 index 385c210..0000000 Binary files a/static/img/im/face/face_11.jpg and /dev/null differ diff --git a/static/img/im/face/face_12.jpg b/static/img/im/face/face_12.jpg deleted file mode 100644 index 97a8703..0000000 Binary files a/static/img/im/face/face_12.jpg and /dev/null differ diff --git a/static/img/im/face/face_13.jpg b/static/img/im/face/face_13.jpg deleted file mode 100644 index dba5a72..0000000 Binary files a/static/img/im/face/face_13.jpg and /dev/null differ diff --git a/static/img/im/face/face_14.jpg b/static/img/im/face/face_14.jpg deleted file mode 100644 index 58d5982..0000000 Binary files a/static/img/im/face/face_14.jpg and /dev/null differ diff --git a/static/img/im/face/face_15.jpg b/static/img/im/face/face_15.jpg deleted file mode 100644 index 9348b8e..0000000 Binary files a/static/img/im/face/face_15.jpg and /dev/null differ diff --git a/static/img/im/face/face_2.jpg b/static/img/im/face/face_2.jpg deleted file mode 100644 index 3719376..0000000 Binary files a/static/img/im/face/face_2.jpg and /dev/null differ diff --git a/static/img/im/face/face_3.jpg b/static/img/im/face/face_3.jpg deleted file mode 100644 index 64adc57..0000000 Binary files a/static/img/im/face/face_3.jpg and /dev/null differ diff --git a/static/img/im/face/face_4.jpg b/static/img/im/face/face_4.jpg deleted file mode 100644 index 34dd89a..0000000 Binary files a/static/img/im/face/face_4.jpg and /dev/null differ diff --git a/static/img/im/face/face_5.jpg b/static/img/im/face/face_5.jpg deleted file mode 100644 index 0118566..0000000 Binary files a/static/img/im/face/face_5.jpg and /dev/null differ diff --git a/static/img/im/face/face_6.jpg b/static/img/im/face/face_6.jpg deleted file mode 100644 index bdf3ef0..0000000 Binary files a/static/img/im/face/face_6.jpg and /dev/null differ diff --git a/static/img/im/face/face_7.jpg b/static/img/im/face/face_7.jpg deleted file mode 100644 index 6463ed8..0000000 Binary files a/static/img/im/face/face_7.jpg and /dev/null differ diff --git a/static/img/im/face/face_8.jpg b/static/img/im/face/face_8.jpg deleted file mode 100644 index 5eefe4f..0000000 Binary files a/static/img/im/face/face_8.jpg and /dev/null differ diff --git a/static/img/im/face/face_9.jpg b/static/img/im/face/face_9.jpg deleted file mode 100644 index 15733fd..0000000 Binary files a/static/img/im/face/face_9.jpg and /dev/null differ diff --git a/static/img/q.jpg b/static/img/q.jpg deleted file mode 100644 index aba0011..0000000 Binary files a/static/img/q.jpg and /dev/null differ diff --git a/static/img/s1.jpg b/static/img/s1.jpg deleted file mode 100644 index 28162f3..0000000 Binary files a/static/img/s1.jpg and /dev/null differ diff --git a/static/img/s2.jpg b/static/img/s2.jpg deleted file mode 100644 index c07d4ee..0000000 Binary files a/static/img/s2.jpg and /dev/null differ diff --git a/static/img/shop/1.jpg b/static/img/shop/1.jpg deleted file mode 100644 index fe1d10d..0000000 Binary files a/static/img/shop/1.jpg and /dev/null differ diff --git a/static/img/shop/2.jpg b/static/img/shop/2.jpg deleted file mode 100644 index 154909f..0000000 Binary files a/static/img/shop/2.jpg and /dev/null differ diff --git a/static/img/shop/3.jpg b/static/img/shop/3.jpg deleted file mode 100644 index c72c320..0000000 Binary files a/static/img/shop/3.jpg and /dev/null differ diff --git a/static/img/shop/4.jpg b/static/img/shop/4.jpg deleted file mode 100644 index 189ffc6..0000000 Binary files a/static/img/shop/4.jpg and /dev/null differ diff --git a/static/voice/1.mp3 b/static/voice/1.mp3 deleted file mode 100644 index 3318c87..0000000 Binary files a/static/voice/1.mp3 and /dev/null differ diff --git a/static/voice/2.mp3 b/static/voice/2.mp3 deleted file mode 100644 index 7d8f557..0000000 Binary files a/static/voice/2.mp3 and /dev/null differ diff --git a/static/voice/3.aac b/static/voice/3.aac deleted file mode 100644 index 3e0f07b..0000000 Binary files a/static/voice/3.aac and /dev/null differ