|
@ -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};
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
/* 小程序特有相关 */
|
||||
"appid" : "wxe27470b2f09a2508",
|
||||
"setting" : {
|
||||
"urlCheck" : true
|
||||
"urlCheck" : false
|
||||
},
|
||||
"permission" : {}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
placeholder-style="color: rgba(255,255,255,0.8);" />
|
||||
</view>
|
||||
<view class="btn" @tap="doLogin">登 录</view>
|
||||
|
||||
<view class="res">
|
||||
<!-- <view @tap="toPage('register')">用户注册</view> -->
|
||||
<!-- <view @tap="toPage('resetpassword')">忘记密码</view> -->
|
||||
<view class="textBtn" @tap="toPage('register')">用户注册</view>
|
||||
<view class="textBtn" @tap="toPage('resetpasswd')">找回密码</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 第三方登录 -->
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="form re">
|
||||
<view class="username">
|
||||
<input placeholder="请输入用户账号" v-model="userName" placeholder-style="color: rgba(255,255,255,0.8);"/>
|
||||
</view>
|
||||
<view class="username">
|
||||
<view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">{{getCodeText}}</view>
|
||||
<input placeholder="请输入手机号" v-model="phoneNumber" placeholder-style="color: rgba(255,255,255,0.8);"/>
|
||||
|
@ -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()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<input placeholder="请输入验证码" v-model="code" placeholder-style="color: rgba(255,255,255,0.8);"/>
|
||||
</view>
|
||||
<view class="password">
|
||||
<input placeholder="请输入密码" v-model="passwd" password=true placeholder-style="color: rgba(255,255,255,0.8);"/>
|
||||
<input placeholder="请输入密码" v-model="password" password=true placeholder-style="color: rgba(255,255,255,0.8);"/>
|
||||
</view>
|
||||
<view class="btn" @tap="doReset">重置密码</view>
|
||||
|
||||
|
@ -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({
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
</view>
|
||||
<view class="text">{{row.text}}</view>
|
||||
</view>
|
||||
<view @click="changePwd">修改密码</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 占位 -->
|
||||
|
@ -205,6 +206,11 @@
|
|||
}
|
||||
|
||||
},
|
||||
changePwd(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/login/login'
|
||||
})
|
||||
},
|
||||
toMyQR(){
|
||||
uni.navigateTo({
|
||||
url:'../../user/myQR/myQR'
|
||||
|
|
|
@ -54,6 +54,7 @@ page {
|
|||
border-radius: 45upx;
|
||||
background-color: #fff;
|
||||
font-size: 40upx;
|
||||
margin-bottom: 20upx!important;
|
||||
}
|
||||
}
|
||||
.re {
|
||||
|
|
BIN
static/img/1.jpg
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
static/img/2.jpg
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 2.3 KiB |
BIN
static/img/3.jpg
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.8 KiB |
BIN
static/img/q.jpg
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 4.2 KiB |