zj #69
@ -12,8 +12,15 @@ import { del, get, post, put, setToken } from './base'
|
||||
* @param password 密码
|
||||
*/
|
||||
|
||||
export async function loginpass(phone: string, password: string){
|
||||
const res = await post<LoginData>("login",{type: 2,username: phone, password: password});
|
||||
export async function loginpass(phone: string, password: string,type?:number,smscode?:string){
|
||||
let newdata={}
|
||||
if(type==1){
|
||||
newdata={type:type?type:2,username: phone, smscode: smscode}
|
||||
}else{
|
||||
newdata={type:type?type:2,username: phone, password: password}
|
||||
}
|
||||
|
||||
const res = await post<LoginData>("login",newdata);
|
||||
console.log(res.code)
|
||||
if(res.code == 1){
|
||||
message.error(res.msg)
|
||||
@ -576,6 +583,16 @@ export async function checkuser(data?:any){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区号列表
|
||||
*/
|
||||
export async function getquhaolist() {
|
||||
const res=await get("phonecodes")
|
||||
// console.log(res)
|
||||
return res.data
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
* @param phone 手机号
|
||||
@ -746,7 +763,20 @@ export async function cancellive(id: number, status: number){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改手机号
|
||||
*/
|
||||
export async function changetel(e:string) {
|
||||
const res = await put(`member/${store.state.userinfo.memberid}`,{mobile:e});
|
||||
console.log(res)
|
||||
if(res.code == 0){
|
||||
message.success("修改成功")
|
||||
return true;
|
||||
}else{
|
||||
message.error(res.msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ export default createStore({
|
||||
country: "",
|
||||
countryValue: "",
|
||||
cover: "",
|
||||
code:"",
|
||||
created_at: "",
|
||||
currency: "",
|
||||
currencyValue: "",
|
||||
|
1
src/types/index.d.ts
vendored
1
src/types/index.d.ts
vendored
@ -61,6 +61,7 @@ export interface UserInfo {
|
||||
video: string;
|
||||
desc: string;
|
||||
money: string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,11 +17,17 @@
|
||||
<a-form :layout="formLayout">
|
||||
<a-form-item label="手机号" class="form-item">
|
||||
<a-input-group compact>
|
||||
<a-select default-value="Zhejiang" class="getcode">
|
||||
<!-- <a-select default-value="Zhejiang" class="getcode">
|
||||
<a-select-option value="Zhejiang">
|
||||
中国+0086
|
||||
</a-select-option>
|
||||
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
|
||||
</a-select> -->
|
||||
<a-select :default-value="quhaolist[0].code" size="small" @change="getquhao" class="getcode">
|
||||
<a-select-option v-for="(i,j) in quhaolist" :key="j" :value="i.code">
|
||||
{{i.name}}+{{i.code}}
|
||||
</a-select-option>
|
||||
<!-- <a-select-option value="Jiangsu"> Jiangsu </a-select-option> -->
|
||||
</a-select>
|
||||
<div class="line"></div>
|
||||
<a-input v-model:value="phone" style="width: 50%" placeholder="请输入您的手机号" />
|
||||
@ -33,10 +39,10 @@
|
||||
点击获取验证码{{ time == 60 ? "" : "(" + time + ")" }}
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<a-input style="width: 50%" placeholder="请输入您的验证码" />
|
||||
<a-input style="width: 50%" placeholder="请输入您的验证码" v-model:value="code"/>
|
||||
</a-input-group>
|
||||
</a-form-item>
|
||||
<div class="submit">立即登录</div>
|
||||
<div class="submit" @click="sublogin">立即登录</div>
|
||||
<div>Beelink公司版权所有 2019—2022</div>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -146,10 +152,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, ref } from "vue";
|
||||
import { defineComponent, onMounted, reactive, ref } from "vue";
|
||||
import LoginTab from "@/components/login/LoginTab.vue";
|
||||
import NavTop from "@/components/NavTop.vue"
|
||||
import { loginpass } from '@/api';
|
||||
import { getquhaolist, loginpass, sendsms } from '@/api';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: "Login",
|
||||
@ -165,10 +172,26 @@ export default defineComponent({
|
||||
const tabselected = ref(1); //tab切换的标志
|
||||
const time = ref(60);//倒计时
|
||||
const phone = ref(""); // 手机号
|
||||
const code =ref("")
|
||||
const myquhao=ref("86")
|
||||
const userinfo = reactive({
|
||||
phone: '13152639856',
|
||||
password: '123456'
|
||||
})
|
||||
const quhaolist = ref<any>([
|
||||
{
|
||||
code: "86",
|
||||
id: 214,
|
||||
name: "中国"
|
||||
}
|
||||
])
|
||||
|
||||
onMounted(async ()=>{
|
||||
quhaolist.value=await getquhaolist()
|
||||
console.log(quhaolist.value,"listsssss")
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* @param val 子组件传过来的值
|
||||
*/
|
||||
@ -182,10 +205,25 @@ export default defineComponent({
|
||||
* @param
|
||||
* 点击获取验证码 触发倒计时
|
||||
*/
|
||||
let lock=false
|
||||
const getcode: () => void = () => {
|
||||
console.log(phone.value);
|
||||
const timestep = setInterval(() => {
|
||||
if (lock) {
|
||||
console.log("lock")
|
||||
return;
|
||||
}
|
||||
if (phone.value == "") {
|
||||
message.error("手机号不能为空");
|
||||
return;
|
||||
}
|
||||
lock = true;
|
||||
console.log(myquhao.value,"quhao")
|
||||
sendsms(myquhao.value + phone.value, 0);
|
||||
const timestep = setInterval(() => {
|
||||
console.log(11112);
|
||||
|
||||
|
||||
|
||||
time.value = time.value - 1;
|
||||
if (time.value > 0) {
|
||||
console.log();
|
||||
@ -195,11 +233,21 @@ export default defineComponent({
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
function getquhao(e ?:any){
|
||||
console.log(e)
|
||||
myquhao.value=e.toString()
|
||||
console.log(myquhao.value)
|
||||
}
|
||||
function login(): void {
|
||||
console.log(userinfo.phone,userinfo.password)
|
||||
loginpass(userinfo.phone,userinfo.password)
|
||||
|
||||
}
|
||||
|
||||
function sublogin(){
|
||||
console.log(11)
|
||||
loginpass(phone.value,'',1,code.value)
|
||||
}
|
||||
return {
|
||||
formLayout,
|
||||
tabselected,
|
||||
@ -208,7 +256,12 @@ export default defineComponent({
|
||||
time,
|
||||
phone,
|
||||
login,
|
||||
userinfo
|
||||
userinfo,
|
||||
quhaolist,
|
||||
getquhao,
|
||||
code,
|
||||
myquhao,
|
||||
sublogin
|
||||
};
|
||||
},
|
||||
});
|
||||
|
@ -209,7 +209,7 @@
|
||||
<div class="form-item">
|
||||
<label class="label">手机验证码</label>
|
||||
<a-input size="small" v-model:value="verificationCode" />
|
||||
<div @click="sendVerificationCode(userinfo.mobile)" class="confirm-btn">获取验证码<span v-if="remainTime>0">({{ remainTime }}s)</span></div>
|
||||
<div @click="sendVerificationCode(userinfo.code+userinfo.mobile)" class="confirm-btn">获取验证码<span v-if="remainTime>0">({{ remainTime }}s)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div @click="nextPhoneStep" class="confirm-btn">下一步</div>
|
||||
@ -220,15 +220,25 @@
|
||||
<div class="form-box">
|
||||
<div class="form-item">
|
||||
<label class="label">手机号</label>
|
||||
<a-input size="small" v-model:value="bindPhone.number" />
|
||||
<!-- <a-input size="small" v-model:value="bindPhone.number" /> -->
|
||||
<a-input-group compact class="telbox">
|
||||
<a-select :default-value="quhaolist[0].code" size="small" @change="getquhao">
|
||||
<a-select-option v-for="(i,j) in quhaolist" :key="j" :value="i.code">
|
||||
{{i.name}}+{{i.code}}
|
||||
</a-select-option>
|
||||
<!-- <a-select-option value="Jiangsu"> Jiangsu </a-select-option> -->
|
||||
</a-select>
|
||||
<div class="line"></div>
|
||||
<a-input v-model:value="mynewtel" size="small" placeholder="请输入您的手机号" />
|
||||
</a-input-group>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="label">手机验证码</label>
|
||||
<a-input size="small" v-model:value="bindPhone.code" />
|
||||
<div @click="sendVerificationCode" class="confirm-btn">获取验证码<span v-if="remainTime>0">({{ remainTime }}s)</span></div>
|
||||
<div @click="sendVerificationCode(myquhao+mynewtel)" class="confirm-btn">获取验证码<span v-if="remainTime>0">({{ remainTime }}s)</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div @click="nextPhoneStep" class="confirm-btn">绑定手机</div>
|
||||
<div @click="updatePhoneNumber" class="confirm-btn">绑定手机</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
<!-- 修改密码 -->
|
||||
@ -277,7 +287,7 @@ import { uploadflie } from "@/utils/vod"
|
||||
import store from '@/store';
|
||||
import smile from "@/static/images/smile.png"
|
||||
import smilet from "@/static/images/smilet.png"
|
||||
import { editpassword, getarchives, getlanguages, putmember, sendsms } from "@/api/index"
|
||||
import { changetel, checksmscode, editpassword, getarchives, getlanguages, getquhaolist, putmember, sendsms } from "@/api/index"
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
export default defineComponent({
|
||||
@ -306,9 +316,16 @@ export default defineComponent({
|
||||
|
||||
const chiveslist = ref<any>([[],[]]);
|
||||
const languages = ref<unknown>([])
|
||||
const quhaolist = ref<any>([])
|
||||
const myquhao=ref<string>("")
|
||||
|
||||
const mynewtel=ref<string>("")
|
||||
onMounted(async ()=>{
|
||||
chiveslist.value = await getarchives()
|
||||
languages.value = await getlanguages()
|
||||
quhaolist.value=await getquhaolist()
|
||||
myquhao.value=quhaolist.value[0].code
|
||||
console.log(quhaolist.value,"listsssss")
|
||||
})
|
||||
|
||||
/**
|
||||
@ -370,10 +387,11 @@ export default defineComponent({
|
||||
/**
|
||||
* 发送验证码
|
||||
*/
|
||||
function sendVerificationCode(phone: string): void {
|
||||
function sendVerificationCode(tel: string): void {
|
||||
if(remainTime.value === 0) {
|
||||
computedVerificationCode();
|
||||
sendsms(phone, 0)
|
||||
console.log(tel,"send")
|
||||
sendsms(tel, 0)
|
||||
}
|
||||
}
|
||||
// 绑定手机号是否是第二步
|
||||
@ -389,16 +407,45 @@ export default defineComponent({
|
||||
/**
|
||||
* 绑定手机号下一步
|
||||
*/
|
||||
function nextPhoneStep(): void {
|
||||
isSecondStep.value = true;
|
||||
async function nextPhoneStep(): Promise<void> {
|
||||
|
||||
remainTime.value = 0
|
||||
if(!isSecondStep.value){
|
||||
console.log(formData.value.code)
|
||||
if(verificationCode.value == ""){
|
||||
return ;
|
||||
}
|
||||
const res=await checksmscode(formData.value.code+formData.value.mobile,verificationCode.value)
|
||||
console.log(res,"0.0")
|
||||
if(res){
|
||||
isSecondStep.value = true;
|
||||
}
|
||||
// isSecondStep.value = true;
|
||||
}
|
||||
|
||||
|
||||
// isSecondStep.value = true;
|
||||
}
|
||||
/**
|
||||
* 修改手机号
|
||||
* @return { void }
|
||||
*/
|
||||
function updatePhoneNumber (): void {
|
||||
async function updatePhoneNumber (): Promise<void> {
|
||||
console.log('修改手机号');
|
||||
|
||||
console.log(mynewtel.value,myquhao.value,bindPhone.code)
|
||||
const res=await checksmscode(myquhao.value+mynewtel.value,bindPhone.code.toString())
|
||||
console.log(res,"xiugai")
|
||||
if(res){
|
||||
const res1=await changetel(mynewtel.value)
|
||||
if(res1){
|
||||
store.dispatch("setUserInfo");
|
||||
updatePhoneVisible.value=false
|
||||
}
|
||||
}
|
||||
}
|
||||
function getquhao(e ?:any){
|
||||
console.log(e)
|
||||
myquhao.value=e.toString()
|
||||
}
|
||||
// 是否显示修改密码框
|
||||
const updatePasswordVisible: Ref<boolean> = ref(false);
|
||||
@ -553,7 +600,11 @@ export default defineComponent({
|
||||
chiveslist,
|
||||
languages,
|
||||
uploadprogress,
|
||||
choosewillsay
|
||||
choosewillsay,
|
||||
mynewtel,
|
||||
quhaolist,
|
||||
getquhao,
|
||||
myquhao
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -567,6 +618,10 @@ export default defineComponent({
|
||||
padding: 46px;
|
||||
border-radius: 17px;
|
||||
position: relative;
|
||||
.telbox{
|
||||
margin-left:15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.update-btn {
|
||||
font-size: 11px;
|
||||
color: #08AE98;
|
||||
|
Loading…
Reference in New Issue
Block a user