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();
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="form"> <div class="form">
<div id="changeLogin" @click="changeLogin" class="code-tip"> <div id="changeLogin" @click="changeLogin" class="code-tip">
<p id="right_text" class="code-tip-text">4k 登陆</p> <p id="right_text" class="code-tip-text">4k 登陆</p>
</div> </div>
<div class="welcome"> <div class="welcome">
<p>欢迎登录</p> <p>欢迎登录</p>
<p>广州百伦供应链SAA系统</p> <p>广州百伦供应链SAA系统</p>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div id="qr_login" v-show="bailunLoginShow"> <div id="qr_login" v-show="bailunLoginShow">
<div id="wx_login"></div> <div id="wx_login"></div>
</div> </div>
<div id="qr_login" v-show="fourkLoginShow"> <div id="qr_login" v-show="fourkLoginShow">
<div id="fourkwx_login"></div> <div id="fourkwx_login"></div>
</div> </div>
</div> </div>
...@@ -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;
...@@ -194,7 +234,7 @@ export default { ...@@ -194,7 +234,7 @@ export default {
state: "discuz", state: "discuz",
redirect_uri: "https://discuz.bailuntec.com/user/login", redirect_uri: "https://discuz.bailuntec.com/user/login",
}); });
}, },
create4kCode() { create4kCode() {
window.WwLogin({ window.WwLogin({
id: "fourkwx_login", id: "fourkwx_login",
...@@ -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) {
localStorage.setItem( let isSetItem=true
"user_id", while (isSetItem)
res.data.data.relationships.users.data.id {
); localStorage.setItem(
localStorage.setItem( "user_id",
"access_token", res.data.data.relationships.users.data.id
res.data.data.attributes.access_token );
);
window.location.href = "https://discuz.bailuntec.com/knowledge"; localStorage.setItem(
"access_token",
res.data.data.attributes.access_token
);
let uid=localStorage.getItem("user_id")
if(!!uid)
{
location.reload();
isSetIte=false;
}
}
} }
}); });
}, },
...@@ -250,19 +304,19 @@ export default { ...@@ -250,19 +304,19 @@ export default {
height: 35px; height: 35px;
font-size: 26px; font-size: 26px;
} }
.login .form .code-tip { .login .form .code-tip {
cursor: pointer; cursor: pointer;
width: 102px; width: 102px;
height: 128px; height: 128px;
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;
} }
.login .form .code-tip .code-tip-text { .login .form .code-tip .code-tip-text {
line-height: 34px; line-height: 34px;
position: absolute; position: absolute;
right: 5px; right: 5px;
......
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