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

View File

@ -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 => {

View File

@ -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"
}) })
] ]
}, },