Commit 962770a7 by xiongyuwen

no message

parent 7611fdc5
...@@ -52,10 +52,10 @@ export default { ...@@ -52,10 +52,10 @@ export default {
* createQrcode('https://xxx.com/') * createQrcode('https://xxx.com/')
*/ */
createQrcode(link) { createQrcode(link) {
if (link == "https://wiki.bailuntec.com/category") { if (link == "http://wiki.bailuntec.com/category") {
link = "https://wiki.bailuntec.com/"; link = "https://wiki.bailuntec.com/";
} }
if (link == "https://discuz.bailuntec.com/category") { if (link == "http://discuz.bailuntec.com/category") {
link = "https://discuz.bailuntec.com/"; link = "https://discuz.bailuntec.com/";
} }
......
...@@ -35,7 +35,7 @@ import config from "@/config.js"; ...@@ -35,7 +35,7 @@ import config from "@/config.js";
export default { export default {
data() { data() {
return { return {
userId: this.$store.getters["session/get"]("userId"), // 获取当前登陆用户的ID userId: "", // 获取当前登陆用户的ID
userInfo: "", userInfo: "",
qywxUserid: "", qywxUserid: "",
loading: false, loading: false,
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
const params = { const params = {
include: "groups,wechat", include: "groups,wechat",
}; };
this.userId=localStorage.getItem("user_id");
if (!this.userId) { if (!this.userId) {
this.getCode(); this.getCode();
} }
......
...@@ -38,7 +38,7 @@ import head from "@/mixin/head"; ...@@ -38,7 +38,7 @@ import head from "@/mixin/head";
import handleError from "@/mixin/handleError"; import handleError from "@/mixin/handleError";
import loginAbout from "@/mixin/loginAbout"; import loginAbout from "@/mixin/loginAbout";
import service from "../../api/request"; import service from "../../api/request";
import axios from "@/plugins/axios.js" import axios from "@/plugins/axios.js";
import "@/plugins/qrcode.js"; import "@/plugins/qrcode.js";
export default { export default {
...@@ -49,7 +49,10 @@ export default { ...@@ -49,7 +49,10 @@ export default {
title: this.$t("user.login"), title: this.$t("user.login"),
userName: "", userName: "",
passWord: "", passWord: "",
state:"", userInfo: "",
userId: localStorage.getItem("user_id"), // 获取当前登陆用户的ID
qywxUserid: "",
state: "",
checked: true, checked: true,
activeName: "0", // 默认激活tab activeName: "0", // 默认激活tab
site_mode: "", // 站点模式 site_mode: "", // 站点模式
...@@ -59,8 +62,8 @@ export default { ...@@ -59,8 +62,8 @@ export default {
canReg: false, canReg: false,
ischeck: true, ischeck: true,
preurl: "/", preurl: "/",
bailunLoginShow:true, bailunLoginShow: true,
fourkLoginShow:false fourkLoginShow: false,
}; };
}, },
computed: { computed: {
...@@ -71,8 +74,10 @@ export default { ...@@ -71,8 +74,10 @@ export default {
mounted() { mounted() {
const { code, preurl } = this.$route.query; const { code, preurl } = this.$route.query;
this.createCode(); if(this.userId)
this.create4kCode(); {
this.$router.push(`/category`);
}else{
this.code = this.getQueryVariable("code"); this.code = this.getQueryVariable("code");
this.state = this.getQueryVariable("state"); this.state = this.getQueryVariable("state");
if (preurl) { if (preurl) {
...@@ -80,6 +85,10 @@ export default { ...@@ -80,6 +85,10 @@ export default {
} }
if (this.code) { if (this.code) {
this.getStaffInfo(this.code); this.getStaffInfo(this.code);
} else {
this.createCode();
this.create4kCode();
this.pcwxgetCode();
} }
if (this.forums && this.forums.set_site && this.forums.set_site.site_mode) { if (this.forums && this.forums.set_site && this.forums.set_site.site_mode) {
this.site_mode = this.forums.set_site.site_mode; this.site_mode = this.forums.set_site.site_mode;
...@@ -91,13 +100,44 @@ export default { ...@@ -91,13 +100,44 @@ export default {
) { ) {
this.canReg = true; this.canReg = true;
} }
}
}, },
methods: { methods: {
changeLogin() pcwxgetCode() {
{ let ua = window.navigator.userAgent.toLowerCase();
this.bailunLoginShow=!this.bailunLoginShow; if (
this.fourkLoginShow=!this.fourkLoginShow; ua.match(/MicroMessenger/i) == "micromessenger" &&
ua.match(/wxwork/i) == "wxwork"
) {
// 静默授权
//const code = this.getUrlParam("code"); // 截取路径中的code,如果没有就去微信授权,如果已经获取到了就直接传code给后台获取openId
let local = "https://wiki.bailuntec.com/user/login";
let APPID = "ww833808f6b8dc0745"; // 企业微信
let href = window.location.href;
if (href.indexOf("discuz.bailuntec.com") > -1) {
local = "https://discuz.bailuntec.com/user/login";
APPID = "ww4e7dd5ae312eb101"; // 企业微信
window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
APPID +
"&redirect_uri=" +
encodeURIComponent(local) +
"&response_type=code&scope=snsapi_base&state=4k#wechat_redirect";
} else {
window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
APPID +
"&redirect_uri=" +
encodeURIComponent(local) +
"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
}
}
},
changeLogin() {
this.bailunLoginShow = !this.bailunLoginShow;
this.fourkLoginShow = !this.fourkLoginShow;
}, },
check(value) { check(value) {
this.ischeck = value; this.ischeck = value;
...@@ -205,19 +245,33 @@ export default { ...@@ -205,19 +245,33 @@ export default {
}); });
}, },
getStaffInfo(code) { getStaffInfo(code) {
let _this=this;
axios axios
.get(`https://discuz.bailuntec.com/api/login?code=${code}&state=${this.state}`) .get(
`https://discuz.bailuntec.com/api/login?code=${code}&state=${this.state}`
)
.then((res) => { .then((res) => {
this.userId = res.data.data.relationships.users.data.id;
if (res.data.data.relationships.users.data.id) { if (res.data.data.relationships.users.data.id) {
let isSetItem=true
while (isSetItem)
{
localStorage.setItem( localStorage.setItem(
"user_id", "user_id",
res.data.data.relationships.users.data.id res.data.data.relationships.users.data.id
); );
localStorage.setItem( localStorage.setItem(
"access_token", "access_token",
res.data.data.attributes.access_token res.data.data.attributes.access_token
); );
window.location.href = "https://discuz.bailuntec.com/knowledge"; let uid=localStorage.getItem("user_id")
if(!!uid)
{
location.reload();
isSetIte=false;
}
}
} }
}); });
}, },
...@@ -257,7 +311,7 @@ export default { ...@@ -257,7 +311,7 @@ export default {
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
background-image: url('../../assets/to_qr.png'); background-image: url("../../assets/to_qr.png");
background-position: center; background-position: center;
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment