Compare commits

...

10 Commits

Author SHA1 Message Date
xiaoronghao
d82c425491 提交 2023-04-11 17:56:16 +08:00
xiaoronghao
5a6d83cc06 no message 2023-04-10 19:20:33 +08:00
xiaoronghao
e5df02f241 no message 2023-04-10 17:19:22 +08:00
xiaoronghao
3000ff590b 哈哈 2023-04-10 15:37:48 +08:00
xiaoronghao
6466a55896 444 2023-04-07 19:12:02 +08:00
xiaoronghao
03d27d5c41 45 2023-04-07 19:11:23 +08:00
xiaoronghao
3cfb24ba8c 56 2023-04-07 19:09:40 +08:00
xiaoronghao
cbdda8699f 1 2023-04-07 19:09:18 +08:00
xiaoronghao
838988d55e 哈哈哈 2023-04-07 19:06:01 +08:00
xiaoronghao
1d244c56e5 no message 2023-04-07 19:05:21 +08:00
27 changed files with 736 additions and 202 deletions

View File

@ -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": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

BIN
public/img/unlock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -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) ///
}, },
} }
@ -35,7 +40,7 @@ export default {
flex-direction: column; flex-direction: column;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
overflow: hidden; // overflow: hidden;
} }
a { a {

View File

@ -231,6 +231,29 @@ section {
} }
.paging {
margin-top: .48rem;
::v-deep {
.el-pagination.is-background .el-pager li:not(.disabled).active {
background: rgba(98, 177, 255, 1);
border-radius: 50%;
}
.el-pagination .btn-next .el-icon,
.el-pagination .btn-prev .el-icon {
font-size: .4rem;
}
.el-pagination.is-background.el-pagination--small .btn-next,
.el-pagination.is-background.el-pagination--small .btn-prev,
.el-pagination.is-background.el-pagination--small .el-pager li {
border-radius: 50%;
}
}
}
.result-empty-box { .result-empty-box {
height: 100%; height: 100%;
width: 100%; width: 100%;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -12,11 +12,12 @@
<div class="discussion-single-box flexflex flex1"> <div class="discussion-single-box flexflex flex1">
<div class="discussion-single-content flexacenter flex1"> <div class="discussion-single-content flexacenter flex1">
<input class="discussion-single-input flex1" cursor-spacing="5" type="text" <input class="discussion-single-input flex1" cursor-spacing="5" type="text"
:placeholder="twoCommentData ? '写回复…' : '想问啥,大胆问…'" v-model="commentContent" /> :placeholder="twoCommentData ? '写回复…' : '想问啥,大胆问…'" :value="commentContent"
@input="inputCommentContent($event)" />
<img class="discussion-single-input-icom" @click.stop="setValue()" <img class="discussion-single-input-icom" @click.stop="setValue()"
src="@/assets/img/detail/unfold.png" /> src="@/assets/img/detail/unfold.png" />
</div> </div>
<div class="discussion-single-btn flexcenter" @click.stop="postComment(commentContent)"> <div class="discussion-single-btn flexcenter" @click.stop="postComment()">
发布 发布
</div> </div>
</div> </div>
@ -32,14 +33,14 @@
<div class="discussion-text one-line">{{ twoCommentData.content }}</div> <div class="discussion-text one-line">{{ twoCommentData.content }}</div>
</div> </div>
<div class="discussion-multi-content flexflex flex1"> <div class="discussion-multi-content flexflex flex1">
<textarea class="discussion-multi-textarea flex1" type="text" maxlength="500" v-model="commentContent" <textarea class="discussion-multi-textarea flex1" type="text" maxlength="500" :value="commentContent"
:placeholder="twoCommentData ? '写回复…' : '想问啥,大胆问…'"></textarea> :placeholder="twoCommentData ? '写回复…' : '想问啥,大胆问…'" @input="inputCommentContent($event)"></textarea>
<img class="discussion-multi-icom" @click.stop="openDiscussionSingle()" <img class="discussion-multi-icom" @click.stop="openDiscussionSingle()"
src="@/assets/img/detail/pack.png" /> src="@/assets/img/detail/pack.png" />
<div class="discussion-multi-sum">{{ 500 - commentContent.length }}</div> <div class="discussion-multi-sum">{{ 500 - commentContent.length }}</div>
</div> </div>
<div class="discussion-multi-bottom flexflex flexacenter"> <div class="discussion-multi-bottom flexflex flexacenter">
<div class="discussion-multi-btn flexcenter" @click.stop="postComment(commentContent)"> <div class="discussion-multi-btn flexcenter" @click.stop="postComment()">
发布 发布
</div> </div>
</div> </div>
@ -53,30 +54,26 @@ export default {
name: 'DetailReply', name: 'DetailReply',
data() { data() {
return { return {
commentContent: "",
openDiscussionSingleState: true, // openDiscussionSingleState: true, //
}; };
}, },
props: ["twoCommentData", "popState"], props: ["twoCommentData", "popState", "commentContent"],
mounted() { mounted() {
// console.log("");
console.log("子组件");
}, },
methods: { methods: {
// //
postComment(commentContent) { postComment() {
this.$parent.postComment(commentContent) this.$parent.postComment()
}, },
// //
handlePopCancel() { handlePopCancel() {
console.log(this.$parent.popState, "this.$parent.popState");
this.$parent.twoCommentData = null this.$parent.twoCommentData = null
this.$parent.popState = "" this.$parent.popState = ""
}, },
// //
@ -98,6 +95,11 @@ export default {
}, 500); }, 500);
}, },
inputCommentContent(event) {
let value = event.currentTarget.value
this.$parent.commentContent = value
}
}, },
}; };

View File

@ -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,10 +127,10 @@ 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

View File

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

View File

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

View File

@ -6,8 +6,14 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
historicalSearch: [], historicalSearch: [],
allForumList: [{}], // 全部板块数据 allForumList: [], // 全部板块数据
homeRequestState: false, // 首页推荐和收藏接口的数据请求状态 这个是是否需要发送请求,因为用户点击收藏后需要重新获取
getUserInfoState: false, // 这个是是否在请求状态
favoriteList: [],
recommendList: [],
user: {}, // 用户信息
hotSearchkeywords: [], // 热门搜索
loading: null,
}, },
getters: { getters: {
}, },
@ -26,6 +32,30 @@ export default new Vuex.Store({
state.allForumList = payload state.allForumList = payload
}, },
setHomeRequestState(state, payload) {
state.homeRequestState = payload
},
setFavoriteList(state, payload) {
state.favoriteList = payload
},
setRecommendList(state, payload) {
state.recommendList = payload
},
setUser(state, payload) {
state.user = payload
},
setHotSearchkeywords(state, payload) {
state.hotSearchkeywords = payload
},
setgetUserInfoState(state, payload) {
state.getUserInfoState = payload
},
}, },
actions: { actions: {
@ -37,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;
@ -48,10 +79,39 @@ 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)
})
},
}, },
modules: { modules: {

View File

@ -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
} }

View File

@ -19,7 +19,7 @@ baseURL = {
const service = axios.create({ const service = axios.create({
baseURL: baseURL.forum, baseURL: baseURL.forum,
timeout: 5000 timeout: 15000
}) })
// 2.请求拦截器 // 2.请求拦截器

View File

@ -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></router-view> <router-view :key="key" />
</div> </div>
</template> </template>
@ -18,6 +18,11 @@ export default {
}; };
}, },
computed: {
key() {
return this.$route.path + Math.random()
}
},
mounted() { mounted() {
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container"> <div class="container">
<div class="detail-head flexacenter"> <div class="detail-head flexacenter">
<div class="detail-section">版块<span class="section-name">香港澳门台湾留学申请</span></div> <div class="detail-section" @click="toAllSection()">版块<span class="section-name">{{ info.forum }}</span></div>
<div class="detail-data flexacenter"> <div class="detail-data flexacenter">
<div class="detail-data-item flexacenter"> <div class="detail-data-item flexacenter">
<img class="detail-data-eye" src="@/assets/img/detail/eye.png">{{ info.views }} <img class="detail-data-eye" src="@/assets/img/detail/eye.png">{{ info.views }}
@ -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">
@ -99,7 +100,7 @@
<template v-else-if="type == 3"> <template v-else-if="type == 3">
<div class="offer-content"> <div class="offer-content">
<div class="offer-content-box" v-if="tenementInfoState"> <div class="offer-content-box">
<template v-for="(item, index) in tenementKey"> <template v-for="(item, index) in tenementKey">
<div class="offer-content-item flexacenter" :key="index" v-if="info[item.key]"> <div class="offer-content-item flexacenter" :key="index" v-if="info[item.key]">
<div class="offer-content-key" v-if="info[item.key]">{{ item.name }}</div> <div class="offer-content-key" v-if="info[item.key]">{{ item.name }}</div>
@ -112,15 +113,20 @@
</template> </template>
</div> </div>
<div v-html="info.message" class="vHtmlMessage" style=""> <div v-html="info.message" class="vHtmlMessage" style="margin: .52rem 0;">
</div> </div>
<img class="tenement-img" v-for="(item, index) in info.images" :key="index" :src="item">
</div> </div>
</template> </template>
<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>
@ -131,9 +137,7 @@
<img class="card-head-icon" :src="item.avatar" /> <img class="card-head-icon" :src="item.avatar" />
<div class="card-head-content flex1 flexflex"> <div class="card-head-content flex1 flexflex">
<div class="card-head-name flexflex">{{ item.author }} <div class="card-head-name flexflex">{{ item.author }}
<!-- <div class="landlord flexcenter" v-if="index == 0"> <div class="landlord flexcenter" v-if="item.isauthor == 1">楼主</div>
楼主
</div> -->
</div> </div>
<div class="card-head-time">{{ $formattedDate(item.dateline) }}</div> <div class="card-head-time">{{ $formattedDate(item.dateline) }}</div>
</div> </div>
@ -142,10 +146,13 @@
index + 2}` }}</div> index + 2}` }}</div>
<div class="card-head-fool" v-else>{{ `${(postList.page - 1) * postList.limit + index + 1}` }} <div class="card-head-fool" v-else>{{ `${(postList.page - 1) * postList.limit + index + 1}` }}
</div> </div>
<div class="edit-box flexcenter" v-if="item.ismyself == 1" @click.stop="handleIsmyself(item)">
<img class="edit-icom" src="@/assets/img/detail/edit.png" />
</div>
<!-- <div class="card-head-fool">{{ index == 0 ? '楼主' : `${index}` }}</div> --> <!-- <div class="card-head-fool">{{ index == 0 ? '楼主' : `${index}` }}</div> -->
</div> </div>
<div class="card-content flex1" v-html="item.message"></div> <div class="card-content flex1" @click.stop="handleReplyPop(item)" v-html="item.message"></div>
<template v-if="false"> <template v-if="false">
@ -282,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"
@ -296,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')">
@ -315,7 +317,8 @@
</div> </div>
</div> </div>
<detail-reply :two-comment-data="twoCommentData" :pop-state="popState"></detail-reply> <detail-reply :two-comment-data="twoCommentData" :comment-content="commentContent"
:pop-state="popState"></detail-reply>
<coins :coin-config="coinConfig" :pop-state="popState"></coins> <coins :coin-config="coinConfig" :pop-state="popState"></coins>
</div> </div>
@ -324,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() {
@ -332,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: "攒币指南",
@ -456,12 +460,18 @@ export default {
loading: null, // loading: null, //
commentContent: "", //
operateState: false, //
}; };
}, },
mounted() { mounted() {
this.tid = this.$route.query['tid'] this.tid = this.$route.query['tid']
this.postList.page = this.$route.query['page'] || 1
this.getDetail() this.getDetail()
window.scrollTo(0, 0);
}, },
methods: { methods: {
@ -474,14 +484,42 @@ 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")
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) => {
return match.replace(/width="[^"]*"/g, '').replace(/height="[^"]*"/g, ''); return match.replace(/width="[^"]*"/g, '').replace(/height="[^"]*"/g, '');
}); })
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>`)
// 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>`
// }
// 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
@ -491,7 +529,8 @@ export default {
else if (this.type == 5) this.getsummaryDetails() else if (this.type == 5) this.getsummaryDetails()
else if (this.type == 3) this.getTenementDetails() else if (this.type == 3) this.getTenementDetails()
else if (this.type == 2) this.getInterviewDetails() else if (this.type == 2) this.getInterviewDetails()
this.getPostList()
info['ispost'] != 0 ? this.getPostList() : ''
}).finally(() => { }).finally(() => {
this.$closeUnderLoading(this) this.$closeUnderLoading(this)
@ -506,7 +545,6 @@ export default {
let data = res.data let data = res.data
// let offerinfo = data.offerinfo // let offerinfo = data.offerinfo
let offerinfo = data.collegelist[0] let offerinfo = data.collegelist[0]
console.log("offerinfo", offerinfo);
let useperformanceStr = "" let useperformanceStr = ""
offerinfo.useperformance && offerinfo.useperformance.forEach((el, index) => { offerinfo.useperformance && offerinfo.useperformance.forEach((el, index) => {
useperformanceStr += el + (offerinfo.useperformance.length - 1 == index ? '' : '、') useperformanceStr += el + (offerinfo.useperformance.length - 1 == index ? '' : '、')
@ -516,7 +554,6 @@ export default {
// offerinfo['schoolname'] = offerinfo.school.name // offerinfo['schoolname'] = offerinfo.school.name
this.offerinfo = offerinfo this.offerinfo = offerinfo
// this.shareurl = data.shareurl
}) })
}, },
@ -538,17 +575,15 @@ export default {
this.info = { ...this.info, ...data.info } this.info = { ...this.info, ...data.info }
console.log(this.info);
this.collegelist = collegelist this.collegelist = collegelist
this.shareurl = data.shareurl this.shareurl = data.shareurl
}) })
}, },
// https://app.gter.net/tenement/forum/show
//
getTenementDetails() { getTenementDetails() {
console.log("ggjlgjkgj");
this.$http.post("/tenement/forum/show", { this.$http.post("/tenement/forum/show", {
// tid: 2540476
token: this.token token: this.token
}, "tenement").then(res => { }, "tenement").then(res => {
@ -576,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, '');
}); });
@ -587,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 }
@ -623,24 +657,60 @@ export default {
}, },
//
handleReplyPop(item) {
// console.log(item);
this.popState = "discussionSingle"
},
// //
postComment(message) { postComment(message) {
this.$http.post("/api/operation/reply", { this.$http.post("/api/operation/reply", {
token: this.token, token: this.token,
message message: this.commentContent
}).then(res => { }).then(res => {
console.log(res); if (res.code != 200) return
// let data = res.data
// console.log(data);
this.popState = ""
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 = {
page,
tid: this.tid
}
this.$router.push({ path: `/detailIndex`, query })
}) })
}, },
// //
currentChange() { currentChange() {
this.getPostList()
// this.getPostList()
let query = {
page: this.postList.page,
tid: this.tid
}
this.$router.push({ path: `/detailIndex`, query })
}, },
// //
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"
@ -650,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
}) })
}, },
@ -672,7 +744,19 @@ export default {
// //
postcollect() { postcollect() {
console.log("点击收藏"); console.log("点击收藏");
} },
//
toAllSection() {
this.$router.push({ path: `/allSections`, query: { twofid: this.info.fid } })
},
//
handleIsmyself(item) {
console.log(item, "item");
this.twoCommentData = item.message
this.popState = "discussionMulti"
},
}, },
@ -818,7 +902,21 @@ export default {
color: rgb(127, 127, 127); color: rgb(127, 127, 127);
font-size: .32rem; font-size: .32rem;
} }
.edit-box {
width: .64rem;
height: .64rem;
border-radius: 50%;
background: #f6f6f6;
margin-left: .32rem;
.edit-icom {
width: .4rem;
// height: .4rem;
} }
}
}
.card-content { .card-content {
color: #333; color: #333;
@ -827,6 +925,13 @@ export default {
padding: .5rem .32rem; padding: .5rem .32rem;
word-break: break-word; word-break: break-word;
/deep/ {
img {
width: 100% !important;
height: auto !important;
}
}
.quotation { .quotation {
width: 100%; width: 100%;
color: #333; color: #333;
@ -862,6 +967,7 @@ export default {
} }
} }
/deep/ {
.content-unlock { .content-unlock {
&.content-unlock-no { &.content-unlock-no {
height: 3.2rem; height: 3.2rem;
@ -870,6 +976,7 @@ export default {
width: .64rem; width: .64rem;
height: .64rem; height: .64rem;
margin-right: 0.2rem; margin-right: 0.2rem;
vertical-align: middle;
} }
} }
@ -902,7 +1009,7 @@ export default {
} }
} }
}
} }
@ -915,13 +1022,65 @@ export default {
line-height: .6rem; line-height: .6rem;
word-break: break-word; word-break: break-word;
/deep/ strong { /deep/ {
strong {
font-weight: bold; font-weight: bold;
} }
/deep/ img { img {
max-width: 100%; max-width: 100%;
} }
.content-unlock {
&.content-unlock-no {
height: 3.2rem;
.unlock-icom {
width: .64rem;
height: .64rem;
margin-right: 0.2rem;
vertical-align: middle;
}
}
background: rgba(242, 242, 242, 0.7);
margin: .48rem 0;
color: #555555;
font-size: .32rem;
border-radius: .16rem;
&.content-already {
background: rgba(242, 242, 242, 0.7);
margin: .48rem 0;
padding: .32rem;
color: #555555;
font-size: .32rem;
border-radius: .16rem;
.content-already-header {
color: #7f7f7f;
font-size: .28rem;
justify-content: center;
}
.content-unlock-wenzi {
color: #333;
font-size: .36rem;
line-height: .6rem;
margin-top: .3rem;
}
}
}
}
}
.tenement-img {
width: 100%;
} }
.offer-content-box { .offer-content-box {

View File

@ -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>
@ -37,8 +37,9 @@
</div> </div>
<!-- .paging-box { -->
<div v-if="invitationList.length != 0" class="paging flexcenter"> <div v-if="invitationList.length != 0" class="paging-bo paging flexcenter">
<el-pagination small background layout="prev, pager, next" @current-change="currentChange" <el-pagination small background layout="prev, pager, next" @current-change="currentChange"
:current-page.sync="invitationPage" :page-size="invitationLimit" :total="invitationCount"> :current-page.sync="invitationPage" :page-size="invitationLimit" :total="invitationCount">
</el-pagination> </el-pagination>
@ -74,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
@ -84,26 +96,22 @@ export default {
if (twofid) this.twofid = twofid if (twofid) this.twofid = twofid
if (invitationPage) this.invitationPage = Number(invitationPage) if (invitationPage) this.invitationPage = Number(invitationPage)
if (Number(onefid) > 0) this.a() if (Number(onefid) > 0 || Number(twofid) > 0) this.handQuery()
if (Number(twofid) > 0) this.getInvitationList() if (Number(twofid) > 0) this.getInvitationList()
}, },
methods: { methods: {
a() { // query
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) => {
// console.log(this.twofid);
if (el.fid == this.onefid) this.allActive = index if (el.fid == this.onefid) this.allActive = index
if (this.twofid) { if (this.twofid) {
el.data.forEach((element, i) => { el.data.forEach((element, i) => {
console.log(element, i);
if (element.fid == this.twofid) { if (element.fid == this.twofid) {
this.plate = { this.plate = {
stairname: el.name, stairname: el.name,
@ -116,11 +124,9 @@ export default {
}) })
console.log(this.onefid, "onefidonefid");
} else { } else {
setTimeout(() => { setTimeout(() => {
this.a() this.handQuery()
}, 500) }, 500)
} }
@ -132,10 +138,7 @@ export default {
allClick(index, fid) { allClick(index, fid) {
this.allActive = index this.allActive = index
const params = new URLSearchParams(window.location.search); this.$updateURLSearchParams({ onefid: fid })
params.set('onefid', fid);
const newUrl = window.location.pathname + '?' + params.toString();
window.history.pushState({}, '', newUrl);
}, },
// //
@ -159,6 +162,8 @@ export default {
this.$forceUpdate() this.$forceUpdate()
}).finally(() => { }).finally(() => {
this.postCollectionState = false this.postCollectionState = false
this.$store.commit('setHomeRequestState', false)
this.$store.dispatch('getUserInfo', this)
}) })
}, },
@ -175,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
@ -236,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;

View File

@ -2,45 +2,44 @@
<!-- 收藏版块 --> <!-- 收藏版块 -->
<div class="collect"> <div class="collect">
<!-- 未收藏 --> <!-- 未收藏 -->
<div v-if="collect.length == 0" 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>
<!-- <div class="collect-btn"> -->
<router-link to="/allSections" class="flexcenter collect-btn"> <router-link to="/allSections" class="flexcenter collect-btn">
<div class="collect-btn-text">马上收藏</div> <div class="collect-btn-text">马上收藏</div>
<svg-icon icon-class="collect-btn" class-name="icon-collect"></svg-icon> <svg-icon icon-class="collect-btn" class-name="icon-collect"></svg-icon>
</router-link> </router-link>
<!-- </div> -->
</div> </div>
<!-- 已收藏 --> <!-- 已收藏 -->
<div v-else> <div v-else>
<!-- 热门版块 --> <!-- 热门版块 -->
<div class="hot-box"> <div class="hot-box" v-if="favoriteHeadList.length > 1">
<div class="hot-label" :class="{ active: hotActive == index }" v-for="(item, index) in list" :key="index" <div class="hot-label" :class="{ active: fid == item.fid }" v-for="(item, index) in favoriteHeadList" :key="index"
@click="hotLabelClick(index)"> @click="hotLabelClick(item.fid)">
{{ item.label }} {{ item.name }}
</div> </div>
<!-- 设置按钮 --> <!-- 设置按钮 -->
<div class="setting flexcenter" @click="settingClick"> <div class="setting flexcenter" @click="settingClick">
<img src="~assets/img/icon/setting.png" alt="设置" /> <img src="~assets/img/icon/setting.png" alt="设置" />
设置 设置
</div> </div>
<!-- 设置 收藏版块弹窗 --> <!-- 设置 收藏版块弹窗 -->
<div class="setting-window" :class="{ 'setting-show': settingShow == true }" @click="settingClose"> <div class="setting-window" :class="{ 'setting-show': settingShow == true }" @click="settingClose">
<div class="setting-container" @click.stop> <div class="setting-container" @click.stop>
<div class="setting-title">设置收藏版块</div> <div class="setting-title">设置收藏版块</div>
<div class="setting-total"> <div class="setting-total">
<div class="setting-num">共收藏<b> {{ list.length - 1 }} </b>个版块</div> <div class="setting-num">共收藏<b> {{ favoriteHeadList.length - 1 }} </b>个版块</div>
<router-link to="/allSections" class="flexcenter setting-add"> <router-link to="/allSections" class="flexcenter setting-add">
<svg-icon icon-class="settingAdd" class-name="setting-add-img"></svg-icon>添加 <svg-icon icon-class="settingAdd" class-name="setting-add-img"></svg-icon>添加
</router-link> </router-link>
</div> </div>
<!-- 弹窗收藏版块内容 --> <!-- 弹窗收藏版块内容 -->
<div class="setting-sections"> <div class="setting-sections">
<div v-for="(item, index) in list" :key="index"> <div v-for="(item, index) in favoriteHeadList" :key="index">
<div v-if="index != 0" class="setting-item" @click.stop="cancelFavoritesSection(index)"> <div v-if="index != 0" class="setting-item" @click.stop="cancelFavoritesSection(item.fid, index)">
<div class="setting-item-title">{{ item.label }}</div> <div class="setting-item-title">{{ item.name }}</div>
<div class="setting-star"></div> <div class="setting-star"></div>
</div> </div>
</div> </div>
@ -50,12 +49,24 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 路径 --> <!-- 路径 -->
<plate-navigation stairname="寄托学术类备" subsectionsname="SAT、AP考试、海外本科申…"></plate-navigation> <template v-if="fid != 0">
<plate-navigation :stairname="plate.stairname" :subsectionsname="plate.subsectionsname"></plate-navigation>
</template>
<!-- 内容区域 --> <!-- 内容区域 -->
<section> <section>
<!-- <index-list :list=""></index-list> --> <template v-if="favorite.list.length != 0 || loading">
<index-list></index-list> <index-list :list="favorite.list"></index-list>
<div class="paging flexcenter">
<el-pagination small background layout="prev, pager, next" @current-change="currentChange"
:current-page.sync="favorite.page" :page-size="favorite.limit" :total="favorite.count">
</el-pagination>
</div>
</template>
</section> </section>
</div> </div>
</div> </div>
@ -69,37 +80,146 @@ export default {
name: "Collect", name: "Collect",
data() { data() {
return { return {
hotActive: 0, // allForumList: [], //
favoriteHeadList: [],
// {
// name: "",
// fid: 0
// }],
favoriteHeadIdList: [],
// favoriteHeadIdList: this.$store.state.favoriteList,
fid: 0, //
collect: [1], collect: [1],
settingShow: false, // settingShow: false, //
settingStar: false, settingStar: false,
list: [ plate: {
// stairname: "",//
{ subsectionsname: "",//
label: "全部",
}, },
{ favorite: { //
label: "香港留学", list: [],
limit: 20,
page: 1,
count: 0
}, },
{ loading: null,
label: "香港留学",
},
{
label: "香港留学",
},
],
}; };
}, },
mounted() {
watch: {
"$store.state.allForumList": {
handler(newV, oldV) {
if (!Array.isArray(newV)) return
this.allForumList = newV
if (this.favoriteHeadList.length != 0) this.handleFavoriteHeadList()
},
immediate: true
},
favoriteHeadIdList: {
handler(newV, oldV) {
if (!Array.isArray(newV)) return
this.favoriteHeadList = newV
if (this.allForumList.length != 0) this.handleFavoriteHeadList()
}, },
components: { immediate: true
plateNavigation,
indexList
}, },
},
mounted() {
let { page, fid } = this.$route.query
if (page) this.favorite.page = Number(page)
if (fid) this.fid = fid
this.init()
},
methods: { methods: {
hotLabelClick(index) { init() {
this.hotActive = index; let { homeRequestState, favoriteList } = this.$store.state
if (!homeRequestState) {
setTimeout(() => {
this.init()
}, 300);
} else {
this.favoriteHeadIdList = favoriteList
this.getCollectList()
}
},
//
getCollectList() {
if (this.favoriteHeadIdList.length == 0) return
this.$startupUnderLoading(this)
this.$http.get("/api/home/threadList", {
limit: this.favorite.limit,
page: this.favorite.page,
fid: this.fid,
type: "fav"
}).then(res => {
if (res.code != 200) return
let data = res.data
this.favorite.list = data.data
this.favorite.page = data.page
this.favorite.limit = data.limit
this.favorite.count = data.count
}).finally(() => {
this.$closeUnderLoading(this)
})
},
//
handleFavoriteHeadList() {
let allForumList = this.allForumList
let favoriteHeadIdList = this.favoriteHeadIdList
let favoriteHeadList = [{
name: "全部",
fid: 0
}]
allForumList.forEach((el, index) => {
if (!Array.isArray(el.data)) return
el.data.forEach(elememt => {
if (elememt.fid == this.fid) {
this.plate.stairname = el.name
this.plate.subsectionsname = elememt.name
}
if (favoriteHeadIdList.includes(elememt.fid)) {
favoriteHeadList.push({
fid: elememt.fid,
name: elememt.name,
})
}
})
})
this.favoriteHeadList = favoriteHeadList
},
currentChange() {
let query = {
page: this.favorite.page,
}
if (this.fid) query['fid'] = this.fid
this.$router.push({ path: `/collect`, query })
},
hotLabelClick(fid) {
let query = {
page: 1,
fid
}
this.$router.push({ path: `/collect`, query })
}, },
// //
settingClick() { settingClick() {
@ -110,11 +230,33 @@ export default {
this.settingShow = false; this.settingShow = false;
}, },
// //
cancelFavoritesSection(index) { cancelFavoritesSection(fid, index) {
this.list.splice(index, 1) let url = "/api/operation/unforumFav"
this.$http.post(url, {
fid
}).then(res => {
if (res.code != 200) return
let list = this.$store.state.allForumList
this.$store.commit('setAllForumList', list)
this.favoriteHeadList.splice(index, 1)
this.$Message.success(res.message)
}).finally(() => {
this.$store.commit('setHomeRequestState', false)
this.$parent.init()
})
} }
}, },
components: {
plateNavigation,
indexList
},
}; };
</script> </script>
@ -314,6 +456,7 @@ export default {
.paging { .paging {
margin-top: .48rem; margin-top: .48rem;
padding-bottom: 1rem;
::v-deep { ::v-deep {
.el-pagination.is-background .el-pager li:not(.disabled).active { .el-pagination.is-background .el-pager li:not(.disabled).active {

View File

@ -34,20 +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() {
this.$http.post("/api/home").then(res => {
let data = res.data
this.favorite = data.favorite
this.recommend = data.recommend
})
},
} }
}; };
</script> </script>

View File

@ -2,14 +2,21 @@
<div class="recommend"> <div class="recommend">
<!-- 热门版块 --> <!-- 热门版块 -->
<div class="hot-box"> <div class="hot-box">
<div class="hot-label" :class="{ 'active': hotActive == index }" v-for="(item, index) in list" :key="index" <div class="hot-label" :class="{ 'active': item.fid == fid }" v-for="(item, index) in hotList" :key="index"
@click="hotLabelClick(index)">{{ item.label }}</div> @click="hotLabelClick(item.fid)">{{ item.name }}</div>
</div> </div>
<!-- 路径 --> <!-- 路径 -->
<plate-navigation stairname="香港澳门台湾" subsectionsname="SAT、AP考试、海外本科申…"></plate-navigation> <plate-navigation v-if="fid != 0" :stairname="plate.stairname"
:subsectionsname="plate.subsectionsname"></plate-navigation>
<section> <section>
<template v-if="list.length == 0"> <template v-if="list.length != 0 || loading">
<index-list></index-list> <index-list :list="list"></index-list>
<div class="paging flexcenter">
<el-pagination small background layout="prev, pager, next" @current-change="currentChange"
:current-page.sync="page" :page-size="limit" :total="count">
</el-pagination>
</div>
</template> </template>
<div class="result-empty-box flexcenter shadow" v-else> <div class="result-empty-box flexcenter shadow" v-else>
<img class="result-empty-icon" src="@/assets/img/icon/empty.png"> <img class="result-empty-icon" src="@/assets/img/icon/empty.png">
@ -25,30 +32,102 @@ export default {
name: "Recommend",// name: "Recommend",//
data() { data() {
return { return {
hotActive: -1,// hotList: [],
list: [ list: [],
{ count: 0, //
label: "香港留学" limit: 20, //
page: 1, //
fid: 0, // id
plate: {
stairname: "",//
subsectionsname: "",//
}, },
{
label: "香港留学" loading: null,
}, allForumList: this.$store.state.allForumList || [],
{
label: "香港留学"
},
{
label: "香港留学"
} }
] },
watch: {
"$parent.recommend": {
handler(newV, oldV) {
this.hotList = newV
},
immediate: true
},
"$store.state.allForumList": {
handler(newV, oldV) {
this.allForumList = newV
this.handleForumFid()
},
immediate: true
} }
}, },
mounted() { mounted() {
console.log(this.$parent); let { page, fid } = this.$route.query
if (page) this.page = Number(page)
if (fid) {
this.fid = fid
this.handleForumFid()
}
this.init()
}, },
methods: { methods: {
hotLabelClick(index) { init() {
this.hotActive = index this.$startupUnderLoading(this)
this.$http.get("/api/home/threadList", {
limit: this.limit,
type: "recommend",
page: this.page,
fid: this.fid,
}).then(res => {
if (res.code != 200) return
let data = res.data
this.list = data.data
this.limit = data.limit
this.page = data.page
this.count = data.count
}).finally(() => {
this.$closeUnderLoading(this)
})
},
//
handleForumFid() {
let allForumList = this.allForumList
if (!Array.isArray(allForumList) || allForumList.length <= 1) return
allForumList.forEach((el, index) => {
if (!Array.isArray(el['data'])) return
el.data.forEach(element => {
if (element['fid'] == this.fid) {
this.plate.subsectionsname = element.name
this.plate.stairname = el.name
}
})
})
},
currentChange() {
let query = {
page: this.page,
}
if (this.fid) query['fid'] = this.fid
this.$router.push({ path: `/recommend`, query })
},
hotLabelClick(fid) {
let query = {
page: 1,
fid
}
this.$router.push({ path: `/recommend`, query })
} }
}, },
components: { components: {
@ -59,8 +138,13 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.path-box {
margin-bottom: 0.2rem;
}
.paging { .paging {
margin-top: .48rem; margin-top: .48rem;
padding-bottom: 1rem;
::v-deep { ::v-deep {
.el-pagination.is-background .el-pager li:not(.disabled).active { .el-pagination.is-background .el-pager li:not(.disabled).active {
@ -72,10 +156,25 @@ export default {
.el-pagination .btn-prev .el-icon { .el-pagination .btn-prev .el-icon {
font-size: .4rem; font-size: .4rem;
} }
}
.is-background.el-pagination--small .el-pager li {
border-radius: 50% !important;
} }
.el-pagination.is-background.el-pagination--small .btn-next,
.el-pagination.is-background.el-pagination--small .btn-prev,
.el-pagination.is-background.el-pagination--small .el-pager li {
border-radius: 50%;
}
}
}
section { section {
padding-top: 0;
height: 10.3333rem; height: 10.3333rem;
} }
</style> </style>

View File

@ -108,9 +108,11 @@ export default {
let kw = this.kw let kw = this.kw
if (!kw) return if (!kw) return
this.page = 1 this.page = 1
this.getSearchResult()
this.$updateURLSearchParams({ kw: this.kw, page: this.page }) this.$router.push({ path: `/searchResult`, query: { kw: this.kw, page: this.page } })
// this.getSearchResult()
// this.$updateURLSearchParams({ kw: this.kw, page: this.page })
}, },
// //