diff --git a/src/assets/img/gitee_logo.png b/src/assets/img/gitee_logo.png new file mode 100644 index 0000000..9316273 Binary files /dev/null and b/src/assets/img/gitee_logo.png differ diff --git a/src/assets/img/gitee_logo.svg b/src/assets/img/gitee_logo.svg new file mode 100644 index 0000000..af03316 --- /dev/null +++ b/src/assets/img/gitee_logo.svg @@ -0,0 +1,17 @@ + + + + logo + Created with Sketch. + + \ No newline at end of file diff --git a/src/assets/img/github-logo.png b/src/assets/img/github-logo.png new file mode 100644 index 0000000..fff325f Binary files /dev/null and b/src/assets/img/github-logo.png differ diff --git a/src/views/pages/login.vue b/src/views/pages/login.vue index 2cbd63a..ad086bd 100644 --- a/src/views/pages/login.vue +++ b/src/views/pages/login.vue @@ -52,23 +52,37 @@

- - 第三方登录 -
+ + 第三方登录 + -
+ circle + > + + +
+ @@ -117,6 +131,8 @@ const rules = { }; // 表单引用 const login = ref(null); +const maxLoginRepeatRequest = 30; //最大请求次数 +const currentLoginRequest = ref(0); //当前请求次数 //表单数据 var loginData = ref({ @@ -139,7 +155,7 @@ const thirdLogin = async (type) => { return; } let result={}; - if(type !== "github" && type !== "qq") { + if(type !== "github" && type !== "qq" && type !== "gitee") { ElMessage.error("不支持的登录平台!请稍后再试:"+type); return; @@ -156,6 +172,12 @@ const thirdLogin = async (type) => { } //获取登录状态每2秒请求一次 let timer = setInterval(async () => { + currentLoginRequest.value++; + if (currentLoginRequest.value > maxLoginRepeatRequest) { + clearInterval(timer); + ElMessage.error("登录超时,请重新登录!"); + return; + } let statusResp = await getThirdPartyLoginStatus({uuid: uuid}); if (statusResp["code"] !== 0) { ElMessage.error("获取登录状态失败!请稍后再试"); @@ -318,4 +340,28 @@ const getMyUserInfo = async (id) => { font-size: 14px; color: #787878; } + +.login-text { + text-align: center; +} + +.login-btn { + width: 100%; + height: 40px; + line-height: 40px; + border-radius: 5px; + font-size: 16px; +} +.github-btn { + background-image: url(../../assets/img/github-logo.png) !important; +} + + +.gitee-btn { + background-image: url(../../assets/img/gitee_logo.png) !important; +} +.qq-btn { + background-image: url(https://wiki.connect.qq.com/wp-content/uploads/2016/12/Connect_logo_4.png); + +} diff --git a/src/views/pages/ucenter.vue b/src/views/pages/ucenter.vue index d528984..3e9c5b8 100644 --- a/src/views/pages/ucenter.vue +++ b/src/views/pages/ucenter.vue @@ -76,17 +76,31 @@ + 绑定

已绑定的第三方登录账号

@@ -139,6 +153,8 @@ const avatarImg = ref(''); const imgSrc = ref(''); const cropImg = ref(''); const cropper: any = ref(); +const maxLoginRepeatRequest = 30; //最大请求次数 +const currentLoginRequest = ref(0); //当前请求次数 const thirdPartyUserInfo = ref([]); @@ -363,7 +379,7 @@ const thirdLogin = async (type) => { return; } let result={}; - if(type !== "github" && type !== "qq") { + if(type !== "github" && type !== "qq" && type !== "gitee") { ElMessage.error("不支持的登录平台!请稍后再试:"+type); return; } @@ -379,6 +395,12 @@ const thirdLogin = async (type) => { } //获取登录状态每2秒请求一次 let timer = setInterval(async () => { + currentLoginRequest.value++; + if (currentLoginRequest.value > maxLoginRepeatRequest) { + clearInterval(timer); + ElMessage.error("登录超时,请重新登录!"); + return; + } let statusResp = await getThirdPartyLoginStatus({uuid: uuid}); if (statusResp["code"] !== 0) { ElMessage.error("获取登录状态失败!请稍后再试");