no message
This commit is contained in:
parent
562481d08c
commit
07b7eb2471
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
1
dist/js/app~42f9d7e6.127ad36b.js
vendored
Normal file
1
dist/js/app~42f9d7e6.127ad36b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/js/app~42f9d7e6.d8200ec5.js
vendored
1
dist/js/app~42f9d7e6.d8200ec5.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
410
src/App.vue
410
src/App.vue
@ -1,286 +1,274 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<router-view />
|
<router-view />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: null,
|
loading: null,
|
||||||
pathname: "",
|
pathname: "",
|
||||||
parameterObject: {},
|
parameterObject: {},
|
||||||
isPc: false,
|
isPc: false,
|
||||||
socketTask: null,
|
socketTask: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {},
|
||||||
|
mounted() {
|
||||||
|
this.$store.dispatch("fetchHistoricalSearch") // 获取历史搜索记录
|
||||||
|
this.$store.dispatch("getAllForum", this) // 获取全部板块
|
||||||
|
|
||||||
},
|
this.isJudgePc()
|
||||||
mounted() {
|
// this.$skipUrl("gggg", false)
|
||||||
this.$store.dispatch('fetchHistoricalSearch') // 获取历史搜索记录
|
// setTimeout(() => {
|
||||||
this.$store.dispatch('getAllForum', this) // 获取全部板块
|
// // this.hasMiucmsSessionCookie()
|
||||||
|
// // this.useSocket
|
||||||
|
// console.log(this.$store.state['user']);
|
||||||
|
// }, 1000)
|
||||||
|
|
||||||
this.isJudgePc()
|
let timer = setInterval(() => {
|
||||||
// this.$skipUrl("gggg", false)
|
if (Object.keys(this.$store.state.user).length !== 0) {
|
||||||
// setTimeout(() => {
|
this.useSocket()
|
||||||
// // this.hasMiucmsSessionCookie()
|
clearInterval(timer)
|
||||||
// // this.useSocket
|
}
|
||||||
// console.log(this.$store.state['user']);
|
}, 1000)
|
||||||
// }, 1000)
|
},
|
||||||
|
|
||||||
let timer = setInterval(() => {
|
methods: {
|
||||||
if (Object.keys(this.$store.state.user).length !== 0) {
|
// 开启socket
|
||||||
this.useSocket()
|
useSocket() {
|
||||||
clearInterval(timer)
|
let token = this.getMiucmsSessionCookie() || ""
|
||||||
}
|
this.socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`)
|
||||||
}, 1000);
|
this.socketTask.onopen = () => {
|
||||||
|
let user = this.$store.state.user || {}
|
||||||
|
if (user && token) {
|
||||||
|
this.socketTask.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: "bind",
|
||||||
|
data: {
|
||||||
|
token,
|
||||||
|
uid: user.uid || 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
setTimeout(() => this.timedTransmission(), 50000)
|
||||||
|
}
|
||||||
|
this.socketTask.onclose = () => {
|
||||||
|
console.log("socket关闭了", new Date())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
// 定时发送
|
||||||
|
timedTransmission() {
|
||||||
|
if (this.socketTask.readyState != 1) return
|
||||||
|
this.socketTask.send(JSON.stringify({type: "ping"}))
|
||||||
|
setTimeout(() => this.timedTransmission(), 50000)
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
getMiucmsSessionCookie() {
|
||||||
// 开启socket
|
let cookies = document.cookie.split(";")
|
||||||
useSocket() {
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
let token = this.getMiucmsSessionCookie() || ''
|
let cookie = cookies[i].split("=")
|
||||||
this.socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`);
|
if (cookie[0].trim() === "miucms_session") {
|
||||||
this.socketTask.onopen = () => {
|
return cookie[1]
|
||||||
let user = this.$store.state.user || {};
|
}
|
||||||
if (user && token) {
|
}
|
||||||
this.socketTask.send(JSON.stringify({
|
return null
|
||||||
type: 'bind',
|
},
|
||||||
data: {
|
isJudgePc() {
|
||||||
token,
|
return
|
||||||
uid: user.uid || 0
|
const userAgentInfo = navigator.userAgent
|
||||||
}
|
const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]
|
||||||
}))
|
let flag = true
|
||||||
}
|
for (let i = 0; i < Agents.length; i++) {
|
||||||
setTimeout(() => this.timedTransmission(), 50000);
|
if (userAgentInfo.indexOf(Agents[i]) > 0) {
|
||||||
};
|
flag = false
|
||||||
this.socketTask.onclose = () => {
|
break
|
||||||
console.log('socket关闭了', new Date());
|
}
|
||||||
};
|
}
|
||||||
},
|
|
||||||
|
|
||||||
// 定时发送
|
if (flag) {
|
||||||
timedTransmission() {
|
console.log("flag", flag)
|
||||||
if (this.socketTask.readyState != 1) return
|
let pathname = window.location.pathname
|
||||||
this.socketTask.send(JSON.stringify({ type: 'ping' }))
|
|
||||||
setTimeout(() => this.timedTransmission(), 50000)
|
|
||||||
},
|
|
||||||
|
|
||||||
getMiucmsSessionCookie() {
|
const queryString = window.location.search
|
||||||
let cookies = document.cookie.split(";");
|
const parameters = queryString.substring(1)
|
||||||
for (let i = 0; i < cookies.length; i++) {
|
let parameterObject = Object.fromEntries(new URLSearchParams(parameters))
|
||||||
let cookie = cookies[i].split("=");
|
this.pathname = pathname
|
||||||
if (cookie[0].trim() === "miucms_session") {
|
this.parameterObject = parameterObject
|
||||||
return cookie[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
isJudgePc() {
|
|
||||||
const userAgentInfo = navigator.userAgent;
|
|
||||||
const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
|
||||||
let flag = true;
|
|
||||||
for (let i = 0; i < Agents.length; i++) {
|
|
||||||
if (userAgentInfo.indexOf(Agents[i]) > 0) {
|
|
||||||
flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag) {
|
if (this.pathname.indexOf("allSections") != -1 && this.parameterObject["fid"]) {
|
||||||
let pathname = window.location.pathname
|
this.handleNeedAllSkipPc()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.pathname.indexOf("userIndex") != -1) {
|
||||||
|
this.handleNeedInfo()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const queryString = window.location.search;
|
let url = ""
|
||||||
const parameters = queryString.substring(1);
|
|
||||||
let parameterObject = Object.fromEntries(new URLSearchParams(parameters));
|
|
||||||
this.pathname = pathname
|
|
||||||
this.parameterObject = parameterObject
|
|
||||||
|
|
||||||
if (this.pathname.indexOf("allSections") != -1 && this.parameterObject['fid']) {
|
if (pathname.indexOf("detailIndex") != -1) url = `https://bbs.gter.net/thread-${parameterObject["tid"]}-${parameterObject["page"] || 1}-1.html`
|
||||||
this.handleNeedAllSkipPc()
|
if (pathname.indexOf("searchResult") != -1) url = `https://search.gter.net/index.html?type=forum${parameterObject["kw"] ? `&kw=${parameterObject["kw"]}` : ""}`
|
||||||
return
|
if (pathname.indexOf("allSections") != -1 && !parameterObject["fid"]) url = `https://bbs.gter.net/forum.php`
|
||||||
}
|
if (pathname.indexOf("recommend") != -1) url = `https://bbs.gter.net/forum.php`
|
||||||
if (this.pathname.indexOf("userIndex") != -1) {
|
if (pathname.indexOf("collect") != -1) url = `https://bbs.gter.net/forum.php`
|
||||||
this.handleNeedInfo()
|
if (pathname == "/" || pathname == "" || !pathname) url = `https://bbs.gter.net/forum.php`
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (url) this.$skipUrl(url, false)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理需要user信息的跳转PC端
|
||||||
|
handleNeedInfo() {
|
||||||
|
let user = this.$store.state.user || {}
|
||||||
|
let url = ""
|
||||||
|
if (JSON.stringify(user) != "{}") {
|
||||||
|
url = `https://bbs.gter.net/home.php?mod=space&uid=${user.uin}`
|
||||||
|
this.$skipUrl(url, false)
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.handleNeedInfo()
|
||||||
|
}, 300)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
let url = ""
|
// 处理需要全部板块的跳转PC端
|
||||||
|
handleNeedAllSkipPc() {
|
||||||
if (pathname.indexOf("detailIndex") != -1) url = `https://bbs.gter.net/thread-${parameterObject['tid']}-${parameterObject['page'] || 1}-1.html`
|
let allForumList = this.$store.state.allForumList || []
|
||||||
if (pathname.indexOf("searchResult") != -1) url = `https://search.gter.net/index.html?type=forum${parameterObject['kw'] ? `&kw=${parameterObject['kw']}` : ''}`
|
|
||||||
if (pathname.indexOf("allSections") != -1 && !parameterObject['fid']) url = `https://bbs.gter.net/forum.php`
|
|
||||||
if (pathname.indexOf("recommend") != -1) url = `https://bbs.gter.net/forum.php`
|
|
||||||
if (pathname.indexOf("collect") != -1) url = `https://bbs.gter.net/forum.php`
|
|
||||||
if (pathname == "/" || pathname == "" || !pathname) url = `https://bbs.gter.net/forum.php`
|
|
||||||
|
|
||||||
|
|
||||||
if (url) this.$skipUrl(url, false)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理需要user信息的跳转PC端
|
|
||||||
handleNeedInfo() {
|
|
||||||
let user = this.$store.state.user || {}
|
|
||||||
let url = ""
|
|
||||||
if (JSON.stringify(user) != "{}") {
|
|
||||||
url = `https://bbs.gter.net/home.php?mod=space&uid=${user.uin}`
|
|
||||||
this.$skipUrl(url, false)
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.handleNeedInfo()
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理需要全部板块的跳转PC端
|
|
||||||
handleNeedAllSkipPc() {
|
|
||||||
let allForumList = this.$store.state.allForumList || []
|
|
||||||
|
|
||||||
let url = ""
|
|
||||||
let fid = this.parameterObject['fid'] || null
|
|
||||||
|
|
||||||
if (allForumList.length != 0) {
|
|
||||||
allForumList.forEach((element, index) => {
|
|
||||||
if (element.fid == fid) url = `https://bbs.gter.net/forum.php?gid=${element.fid}`
|
|
||||||
element.data.forEach((el, i) => {
|
|
||||||
if (el.fid == fid) url = `https://bbs.gter.net/forum-${el.fid}-${this.parameterObject['page'] || 1}.html`
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.$skipUrl(url, false)
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.handleNeedAllSkipPc()
|
|
||||||
}, 300)
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
let url = ""
|
||||||
|
let fid = this.parameterObject["fid"] || null
|
||||||
|
|
||||||
|
if (allForumList.length != 0) {
|
||||||
|
allForumList.forEach((element, index) => {
|
||||||
|
if (element.fid == fid) url = `https://bbs.gter.net/forum.php?gid=${element.fid}`
|
||||||
|
element.data.forEach((el, i) => {
|
||||||
|
if (el.fid == fid) url = `https://bbs.gter.net/forum-${el.fid}-${this.parameterObject["page"] || 1}.html`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.$skipUrl(url, false)
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.handleNeedAllSkipPc()
|
||||||
|
}, 300)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import 'assets/css/normalize.css';
|
@import "assets/css/normalize.css";
|
||||||
@import 'assets/css/public.scss'; //帖子内容样式
|
@import "assets/css/public.scss"; //帖子内容样式
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
// overflow: hidden;
|
// overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
|
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
// padding: 0 0.35rem;
|
// padding: 0 0.35rem;
|
||||||
background-color: rgba(246, 246, 246, 1);
|
background-color: rgba(246, 246, 246, 1);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flexflex {
|
.flexflex {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flexcenter {
|
.flexcenter {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flexacenter {
|
.flexacenter {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flexcolumn {
|
.flexcolumn {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex1 {
|
.flex1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-message {
|
.el-message {
|
||||||
min-width: 7rem !important;
|
min-width: 7rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文字一行显示
|
// 文字一行显示
|
||||||
.one-line {
|
.one-line {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
display: -moz-box;
|
display: -moz-box;
|
||||||
-moz-box-orient: vertical;
|
-moz-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文字两行显示
|
// 文字两行显示
|
||||||
.two-lines {
|
.two-lines {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文章三行显示
|
// 文章三行显示
|
||||||
.three-lines {
|
.three-lines {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 3;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 阴影
|
// 阴影
|
||||||
.shadow {
|
.shadow {
|
||||||
-webkit-box-shadow: 0 0 .3rem rgba(0, 0, 0, .1);
|
-webkit-box-shadow: 0 0 0.3rem rgba(0, 0, 0, 0.1);
|
||||||
box-shadow: 0 0 .3rem rgba(0, 0, 0, .1);
|
box-shadow: 0 0 0.3rem rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 弹窗公共类 蒙版
|
// 弹窗公共类 蒙版
|
||||||
.pop-box {
|
.pop-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: rgba(0, 0, 0, 0.64);
|
background-color: rgba(0, 0, 0, 0.64);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除 input 和 textarea 的默认样式
|
// 清除 input 和 textarea 的默认样式
|
||||||
input,
|
input,
|
||||||
textarea {
|
textarea {
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,7 +31,7 @@ service.interceptors.request.use(config => {
|
|||||||
// config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
// config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
||||||
// config['headers']['authorization'] = "661aiz52k5e6vqgmkxnz0wvbv8nciz8h"
|
// config['headers']['authorization'] = "661aiz52k5e6vqgmkxnz0wvbv8nciz8h"
|
||||||
|
|
||||||
if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "0h870ovk2xckoqfsh8a3t3sg4sg5z7eg"
|
// if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "0h870ovk2xckoqfsh8a3t3sg4sg5z7eg"
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
|
@ -11,7 +11,7 @@ module.exports = defineConfig({
|
|||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env.URL_ENV': "https://x-cloud-project.oss-cn-guangzhou.aliyuncs.com/forum"
|
// 'process.env.URL_ENV': "https://x-cloud-project.oss-cn-guangzhou.aliyuncs.com/forum"
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user