登录接口
This commit is contained in:
parent
2a1e290d12
commit
e9a37efe02
@ -7,10 +7,14 @@ import { AxiosPromise } from 'axios'
|
|||||||
* @param type 类型 0国内 1国外
|
* @param type 类型 0国内 1国外
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function sendsms(phone: string, type?: number): Promise<AxiosPromise>{
|
export function sendsms(phone: string, type?: number): Promise<AxiosPromise>{
|
||||||
return post('SendSms',{phone, type})
|
return post('SendSms',{phone, type})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loginpass(phone: string, password: string): Promise<AxiosPromise>{
|
||||||
|
return post("login",{type: 2,username: phone, password: password})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 下面是示例接口 可以删除
|
// 下面是示例接口 可以删除
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
axios.defaults.baseURL = 'http://beelink.com/home/';
|
axios.defaults.baseURL = '/beelink/public/home/';
|
||||||
axios.defaults.headers.common['Authorization'] = 'token';
|
axios.defaults.headers.common['Authorization'] = 'token';
|
||||||
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
<a-input
|
<a-input
|
||||||
style="width: 80%"
|
style="width: 80%"
|
||||||
placeholder="请输入您的邮箱或者手机号"
|
placeholder="请输入您的邮箱或者手机号"
|
||||||
|
v-model:value="userinfo.phone"
|
||||||
/>
|
/>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -58,11 +59,12 @@
|
|||||||
placeholder="请输入您的密码"
|
placeholder="请输入您的密码"
|
||||||
type="password"
|
type="password"
|
||||||
class="shuru"
|
class="shuru"
|
||||||
|
v-model:value="userinfo.password"
|
||||||
/>
|
/>
|
||||||
<div class="forget">忘记密码?</div>
|
<div class="forget">忘记密码?</div>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<div class="submit">立即登录</div>
|
<div class="submit" @click="login">立即登录</div>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -144,10 +146,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref } from "vue";
|
import { defineComponent, reactive, ref } from "vue";
|
||||||
import LoginTab from "@/components/login/LoginTab.vue";
|
import LoginTab from "@/components/login/LoginTab.vue";
|
||||||
import NavTop from "@/components/NavTop.vue"
|
import NavTop from "@/components/NavTop.vue"
|
||||||
import { sendsms } from '@/api';
|
import { loginpass, sendsms } from '@/api';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Login",
|
name: "Login",
|
||||||
@ -163,6 +165,10 @@ export default defineComponent({
|
|||||||
const tabselected = ref(1); //tab切换的标志
|
const tabselected = ref(1); //tab切换的标志
|
||||||
const time = ref(60);//倒计时
|
const time = ref(60);//倒计时
|
||||||
const phone = ref(""); // 手机号
|
const phone = ref(""); // 手机号
|
||||||
|
const userinfo = reactive({
|
||||||
|
phone: '',
|
||||||
|
password: ''
|
||||||
|
})
|
||||||
/**
|
/**
|
||||||
* @param val 子组件传过来的值
|
* @param val 子组件传过来的值
|
||||||
*/
|
*/
|
||||||
@ -192,13 +198,22 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function login(): void {
|
||||||
|
console.log(userinfo.phone,userinfo.password)
|
||||||
|
loginpass(userinfo.phone,userinfo.password).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
formLayout,
|
formLayout,
|
||||||
tabselected,
|
tabselected,
|
||||||
Selectnum,
|
Selectnum,
|
||||||
getcode,
|
getcode,
|
||||||
time,
|
time,
|
||||||
phone
|
phone,
|
||||||
|
login,
|
||||||
|
userinfo
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -17,6 +17,10 @@ module.exports = {
|
|||||||
// 为生产环境修改配置...
|
// 为生产环境修改配置...
|
||||||
} else {
|
} else {
|
||||||
// 为开发环境修改配置...
|
// 为开发环境修改配置...
|
||||||
|
|
||||||
|
config.devServer = {
|
||||||
|
proxy: 'http://case.sy-my.net'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user