affair.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="home-page">
  3. <!-- 政务 -->
  4. <view class="pages-content zw-pages-content">
  5. <roll-message ref="rollMessage" />
  6. <!-- 主题服务 -->
  7. <view class="zw-service-box theme-service zw-interval" v-if="AggregationService">
  8. <view class="service-title">
  9. {{ AggregationService.themeVo.themeName }}
  10. </view>
  11. <view class="service-content">
  12. <u-row gutter="20">
  13. <u-col span="6" v-for="item in AggregationService.themeModuleVoList">
  14. <view class="service-item lazy-img" @click.stop="$openPage(item)">
  15. <u-image class="service-img" :src="$getImgPath(item.moduleImage)" mode="aspectFit"
  16. :lazy-load="true"></u-image>
  17. </view>
  18. </u-col>
  19. </u-row>
  20. </view>
  21. </view>
  22. <!-- 一件事中心 -->
  23. <view class="zw-service-box group-service zw-interval" v-if="yijianshi && (chusheng || biye)">
  24. <view class="service-title">
  25. <text>{{ yijianshi.themeVo.themeName }}</text>
  26. <text class="moer-text" @click.stop="$openPage(yijianshi.themeVo.themeId , 1)">更多
  27. <text class="moer-icon iconfont_yige">&#xe65f;</text>
  28. </text>
  29. </view>
  30. <view class="service-content one-thing">
  31. <view class="one-thing-item" v-if="chusheng"
  32. :style="{'backgroundImage': `url(${chusheng.themeVo.themeInnerImage})`}">
  33. <view class="one-thing-title">
  34. <text class="zw-two-row">{{chusheng.themeVo.themeName}}</text>
  35. </view>
  36. <view class="one-thing-content">
  37. <view class="one-thing-type" :key="`chusheng_${index}`"
  38. v-for="(item , index) in chusheng.themeModuleVoList" @click.stop="$openPage(item)">
  39. <text class="one-thing-lable zw-one-row">{{item.moduleName}}</text>
  40. <text class="moer-icon iconfont_yige">&#xe65f;</text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="one-thing-item" v-if="biye"
  45. :style="{'backgroundImage': `url(${biye.themeVo.themeInnerImage})`}">
  46. <view class="one-thing-title">
  47. <text class="zw-two-row">{{biye.themeVo.themeName}}</text>
  48. </view>
  49. <view class="one-thing-content">
  50. <view class="one-thing-type" :key="`biye_${index}`"
  51. v-for="(item , index) in biye.themeModuleVoList" @click.stop="$openPage(item)">
  52. <text class="one-thing-lable zw-one-row">{{item.moduleName}}</text>
  53. <text class="moer-icon iconfont_yige">&#xe65f;</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 社区生活 -->
  60. <view class="zw-service-box group-service zw-interval" v-if="shequshenghuo">
  61. <view class="service-title">
  62. <text>{{ shequshenghuo.themeVo.themeName }}</text>
  63. </view>
  64. <view class="service-content community-content">
  65. <template v-if="shequshenghuo.themeModuleVoList && shequshenghuo.themeModuleVoList.length > 0">
  66. <view class="community-max" @click.stop="$openPage(shequshenghuo.themeModuleVoList[0])">
  67. <image class="community-img" :src="shequshenghuo.themeModuleVoList[0].moduleImage"
  68. mode="scaleToFill"></image>
  69. </view>
  70. <view class="community-box">
  71. <view class="community-min" @click.stop="$openPage(shequshenghuo.themeModuleVoList[1])"
  72. v-if="shequshenghuo.themeModuleVoList[1]">
  73. <image class="community-img" :src="shequshenghuo.themeModuleVoList[1].moduleImage"
  74. mode="scaleToFill"></image>
  75. </view>
  76. <view class="community-min" @click.stop="$openPage(shequshenghuo.themeModuleVoList[2])"
  77. v-if="shequshenghuo.themeModuleVoList[2]">
  78. <image class="community-img" :src="shequshenghuo.themeModuleVoList[2].moduleImage"
  79. mode="scaleToFill"></image>
  80. </view>
  81. </view>
  82. </template>
  83. </view>
  84. </view>
  85. <!-- 区县服务 -->
  86. <view class="zw-service-box group-service zw-interval" v-if="districtService">
  87. <view class="service-title">
  88. {{ districtService.themeVo.themeName }}
  89. </view>
  90. <view class="service-content">
  91. <scroll-view class="district-service" scroll-x="true">
  92. <div class="district-service-items">
  93. <block v-for="item in districtService.themeModuleVoList">
  94. <view class="district-service-item"
  95. :style="{'background-image':`url(${item.moduleImage})`}"
  96. @click.stop="$openPage(item)">
  97. <view class="district-service-name zw-one-row">
  98. {{item.moduleName}}
  99. </view>
  100. </view>
  101. </block>
  102. </div>
  103. </scroll-view>
  104. </view>
  105. </view>
  106. <!-- 群体服务 -->
  107. <view class="zw-service-box group-service zw-interval" v-if="groupService">
  108. <view class="service-title">
  109. {{ groupService.themeVo.themeName }}
  110. </view>
  111. <view class="service-content">
  112. <u-row gutter="20">
  113. <u-col span="4" v-for="item in groupService.themeModuleVoList">
  114. <view class="service-item lazy-img" @click.stop="$openPage(item)">
  115. <u-image class="service-img" :src="$getImgPath(item.moduleImage)" mode="aspectFit"
  116. :lazy-load="true"></u-image>
  117. </view>
  118. </u-col>
  119. </u-row>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 新闻 -->
  124. <view class="news-box">
  125. <view class="news-lable">
  126. <view class="news-lable-title">
  127. <block v-for="item in InformationLable">
  128. <text :class="{'active-news-lable':activeInformationLable === item.informationTypeName}"
  129. @click.stop="onInformation(item)">
  130. {{item.informationTypeName}}
  131. </text>
  132. </block>
  133. </view>
  134. <view class="news-lable-moer" @click.stop="openNews()">
  135. 更多<text class="iconfont_yige">&#xe65f;</text>
  136. </view>
  137. </view>
  138. <view class="news-list-box"
  139. v-if="InformationList[activeInformationLable] && InformationList[activeInformationLable].length > 0">
  140. <block v-for="item in InformationList[activeInformationLable]">
  141. <template v-if="activeInformationLable === '宜昌发布'">
  142. <view class="news-item" @click.stop="openYiChangNewsDetail(item)">
  143. <view class="news-info">
  144. <view class="news-title">
  145. {{ item.title }}
  146. </view>
  147. <view class="news-tag">
  148. <text>{{ item.author }}</text>
  149. <text>{{ item.published }}</text>
  150. </view>
  151. </view>
  152. <view class="news-img lazy-img">
  153. <u-image class="service-img" :src="item.coverImgUrl" mode="aspectFill"
  154. :lazy-load="true"></u-image>
  155. </view>
  156. </view>
  157. </template>
  158. <template v-else>
  159. <view class="news-item" @click.stop="openNewsDetail(item.informationId)">
  160. <view class="news-info">
  161. <view class="news-title">
  162. {{ item.informationTitle }}
  163. </view>
  164. <view class="news-tag">
  165. <text>{{ item.informationTypeName }}</text>
  166. <text>{{ item.createTime }}</text>
  167. </view>
  168. </view>
  169. <view class="news-img lazy-img">
  170. <u-image class="service-img" :src="$getImgPath(item.informationThumbnail)"
  171. mode="aspectFill" :lazy-load="true"></u-image>
  172. </view>
  173. </view>
  174. </template>
  175. </block>
  176. </view>
  177. <template v-else>
  178. <view class="empty-box">
  179. <EmptyDate />
  180. </view>
  181. </template>
  182. </view>
  183. </view>
  184. </template>
  185. <script>
  186. import Mixin from "./module/Mixin.js";
  187. import kongKim from "./module/kong-kim.vue"
  188. import rollMessage from "./module/roll-message.vue"
  189. import {
  190. getThemeModule
  191. } from "@/api/government.js"
  192. import {
  193. getInformation_Api,
  194. getInformationList_Api
  195. } from "./../government/conmon.js"
  196. import {
  197. getYiChangNews,
  198. openYiChangNews
  199. } from "../government/conmon.js"
  200. export default {
  201. mixins: [Mixin],
  202. components: {
  203. kongKim,
  204. rollMessage
  205. },
  206. data() {
  207. return {
  208. list: [],
  209. AggregationService: null,
  210. groupService: null,
  211. InformationLable: null,
  212. activeInformationLable: null,
  213. InformationList: {},
  214. districtService: null,
  215. shequshenghuo: null,
  216. yijianshi: null,
  217. chusheng: null,
  218. biye: null,
  219. }
  220. },
  221. onShow() {
  222. },
  223. created() {
  224. //
  225. },
  226. mounted() {
  227. // this.initPage()
  228. },
  229. methods: {
  230. init() {
  231. this.$nextTick(() => {
  232. this.$refs.rollMessage.init();
  233. });
  234. this.initPage();
  235. },
  236. openNews() {
  237. uni.navigateTo({
  238. url: '/pages/news/index',
  239. fail: err => {
  240. console.log('条钻错误 = ', err)
  241. }
  242. })
  243. },
  244. openNewsDetail(informationId) {
  245. uni.navigateTo({
  246. url: `/pages/news/news_detail?informationId=${informationId}`,
  247. fail: err => {
  248. console.log('条钻错误 = ', err)
  249. }
  250. })
  251. },
  252. initPage() {
  253. // 获取 聚合
  254. // ZW_THEME: "page001", // 主题服务
  255. // ZW_GROUP: "page002",
  256. const keys = [this.$keys.ZW_THEME, this.$keys.ZW_GROUP, this.$keys.QX_FW, this.$keys.SQSH_SERVE,
  257. this.$keys.YIJIANSHI_SERVE, this.$keys.YIJIANSHI_CHUSHENG, this.$keys.YIJIANSHI_BIYE
  258. ]
  259. keys.forEach(el => {
  260. getThemeModule(el).then(res => {
  261. const {
  262. themeVo,
  263. themeModuleVoList
  264. } = res.data || {};
  265. if (!themeVo || !themeModuleVoList || !themeModuleVoList.length === 0) {
  266. throw new Error()
  267. } else {
  268. this.setService(res.data, el, keys)
  269. }
  270. }).catch(err => {
  271. this.setService(null, el, keys)
  272. })
  273. })
  274. getInformation_Api({
  275. informationChannel: this.$keys.information_home
  276. }).then(res => {
  277. this.InformationLable = res || null
  278. if (res && res.length > 0) {
  279. res.forEach((el, index) => {
  280. if (index === 0) {
  281. this.activeInformationLable = el.informationTypeName
  282. }
  283. this.getInformationList(el)
  284. })
  285. }
  286. // this.getInformationList(res[0])
  287. })
  288. },
  289. onInformation(item) {
  290. this.activeInformationLable = item.informationTypeName;
  291. this.getInformationList(item);
  292. },
  293. // 获取资讯列表
  294. getInformationList(item) {
  295. // this.activeInformationLable = item.informationTypeName;
  296. const list = this.InformationList[item.informationTypeName]
  297. // console.log('this.activeInformationLable', item.informationTypeName)
  298. // 加载过,就不加载
  299. if (list) {
  300. // && list.length > 0
  301. return false
  302. }
  303. if (item.informationTypeName === "宜昌发布") {
  304. getYiChangNews(6).then(res => {
  305. // console.log('getYiChangNews = ', res)
  306. this.$set(this.InformationList, item.informationTypeName, res || [])
  307. })
  308. } else {
  309. getInformationList_Api({
  310. informationTypeId: item.informationTypeId
  311. }).then(res => {
  312. this.$set(this.InformationList, item.informationTypeName, res.rows || [])
  313. })
  314. }
  315. },
  316. openYiChangNewsDetail(row) {
  317. openYiChangNews(row)
  318. },
  319. setService(data, key, keys) {
  320. switch (key) {
  321. case this.$keys.ZW_THEME:
  322. // 主题服务
  323. this.AggregationService = data || null
  324. break;
  325. case this.$keys.ZW_GROUP:
  326. // 群体服务
  327. this.groupService = data || null
  328. break;
  329. case this.$keys.QX_FW:
  330. // 区县服务
  331. this.districtService = data || null
  332. break;
  333. case this.$keys.SQSH_SERVE:
  334. // 社区生活
  335. this.shequshenghuo = data || null
  336. break;
  337. case this.$keys.YIJIANSHI_SERVE:
  338. // 一件事
  339. this.yijianshi = data || null
  340. break;
  341. case this.$keys.YIJIANSHI_CHUSHENG:
  342. // 出生一件事
  343. this.chusheng = data || null
  344. break;
  345. case this.$keys.YIJIANSHI_BIYE:
  346. // 出生一件事
  347. this.biye = data || null
  348. break;
  349. }
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss" scoped>
  355. // @import url("~./sever.scss");
  356. @import './sever.scss';
  357. .pages-content {
  358. .wrap-list {
  359. width: 100%;
  360. height: 200rpx;
  361. }
  362. .zw-interval {
  363. border-radius: $zw-border-radius;
  364. }
  365. .group-service {
  366. .service-item {
  367. width: 200rpx;
  368. height: 236rpx;
  369. .service-img {
  370. width: 100%;
  371. height: 100%;
  372. }
  373. }
  374. }
  375. }
  376. // 新闻
  377. .news-box {
  378. width: 100%;
  379. margin-top: $zw-gap;
  380. background-color: #fff;
  381. .news-lable {
  382. width: 100%;
  383. height: 82rpx;
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: center;
  387. padding: 0 30rpx;
  388. border-bottom: 2rpx solid $zw-border-color;
  389. .news-lable-title {
  390. height: 100%;
  391. line-height: 82rpx;
  392. display: flex;
  393. align-items: stretch;
  394. text {
  395. margin-left: 30rpx;
  396. font-size: 30rpx;
  397. font-family: PingFang SC, PingFang SC-Regular;
  398. font-weight: 400;
  399. color: #4d4d4d;
  400. &:first-child {
  401. margin-left: 0;
  402. }
  403. }
  404. .active-news-lable {
  405. font-weight: bold;
  406. font-size: 34rpx;
  407. font-family: PingFang SC, PingFang SC-Bold;
  408. font-weight: 700;
  409. color: #1a1a1a;
  410. position: relative;
  411. &::before {
  412. content: '';
  413. position: absolute;
  414. max-width: 70rpx;
  415. left: 50%;
  416. bottom: 0;
  417. transform: translateX(-50%);
  418. width: 100%;
  419. height: 8rpx;
  420. background: linear-gradient(127deg, #3cb8d2 0%, #45c7d4 95%);
  421. border-radius: 4rpx;
  422. }
  423. }
  424. }
  425. .news-lable-moer {
  426. flex-shrink: 0;
  427. color: #808080;
  428. font-size: 24rpx;
  429. }
  430. }
  431. .news-list-box {
  432. width: 100%;
  433. padding: 0 20rpx;
  434. .news-item {
  435. padding: 40rpx 0;
  436. width: 100%;
  437. display: flex;
  438. justify-content: space-between;
  439. align-items: stretch;
  440. border-bottom: 2rpx solid $zw-border-color;
  441. .news-img {
  442. flex-shrink: 0;
  443. width: 258rpx;
  444. height: 163rpx;
  445. border-radius: 20rpx;
  446. }
  447. .news-info {
  448. width: calc(100% - 258rpx);
  449. display: flex;
  450. justify-content: space-between;
  451. flex-direction: column;
  452. padding-right: 40rpx;
  453. .news-title {
  454. font-size: 28rpx;
  455. font-family: PingFang SC, PingFang SC-Regular;
  456. font-weight: 400;
  457. text-align: left;
  458. color: #1a1a1a;
  459. }
  460. .news-tag {
  461. font-size: 24rpx;
  462. line-height: 1;
  463. font-family: PingFang SC, PingFang SC-Regular;
  464. font-weight: 400;
  465. text-align: left;
  466. color: #999999;
  467. text {
  468. padding-right: 10rpx;
  469. line-height: 1;
  470. &+text {
  471. padding-right: 0;
  472. padding-left: 10rpx;
  473. // border-left: 1rpx solid #999999;
  474. position: relative;
  475. &::before {
  476. content: '';
  477. position: absolute;
  478. left: 0;
  479. top: 50%;
  480. transform: translateY(-50%);
  481. width: 2rpx;
  482. height: 60%;
  483. background-color: #999999;
  484. }
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. }
  492. .empty-box {
  493. padding-top: 80rpx;
  494. }
  495. .district-service {
  496. width: 100%;
  497. height: 175rpx;
  498. white-space: nowrap;
  499. .district-service-items {
  500. display: flex;
  501. flex-direction: row;
  502. align-items: stretch;
  503. }
  504. .district-service-item {
  505. flex-shrink: 0;
  506. width: 175rpx;
  507. height: 175rpx;
  508. margin-right: 18rpx;
  509. background-size: 100% 100%;
  510. background-repeat: no-repeat;
  511. position: relative;
  512. overflow: hidden;
  513. // border-radius: 10rpx;
  514. &:last-child {
  515. margin-right: 0;
  516. }
  517. .district-service-name {
  518. position: absolute;
  519. left: 0;
  520. right: 0;
  521. bottom: 0;
  522. background-color: rgba(173, 173, 173, 0.6);
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. height: 44rpx;
  527. font-size: 20rpx;
  528. font-family: Microsoft YaHei;
  529. font-weight: 400;
  530. color: #FFFFFF;
  531. }
  532. }
  533. }
  534. .one-thing {
  535. width: 100%;
  536. display: flex;
  537. justify-content: space-between;
  538. align-items: stretch;
  539. .one-thing-item {
  540. width: calc(50% - 10rpx);
  541. padding: 0 20rpx 20rpx;
  542. border-radius: 20rpx;
  543. background-repeat: no-repeat;
  544. background-size: 100% 100%;
  545. // &:nth-child(1) {
  546. // background-color: #99c8fe;
  547. // }
  548. // &:nth-child(2) {
  549. // background-color: #a0e1ff;
  550. // }
  551. .one-thing-title {
  552. width: 100%;
  553. height: 100rpx;
  554. display: flex;
  555. justify-content: center;
  556. align-items: center;
  557. color: #fff;
  558. font-size: 28rpx;
  559. font-family: Microsoft YaHei;
  560. font-weight: 400;
  561. }
  562. .one-thing-content {
  563. background-color: #fff;
  564. min-height: 234rpx;
  565. border-radius: 20rpx;
  566. .one-thing-type {
  567. width: 100%;
  568. height: 78rpx;
  569. padding: 0 30rpx;
  570. display: flex;
  571. justify-content: space-between;
  572. align-items: center;
  573. font-size: 24rpx;
  574. font-family: Microsoft YaHei;
  575. font-weight: 400;
  576. color: #333333;
  577. .one-thing-lable {
  578. flex: 1;
  579. padding-right: 10rpx;
  580. }
  581. .moer-icon {
  582. font-size: 24rpx;
  583. flex-shrink: 0;
  584. }
  585. }
  586. }
  587. }
  588. }
  589. .community-content {
  590. display: flex;
  591. justify-content: space-between;
  592. align-items: stretch;
  593. .community-max {
  594. width: 408rpx;
  595. height: 274rpx;
  596. flex-shrink: 0;
  597. }
  598. .community-box {
  599. flex: 1;
  600. padding-left: 15rpx;
  601. // flex-shrink: 0;
  602. // width: 212rpx;
  603. display: flex;
  604. flex-direction: column;
  605. justify-content: space-between;
  606. .community-min {
  607. width: 100%;
  608. height: calc((274rpx - 15rpx) / 2);
  609. }
  610. }
  611. .community-img {
  612. width: 100%;
  613. height: 100%;
  614. }
  615. }
  616. </style>