Commit 962770a7 by xiongyuwen

no message

parent 7611fdc5
......@@ -52,10 +52,10 @@ export default {
* createQrcode('https://xxx.com/')
*/
createQrcode(link) {
if (link == "https://wiki.bailuntec.com/category") {
if (link == "http://wiki.bailuntec.com/category") {
link = "https://wiki.bailuntec.com/";
}
if (link == "https://discuz.bailuntec.com/category") {
if (link == "http://discuz.bailuntec.com/category") {
link = "https://discuz.bailuntec.com/";
}
......
......@@ -35,7 +35,7 @@ import config from "@/config.js";
export default {
data() {
return {
userId: this.$store.getters["session/get"]("userId"), // 获取当前登陆用户的ID
userId: "", // 获取当前登陆用户的ID
userInfo: "",
qywxUserid: "",
loading: false,
......@@ -47,6 +47,7 @@ export default {
const params = {
include: "groups,wechat",
};
this.userId=localStorage.getItem("user_id");
if (!this.userId) {
this.getCode();
}
......
......@@ -10,7 +10,7 @@
<div class="form">
<div id="changeLogin" @click="changeLogin" class="code-tip">
<p id="right_text" class="code-tip-text">4k 登陆</p>
</div>
</div>
<div class="welcome">
<p>欢迎登录</p>
<p>广州百伦供应链SAA系统</p>
......@@ -18,7 +18,7 @@
<div id="qr_login" v-show="bailunLoginShow">
<div id="wx_login"></div>
</div>
<div id="qr_login" v-show="fourkLoginShow">
<div id="qr_login" v-show="fourkLoginShow">
<div id="fourkwx_login"></div>
</div>
</div>
......@@ -38,7 +38,7 @@ import head from "@/mixin/head";
import handleError from "@/mixin/handleError";
import loginAbout from "@/mixin/loginAbout";
import service from "../../api/request";
import axios from "@/plugins/axios.js"
import axios from "@/plugins/axios.js";
import "@/plugins/qrcode.js";
export default {
......@@ -49,7 +49,10 @@ export default {
title: this.$t("user.login"),
userName: "",
passWord: "",
state:"",
userInfo: "",
userId: localStorage.getItem("user_id"), // 获取当前登陆用户的ID
qywxUserid: "",
state: "",
checked: true,
activeName: "0", // 默认激活tab
site_mode: "", // 站点模式
......@@ -59,8 +62,8 @@ export default {
canReg: false,
ischeck: true,
preurl: "/",
bailunLoginShow:true,
fourkLoginShow:false
bailunLoginShow: true,
fourkLoginShow: false,
};
},
computed: {
......@@ -71,8 +74,10 @@ export default {
mounted() {
const { code, preurl } = this.$route.query;
this.createCode();
this.create4kCode();
if(this.userId)
{
this.$router.push(`/category`);
}else{
this.code = this.getQueryVariable("code");
this.state = this.getQueryVariable("state");
if (preurl) {
......@@ -80,6 +85,10 @@ export default {
}
if (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) {
this.site_mode = this.forums.set_site.site_mode;
......@@ -91,13 +100,44 @@ export default {
) {
this.canReg = true;
}
}
},
methods: {
changeLogin()
{
this.bailunLoginShow=!this.bailunLoginShow;
this.fourkLoginShow=!this.fourkLoginShow;
pcwxgetCode() {
let ua = window.navigator.userAgent.toLowerCase();
if (
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) {
this.ischeck = value;
......@@ -194,7 +234,7 @@ export default {
state: "discuz",
redirect_uri: "https://discuz.bailuntec.com/user/login",
});
},
},
create4kCode() {
window.WwLogin({
id: "fourkwx_login",
......@@ -205,19 +245,33 @@ export default {
});
},
getStaffInfo(code) {
let _this=this;
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) => {
this.userId = res.data.data.relationships.users.data.id;
if (res.data.data.relationships.users.data.id) {
localStorage.setItem(
"user_id",
res.data.data.relationships.users.data.id
);
localStorage.setItem(
"access_token",
res.data.data.attributes.access_token
);
window.location.href = "https://discuz.bailuntec.com/knowledge";
let isSetItem=true
while (isSetItem)
{
localStorage.setItem(
"user_id",
res.data.data.relationships.users.data.id
);
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 {
height: 35px;
font-size: 26px;
}
.login .form .code-tip {
cursor: pointer;
width: 102px;
height: 128px;
position: absolute;
right: 0;
top: 0;
background-image: url('../../assets/to_qr.png');
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
}
.login .form .code-tip .code-tip-text {
.login .form .code-tip {
cursor: pointer;
width: 102px;
height: 128px;
position: absolute;
right: 0;
top: 0;
background-image: url("../../assets/to_qr.png");
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
}
.login .form .code-tip .code-tip-text {
line-height: 34px;
position: absolute;
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