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
98
src/App.vue
98
src/App.vue
@ -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)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 处理需要user信息的跳转PC端
|
||||
@ -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);
|
||||
}
|
||||
|
||||
// 弹窗公共类 蒙版
|
||||
|
@ -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 => {
|
||||
|
@ -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"
|
||||
})
|
||||
]
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user