调用了接口

This commit is contained in:
luyuan 2020-10-09 09:45:13 +08:00
parent 1d0b8f2043
commit 645001f128
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,19 @@
import { get, post } from './base'
import { AxiosPromise } from 'axios'
/**
*
* @param phone
* @param type 0 1
*/
export function sendsms(phone: string, type?: number): Promise<AxiosPromise>{
return post('SendSms',{phone, type})
}
// 下面是示例接口 可以删除
/**
*
*/

View File

@ -1,5 +1,5 @@
import axios from 'axios'
axios.defaults.baseURL = 'https://theluyuan.com/api/';
axios.defaults.baseURL = 'http://beelink.com/home/';
axios.defaults.headers.common['Authorization'] = 'token';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

View File

@ -24,7 +24,7 @@
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
</a-select>
<div class="line"></div>
<a-input style="width: 50%" placeholder="请输入您的手机号" />
<a-input v-model:value="phone" style="width: 50%" placeholder="请输入您的手机号" />
</a-input-group>
</a-form-item>
<a-form-item label="验证码" class="form-item">
@ -147,6 +147,7 @@
import { defineComponent, ref } from "vue";
import LoginTab from "@/components/login/LoginTab.vue";
import NavTop from "@/components/NavTop.vue"
import { sendsms } from '@/api';
export default defineComponent({
name: "Login",
@ -161,7 +162,7 @@ export default defineComponent({
};
const tabselected = ref(1); //tab
const time = ref(60);//
const phone = ref(""); //
/**
* @param val 子组件传过来的值
*/
@ -176,7 +177,10 @@ export default defineComponent({
* 点击获取验证码 触发倒计时
*/
const getcode: () => void = () => {
console.log(11111);
console.log(phone.value);
sendsms("86" + phone.value, 0).then((res)=>{
console.log(res)
})
const timestep = setInterval(() => {
console.log(11112);
time.value = time.value - 1;
@ -194,6 +198,7 @@ export default defineComponent({
Selectnum,
getcode,
time,
phone
};
},
});
@ -385,7 +390,6 @@ export default defineComponent({
}
.relation{
height:29px;
background: gold;
display: flex;
line-height: 29px;
margin-top: 52px;