修改登录判断

This commit is contained in:
A1300399510 2025-02-08 11:45:15 +08:00
parent f6091b0b28
commit 2b2bd9da53
22 changed files with 144 additions and 147 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/index.html vendored

File diff suppressed because one or more lines are too long

1
dist/js/124.79130f1c.js vendored Normal file
View File

@ -0,0 +1 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[124],{9143:function(e,t,n){n.r(t),n.d(t,{default:function(){return l}});var a=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("帖子详情")])],2),t("router-view",{key:e.key})],1)},r=[],u=n(517),s={name:"detail",data(){return{}},computed:{key(){return this.$route.path+Math.random()}},mounted(){},methods:{},components:{HeaderNav:u.Z}},d=s,i=n(1001),o=(0,i.Z)(d,a,r,!1,null,"10593ad7",null),l=o.exports}}]);

1
dist/js/337.4b2508a0.js vendored Normal file
View File

@ -0,0 +1 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[337],{5817:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var r=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!1,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("搜索帖子")])],2),t("router-view",{key:e.key})],1)},a=[],u=n(517),s={name:"search",data(){return{}},computed:{key(){return this.$route.path+Math.random()}},mounted(){},methods:{},components:{HeaderNav:u.Z}},o=s,c=n(1001),d=(0,c.Z)(o,r,a,!1,null,"24c9f798",null),h=d.exports}}]);

1
dist/js/354.bc2d16ec.js vendored Normal file
View File

@ -0,0 +1 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[354],{6170:function(e,t,n){n.r(t),n.d(t,{default:function(){return o}});var r=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("我的寄托")])],2),t("router-view")],1)},a=[],u=n(517),s={name:"user",data(){return{}},mounted(){},methods:{},components:{HeaderNav:u.Z}},d=s,i=n(1001),l=(0,i.Z)(d,r,a,!1,null,"7090fd6a",null),o=l.exports}}]);

View File

@ -1 +0,0 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[483],{5817:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var r=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!1,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("搜索帖子")])],2),t("router-view",{key:e.key})],1)},a=[],u=n(4917),s={name:"search",data(){return{}},computed:{key(){return this.$route.path+Math.random()}},mounted(){},methods:{},components:{HeaderNav:u.Z}},o=s,c=n(1001),d=(0,c.Z)(o,r,a,!1,null,"24c9f798",null),h=d.exports}}]);

1
dist/js/517.b66c61bd.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[561],{9143:function(e,t,n){n.r(t),n.d(t,{default:function(){return l}});var a=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("帖子详情")])],2),t("router-view",{key:e.key})],1)},r=[],u=n(4917),s={name:"detail",data(){return{}},computed:{key(){return this.$route.path+Math.random()}},mounted(){},methods:{},components:{HeaderNav:u.Z}},d=s,i=n(1001),o=(0,i.Z)(d,a,r,!1,null,"10593ad7",null),l=o.exports}}]);

View File

@ -1 +0,0 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[584],{6170:function(e,t,n){n.r(t),n.d(t,{default:function(){return o}});var r=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("我的寄托")])],2),t("router-view")],1)},a=[],u=n(4917),s={name:"user",data(){return{}},mounted(){},methods:{},components:{HeaderNav:u.Z}},d=s,i=n(1001),l=(0,i.Z)(d,r,a,!1,null,"7090fd6a",null),o=l.exports}}]);

File diff suppressed because one or more lines are too long

1
dist/js/718.165fc1ef.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/js/831.6fddd3bb.js vendored Normal file
View File

@ -0,0 +1 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[831],{2013:function(e,t,n){n.r(t),n.d(t,{default:function(){return u}});var a=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("寄托天下论坛")])],2),t("nav",[t("router-link",{attrs:{to:e.recommendURl,exact:""}},[e._v("推荐阅读")]),t("router-link",{attrs:{to:e.collect,exact:""}},[e._v("收藏的版块")]),t("router-link",{attrs:{to:e.allSections,exact:""}},[e._v("全部版块")])],1),t("div",{staticClass:"publish flexcolumn flexcenter",on:{click:function(t){return t.stopPropagation(),e.$skipUrl(e.invitationPost)}}},[t("svg-icon",{attrs:{"icon-class":"add","class-name":"icon-publish"}}),e._v(" 发帖 ")],1),t("router-view",{key:e.key})],1)},l=[],o=n(517),i=n(6799),r={name:"Index",data(){return{favorite:[],recommend:[],fid:null,allSections:"/allSections",collect:"/collect",recommendURl:"/recommend",invitationPost:i.a}},computed:{key(){return this.$route.path+Math.random()}},watch:{"$store.state.homeRequestState":{handler(e,t){let{favoriteList:n,recommendList:a}=this.$store.state;this.favorite=n,this.recommend=a},immediate:!0},$route:{handler(e,t){let n=e.fullPath;-1!=n.indexOf("allSections")&&(this.allSections=n),-1!=n.indexOf("collect")&&(this.collect=n),-1!=n.indexOf("recommend")&&(this.recommendURl=n)},immediate:!0}},mounted(){},components:{HeaderNav:o.Z},methods:{}},s=r,c=n(1001),d=(0,c.Z)(s,a,l,!1,null,null,null),u=d.exports}}]);

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[94],{2013:function(e,t,n){n.r(t),n.d(t,{default:function(){return u}});var a=function(){var e=this,t=e._self._c;return t("div",[t("header-nav",{attrs:{issearch:!0,needgetuser:!0}},[t("template",{slot:"header-title"},[e._v("寄托天下论坛")])],2),t("nav",[t("router-link",{attrs:{to:e.recommendURl,exact:""}},[e._v("推荐阅读")]),t("router-link",{attrs:{to:e.collect,exact:""}},[e._v("收藏的版块")]),t("router-link",{attrs:{to:e.allSections,exact:""}},[e._v("全部版块")])],1),t("div",{staticClass:"publish flexcolumn flexcenter",on:{click:function(t){return t.stopPropagation(),e.$skipUrl(e.invitationPost)}}},[t("svg-icon",{attrs:{"icon-class":"add","class-name":"icon-publish"}}),e._v(" 发帖 ")],1),t("router-view",{key:e.key})],1)},l=[],o=n(4917),i=n(6799),r={name:"Index",data(){return{favorite:[],recommend:[],fid:null,allSections:"/allSections",collect:"/collect",recommendURl:"/recommend",invitationPost:i.a}},computed:{key(){return this.$route.path+Math.random()}},watch:{"$store.state.homeRequestState":{handler(e,t){let{favoriteList:n,recommendList:a}=this.$store.state;this.favorite=n,this.recommend=a},immediate:!0},$route:{handler(e,t){let n=e.fullPath;-1!=n.indexOf("allSections")&&(this.allSections=n),-1!=n.indexOf("collect")&&(this.collect=n),-1!=n.indexOf("recommend")&&(this.recommendURl=n)},immediate:!0}},mounted(){},components:{HeaderNav:o.Z},methods:{}},s=r,c=n(1001),d=(0,c.Z)(s,a,l,!1,null,null,null),u=d.exports}}]);

File diff suppressed because one or more lines are too long

View File

@ -18,8 +18,8 @@
</div> </div>
</div> </div>
<div class="head-arrows" :class="{animation: headMorePopState}" v-if="headMorePopState"></div> <div class="head-arrows" :class="{ animation: headMorePopState }" v-if="headMorePopState"></div>
<div class="head-more-pop" :class="{animation: headMorePopState}"> <div class="head-more-pop" :class="{ animation: headMorePopState }">
<div class="head-more-userinfo flex1 flexacenter"> <div class="head-more-userinfo flex1 flexacenter">
<div class="head-more-left flexacenter" v-if="islogin"> <div class="head-more-left flexacenter" v-if="islogin">
<router-link class="flexacenter" to="/user" @click.native="headMorePopState = !headMorePopState"> <router-link class="flexacenter" to="/user" @click.native="headMorePopState = !headMorePopState">
@ -46,7 +46,7 @@
</div> </div>
<div class="tab-list"> <div class="tab-list">
<a class="tab-item flexacenter" :href="item.url" target="_blank" :class="{pitch: item.current == 1}" v-for="(item, index) in menu" :key="index">{{ item.name }}</a> <a class="tab-item flexacenter" :href="item.url" target="_blank" :class="{ pitch: item.current == 1 }" v-for="(item, index) in menu" :key="index">{{ item.name }}</a>
</div> </div>
<div class="head-more-post flexcenter" @click.stop="$skipUrl(invitationPost, false)"> <div class="head-more-post flexcenter" @click.stop="$skipUrl(invitationPost, false)">
@ -69,7 +69,7 @@
<script> <script>
import SearchBox from "../components/SearchBox.vue" import SearchBox from "../components/SearchBox.vue"
import {invitationPost} from "@/utils/bizarreUrl" import { invitationPost } from "@/utils/bizarreUrl"
export default { export default {
name: "HeaderNav", name: "HeaderNav",
@ -98,11 +98,10 @@ export default {
if (JSON.stringify(user) === "{}") this.$store.dispatch("getUserInfo", this) if (JSON.stringify(user) === "{}") this.$store.dispatch("getUserInfo", this)
else { else {
this.userInfo = user this.userInfo = user
this.islogin = user.uid > 0 ? true : false this.islogin = user.uid > 0 || user.uin > 0 ? true : false
this.hotSearchkeywords = this.$store.state.hotSearchkeywords this.hotSearchkeywords = this.$store.state.hotSearchkeywords
this.menu = this.$store.state.menu this.menu = this.$store.state.menu
} }
}, },
methods: { methods: {

View File

@ -1,5 +1,5 @@
import Vue from 'vue' import Vue from "vue"
import Vuex from 'vuex' import Vuex from "vuex"
Vue.use(Vuex) Vue.use(Vuex)
@ -16,8 +16,7 @@ export default new Vuex.Store({
hotSearchkeywords: [], // 热门搜索 hotSearchkeywords: [], // 热门搜索
loading: null, loading: null,
}, },
getters: { getters: {},
},
mutations: { mutations: {
setHistoricalSearch(state, payload) { setHistoricalSearch(state, payload) {
@ -26,7 +25,7 @@ export default new Vuex.Store({
if (targetArr.length > 10) targetArr = targetArr.slice(0, 10) if (targetArr.length > 10) targetArr = targetArr.slice(0, 10)
state.historicalSearch = targetArr state.historicalSearch = targetArr
localStorage.setItem('historicalSearch', JSON.stringify(targetArr)) localStorage.setItem("historicalSearch", JSON.stringify(targetArr))
}, },
setAllForumList(state, payload) { setAllForumList(state, payload) {
@ -59,79 +58,78 @@ export default new Vuex.Store({
setMenu(state, payload) { setMenu(state, payload) {
state.menu = payload state.menu = payload
} },
}, },
actions: { actions: {
// 获取历史搜索的数据 // 获取历史搜索的数据
fetchHistoricalSearch({ commit }) { fetchHistoricalSearch({ commit }) {
let historicalSearch = JSON.parse(localStorage.getItem('historicalSearch')) || [] let historicalSearch = JSON.parse(localStorage.getItem("historicalSearch")) || []
commit('setHistoricalSearch', historicalSearch) commit("setHistoricalSearch", historicalSearch)
}, },
// 获取全部板块的数据 // 获取全部板块的数据
getAllForum({ commit }, that) { getAllForum({ commit }, that) {
that.$http.get("/api/home/allForum").then(res => { that.$http
if (res.code != 200) return; .get("/api/home/allForum")
.then(res => {
if (res.code != 200) return
let allForumList = res.data let allForumList = res.data
commit('setAllForumList', allForumList) commit("setAllForumList", allForumList)
}).catch(err => { })
.catch(err => {
that.$message.error(err.message) that.$message.error(err.message)
}) })
}, },
// 获取用户信息 获取收藏信息那些数据 // 获取用户信息 获取收藏信息那些数据
getUserInfo({ state, commit }, that) { getUserInfo({ state, commit }, that) {
if (state.getUserInfoState) return if (state.getUserInfoState) return
commit('setgetUserInfoState', true) commit("setgetUserInfoState", true)
that.$http.post("/api/home").then(res => { that.$http
if (res.code != 200) return; .post("/api/home")
.then(res => {
if (res.code != 200) return
let data = res.data let data = res.data
let { config, favorite, hotSearchkeywords, recommend, user, menu } = data let { config, favorite, hotSearchkeywords, recommend, user, menu } = data
console.log("user",user.uid > 0); const islogin = user.uin > 0 || user.uid > 0 ? true : false
const islogin = user.uid > 0 ? true : false; // console.log("islogin", islogin)
console.log("islogin",islogin); commit("setHomeRequestState", true)
commit('setHomeRequestState', true) commit("setUser", user)
commit('setUser', user) commit("setFavoriteList", favorite)
commit('setFavoriteList', favorite) commit("setRecommendList", recommend)
commit('setRecommendList', recommend) commit("setHotSearchkeywords", hotSearchkeywords)
commit('setHotSearchkeywords', hotSearchkeywords) commit("setMenu", menu)
commit('setMenu', menu)
if (user.uid > 0) { // 这个是顶部用户数据的 这样不用监听是否请求成功 if (user.uid > 0 || user.uin > 0) {
// 这个是顶部用户数据的 这样不用监听是否请求成功
setTimeout(() => { setTimeout(() => {
if (typeof xstat !== "undefined") { if (typeof xstat !== "undefined") {
xstat.identify({ xstat.identify({
uid: user.uid, uid: user.uid,
uin: user.uin, uin: user.uin,
}); })
} }
}, 600) }, 600)
} }
if (that.userInfo) {
if (that.userInfo) { // 这个是顶部用户数据的 这样不用监听是否请求成功 // 这个是顶部用户数据的 这样不用监听是否请求成功
that.userInfo = user that.userInfo = user
that.islogin = user.uid > 0 ? true : false; that.islogin = user.uid > 0 || user.uin > 0 ? true : false
that.hotSearchkeywords = hotSearchkeywords that.hotSearchkeywords = hotSearchkeywords
that.menu = menu that.menu = menu
} }
})
}).catch(err => { .catch(err => {
that.$message.error(err.message) that.$message.error(err.message)
}).finally(() => { })
.finally(() => {
// that.$closeUnderLoading(that) // that.$closeUnderLoading(that)
commit('setgetUserInfoState', false) commit("setgetUserInfoState", false)
}) })
}, },
},
modules: {
}, },
modules: {},
}) })

View File

@ -572,7 +572,7 @@ export default {
"$store.state.user": { "$store.state.user": {
handler(newV, oldV) { handler(newV, oldV) {
if (JSON.stringify(newV) != "{}") { if (JSON.stringify(newV) != "{}") {
this.islogin = newV.uid > 0 ? true : false this.islogin = newV.uid > 0 || newV.uin > 0 ? true : false
this.tid = this.$route.query["tid"] this.tid = this.$route.query["tid"]
this.postList.page = this.$route.query["page"] || 1 this.postList.page = this.$route.query["page"] || 1