h5账号密码登录 修改(初始化)h5和app的登录密码
This commit is contained in:
@ -63,7 +63,7 @@ export function register(data) {
|
|||||||
*/
|
*/
|
||||||
export function registerReset(data) {
|
export function registerReset(data) {
|
||||||
return request.post('/register/reset', data, {
|
return request.post('/register/reset', data, {
|
||||||
login: false,
|
login: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between-wrapper">
|
<view class="item acea-row row-between-wrapper">
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
<button class="code font-color-red" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
|
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
|
||||||
@ -82,13 +82,24 @@ export default {
|
|||||||
password: that.password,
|
password: that.password,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
|
this.$yrouter.replace({
|
||||||
// that.$yrouter.push({ path: "/pages/user/Login/index" });
|
path: "/pages/user/Login/index",
|
||||||
|
query: {},
|
||||||
|
});
|
||||||
|
// getLogout()
|
||||||
|
// .then((res) => {
|
||||||
|
// this.$store.commit("logout");
|
||||||
|
// this.$yrouter.replace({
|
||||||
|
// path: "/pages/user/Login/index",
|
||||||
|
// query: {},
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// .catch((err) => {});
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -134,11 +145,24 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.ChangePassword {
|
.ChangePassword {
|
||||||
|
.title{
|
||||||
|
margin: 10rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
}
|
||||||
.list{
|
.list{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
padding: 0 10%;
|
padding: 0 10%;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
.code{}
|
.code{
|
||||||
|
width: 30%;
|
||||||
|
text-align: center;
|
||||||
|
color: #FFFFFF;
|
||||||
|
background-color: #f35749;
|
||||||
|
padding: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<view class="list" :hidden="current !== 0">
|
<view class="list" :hidden="current !== 0">
|
||||||
<form @submit.prevent="submit">
|
<form @submit.prevent="submit">
|
||||||
<view class="item getPhoneCode">
|
<view class="item getPhoneCode">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="phoneInput acea-row row-between-wrapper">
|
||||||
<input type="text" placeholder="输入手机号码"
|
<input type="text" placeholder="输入手机号码"
|
||||||
v-model="account" required/>
|
v-model="account" required/>
|
||||||
</view>
|
</view>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<input type="text" placeholder="输入密码" v-model="password" />
|
<input type="password" placeholder="输入密码" v-model="password" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="item">
|
<!-- <view class="item">
|
||||||
@ -134,8 +134,8 @@
|
|||||||
mixins: [sendVerifyCode],
|
mixins: [sendVerifyCode],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
// navList: ["手机号登录", "密码登录"],
|
navList: ["手机号登录", "密码登录"],
|
||||||
navList: ["手机号登录",],
|
// navList: ["手机号登录",],
|
||||||
current: 0,
|
current: 0,
|
||||||
account: "",
|
account: "",
|
||||||
password: "",
|
password: "",
|
||||||
@ -145,7 +145,7 @@
|
|||||||
type: "login",
|
type: "login",
|
||||||
timer: null,
|
timer: null,
|
||||||
clock: 60,
|
clock: 60,
|
||||||
clockText: '获取验证码'
|
clockText: '验证码'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -174,25 +174,33 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
return validatorDefaultCatch(e);
|
return validatorDefaultCatch(e);
|
||||||
}
|
}
|
||||||
loginMobile({
|
const res = await loginMobile({
|
||||||
account: that.account,
|
account: that.account,
|
||||||
captcha: that.captcha,
|
captcha: that.captcha,
|
||||||
spread: cookie.get("spread")
|
spread: cookie.get("spread")
|
||||||
})
|
})
|
||||||
.then(res => {
|
if (res.status === 200) {
|
||||||
var data = res.data;
|
this.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
|
||||||
that.$store.commit("login", data.token, dayjs(data.expires_time));
|
|
||||||
that.$store.dispatch('userInfo', true)
|
|
||||||
handleGetUserInfo();
|
handleGetUserInfo();
|
||||||
})
|
} else {
|
||||||
.catch(err => {
|
|
||||||
console.log(err)
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
title: res.msg || res.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
// .then(res => {
|
||||||
|
// that.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
|
||||||
|
// handleGetUserInfo();
|
||||||
|
// })
|
||||||
|
// .catch(err => {
|
||||||
|
// console.log(err)
|
||||||
|
// uni.showToast({
|
||||||
|
// title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
// icon: "none",
|
||||||
|
// duration: 2000
|
||||||
|
// });
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
async register() {
|
async register() {
|
||||||
var that = this;
|
var that = this;
|
||||||
@ -357,32 +365,21 @@
|
|||||||
return validatorDefaultCatch(e);
|
return validatorDefaultCatch(e);
|
||||||
}
|
}
|
||||||
// 账号密码登录
|
// 账号密码登录
|
||||||
login({
|
const res = await login({
|
||||||
username: account,
|
username: account,
|
||||||
password,
|
password,
|
||||||
spread: cookie.get("spread")
|
spread: cookie.get("spread")
|
||||||
})
|
})
|
||||||
.then(({
|
if (res.status === 200) {
|
||||||
data
|
this.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
|
||||||
}) => {
|
|
||||||
this.$store.commit("login", data.token, dayjs(data.expires_time));
|
|
||||||
handleGetUserInfo();
|
handleGetUserInfo();
|
||||||
// let replace=this.$yroute.query.replace
|
} else {
|
||||||
// if(replace){
|
|
||||||
|
|
||||||
// }
|
|
||||||
// this.$yrouter.replace({
|
|
||||||
// path: this.$yroute.query.replace || '/pages/home/index'
|
|
||||||
// });
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
title: res.msg || res.response.data.msg || err.response.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -398,10 +395,16 @@
|
|||||||
.getPhoneCode{
|
.getPhoneCode{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
.phoneInput{
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
.phoneCode{
|
.phoneCode{
|
||||||
|
width: 30%;
|
||||||
|
text-align: center;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
background-color: #f35749;
|
background-color: #f35749;
|
||||||
padding: 12rpx;
|
padding: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@
|
|||||||
<input type="text" v-else value="未绑定" disabled class="id" />
|
<input type="text" v-else value="未绑定" disabled class="id" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="item acea-row row-between-wrapper" @click="goChangePassword()">
|
<view class="item acea-row row-between-wrapper" @click="goChangePassword()">
|
||||||
<view>密码</view>
|
<view>密码</view>
|
||||||
<view class="input acea-row row-between-wrapper">
|
<view class="input acea-row row-between-wrapper">
|
||||||
<text>点击修改密码</text>
|
<text>点击修改密码</text>
|
||||||
<text class="iconfont icon-suozi"></text>
|
<text class="iconfont icon-suozi"></text>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
|
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
|
Reference in New Issue
Block a user