window
This commit is contained in:
@ -13,9 +13,9 @@ import Container from './grid/Container'
|
||||
import Grid from './grid/Grid'
|
||||
import GridItem from './grid/GridItem'
|
||||
import defaults from './grid/utils/defaults'
|
||||
import './login-manager.js'
|
||||
|
||||
import Comp from './comp/index'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const VueFractionGrid = {
|
||||
install (Vue, options) {
|
||||
@ -88,6 +88,30 @@ export default ({
|
||||
duration: 1200
|
||||
});
|
||||
}, 200)
|
||||
|
||||
let TOKEN_KEY = 'kb-user-center-token'
|
||||
|
||||
let domain = window.location.hostname
|
||||
if (domain.indexOf('kuboard.cn') >= 0) {
|
||||
domain = 'kuboard.cn'
|
||||
}
|
||||
window.KbUcloginStatus = {
|
||||
status: Cookies.get(TOKEN_KEY) !== null && Cookies.get(TOKEN_KEY) !== undefined,
|
||||
user: undefined
|
||||
}
|
||||
Vue.prototype.$login = function (token) {
|
||||
// axios.defaults.headers.common['Authorization'] = token;
|
||||
// localStorage.setItem(TOKEN_KEY, token)
|
||||
Cookies.set(TOKEN_KEY, token, { domain: domain, expires: 7, path: '/' })
|
||||
window.KbUcloginStatus.status = true
|
||||
}
|
||||
|
||||
Vue.prototype.$logout = function () {
|
||||
window.KbUcloginStatus.status = false
|
||||
// localStorage.removeItem(TOKEN_KEY)
|
||||
Cookies.remove(TOKEN_KEY, { domain: domain, expires: 7, path: '/' })
|
||||
// delete (axios.defaults.headers.common['Authorization'])
|
||||
}
|
||||
}
|
||||
// console.log('sharing', sharing)
|
||||
Vue.prototype.$isSharing = sharing
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
let TOKEN_KEY = 'kb-user-center-token'
|
||||
|
||||
let domain = ''
|
||||
if (typeof window !== 'undefined') {
|
||||
domain = window.location.hostname
|
||||
window.KbUcloginStatus = {
|
||||
status: Cookies.get(TOKEN_KEY) !== null && Cookies.get(TOKEN_KEY) !== undefined,
|
||||
user: undefined
|
||||
}
|
||||
}
|
||||
if (domain.indexOf('kuboard.cn') >= 0) {
|
||||
domain = 'kuboard.cn'
|
||||
}
|
||||
|
||||
|
||||
Vue.prototype.$login = function (token) {
|
||||
// axios.defaults.headers.common['Authorization'] = token;
|
||||
// localStorage.setItem(TOKEN_KEY, token)
|
||||
Cookies.set(TOKEN_KEY, token, { domain: domain, expires: 7, path: '/' })
|
||||
if (typeof window !== 'undefined') {
|
||||
window.KbUcloginStatus.status = true
|
||||
}
|
||||
}
|
||||
|
||||
Vue.prototype.$logout = function () {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.KbUcloginStatus.status = false
|
||||
}
|
||||
// localStorage.removeItem(TOKEN_KEY)
|
||||
Cookies.remove(TOKEN_KEY, { domain: domain, expires: 7, path: '/' })
|
||||
// delete (axios.defaults.headers.common['Authorization'])
|
||||
}
|
||||
@ -15,37 +15,45 @@ import axios from 'axios'
|
||||
import {format} from 'date-fns'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
(function(a, b, c, d, e, j, s) {
|
||||
a[d] = a[d] || function() {
|
||||
(a[d].a = a[d].a || []).push(arguments)
|
||||
};
|
||||
j = b.createElement(c),
|
||||
s = b.getElementsByTagName(c)[0];
|
||||
j.async = true;
|
||||
j.charset = 'UTF-8';
|
||||
j.src = 'https://static.meiqia.com/widget/loader.js';
|
||||
s.parentNode.insertBefore(j, s);
|
||||
})(window, document, 'script', '_MEIQIA');
|
||||
_MEIQIA('entId', '961dff7f89ddc015ac1f8e193bf774d0');
|
||||
_MEIQIA('manualInit');
|
||||
_MEIQIA('withoutBtn');
|
||||
|
||||
let TOKEN_KEY = 'kb-user-center-token'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
},
|
||||
data() {
|
||||
console.log(window.location.search, 'search')
|
||||
return {
|
||||
showLogout: false,
|
||||
isdebugging: window.location.search === '?showLogin=true'
|
||||
if (typeof window !== 'undefined') {
|
||||
console.log(window.location.search, 'search')
|
||||
return {
|
||||
showLogout: false,
|
||||
isdebugging: window.location.search === '?showLogin=true'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
showLogout: false,
|
||||
isdebugging: false
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
components: { OnlineChatLogin },
|
||||
mounted () {
|
||||
if (typeof window !== 'undefined') {
|
||||
(function(a, b, c, d, e, j, s) {
|
||||
a[d] = a[d] || function() {
|
||||
(a[d].a = a[d].a || []).push(arguments)
|
||||
};
|
||||
j = b.createElement(c),
|
||||
s = b.getElementsByTagName(c)[0];
|
||||
j.async = true;
|
||||
j.charset = 'UTF-8';
|
||||
j.src = 'https://static.meiqia.com/widget/loader.js';
|
||||
s.parentNode.insertBefore(j, s);
|
||||
})(window, document, 'script', '_MEIQIA');
|
||||
_MEIQIA('entId', '961dff7f89ddc015ac1f8e193bf774d0');
|
||||
_MEIQIA('manualInit');
|
||||
_MEIQIA('withoutBtn');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showChat () {
|
||||
|
||||
@ -170,7 +170,7 @@ export default {
|
||||
this.$login(resp.data.data)
|
||||
this.loginLoading = false
|
||||
console.log(this.goStandAlone)
|
||||
if (this.goStandAlone) {
|
||||
if (this.goStandAlone && typeof window !== 'undefined') {
|
||||
window.location.href = '/chat/'
|
||||
} else {
|
||||
this.$emit('loginSuccess')
|
||||
|
||||
Reference in New Issue
Block a user