PolicyInformation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <!--
  2. * @Description: 政策资讯部分
  3. * @Author: 空白格
  4. * @Date: 2022-08-30 13:51:52
  5. * @LastEditors: 空白格
  6. * @LastEditTime: 2022-09-05 17:05:04
  7. * @FilePath: \veterans_client_web\src\views\Home\components\PolicyInformation.vue
  8. * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
  9. -->
  10. <template>
  11. <div class="home-main-policy-box">
  12. <!-- 政策资讯部分 -->
  13. <el-row :gutter="0" class="home-main-policy">
  14. <el-col :span="24" class="home-main-policy-carousel">
  15. <el-carousel :interval="5000" arrow="never" height="140px">
  16. <el-carousel-item v-for="(item, index) in bannerList" :key="index">
  17. <el-image
  18. class="image"
  19. :src="
  20. item.bannerUrl || require('@/assets/images/default-news.jpg')
  21. "
  22. fit="cover"
  23. @click="
  24. item.id &&
  25. jumpPage('/bannerdetails', {
  26. id: item.id,
  27. type: 5,
  28. })
  29. "
  30. >
  31. <div slot="placeholder" class="image-slot">
  32. 加载图片中<span class="dot">...</span>
  33. </div>
  34. <div slot="error" class="image-slot">
  35. <el-image
  36. class="image"
  37. :src="require('@/assets/images/default-news.jpg')"
  38. fit="cover"
  39. ></el-image>
  40. </div>
  41. </el-image>
  42. <div class="title">
  43. {{ item.artTitle || "" }}
  44. </div>
  45. </el-carousel-item>
  46. </el-carousel>
  47. </el-col>
  48. <el-col :span="24" class="home-main-policy-content" v-loading="loading">
  49. <el-row :gutter="54">
  50. <el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
  51. <div class="hmpc-left">
  52. <el-tabs v-model="tabCur" @tab-click="handlePolicyClick">
  53. <el-tab-pane
  54. v-for="(item, index) in policyTypeList"
  55. :key="index"
  56. :label="item.label"
  57. :name="item.text"
  58. >
  59. <div class="hmpc-left-list" v-if="policyList.length">
  60. <div
  61. @click="
  62. jumpPage('newsdetails', {
  63. id: item.artId,
  64. type: 'policy',
  65. })
  66. "
  67. class="hmpc-left-list-item"
  68. v-for="(item, index) in policyList"
  69. :key="index"
  70. >
  71. <div class="title">{{ item.artTitle }}</div>
  72. <div class="date">
  73. {{ parseTime(item.artPostTime, "{y}-{m}-{d}") }}
  74. </div>
  75. </div>
  76. </div>
  77. <el-empty description="资讯数据为空" v-else></el-empty>
  78. </el-tab-pane>
  79. </el-tabs>
  80. <div class="more-btn" @click="jumpPage('/policyadvice')">
  81. 更多
  82. </div>
  83. </div>
  84. </el-col>
  85. <el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8">
  86. <div class="hmpc-right">
  87. <div class="hmpc-right-title">退役军人服务</div>
  88. <div class="hmpc-right-list">
  89. <div
  90. class="hmpc-right-list-btn hmpc-right-list-btn-1"
  91. @click="jumpPage('/policyadvice')"
  92. ></div>
  93. <div
  94. class="hmpc-right-list-btn hmpc-right-list-btn-2"
  95. @click="jumpPage('/recruitmentemployment')"
  96. ></div>
  97. <div
  98. class="hmpc-right-list-btn hmpc-right-list-btn-3"
  99. @click="jumpPage('/skilltraining')"
  100. ></div>
  101. <div
  102. class="hmpc-right-list-btn hmpc-right-list-btn-4"
  103. @click="jumpPage('/educationpromote')"
  104. ></div>
  105. <div
  106. class="hmpc-right-list-btn hmpc-right-list-btn-5"
  107. @click="jumpPage('/workguide')"
  108. ></div>
  109. </div>
  110. </div>
  111. </el-col>
  112. </el-row>
  113. </el-col>
  114. </el-row>
  115. </div>
  116. </template>
  117. <script>
  118. import { parseTime } from "@/utils/utils";
  119. import { getDictData } from "@/api/Dict";
  120. import { getPolicyData } from "@/api/PolicyAdvice";
  121. import { getBannerList } from "@/api/Home";
  122. export default {
  123. name: "PolicyInformation",
  124. data() {
  125. return {
  126. parseTime: parseTime,
  127. loading: false,
  128. bannerList: [
  129. { bannerUrl: require("@/assets/images/policy-advice-logo.png") },
  130. ],
  131. policyTypeList: [],
  132. tabCur: "",
  133. policyList: [],
  134. };
  135. },
  136. created() {
  137. this.getDict();
  138. this.getPolicyBannerList();
  139. },
  140. methods: {
  141. /**
  142. * 获取字典数据
  143. * @date 2022-08-17
  144. * @returns {any}
  145. */
  146. getDict() {
  147. getDictData({ key: "policy_type" }).then((res) => {
  148. this.policyTypeList = res?.data;
  149. this.policyTypeList.length &&
  150. (this.tabCur = this.policyTypeList[0].text) &&
  151. this.getPolicyList();
  152. });
  153. },
  154. /**
  155. * 获取政策资讯轮播
  156. * @date 2022-08-17
  157. * @returns {any}
  158. */
  159. getPolicyBannerList() {
  160. getBannerList({ type: 5 }).then((res) => {
  161. res.data.length ? (this.bannerList = res.data) : "";
  162. });
  163. },
  164. /**
  165. * 获取咨询列表
  166. * @date 2022-08-17
  167. * @returns {any}
  168. */
  169. getPolicyList() {
  170. this.loading = true;
  171. getPolicyData({
  172. pageNum: 1,
  173. pageSize: 10,
  174. artCategoryId: this.tabCur,
  175. }).then((res) => {
  176. this.policyList = res?.rows;
  177. this.loading = false;
  178. });
  179. },
  180. /**
  181. * 切换触发
  182. * @date 2022-08-30
  183. * @param {any} tab
  184. * @returns {any}
  185. */
  186. handlePolicyClick(tab) {
  187. this.tabCur = tab.name;
  188. this.getPolicyList();
  189. },
  190. /**
  191. * 跳转
  192. * @date 2022-08-30
  193. * @param {any} path
  194. * @param {any} query
  195. * @returns {any}
  196. */
  197. jumpPage(path, query) {
  198. this.$router.push({ path, query });
  199. },
  200. },
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. .home-main {
  205. &-policy-box {
  206. background: #f7f7f7;
  207. }
  208. &-policy {
  209. width: 70%;
  210. margin: 0 auto;
  211. min-width: 600px;
  212. padding: 40px 0;
  213. &-carousel {
  214. cursor: pointer;
  215. :deep(.el-carousel__button) {
  216. // 指示器按钮
  217. width: 7px;
  218. height: 7px;
  219. border: none;
  220. border-radius: 50%;
  221. background-color: #fff;
  222. }
  223. :deep(.is-active .el-carousel__button) {
  224. // 指示器激活按钮
  225. width: 16px;
  226. border-radius: 10px;
  227. }
  228. .image {
  229. width: 100%;
  230. height: 100%;
  231. }
  232. }
  233. &-content {
  234. margin-top: 50px;
  235. .hmpc-left {
  236. margin-bottom: 20px;
  237. position: relative;
  238. :deep(.el-tabs__item) {
  239. font-size: 20px;
  240. font-weight: 500;
  241. color: #666666;
  242. }
  243. :deep(.el-tabs__item:hover) {
  244. color: #163da5;
  245. }
  246. :deep(.el-tabs__item.is-active) {
  247. color: #163da5;
  248. }
  249. :deep(.el-tabs__active-bar) {
  250. background-color: #163da5;
  251. }
  252. &-list {
  253. padding: 10px 0;
  254. &-item {
  255. display: flex;
  256. justify-content: space-between;
  257. margin-bottom: 10px;
  258. font-size: 14px;
  259. color: #373737;
  260. cursor: pointer;
  261. &:hover {
  262. text-decoration: underline;
  263. }
  264. .title {
  265. width: 80%;
  266. white-space: nowrap;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. word-break: break-all;
  270. }
  271. .date {
  272. width: 20%;
  273. white-space: nowrap;
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. word-break: break-all;
  277. text-align: right;
  278. color: #797979;
  279. }
  280. }
  281. }
  282. .more-btn {
  283. position: absolute;
  284. right: 0;
  285. top: 12px;
  286. color: #727272;
  287. font-size: 14px;
  288. cursor: pointer;
  289. }
  290. }
  291. .hmpc-right {
  292. margin-bottom: 20px;
  293. &-title {
  294. font-size: 20px;
  295. color: #163da5;
  296. margin-bottom: 10px;
  297. }
  298. &-list {
  299. &-btn {
  300. width: 100%;
  301. text-align: center;
  302. height: 47px;
  303. line-height: 47px;
  304. border-radius: 5px;
  305. cursor: pointer;
  306. font-size: 14px;
  307. margin-bottom: 7px;
  308. position: relative;
  309. &:hover {
  310. opacity: 0.8;
  311. }
  312. &::before {
  313. content: "";
  314. display: inline-block;
  315. width: 25px;
  316. height: 25px;
  317. background-size: 100% 100%;
  318. background-repeat: no-repeat;
  319. background-position: center center;
  320. vertical-align: middle;
  321. position: absolute;
  322. left: calc(45% - 35px);
  323. top: 50%;
  324. margin-top: -12.5px;
  325. }
  326. &::after {
  327. position: absolute;
  328. left: 45%;
  329. }
  330. }
  331. &-btn-1 {
  332. background-image: linear-gradient(137deg, #c5fff6 0%, #5debd8 100%);
  333. color: #028170;
  334. &::before {
  335. background-image: url("./../../../assets/images/zhengcezixun.svg");
  336. }
  337. &::after {
  338. content: "政策资讯";
  339. }
  340. }
  341. &-btn-2 {
  342. background-image: linear-gradient(137deg, #fff6e3 0%, #f7b6a3 100%);
  343. color: #ff6253;
  344. &::before {
  345. background-image: url("./../../../assets/images/woyaojiuye.svg");
  346. }
  347. &::after {
  348. content: "我要就业";
  349. }
  350. }
  351. &-btn-3 {
  352. background-image: linear-gradient(137deg, #fff6e3 0%, #fae08a 100%);
  353. color: #ff8d34;
  354. &::before {
  355. background-image: url("./../../../assets/images/woyaoxuejineng.svg");
  356. }
  357. &::after {
  358. content: "我要学技能";
  359. }
  360. }
  361. &-btn-4 {
  362. background-image: linear-gradient(137deg, #eee3ff 0%, #d3b9ff 100%);
  363. color: #8454d3;
  364. &::before {
  365. background-image: url("./../../../assets/images/woxiangshengxueli.svg");
  366. }
  367. &::after {
  368. content: "我要升学历";
  369. }
  370. }
  371. &-btn-5 {
  372. background-image: linear-gradient(137deg, #c9e9ff 0%, #95d2fc 100%);
  373. color: #1b74b4;
  374. &::before {
  375. background-image: url("./../../../assets/images/woxiangchuangye.svg");
  376. }
  377. &::after {
  378. content: "我想创业";
  379. }
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. </style>