调用了接口
This commit is contained in:
		
							parent
							
								
									1d0b8f2043
								
							
						
					
					
						commit
						645001f128
					
				@ -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})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 下面是示例接口 可以删除
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 请求用户信息
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@ -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';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user