index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div>
  3. <!-- 页面头部 -->
  4. <!-- <HomePageHead></HomePageHead>
  5. <HomePageNavigation1></HomePageNavigation1> -->
  6. <!-- 头部 -->
  7. <templateHead></templateHead>
  8. <!-- 菜单 -->
  9. <templateMenu></templateMenu>
  10. <div class="topicBox">
  11. <div class="inner">
  12. <el-tabs v-model="activeName" class="demo-tabs" @tab-change="getTopicsList">
  13. <el-tab-pane label="推荐" name="">
  14. <!-- 列表 -->
  15. <NuxtLink :to="`/topic/${item.id}`" v-for="item in listData" :key="index">
  16. <div class="topicList">
  17. <div class="listHead">
  18. <div class="left">
  19. <span v-for="i in typeList" :key="index">
  20. <span v-if="item.type == i.value" class="one">{{i.label}}</span>
  21. </span>
  22. </div>
  23. <div class="right">{{ item.created_at }}</div>
  24. </div>
  25. <div class="listFoot">
  26. <div class="left">
  27. <h2>{{ item.title }}</h2>
  28. <p>
  29. <img v-if='item.avatar' :src="item.avatar" alt="">
  30. <img v-else src='http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Rectangle.png' alt="">
  31. <span> {{ item.author }}</span>
  32. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Chat.png" alt="">
  33. <span> {{ item.num ? item.num : 0 }}</span>
  34. </p>
  35. </div>
  36. <div class="right" v-show="item.group_name">
  37. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Chat1.png" alt="">
  38. <span>{{ item.group_name }}</span>
  39. </div>
  40. </div>
  41. </div>
  42. </NuxtLink>
  43. <div class="adEmpty" v-show="!currentPage">
  44. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Blogs_empty.png" alt="">
  45. <span>暂无商圈列表~</span>
  46. </div>
  47. </el-tab-pane>
  48. <el-tab-pane :label="item.label" :name="item.value" v-for="item in typeList">
  49. <!-- 列表 -->
  50. <NuxtLink :to="`/topic/${item.id}`" target="_blank" v-for="item in listData">
  51. <div class="topicList">
  52. <div class="listHead">
  53. <div class="left">
  54. <span v-for="i in typeList" :key="index">
  55. <span v-if="item.type == i.value" class="one">{{i.label}}</span>
  56. </span>
  57. </div>
  58. <div class="right">{{ item.created_at }}</div>
  59. </div>
  60. <div class="listFoot">
  61. <div class="left">
  62. <h2>{{ item.title }}</h2>
  63. <p>
  64. <img :src="item.avatar" alt="">
  65. <!-- <img v-else src='../../static/topic/Rectangle.png' alt=""> -->
  66. <span> {{ item.author }}</span>
  67. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Chat.png" alt="">
  68. <span> {{ item.num ? item.num : 0 }}</span>
  69. </p>
  70. </div>
  71. <div class="right" v-show="item.group_name">
  72. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Chat1.png" alt="">
  73. <span>{{ item.group_name }}</span>
  74. </div>
  75. </div>
  76. </div>
  77. </NuxtLink>
  78. <div class="adEmpty" v-show="!currentPage">
  79. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/topic/Blogs_empty.png" alt="">
  80. <span>暂无商圈列表~</span>
  81. </div>
  82. </el-tab-pane>
  83. </el-tabs>
  84. <!-- 分页 -->
  85. <div class="paginationBox" v-show="currentPage">
  86. <el-pagination background layout="prev, pager, next" :total="currentPage" prev-text="上一页"
  87. next-text="下一页" @change="pageChage" />
  88. </div>
  89. </div>
  90. </div>
  91. <!-- 页面底部 -->
  92. <!-- <HomeFoot></HomeFoot> -->
  93. <templateFoot></templateFoot>
  94. </div>
  95. </template>
  96. <script setup>
  97. //1.引用模块 start ---------------------------------------->
  98. //使用ref和reactive动态变量
  99. import { ref, reactive, onMounted } from 'vue'
  100. //使用官方ssr请求模块
  101. // import { useNuxtApp, useFetch } from '#app'
  102. //使用element-plus组件
  103. import { ElTabs, ElTabPane, ElTable, ElTableColumn, ElPagination } from 'element-plus';
  104. // axios请求
  105. const nuxtApp = useNuxtApp();
  106. const axios = nuxtApp.$axios;
  107. //1.引用模块 end ---------------------------------------->
  108. // 定义响应式数据
  109. const seoData = ref({
  110. title: '商圈',
  111. description: '默认描述',
  112. keywords: '默认关键词',
  113. image: 'https://example.com/default-image.jpg'
  114. });
  115. // 在 onMounted 钩子中获取数据
  116. onMounted(()=>{
  117. seoData.value.title = '商圈';
  118. seoData.value.description = '默认描述';
  119. seoData.value.keywords = '默认关键词';
  120. })
  121. //2.页面数据 start ---------------------------------------->
  122. const activeName = useState("activeName", () => '')
  123. const listData = useState("listData", () => [])//商圈列表
  124. const typeList = useState("typeList", () => [])//商圈分类
  125. const statusList = useState("statusList", () => [])//商圈状态
  126. // 分页相关
  127. const currentPage = useState("currentPage", () => 0)
  128. const pageSize = useState("pageSize", () => 10)
  129. const page = useState("page", () => 1)
  130. //2.页面数据 end ---------------------------------------->
  131. //3.分页 start ---------------------------------------->
  132. const pageChage = (val) => {
  133. page.value = val
  134. getTopicsList()
  135. }
  136. //3.分页 start ---------------------------------------->
  137. //4.请求商圈列表 start ---------------------------------------->
  138. const getTopicsList = () => {
  139. console.log('activeName', activeName.value);
  140. let data = new FormData()
  141. data.append('page', page.value)
  142. data.append('page_size', pageSize.value)
  143. data.append('status', 2)
  144. data.append('type', activeName.value)
  145. axios.post('chat/getTopicsList', data).then(response => {
  146. console.log(8899)
  147. console.log("response", response);
  148. listData.value = response.data.data;
  149. currentPage.value = response.data.total;
  150. })
  151. }
  152. const getTopicsList1 = () => {
  153. console.log('activeName', activeName.value);
  154. let data = new FormData()
  155. data.append('page', page.value)
  156. data.append('page_size', pageSize.value)
  157. data.append('status', 2)
  158. // data.append('type', activeName.value)
  159. axios.post('chat/getTopicsList', data).then(response => {
  160. // console.log(response);
  161. listData.value = response.data.data;
  162. currentPage.value = response.data.total;
  163. })
  164. }
  165. onMounted(() => {
  166. getTopicsList1();
  167. })
  168. //4.请求商圈列表 end ---------------------------------------->
  169. //5.获取分类和状态 start ---------------------------------------->
  170. const topicType = () => {
  171. axios.post('/chat/topicType').then(response => {
  172. console.log(111222333)
  173. console.log(response.data);
  174. // console.log(1);
  175. typeList.value = response.data;
  176. })
  177. }
  178. const topicStatus = () => {
  179. axios.post('chat/topicStatus').then(response => {
  180. console.log(response);
  181. })
  182. }
  183. onMounted(() => {
  184. //分类
  185. topicType();
  186. //状态
  187. topicStatus();
  188. })
  189. //5.获取分类和状态 end ---------------------------------------->
  190. //自助建站 start---------------------------------------->
  191. //1.获得自助建站头部底部
  192. import templateHead from '@/components/template/sector/head/1200x200/1.vue'
  193. import templateMenu from '@/components/template/sector/menu/1200x130/1.vue'
  194. import templateFoot from '@/components/template/sector/foot/1200x580/1.vue'
  195. //2.获得pinia源
  196. import { useTemplateBaseStore } from '@/stores/templateBase'
  197. const templateBaseStore = useTemplateBaseStore()
  198. //3.获得该页的皮肤id
  199. const skinId = ref("")
  200. //4.获得站点基本信息
  201. const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
  202. method: 'GET',
  203. query: {
  204. 'link_textnum':24,
  205. 'link_imgnum':18,
  206. 'link_footnum':4
  207. },
  208. });
  209. if (responseStatus.code == 200) {
  210. //4.1设置站点基本信息
  211. templateBaseStore.setWebSiteInfo(responseStatus.data)
  212. //4.2设置皮肤id
  213. skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
  214. //4.3设置seo
  215. useSeoMeta({
  216. title: "商圈" + "_" + "三农资讯网_全国政务信息一体化应用平台",
  217. meta: [
  218. { name: 'description', content: "三农资讯网以服务于党和国家各级职能部门三农政务资讯发布及政务公开信息公示为基点,为全国县级以上各级党政机关及其职能部门配置各自公开独立网络发布平台。主要频道有:三农政务资讯,农科资讯,农资购销,农产购销,农贸资讯,三农致富信息,农村文化生活,三农政策法规,三农之窗,三农调查,三农服务,三农知识,农民工,打假维权等。三农资讯网打造最具影响力的三农信息发布平台,并成为最具权威的三农资讯网。_三农资讯网-测试专用_全国政务信息一体化应用平台" , tagPriority: 10 },
  219. { name: 'keywords', content: "三农资讯,农业,三农,三农在线,农业新闻,三农资讯网_三农资讯网-测试专用_全国政务信息一体化应用平台" , tagPriority: 10 }
  220. ]
  221. });
  222. }
  223. //5.获得广告池
  224. const adData = ref([]);
  225. const adResponseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
  226. method: 'GET',
  227. query: {},
  228. });
  229. if (adResponseStatus.code == 200) {
  230. templateBaseStore.setAdList(adResponseStatus.data)
  231. adData.value = adResponseStatus.data;
  232. }
  233. //自助建站 end---------------------------------------->
  234. </script>
  235. <style lang="less" scoped>
  236. .demo-tabs>.el-tabs__content {
  237. padding: 32px;
  238. color: #6b778c;
  239. font-size: 32px;
  240. font-weight: 600;
  241. }
  242. .topicBox {
  243. margin-bottom: 30px;
  244. .inner {
  245. width: 1200px;
  246. margin: 0 auto;
  247. :deep(.el-tabs__header) {
  248. width: 1200px;
  249. margin: 0 auto;
  250. }
  251. :deep(.el-tabs__item) {
  252. padding: 0 100px 0 20px;
  253. font-size: 16px;
  254. //height: 60px;
  255. }
  256. :deep(.el-tabs__item.is-active),
  257. :deep(.el-tabs__item:hover) {
  258. color: #33b023;
  259. }
  260. :deep(.el-tabs__active-bar) {
  261. background-color: #33b023;
  262. height: 0;
  263. }
  264. :deep(.el-tabs__nav) {
  265. // height: 60px;
  266. height: 54px;
  267. }
  268. .adEmpty {
  269. margin: 150px auto;
  270. text-align: center;
  271. img {
  272. width: 78px;
  273. height: 78px;
  274. vertical-align: -28px;
  275. margin-right: 10px;
  276. }
  277. span {
  278. font-family: Microsoft YaHei, Microsoft YaHei;
  279. font-weight: bold;
  280. font-size: 26px;
  281. color: #CCCCCC;
  282. line-height: 30px;
  283. text-align: center;
  284. font-style: normal;
  285. text-transform: none;
  286. }
  287. }
  288. }
  289. .topicList {
  290. margin-top: 30px;
  291. height: 200px;
  292. border: 1px solid #e7e7e7;
  293. .listHead {
  294. height: 60px;
  295. padding: 15px 24px 15px 50px;
  296. border-bottom: 1px solid #e7e7e7;
  297. box-sizing: border-box;
  298. background-color: #fafafa;
  299. .left {
  300. div {
  301. font-family: Microsoft YaHei, Microsoft YaHei;
  302. font-weight: 400;
  303. font-size: 16px;
  304. color: #FFAA33;
  305. background-color: #fbebd5;
  306. padding: 5px 17px;
  307. }
  308. .one {
  309. color: #FFAA33;
  310. background-color: #fbebd5;
  311. display: block;
  312. padding: 5px 17px;
  313. }
  314. .two {
  315. color: #33B023;
  316. background-color: #d5ecd2;
  317. }
  318. .three {
  319. color: #666;
  320. background-color: #ebebeb;
  321. }
  322. }
  323. .right {
  324. font-family: Microsoft YaHei, Microsoft YaHei;
  325. font-weight: bold;
  326. font-size: 16px;
  327. color: #333333;
  328. padding: 5px 0;
  329. }
  330. }
  331. .listFoot {
  332. margin: 30px 50px;
  333. .left {
  334. h2 {
  335. font-family: Microsoft YaHei, Microsoft YaHei;
  336. font-weight: bold;
  337. font-size: 20px;
  338. color: #333333;
  339. }
  340. p {
  341. margin-top: 30px;
  342. img {
  343. width: 24px;
  344. height: 24px;
  345. vertical-align: middle;
  346. margin-right: 10px;
  347. }
  348. span {
  349. margin-right: 40px;
  350. font-family: Microsoft YaHei, Microsoft YaHei;
  351. font-weight: 400;
  352. font-size: 16px;
  353. color: #333333;
  354. }
  355. }
  356. }
  357. .right {
  358. color: #139602;
  359. margin-top: 27px;
  360. img {
  361. width: 24px;
  362. height: 24px;
  363. vertical-align: middle;
  364. margin-right: 10px;
  365. }
  366. span {
  367. font-family: Microsoft YaHei, Microsoft YaHei;
  368. font-weight: 400;
  369. font-size: 16px;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. //分页样式
  376. .paginationBox {
  377. display: flex;
  378. justify-content: center;
  379. margin-top: 60px;
  380. margin-bottom: 60px;
  381. // 鼠标移入后字体颜色
  382. :deep(.el-pagination:hover) {
  383. color: #139609;
  384. }
  385. :deep(.el-pagination.is-background .btn-next),
  386. :deep(.el-pagination.is-background .btn-prev) {
  387. width: 70px;
  388. height: 34px;
  389. margin: 0px 10px;
  390. border-radius: 4px;
  391. }
  392. :deep(.el-pagination.is-background .el-pager li) {
  393. margin: 0px 10px;
  394. width: 38px;
  395. height: 34px;
  396. border-radius: 4px;
  397. }
  398. :deep(.el-pagination.is-background .btn-next.is-active),
  399. :deep(.el-pagination.is-background .btn-prev.is-active),
  400. :deep(.el-pagination.is-background .el-pager li.is-active) {
  401. background-color: #028e21;
  402. color: #fff;
  403. }
  404. }
  405. </style>