提交
This commit is contained in:
parent
5a6d83cc06
commit
d82c425491
@ -14,6 +14,7 @@
|
|||||||
"svg-sprite-loader": "^6.0.11",
|
"svg-sprite-loader": "^6.0.11",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
"vue-router": "^3.5.1",
|
"vue-router": "^3.5.1",
|
||||||
|
"vue-sanitize": "^0.2.3",
|
||||||
"vuex": "^3.6.2"
|
"vuex": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -15,9 +15,14 @@ export default {
|
|||||||
loading: null,
|
loading: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch:{
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.dispatch('fetchHistoricalSearch')
|
this.$store.dispatch('fetchHistoricalSearch') // 获取历史搜索记录
|
||||||
this.$store.dispatch('getAllForum', this)
|
this.$store.dispatch('getAllForum', this) // 获取全部板块
|
||||||
|
// this.$store.dispatch('getUserInfo', this) /// 获取用户信息
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ export default {
|
|||||||
props: ["twoCommentData", "popState", "commentContent"],
|
props: ["twoCommentData", "popState", "commentContent"],
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log("子组件");
|
// console.log("子组件");
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -76,36 +76,48 @@ export default {
|
|||||||
tab: "Offer榜",
|
tab: "Offer榜",
|
||||||
headMorePopState: false, // 弹窗的状态
|
headMorePopState: false, // 弹窗的状态
|
||||||
islogin: false,
|
islogin: false,
|
||||||
userInfo: {},
|
userInfo: {}, // 注意 userInfo 写I 是否是大写 ,, 因为 user 已经改为全局,后面要删除传值的 user
|
||||||
menu: [],
|
menu: [],
|
||||||
hotSearchkeywords: [], // 热门搜索
|
hotSearchkeywords: [], // 热门搜索
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: ["issearch", "needgetuser", "userinfo"],
|
props: ["issearch", "needgetuser", "userinfo"],
|
||||||
watch: {
|
watch: {
|
||||||
needgetuser: {
|
// needgetuser: {
|
||||||
handler(newValue, oldValue) {
|
// handler(newValue, oldValue) {
|
||||||
if (newValue) this.getUserInfoData();
|
// // if (newValue) this.getUserInfoData();
|
||||||
},
|
// },
|
||||||
immediate: true,
|
// immediate: true,
|
||||||
},
|
// },
|
||||||
|
|
||||||
|
// userinfo(newValue, oldValue) {
|
||||||
|
// this.userInfo = newValue;
|
||||||
|
// this.islogin = newValue.uid > 0 ? true : false;
|
||||||
|
// },
|
||||||
|
|
||||||
userinfo(newValue, oldValue) {
|
|
||||||
this.userInfo = newValue;
|
|
||||||
this.islogin = newValue.uid > 0 ? true : false;
|
|
||||||
},
|
|
||||||
headMorePopState(newValue, oldValue) {
|
headMorePopState(newValue, oldValue) {
|
||||||
if (newValue) this.$pageStop();
|
if (newValue) this.$pageStop();
|
||||||
else this.$pageMove();
|
else this.$pageMove();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getMenu()
|
let user = this.$store.state.user
|
||||||
|
if (JSON.stringify(user) === "{}") this.$store.dispatch('getUserInfo', this)
|
||||||
|
else {
|
||||||
|
this.userInfo = user
|
||||||
|
this.islogin = user.uid > 0 ? true : false;
|
||||||
|
this.hotSearchkeywords = this.$store.state.hotSearchkeywords
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.getMenu()
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
SearchBox,
|
SearchBox,
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// 处理登录
|
// 处理登录
|
||||||
handleRegister() {
|
handleRegister() {
|
||||||
@ -115,17 +127,17 @@ export default {
|
|||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfoData() {
|
getUserInfoData() {
|
||||||
|
return
|
||||||
// this.$http.post("/widget/getUser").then((res) => {
|
// this.$http.post("/widget/getUser").then((res) => {
|
||||||
this.$http.post("/api/index",).then((res) => {
|
this.$http.post("/api/index",).then((res) => {
|
||||||
if (res.code != 200) return;
|
if (res.code != 200) return;
|
||||||
// this.prototype.userInfo = res.data.user
|
|
||||||
this.userInfo = res.data.user;
|
this.userInfo = res.data.user;
|
||||||
this.islogin = res.data.user.uid > 0 ? true : false;
|
this.islogin = res.data.user.uid > 0 ? true : false;
|
||||||
this.hotSearchkeywords = res.data.hotSearchkeywords
|
this.hotSearchkeywords = res.data.hotSearchkeywords
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error(err.message)
|
this.$message.error(err.message)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getMenu() {
|
getMenu() {
|
||||||
|
@ -53,7 +53,6 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
if (this.searchText.length > 0) this.showClear = true
|
if (this.searchText.length > 0) this.showClear = true
|
||||||
else this.showClear = false
|
else this.showClear = false
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -6,6 +6,8 @@ import ElementUI, { Message, Pagination, loading } from 'element-ui';
|
|||||||
import 'element-ui/lib/theme-chalk/index.css';
|
import 'element-ui/lib/theme-chalk/index.css';
|
||||||
import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate, updateURLSearchParams } from "@/utils/common.js"
|
import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate, updateURLSearchParams } from "@/utils/common.js"
|
||||||
import http from "@/utils/request"
|
import http from "@/utils/request"
|
||||||
|
import VueSanitize from 'vue-sanitize'
|
||||||
|
|
||||||
import hintBox from '@/components/Hintbox'
|
import hintBox from '@/components/Hintbox'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
@ -45,6 +47,7 @@ if (!Array.isArray) {
|
|||||||
Vue.use(ElementUI);
|
Vue.use(ElementUI);
|
||||||
Vue.use(Pagination);
|
Vue.use(Pagination);
|
||||||
|
|
||||||
|
Vue.use(VueSanitize);
|
||||||
|
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
|
@ -6,10 +6,14 @@ Vue.use(Vuex)
|
|||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
historicalSearch: [],
|
historicalSearch: [],
|
||||||
allForumList: [{}], // 全部板块数据
|
allForumList: [], // 全部板块数据
|
||||||
homeRequestState: false, // 首页推荐和收藏接口的数据请求状态
|
homeRequestState: false, // 首页推荐和收藏接口的数据请求状态 这个是是否需要发送请求,因为用户点击收藏后需要重新获取
|
||||||
|
getUserInfoState: false, // 这个是是否在请求状态
|
||||||
favoriteList: [],
|
favoriteList: [],
|
||||||
recommendList: [],
|
recommendList: [],
|
||||||
|
user: {}, // 用户信息
|
||||||
|
hotSearchkeywords: [], // 热门搜索
|
||||||
|
loading: null,
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
@ -40,6 +44,18 @@ export default new Vuex.Store({
|
|||||||
state.recommendList = payload
|
state.recommendList = payload
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setUser(state, payload) {
|
||||||
|
state.user = payload
|
||||||
|
},
|
||||||
|
|
||||||
|
setHotSearchkeywords(state, payload) {
|
||||||
|
state.hotSearchkeywords = payload
|
||||||
|
},
|
||||||
|
|
||||||
|
setgetUserInfoState(state, payload) {
|
||||||
|
state.getUserInfoState = payload
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@ -51,6 +67,7 @@ export default new Vuex.Store({
|
|||||||
|
|
||||||
// 获取全部板块的数据
|
// 获取全部板块的数据
|
||||||
getAllForum({ commit }, that) {
|
getAllForum({ commit }, that) {
|
||||||
|
// getAllForum(commit, that) {
|
||||||
that.$startupUnderLoading(that)
|
that.$startupUnderLoading(that)
|
||||||
that.$http.get("/api/home/allForum").then(res => {
|
that.$http.get("/api/home/allForum").then(res => {
|
||||||
if (res.code != 200) return;
|
if (res.code != 200) return;
|
||||||
@ -62,9 +79,38 @@ export default new Vuex.Store({
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
that.$closeUnderLoading(that)
|
that.$closeUnderLoading(that)
|
||||||
})
|
})
|
||||||
// allForumList
|
|
||||||
|
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// 获取用户信息 获取收藏信息那些数据
|
||||||
|
getUserInfo({ state, commit }, that) {
|
||||||
|
if (state.getUserInfoState) return
|
||||||
|
commit('setgetUserInfoState', true)
|
||||||
|
// that.$startupUnderLoading(that)
|
||||||
|
that.$http.post("/api/home").then(res => {
|
||||||
|
if (res.code != 200) return;
|
||||||
|
let data = res.data
|
||||||
|
let { config, favorite, hotSearchkeywords, recommend, user } = data
|
||||||
|
|
||||||
|
commit('setHomeRequestState', true)
|
||||||
|
commit('setUser', user)
|
||||||
|
commit('setFavoriteList', favorite)
|
||||||
|
commit('setRecommendList', recommend)
|
||||||
|
commit('setHotSearchkeywords', hotSearchkeywords)
|
||||||
|
|
||||||
|
if (that.userInfo) { // 这个是顶部用户数据的 这样不用监听是否请求成功
|
||||||
|
that.userInfo = user
|
||||||
|
that.islogin = user.uid > 0 ? true : false;
|
||||||
|
that.hotSearchkeywords = hotSearchkeywords
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
that.$message.error(err.message)
|
||||||
|
}).finally(() => {
|
||||||
|
// that.$closeUnderLoading(that)
|
||||||
|
commit('setgetUserInfoState', false)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -48,6 +48,8 @@ function copy(value, message) {
|
|||||||
|
|
||||||
// 启动加载中
|
// 启动加载中
|
||||||
function startupUnderLoading(that) {
|
function startupUnderLoading(that) {
|
||||||
|
|
||||||
|
// this.
|
||||||
that.loading = that.$loading({
|
that.loading = that.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '加载中...',
|
text: '加载中...',
|
||||||
@ -57,7 +59,7 @@ function startupUnderLoading(that) {
|
|||||||
|
|
||||||
// 关闭加载中
|
// 关闭加载中
|
||||||
function closeUnderLoading(that) {
|
function closeUnderLoading(that) {
|
||||||
that.loading.close();
|
that.loading && that.loading.close();
|
||||||
that.loading = null
|
that.loading = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<header-nav :issearch="true" :needgetuser="true">
|
<header-nav :issearch="true" :needgetuser="true">
|
||||||
<template slot="header-title">帖子详情</template>
|
<template slot="header-title">帖子详情</template>
|
||||||
</header-nav>
|
</header-nav>
|
||||||
<router-view :key="key"></router-view>
|
<router-view :key="key" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -18,7 +18,6 @@ export default {
|
|||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
key() {
|
key() {
|
||||||
return this.$route.path + Math.random()
|
return this.$route.path + Math.random()
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
{{ info.subject }}
|
{{ info.subject }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div class="card flexcenter">
|
<div class="card flexcenter">
|
||||||
<div class="card-item shadow" v-if="postList.page == 1">
|
<div class="card-item shadow" v-if="postList.page == 1">
|
||||||
@ -122,8 +123,10 @@
|
|||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="offer-content">
|
<div class="offer-content">
|
||||||
<div v-html="info.message" style="line-height: normal;" class="vHtmlMessage">
|
<!-- <div v-html="info.message" style="line-height: normal;" class="vHtmlMessage"></div> -->
|
||||||
</div>
|
<!-- <div style="line-height: normal;" ref="vHtmlMessage" class="vHtmlMessage">{{ info.message }}</div> -->
|
||||||
|
<div style="line-height: normal;" ref="vHtmlMessage" class="vHtmlMessage"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@ -286,12 +289,7 @@
|
|||||||
|
|
||||||
<div class="bottom-item flex1 flexacenter">
|
<div class="bottom-item flex1 flexacenter">
|
||||||
<div class="bottom-operation-box flex1 flexacenter">
|
<div class="bottom-operation-box flex1 flexacenter">
|
||||||
<div class="bottom-operation-item flex1 flexcolumn flexcenter" @click="tapOperate('like')">
|
<div class="bottom-operation-item flex1 flexcolumn flexcenter" @click="info.islike == 0 ? tapOperate('like') : ''">
|
||||||
<!-- <div class="praise_bubble" id="praise_bubble" @click.stop=""
|
|
||||||
:style="{ height: prepareLiskeState ? '' : '.5333rem' }">
|
|
||||||
<div class="bubble" v-for="(item, index) in listlist" :key="index"></div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="loginBtn" v-if="!islogin" @click.stop="setValue('isloginBtnState', true, 'boolean')">
|
<div class="loginBtn" v-if="!islogin" @click.stop="setValue('isloginBtnState', true, 'boolean')">
|
||||||
</div>
|
</div>
|
||||||
<img v-if="info.islike == 0" class="bottom-operation-icom"
|
<img v-if="info.islike == 0" class="bottom-operation-icom"
|
||||||
@ -300,7 +298,7 @@
|
|||||||
<img v-else class="bottom-operation-icom"
|
<img v-else class="bottom-operation-icom"
|
||||||
:class="{ 'prepareLiskeAnimateState': prepareLiskeAnimateState }"
|
:class="{ 'prepareLiskeAnimateState': prepareLiskeAnimateState }"
|
||||||
src="@/assets/img/icon/like-o.png" />
|
src="@/assets/img/icon/like-o.png" />
|
||||||
<div class="bottom-operation-text">{{ stat.like == 0 ? '' : stat.like }}赞</div>
|
<div class="bottom-operation-text">{{ info.recommend_add == 0 ? '' : info.recommend_add }}赞</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-operation-item flex1 flexcolumn flexcenter"
|
<div class="bottom-operation-item flex1 flexcolumn flexcenter"
|
||||||
@click="tapOperate(info.isfav == 0 ? 'collect' : 'uncollect')">
|
@click="tapOperate(info.isfav == 0 ? 'collect' : 'uncollect')">
|
||||||
@ -329,6 +327,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import DetailReply from '@/components/DetailReply'
|
import DetailReply from '@/components/DetailReply'
|
||||||
import Coins from '@/components/unlock/Coins'
|
import Coins from '@/components/unlock/Coins'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'detailIndex',
|
name: 'detailIndex',
|
||||||
data() {
|
data() {
|
||||||
@ -337,7 +336,7 @@ export default {
|
|||||||
// avatar: "https://oss.gter.net/avatar/97KwEWANd_4DHWiY6VbnSUFSCKroYWFjYQ~~/middle",
|
// avatar: "https://oss.gter.net/avatar/97KwEWANd_4DHWiY6VbnSUFSCKroYWFjYQ~~/middle",
|
||||||
// content: "评论回复",
|
// content: "评论回复",
|
||||||
// },
|
// },
|
||||||
popState: "",
|
popState: "", // discussionSingle discussionMulti
|
||||||
coinConfig: {
|
coinConfig: {
|
||||||
strategy: {
|
strategy: {
|
||||||
button: "攒币指南",
|
button: "攒币指南",
|
||||||
@ -462,13 +461,13 @@ export default {
|
|||||||
loading: null, // 加载中
|
loading: null, // 加载中
|
||||||
|
|
||||||
commentContent: "", // 评论的文本
|
commentContent: "", // 评论的文本
|
||||||
|
operateState: false, // 操作请求的状态
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.tid = this.$route.query['tid']
|
this.tid = this.$route.query['tid']
|
||||||
this.postList.page = this.$route.query['page']
|
this.postList.page = this.$route.query['page'] || 1
|
||||||
|
|
||||||
this.getDetail()
|
this.getDetail()
|
||||||
|
|
||||||
@ -485,7 +484,6 @@ export default {
|
|||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
|
|
||||||
let data = res.data
|
let data = res.data
|
||||||
|
|
||||||
let info = data.info
|
let info = data.info
|
||||||
|
|
||||||
const reg = new RegExp("\r\n", "g")
|
const reg = new RegExp("\r\n", "g")
|
||||||
@ -496,14 +494,32 @@ export default {
|
|||||||
|
|
||||||
info["messageList"] = []
|
info["messageList"] = []
|
||||||
|
|
||||||
|
info['message'] = info['message'].replaceAll("[hide]作者设置了回复可见[/hide]", `<div class="flexcenter content-unlock content-unlock-no replyVisible" @click="aa()"><img class="unlock-icom" src="./img/unlock.png"/>作者设置了回复可见</div>`)
|
||||||
info['message'] = info['message'].replace("[hide]作者设置了回复可见[/hide]", `<div class="flexcenter content-unlock content-unlock-no"><img class="unlock-icom" src="./img/unlock.png">作者设置了回复可见</div>`)
|
|
||||||
|
|
||||||
// if (info.message.indexOf("[hide]作者设置了回复可见[/hide]")) {
|
// if (info.message.indexOf("[hide]作者设置了回复可见[/hide]")) {
|
||||||
// `<div class="flexcenter content-unlock content-unlock-no"><img class="unlock-icom" src="@/assets/img/detail/unlock.png">作者设置了回复可见</div>`
|
// `<div class="flexcenter content-unlock content-unlock-no"><img class="unlock-icom" src="@/assets/img/detail/unlock.png">作者设置了回复可见</div>`
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// console.log(info['message']);
|
||||||
|
|
||||||
|
// info['message'] = this.$sanitize(info['message'])
|
||||||
|
// console.log(info['message']);
|
||||||
|
|
||||||
|
data.type == 0 ? this.$refs['vHtmlMessage'] ? this.$refs.vHtmlMessage.innerHTML = info['message'] : "" : ""
|
||||||
|
|
||||||
|
let replyVisibleList = document.getElementsByClassName("replyVisible")
|
||||||
|
if (!Array.isArray(replyVisibleList)) {
|
||||||
|
for (let i = 0; i < replyVisibleList.length; i++) {
|
||||||
|
replyVisibleList[i].addEventListener('click', () => {
|
||||||
|
this.$emit("replyVisibleClick")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.$on('replyVisibleClick', () => {
|
||||||
|
this.popState = "discussionSingle"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(info, "offerinfo", data.type);
|
||||||
|
|
||||||
this.info = info
|
this.info = info
|
||||||
this.type = data.type
|
this.type = data.type
|
||||||
@ -564,7 +580,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取租房详情 https://app.gter.net/tenement/forum/show
|
|
||||||
|
// 租房
|
||||||
getTenementDetails() {
|
getTenementDetails() {
|
||||||
this.$http.post("/tenement/forum/show", {
|
this.$http.post("/tenement/forum/show", {
|
||||||
token: this.token
|
token: this.token
|
||||||
@ -594,7 +611,6 @@ export default {
|
|||||||
const reg = new RegExp("\r\n", "g")
|
const reg = new RegExp("\r\n", "g")
|
||||||
info['message'] = info['message'].replaceAll(reg, '<br/>')
|
info['message'] = info['message'].replaceAll(reg, '<br/>')
|
||||||
info['message'] = info['message'].replace(/<img[^>]*>/g, (match) => {
|
info['message'] = info['message'].replace(/<img[^>]*>/g, (match) => {
|
||||||
console.log("match", match);
|
|
||||||
return match.replace(/width="[^"]*"/g, '').replace(/height="[^"]*"/g, '');
|
return match.replace(/width="[^"]*"/g, '').replace(/height="[^"]*"/g, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -605,16 +621,16 @@ export default {
|
|||||||
|
|
||||||
// 获取面经详情
|
// 获取面经详情
|
||||||
getInterviewDetails() {
|
getInterviewDetails() {
|
||||||
// https://app.gter.net/InterviewExperience/thread
|
|
||||||
|
|
||||||
this.$http.post("/InterviewExperience/thread", {
|
this.$http.post("/InterviewExperience/thread", {
|
||||||
// token: this.token,
|
// token: this.token,
|
||||||
// tid: this.tid
|
// tid: this.tid
|
||||||
tid: 2322145,
|
// tid: 2322145,
|
||||||
uniqid: "--G1tS2SCTOQyoOMiedlLKxTnFvHWjBwQezsJjvVJFwgqOtOFeYr4_LAAG5RV37ETvMl2Zd4tSCc-_dqeKpERxXsx-tPfXrUs0kUysTGLzgxYzU~",
|
// uniqid: "--G1tS2SCTOQyoOMiedlLKxTnFvHWjBwQezsJjvVJFwgqOtOFeYr4_LAAG5RV37ETvMl2Zd4tSCc-_dqeKpERxXsx-tPfXrUs0kUysTGLzgxYzU~",
|
||||||
token: "5e3c42209eebfbab66e6f0d6c70a53c7",
|
// token: "5e3c42209eebfbab66e6f0d6c70a53c7",
|
||||||
|
token: this.token
|
||||||
}, "tenement").then(res => {
|
}, "tenement").then(res => {
|
||||||
console.log(res);
|
// console.log(res);
|
||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
let data = res.data
|
let data = res.data
|
||||||
this.info = { ...this.info, ...data }
|
this.info = { ...this.info, ...data }
|
||||||
@ -643,7 +659,7 @@ export default {
|
|||||||
|
|
||||||
// 处理回复点击弹出弹窗
|
// 处理回复点击弹出弹窗
|
||||||
handleReplyPop(item) {
|
handleReplyPop(item) {
|
||||||
console.log(item);
|
// console.log(item);
|
||||||
this.popState = "discussionSingle"
|
this.popState = "discussionSingle"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -654,18 +670,26 @@ export default {
|
|||||||
message: this.commentContent
|
message: this.commentContent
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
let data = res.data
|
// let data = res.data
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
this.popState = ""
|
this.popState = ""
|
||||||
|
|
||||||
let { count, limit } = this.postList
|
let { count, limit } = this.postList
|
||||||
|
|
||||||
|
|
||||||
|
let page = Math.ceil((count + 1) / limit)
|
||||||
|
console.log(page, this.postList.page);
|
||||||
|
if (page == this.postList.page) {
|
||||||
|
this.$router.go(0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let query = {
|
let query = {
|
||||||
page: Math.ceil((count + 1) / limit),
|
page,
|
||||||
tid: this.tid
|
tid: this.tid
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.push({ path: `/detailIndex`, query })
|
this.$router.push({ path: `/detailIndex`, query })
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -685,6 +709,8 @@ export default {
|
|||||||
// 点击点赞和收藏操作
|
// 点击点赞和收藏操作
|
||||||
tapOperate(key) {
|
tapOperate(key) {
|
||||||
// like collect uncollect
|
// like collect uncollect
|
||||||
|
if (this.operateState) return
|
||||||
|
this.operateState = true
|
||||||
|
|
||||||
let url = ""
|
let url = ""
|
||||||
if (key == "like") url = "/api/operation/threadLike"
|
if (key == "like") url = "/api/operation/threadLike"
|
||||||
@ -694,11 +720,13 @@ export default {
|
|||||||
this.$http.post(url, { tid: this.tid }).then(res => {
|
this.$http.post(url, { tid: this.tid }).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
if (key == "like") this.info.like = 1
|
if (key == "like") this.info.islike = 1
|
||||||
if (key == "collect") this.info.isfav = 1
|
if (key == "collect") this.info.isfav = 1
|
||||||
if (key == "uncollect") this.info.isfav = 0
|
if (key == "uncollect") this.info.isfav = 0
|
||||||
this.$message.success(res.message)
|
this.$message.success(res.message)
|
||||||
|
|
||||||
|
}).finally(() => {
|
||||||
|
this.operateState = false
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -948,6 +976,7 @@ export default {
|
|||||||
width: .64rem;
|
width: .64rem;
|
||||||
height: .64rem;
|
height: .64rem;
|
||||||
margin-right: 0.2rem;
|
margin-right: 0.2rem;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,6 +1041,8 @@ export default {
|
|||||||
width: .64rem;
|
width: .64rem;
|
||||||
height: .64rem;
|
height: .64rem;
|
||||||
margin-right: 0.2rem;
|
margin-right: 0.2rem;
|
||||||
|
vertical-align: middle;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="allSections-right">
|
<div class="allSections-right">
|
||||||
<div class="allSections-right-item" @click="pitchPlate(i.fid, i.name)"
|
<div class="allSections-right-item" @click="pitchPlate(i.fid, i.name)"
|
||||||
v-for="(i, k) in list[allActive].data" :key="k">
|
v-for="(i, k) in (list[allActive] && list[allActive]['data'])" :key="k">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-title">{{ i.name }}</div>
|
<div class="item-title">{{ i.name }}</div>
|
||||||
<div v-if="i.description" class="item-text" v-html="i.description.replace(/<[^>]+>/g, '')"></div>
|
<div v-if="i.description" class="item-text" v-html="i.description.replace(/<[^>]+>/g, '')"></div>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import plateNavigation from '@/components/PlateNavigation'
|
import plateNavigation from '@/components/PlateNavigation'
|
||||||
import indexList from '@/components/IndexList'
|
import indexList from '@/components/IndexList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AllSections",
|
name: "AllSections",
|
||||||
data() {
|
data() {
|
||||||
@ -75,6 +75,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
"$store.state.allForumList": {
|
||||||
|
handler(newV, oldV) {
|
||||||
|
if (!Array.isArray(newV)) return
|
||||||
|
this.list = newV
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.subscribe((mutation, state) => {
|
this.$store.subscribe((mutation, state) => {
|
||||||
if (mutation.type == "setAllForumList") this.list = this.$store.state.allForumList
|
if (mutation.type == "setAllForumList") this.list = this.$store.state.allForumList
|
||||||
@ -96,6 +107,7 @@ export default {
|
|||||||
handQuery() {
|
handQuery() {
|
||||||
if (this.list.length >= 2) {
|
if (this.list.length >= 2) {
|
||||||
let list = this.list
|
let list = this.list
|
||||||
|
console.log("list", list);
|
||||||
list.forEach((el, index) => {
|
list.forEach((el, index) => {
|
||||||
if (el.fid == this.onefid) this.allActive = index
|
if (el.fid == this.onefid) this.allActive = index
|
||||||
if (this.twofid) {
|
if (this.twofid) {
|
||||||
@ -151,7 +163,7 @@ export default {
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.postCollectionState = false
|
this.postCollectionState = false
|
||||||
this.$store.commit('setHomeRequestState', false)
|
this.$store.commit('setHomeRequestState', false)
|
||||||
this.$parent.init()
|
this.$store.dispatch('getUserInfo', this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -168,7 +180,7 @@ export default {
|
|||||||
// 获取帖子列表
|
// 获取帖子列表
|
||||||
getInvitationList() {
|
getInvitationList() {
|
||||||
this.$startupUnderLoading(this)
|
this.$startupUnderLoading(this)
|
||||||
this.$http.post("/api/home/threadList", {
|
this.$http.get("/api/home/threadList", {
|
||||||
page: this.invitationPage,
|
page: this.invitationPage,
|
||||||
limit: this.invitationLimit,
|
limit: this.invitationLimit,
|
||||||
fid: this.twofid
|
fid: this.twofid
|
||||||
@ -229,6 +241,15 @@ export default {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
overflow: -moz-scrollbars-none;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
height: 1.28rem;
|
height: 1.28rem;
|
||||||
line-height: 1.28rem;
|
line-height: 1.28rem;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<!-- 收藏版块 -->
|
<!-- 收藏版块 -->
|
||||||
<div class="collect">
|
<div class="collect">
|
||||||
<!-- 未收藏 -->
|
<!-- 未收藏 -->
|
||||||
<div v-if="favoriteHeadList.length <= 1" class="notCollect">
|
<div v-if="favoriteHeadList.length == 0" class="notCollect">
|
||||||
<img class="notCollect-img" src="~assets/img/collect/notCollect.png" alt="未收藏" />
|
<img class="notCollect-img" src="~assets/img/collect/notCollect.png" alt="未收藏" />
|
||||||
<div class="collect-text">收藏你感兴趣的版块,迅速浏览相应的帖子</div>
|
<div class="collect-text">收藏你感兴趣的版块,迅速浏览相应的帖子</div>
|
||||||
<router-link to="/allSections" class="flexcenter collect-btn">
|
<router-link to="/allSections" class="flexcenter collect-btn">
|
||||||
@ -81,12 +81,13 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
allForumList: [], // 所有板块得数据
|
allForumList: [], // 所有板块得数据
|
||||||
favoriteHeadList: [{
|
favoriteHeadList: [],
|
||||||
name: "全部",
|
// {
|
||||||
fid: 0
|
// name: "全部",
|
||||||
}],
|
// fid: 0
|
||||||
// favoriteHeadIdList: [],
|
// }],
|
||||||
favoriteHeadIdList: this.$store.state.favoriteList,
|
favoriteHeadIdList: [],
|
||||||
|
// favoriteHeadIdList: this.$store.state.favoriteList,
|
||||||
fid: 0, // 选中的收藏板块
|
fid: 0, // 选中的收藏板块
|
||||||
collect: [1],
|
collect: [1],
|
||||||
settingShow: false, //弹窗显示
|
settingShow: false, //弹窗显示
|
||||||
@ -108,69 +109,53 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
// "$store.state.homeRequestState": {
|
"$store.state.allForumList": {
|
||||||
// handler(newV, oldV) {
|
|
||||||
// console.log("newVnewV", newV);
|
|
||||||
// if (!newV) return
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.favoriteHeadIdList = this.$parent.favorite || []
|
|
||||||
// this.getAllForumList()
|
|
||||||
|
|
||||||
// if (this.fid) this.handleFavoriteHeadList()
|
|
||||||
// })
|
|
||||||
|
|
||||||
// },
|
|
||||||
// immediate: true
|
|
||||||
// },
|
|
||||||
|
|
||||||
fid: {
|
|
||||||
handler(newV, oldV) {
|
handler(newV, oldV) {
|
||||||
if (this.$store.state.homeRequestState && newV) this.handleFavoriteHeadList()
|
if (!Array.isArray(newV)) return
|
||||||
|
this.allForumList = newV
|
||||||
|
if (this.favoriteHeadList.length != 0) this.handleFavoriteHeadList()
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
},
|
||||||
|
|
||||||
|
favoriteHeadIdList: {
|
||||||
|
handler(newV, oldV) {
|
||||||
|
if (!Array.isArray(newV)) return
|
||||||
|
this.favoriteHeadList = newV
|
||||||
|
if (this.allForumList.length != 0) this.handleFavoriteHeadList()
|
||||||
|
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let { page, fid } = this.$route.query
|
let { page, fid } = this.$route.query
|
||||||
if (page) this.favorite.page = Number(page)
|
if (page) this.favorite.page = Number(page)
|
||||||
if (fid) this.fid = fid
|
if (fid) this.fid = fid
|
||||||
|
|
||||||
this.getCollectList()
|
this.init()
|
||||||
|
|
||||||
// console.log(this.$store.state.favoriteList, "this.$store.state.favoriteList");
|
|
||||||
if (this.favoriteHeadIdList.length != 0) this.getAllForumList()
|
|
||||||
|
|
||||||
console.log("this.favoriteHeadIdList", this.favoriteHeadIdList, this.favoriteHeadList);
|
|
||||||
|
|
||||||
this.$store.subscribe((mutation, state) => {
|
|
||||||
if (mutation.type == "setHomeRequestState" && mutation.payload) {
|
|
||||||
if (!this.$store.state.homeRequestState) return
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.favoriteHeadIdList = this.$parent.favorite || []
|
|
||||||
this.getAllForumList()
|
|
||||||
|
|
||||||
if (this.fid) this.handleFavoriteHeadList()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// 获取收藏列表数据
|
init() {
|
||||||
getCollectList() {
|
|
||||||
let { homeRequestState, favoriteList } = this.$store.state
|
let { homeRequestState, favoriteList } = this.$store.state
|
||||||
console.log("homeRequestState", homeRequestState);
|
|
||||||
if (!homeRequestState) {
|
if (!homeRequestState) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getCollectList()
|
this.init()
|
||||||
}, 300);
|
}, 300);
|
||||||
return
|
} else {
|
||||||
|
this.favoriteHeadIdList = favoriteList
|
||||||
|
this.getCollectList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
if (favoriteList.length == 0) return
|
// 获取收藏列表数据
|
||||||
|
getCollectList() {
|
||||||
|
|
||||||
|
if (this.favoriteHeadIdList.length == 0) return
|
||||||
this.$startupUnderLoading(this)
|
this.$startupUnderLoading(this)
|
||||||
this.$http.post("/api/home/threadList", {
|
this.$http.get("/api/home/threadList", {
|
||||||
limit: this.favorite.limit,
|
limit: this.favorite.limit,
|
||||||
page: this.favorite.page,
|
page: this.favorite.page,
|
||||||
fid: this.fid,
|
fid: this.fid,
|
||||||
@ -183,24 +168,12 @@ export default {
|
|||||||
this.favorite.page = data.page
|
this.favorite.page = data.page
|
||||||
this.favorite.limit = data.limit
|
this.favorite.limit = data.limit
|
||||||
this.favorite.count = data.count
|
this.favorite.count = data.count
|
||||||
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.$closeUnderLoading(this)
|
this.$closeUnderLoading(this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取全部板块数据
|
|
||||||
getAllForumList() {
|
|
||||||
let allForumList = this.$store.state.allForumList
|
|
||||||
if (allForumList.length == 1) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.getAllForumList()
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
this.allForumList = allForumList
|
|
||||||
this.handleFavoriteHeadList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理获取收藏板块的值
|
// 处理获取收藏板块的值
|
||||||
handleFavoriteHeadList() {
|
handleFavoriteHeadList() {
|
||||||
let allForumList = this.allForumList
|
let allForumList = this.allForumList
|
||||||
@ -210,6 +183,7 @@ export default {
|
|||||||
fid: 0
|
fid: 0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
allForumList.forEach((el, index) => {
|
allForumList.forEach((el, index) => {
|
||||||
if (!Array.isArray(el.data)) return
|
if (!Array.isArray(el.data)) return
|
||||||
el.data.forEach(elememt => {
|
el.data.forEach(elememt => {
|
||||||
@ -265,9 +239,6 @@ export default {
|
|||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
|
|
||||||
let list = this.$store.state.allForumList
|
let list = this.$store.state.allForumList
|
||||||
console.log(list, "list");
|
|
||||||
// list[this.allActive].data[k]['iscollection'] = state == "forumFav" ? 1 : 0
|
|
||||||
|
|
||||||
this.$store.commit('setAllForumList', list)
|
this.$store.commit('setAllForumList', list)
|
||||||
|
|
||||||
this.favoriteHeadList.splice(index, 1)
|
this.favoriteHeadList.splice(index, 1)
|
||||||
|
@ -34,33 +34,25 @@ export default {
|
|||||||
return this.$route.path + Math.random()
|
return this.$route.path + Math.random()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
"$store.state.homeRequestState": {
|
||||||
|
handler(newV, oldV) {
|
||||||
|
let { favoriteList, recommendList } = this.$store.state
|
||||||
|
this.favorite = favoriteList
|
||||||
|
this.recommend = recommendList
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init()
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
HeaderNav,
|
HeaderNav,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
|
||||||
let homeRequestState = this.$store.state.homeRequestState
|
|
||||||
if (homeRequestState) {
|
|
||||||
let { favoriteList, recommendList } = this.$store.state
|
|
||||||
this.favorite = favoriteList
|
|
||||||
this.recommend = recommendList
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$http.post("/api/home").then(res => {
|
|
||||||
let data = res.data
|
|
||||||
this.favorite = data.favorite
|
|
||||||
this.recommend = data.recommend
|
|
||||||
this.$store.commit('setHomeRequestState', true)
|
|
||||||
this.$store.commit('setFavoriteList', data.favorite)
|
|
||||||
this.$store.commit('setRecommendList', data.recommend)
|
|
||||||
|
|
||||||
// console.log(this.$store.state.favoriteList,"this.$store.state.favoriteListthis.$store.state.favoriteList ");
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
loading: null,
|
loading: null,
|
||||||
allForumList: this.$store.state.allForumList,
|
allForumList: this.$store.state.allForumList || [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -78,13 +78,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.$startupUnderLoading(this)
|
this.$startupUnderLoading(this)
|
||||||
this.$http.post("/api/home/threadList", {
|
this.$http.get("/api/home/threadList", {
|
||||||
limit: this.limit,
|
limit: this.limit,
|
||||||
type: "recommend",
|
type: "recommend",
|
||||||
page: this.page,
|
page: this.page,
|
||||||
fid: this.fid,
|
fid: this.fid,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res, "ffff");
|
|
||||||
|
|
||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
let data = res.data
|
let data = res.data
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
diff a/src/views/index/recommend/Recommend.vue b/src/views/index/recommend/Recommend.vue (rejected hunks)
|
|
||||||
@@ -23,7 +23,7 @@
|
|
||||||
import plateNavigation from '@/components/PlateNavigation.vue'
|
|
||||||
import indexList from '@/components/IndexList'
|
|
||||||
export default {
|
|
||||||
- name: "Recommend",//推荐阅读hjhjh
|
|
||||||
+ name: "Recommend",//推荐阅读
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hotActive: -1,//热门版块活跃点击
|
|
Loading…
x
Reference in New Issue
Block a user