提交 7fe5c5ca 编写于 作者: laizhilong's avatar laizhilong

登录注册改造

上级 53a4e0db
......@@ -71,13 +71,11 @@
</div>
</template>
<script lang="ts">
import {Vue, Component, Watch} from 'vue-property-decorator';
import {Environment} from '@/environments/environment';
//import Divider from "ibiz-vue-lib/lib/ibiz-vue-lib.common";
@Component({
components: {}
})
export default class Login extends Vue {
......@@ -140,6 +138,9 @@
this.setRules();
}
/**
* 挂载
*/
public mounted() {
this.getCookie();
}
......@@ -219,7 +220,6 @@
_this.$router.push('/register');
}
/**
* 设置cookie,保存账号密码
* @param loginname
......@@ -255,7 +255,15 @@
* @param thirdpart
*/
public tencentHandleClick(thirdpart: any) {
this.$Message.warning("qq授权登录暂未支持")
// this.$Message.warning("qq授权登录暂未支持");
var _this = this;
_this.$store.commit('SET_AUTH_TYPE', thirdpart);
const client_id = 'xxx';// 网站应用appid
const redirect_uri = 'xxx';// 回调地址
// const url = 'https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=' + client_id + '&redirect_uri=' + redirect_uri;
const url = 'https://baidu.com';
// 打开qq授权登录界面,授权成功后会重定向到回调地址
this.openWindow(url, thirdpart, 540, 540);
}
/**
......@@ -263,9 +271,34 @@
* @param thirddpart
*/
public wechatHandleClick(thirddpart: any) {
this.$Message.warning("微信授权登录暂未支持")
this.$Message.warning("微信授权登录暂未支持");
}
/**
* 打开一个新窗口
* @param url 链接地址
* @param title 窗口标题
* @param w 窗口宽度
* @param h 窗口高度
*/
public openWindow(url:any, title:any, w:any, h:any): void {
const dualScreenLeft = window.screenLeft;
const dualScreenTop = window.screenTop;
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
const left = ((width / 2) - (w / 2)) + dualScreenLeft;
const top = ((height / 2) - (h / 2)) + dualScreenTop;
const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow
if (window.focus && newWindow) {
newWindow.focus();
}
}
}
</script>
......
......@@ -200,7 +200,7 @@
closable: true
});
}
// 3s后跳转登录
// 3s后自动登录
this.countDown(3);
}
}).catch((e: any) => {
......@@ -222,7 +222,7 @@
}
/**
* 跳转登录倒计时
* 自动登录倒计时
*/
public countDown(totalTime: any): void {
if (!this.canClick) return;
......@@ -236,10 +236,7 @@
if (totalTime < 0) {
// 清除定时器
window.clearInterval(clock);
// 跳转到登录页
// this.$router.push("/login");
// 登录
// 登录请求
const loginname: any = this.form.loginname;
const password: any = this.form.password;
const post: Promise<any> = this.$http.post('v7/login', this.form, true);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册