no message

This commit is contained in:
A1300399510 2023-10-16 16:55:40 +08:00
parent 562481d08c
commit 07b7eb2471
7 changed files with 204 additions and 216 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,6 @@
</div>
</template>
<script>
export default {
name: "App",
data() {
@ -18,12 +17,10 @@ export default {
socketTask: null,
}
},
watch: {
},
watch: {},
mounted() {
this.$store.dispatch('fetchHistoricalSearch') //
this.$store.dispatch('getAllForum', this) //
this.$store.dispatch("fetchHistoricalSearch") //
this.$store.dispatch("getAllForum", this) //
this.isJudgePc()
// this.$skipUrl("gggg", false)
@ -38,71 +35,74 @@ export default {
this.useSocket()
clearInterval(timer)
}
}, 1000);
}, 1000)
},
methods: {
// socket
useSocket() {
let token = this.getMiucmsSessionCookie() || ''
this.socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`);
let token = this.getMiucmsSessionCookie() || ""
this.socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`)
this.socketTask.onopen = () => {
let user = this.$store.state.user || {};
let user = this.$store.state.user || {}
if (user && token) {
this.socketTask.send(JSON.stringify({
type: 'bind',
this.socketTask.send(
JSON.stringify({
type: "bind",
data: {
token,
uid: user.uid || 0
uid: user.uid || 0,
},
})
)
}
}))
setTimeout(() => this.timedTransmission(), 50000)
}
setTimeout(() => this.timedTransmission(), 50000);
};
this.socketTask.onclose = () => {
console.log('socket关闭了', new Date());
};
console.log("socket关闭了", new Date())
}
},
//
timedTransmission() {
if (this.socketTask.readyState != 1) return
this.socketTask.send(JSON.stringify({ type: 'ping' }))
this.socketTask.send(JSON.stringify({type: "ping"}))
setTimeout(() => this.timedTransmission(), 50000)
},
getMiucmsSessionCookie() {
let cookies = document.cookie.split(";");
let cookies = document.cookie.split(";")
for (let i = 0; i < cookies.length; i++) {
let cookie = cookies[i].split("=");
let cookie = cookies[i].split("=")
if (cookie[0].trim() === "miucms_session") {
return cookie[1];
return cookie[1]
}
}
return null;
return null
},
isJudgePc() {
const userAgentInfo = navigator.userAgent;
const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let flag = true;
return
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;
flag = false
break
}
}
if (flag) {
console.log("flag", flag)
let pathname = window.location.pathname
const queryString = window.location.search;
const parameters = queryString.substring(1);
let parameterObject = Object.fromEntries(new URLSearchParams(parameters));
const queryString = window.location.search
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 (this.pathname.indexOf("allSections") != -1 && this.parameterObject["fid"]) {
this.handleNeedAllSkipPc()
return
}
@ -111,22 +111,17 @@ export default {
return
}
let url = ""
if (pathname.indexOf("detailIndex") != -1) url = `https://bbs.gter.net/thread-${parameterObject['tid']}-${parameterObject['page'] || 1}-1.html`
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("detailIndex") != -1) url = `https://bbs.gter.net/thread-${parameterObject["tid"]}-${parameterObject["page"] || 1}-1.html`
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)
}
},
// userPC
@ -139,9 +134,8 @@ export default {
} else {
setTimeout(() => {
this.handleNeedInfo()
}, 300);
}, 300)
}
},
// PC
@ -149,13 +143,13 @@ export default {
let allForumList = this.$store.state.allForumList || []
let url = ""
let fid = this.parameterObject['fid'] || null
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`
if (el.fid == fid) url = `https://bbs.gter.net/forum-${el.fid}-${this.parameterObject["page"] || 1}.html`
})
})
this.$skipUrl(url, false)
@ -164,20 +158,14 @@ export default {
this.handleNeedAllSkipPc()
}, 300)
}
},
},
}
</script>
<style lang="scss">
@import 'assets/css/normalize.css';
@import 'assets/css/public.scss'; //
@import "assets/css/normalize.css";
@import "assets/css/public.scss"; //
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
@ -257,8 +245,8 @@ a {
//
.shadow {
-webkit-box-shadow: 0 0 .3rem rgba(0, 0, 0, .1);
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 0.3rem rgba(0, 0, 0, 0.1);
}
//

View File

@ -31,7 +31,7 @@ service.interceptors.request.use(config => {
// config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
// 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
}, error => {

View File

@ -11,7 +11,7 @@ module.exports = defineConfig({
configureWebpack: {
plugins: [
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"
})
]
},