From 5e4db83a24149164ea0e87b44ec07513517135e0 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 14 Oct 2020 09:32:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=B8=90=E5=8F=B7=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/api/base.ts | 2 +- src/api/index.ts | 2 +- src/components/Menu.vue | 9 +++++++-- src/store/index.ts | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index 798af9f..8763fb7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,7 @@ import { getValue } from './utils/common'; export default defineComponent({ setup(){ if(getValue('token')){ - store.commit("login") + store.commit("login", true) store.dispatch("setUserInfo"); } } diff --git a/src/api/base.ts b/src/api/base.ts index 9c19fd8..a859850 100644 --- a/src/api/base.ts +++ b/src/api/base.ts @@ -10,9 +10,9 @@ export interface Get { } axios.interceptors.response.use((response)=>{ + return response; },(error)=>{ - message.error(error.response.data.message) return Promise.reject(error) }) diff --git a/src/api/index.ts b/src/api/index.ts index f6c0134..289fbd0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -23,7 +23,7 @@ export async function loginpass(phone: string, password: string){ message.error("存储错误, 请允许网页使用本地存储!") }else{ setToken(); - store.commit("login"); + store.commit("login", true); store.dispatch("setUserInfo"); router.push("/mine/archives") } diff --git a/src/components/Menu.vue b/src/components/Menu.vue index f179fde..1a22d07 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -21,7 +21,7 @@
-
+
帐号退出 @@ -190,12 +190,17 @@ export default defineComponent({ } + function logout(): void{ + store.commit("login", false) + router.replace("/"); + } return{ list, routeto, selnum, - userinfo + userinfo, + logout } } }) diff --git a/src/store/index.ts b/src/store/index.ts index 6461189..65a1479 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -13,8 +13,8 @@ export default createStore({ setUserInfo(state, userinfo){ state.userinfo = userinfo }, - login(state){ - state.islogin = true; + login(state, islogin: boolean){ + state.islogin = islogin; } }, actions: { From fb9ca6f04015a9c3da9e4296aace88e158657ec7 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 14 Oct 2020 10:25:49 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B3=A8=E5=86=8C=20=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 39 ++++++++++++++++---- src/views/login/Login.vue | 4 +- src/views/login/Sign.vue | 77 +++++++++++++++++++++++++-------------- 3 files changed, 82 insertions(+), 38 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 289fbd0..920bcf3 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -144,11 +144,11 @@ export async function getlivelist(data?:any) { * 列表统计 */ - interface StatisticList{ - liveInfo: any; - videoInfo: any; - studentInfo: any; - } +interface StatisticList{ +liveInfo: any; +videoInfo: any; +studentInfo: any; +} export async function getstatisticlist() { const res = await get('statistics'); @@ -166,8 +166,31 @@ export async function getstatisticlist() { interface Liveaddrule{ code:number, msg:string - } - export async function liveadd(data:any) { +} +export async function liveadd(data:any) { const res = await post('live',data); console.log(res) - } \ No newline at end of file +} + + +/** + * 发送验证码 + * @param phone 手机号 + * @param type 国外1 国内0 + */ +interface SendSms{ + code: number; + msg: string; +} + +export async function sendsms(phone: string, type: number): Promise{ + const res = await post("SendSms", {phone, type}); + console.log(res); + if(res.code == 0){ + message.success(res.msg); + return true; + }else{ + message.error(res.msg); + return false; + } +} \ No newline at end of file diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index af9261e..014d145 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -7,7 +7,7 @@ 您好,欢迎来到 Beelink
- 还没有账号? 成为一名Beelink老师 + 还没有账号? 成为一名Beelink老师
@@ -260,7 +260,7 @@ export default defineComponent({ margin-top: 17px; margin-bottom: 35px; } - .tosign { + .tosign > a { color: #0dbba4; cursor: pointer; } diff --git a/src/views/login/Sign.vue b/src/views/login/Sign.vue index d0d62e0..63df4cb 100644 --- a/src/views/login/Sign.vue +++ b/src/views/login/Sign.vue @@ -1,6 +1,6 @@