Merge pull request 'zj' (#62) from zj into master

Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/62
This commit is contained in:
asd 2020-10-21 11:43:17 +08:00
commit 6a350e70f1
3 changed files with 133 additions and 29 deletions

View File

@ -395,21 +395,23 @@ export async function transactioninfo(data?: any){
/**
*
*/
export async function editpassword(data?:any) :Promise<void> {
export async function editpassword(data?:any) :Promise<any> {
console.log(data,111)
const newdata={
memberid:0,
password:"",
topassword:""
}
newdata.memberid=store.state.userinfo.memberid
newdata.memberid=data.memberid
newdata.password=data.password
newdata.topassword=data.topassword
newdata.topassword=data.repassword
console.log(newdata)
const res = await post<Liveaddrule>('resetPassword',newdata)
if(res.code==0){
message.success("修改成功")
}
return res
}
/**
@ -533,6 +535,47 @@ export async function addcomment(data?:any):Promise<void> {
}
return res
}
/**
*
*/
interface CheckuserRule{
memberid: number,
name: string,
mobile: string,
email: string,
code:string
}
interface CheckData{
data: {
memberid: any,
name: string,
mobile: string,
email: string,
code:string
},
code: number;
msg: string;
}
export async function checkuser(data?:any){
const newdata={number:""}
newdata.number=data.phone
const res = await get<CheckuserRule>('checkUser',newdata);
// console.log(res)
return {
code :res.code,
msg:res.msg,
data:{
memberid:res.data.memberid,
name: res.data.name,
mobile: res.data.mobile,
email: res.data.email,
code:res.data.code
}
}
}
/**
*
* @param phone

View File

@ -61,7 +61,7 @@
class="shuru"
v-model:value="userinfo.password"
/>
<div class="forget">忘记密码?</div>
<div class="forget"><router-link to="/reset">忘记密码?</router-link></div>
</a-input-group>
</a-form-item>
<div class="submit" @click="login">立即登录</div>

View File

@ -9,12 +9,12 @@
<div v-if="stepnow == 1">
<div class="nosign">
想起密码
<span class="tosign"> 去登录 </span>
<span class="tosign"><router-link to="/"> 去登录 </router-link></span>
</div>
<a-form :layout="formLayout">
<a-form-item label="账户名" class="form-item">
<a-input class="shuru" placeholder="请输入您的邮箱或者手机号" />
<a-input class="shuru" placeholder="请输入您的邮箱或者手机号" v-model:value="uinfo.phone"/>
</a-form-item>
<div class="submit" @click="next(2)">下一步</div>
@ -24,22 +24,15 @@
<div v-if="stepnow == 2">
<div class="nosign">
已有账号
<span class="tosign"> 去登录 </span>
<span class="tosign"><router-link to="/"> 去登录 </router-link></span>
</div>
<a-form :layout="formLayout">
<div class="signform">
<div style="display:flex">
<a-form-item label="手机号" class="shuru">
<div>13937984111</div>
</a-form-item>
<a-form-item label="手机号" class="shuru">
<div>{{uinfo.phone}}</div>
</a-form-item>
<a-form-item label="验证码" class="form-item yzm">
<!-- <a-input-group compact>
<div class="getcode" @/click="getcode">
点击获取验证码{{ time == 60 ? "" : "(" + time + ")" }}
</div>
<div class="line"></div>
<a-input style="width: 50%" placeholder="请输入您的验证码" />
</a-input-group> -->
<a-input-group compact>
<div class="getcode" @click="getcode">
@ -47,7 +40,7 @@
</div>
<div class="line"></div>
<a-input style="width: 50%" placeholder="请输入您的手机号" />
<a-input style="width: 50%" placeholder="请输入您的验证码" v-model:value="uinfo.code"/>
</a-input-group>
</a-form-item>
@ -55,16 +48,16 @@
<div style="display:flex">
<a-form-item label="设置密码" class="form-item">
<a-input class="shuru" placeholder="请再次输入您的密码" type="password"/>
<a-input class="shuru" placeholder="请再次输入您的密码" type="password" v-model:value="uinfo.password"/>
</a-form-item>
<a-form-item label="设置密码" class="form-item">
<a-input class="shuru" placeholder="请再次输入您的密码" type="password"/>
<a-input class="shuru" placeholder="请再次输入您的密码" type="password" v-model:value="uinfo.repassword"/>
</a-form-item>
</div>
</div>
<div class="submit" @click="next(3)">立刻注册</div>
<div class="submit" @click="next(3)">确认重置</div>
<div class="orginfo">Beelink公司版权所有 20192022</div>
</a-form>
</div>
@ -72,7 +65,7 @@
<div v-if="stepnow == 3">
<div class="nosign">您已完成密码重置</div>
<img src="@/static/images/success.png" alt="" class="success">
<div class="ale">恭喜您重置密码成功点击跳转到登录页面</div>
<div class="ale" @click="tologin">恭喜您重置密码成功点击跳转到登录页面</div>
</div>
</div>
<div :class="stepnow != 2 ? 'right' : 'right right1'">
@ -106,7 +99,10 @@
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import { checksmscode, checkuser, editpassword, sendsms } from '@/api';
import router from '@/router';
import { message } from 'ant-design-vue';
import { defineComponent, ref, toRaw } from "vue";
export default defineComponent({
name: "Sign",
components: {},
@ -115,13 +111,31 @@ export default defineComponent({
labelCol: 4,
wrapperCol: 14,
};
const uinfo=ref({
phone:"",
code:"",
password:"",
repassword:"",
quhao:"",
memberid:0
})
const time = ref(60); //
/**
* 点击获取验证码 触发60S倒计时
*/
let lock=false
const getcode: () => void = () => {
console.log(11111);
if (lock) {
console.log("lock")
return;
}
if (uinfo.value.phone == "") {
message.error("手机号不能为空");
return;
}
lock = true;
sendsms(uinfo.value.quhao + uinfo.value.phone, 0);
const timestep = setInterval(() => {
console.log(11112);
time.value = time.value - 1;
@ -145,13 +159,54 @@ export default defineComponent({
const stepnow = ref(1); //
/**
* @param e 跳转到步骤条的某一步
* 步骤条的当前值切换
*/
const next: (e: number) => void = (e: number) => {
stepnow.value = e;
const next: (e: number) => void = async (e: number) => {
if(e==2){
console.log(uinfo)
const res=await checkuser(toRaw(uinfo.value))
console.log(res.data.memberid)
if(res.code==0){
// stepnow.value = e;
uinfo.value.quhao = res.data.code.toString()
uinfo.value.memberid=res.data.memberid
console.log(uinfo)
stepnow.value=e
}else{
message.error("用户不存在")
}
}else if(e==3){
if(uinfo.value.phone==""|| uinfo.value.code==""|| uinfo.value.password==""|| uinfo.value.repassword==""){
message.error("请先完善相关信息")
return
}else if(uinfo.value.password!=uinfo.value.repassword){
message.error("两次密码输入不一致,请重新输入")
return
}
let checkcode=await checksmscode(uinfo.value.quhao+uinfo.value.phone,uinfo.value.code)
console.log(checkcode,"checked")
if(checkcode){
console.log(uinfo.value)
let res= await editpassword(toRaw(uinfo.value))
if(res.code==0){
stepnow.value=e
}
}else{
message.error("验证码有误,请重新输入")
}
}
};
function tologin (){
router.push("/")
}
return {
formLayout,
getcode,
@ -160,6 +215,8 @@ export default defineComponent({
ifagree,
stepnow,
next,
uinfo,
tologin
};
},
});
@ -173,7 +230,7 @@ export default defineComponent({
}
.ant-input:focus {
border: none;
border-bottom: 1px solid white !important;
border-bottom:none !important;
box-shadow: none;
}
.login ::v-deep(.ant-form-item-label) {
@ -217,6 +274,10 @@ export default defineComponent({
.tosign {
color: #0dbba4;
cursor: pointer;
a{
color: #0dbba4;
cursor: pointer;
}
}
.tab {
margin-bottom: 30px;
@ -238,7 +299,7 @@ export default defineComponent({
.getcode {
font-size: 15px;
color: #08ae98;
width: 119px;
width: 140px;
line-height: 30px;
cursor: pointer;
}
@ -291,7 +352,7 @@ export default defineComponent({
left:40px;
}
.right1 {
width: 230px !important;
width: 260px !important;
}
.right {
width: 690px;