From 645001f1281083b61f268ad0f2c9c95604f00a6a Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Fri, 9 Oct 2020 09:45:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E4=BA=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 13 +++++++++++++ src/config/axiosConfig.ts | 2 +- src/views/login/Login.vue | 12 ++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 82f4cb2..b8ea3bf 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -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{ + return post('SendSms',{phone, type}) +} + + +// 下面是示例接口 可以删除 + /** * 请求用户信息 */ diff --git a/src/config/axiosConfig.ts b/src/config/axiosConfig.ts index 3fb503d..1bbf07a 100644 --- a/src/config/axiosConfig.ts +++ b/src/config/axiosConfig.ts @@ -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'; diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index 93aa905..7c1fcb9 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -24,7 +24,7 @@ Jiangsu
- + @@ -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;