affair - 副本.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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="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" @click.stop="$openPage(item)">
  15. <image class="service-img" :src="$getImgPath(item.moduleImage)" mode="aspectFit">
  16. </image>
  17. </view>
  18. </u-col>
  19. </u-row>
  20. </view>
  21. </view>
  22. <!-- 群体服务 -->
  23. <view class="service-box group-service zw-interval" v-if="groupService">
  24. <view class="service-title">
  25. {{ groupService.themeVo.themeName }}
  26. </view>
  27. <view class="service-content">
  28. <u-row gutter="20">
  29. <u-col span="4" v-for="item in groupService.themeModuleVoList">
  30. <view class="service-item" @click.stop="$openPage(item)">
  31. <image class="service-img" :src="$getImgPath(item.moduleImage)" mode="aspectFit">
  32. </image>
  33. </view>
  34. </u-col>
  35. </u-row>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 新闻 -->
  40. <view class="news-box">
  41. <view class="news-lable">
  42. <view class="news-lable-title">
  43. <block v-for="item in InformationLable">
  44. <text :class="{'active-news-lable':activeInformationLable === item.informationTypeName}"
  45. @click.stop="getInformationList(item)">
  46. {{item.informationTypeName}}
  47. </text>
  48. </block>
  49. </view>
  50. <view class="news-lable-moer" @click.stop="openNews()">
  51. 更多<text class="iconfont_yige">&#xe65f;</text>
  52. </view>
  53. </view>
  54. <view class="news-list-box"
  55. v-if="InformationList[activeInformationLable] && InformationList[activeInformationLable].length > 0">
  56. <block v-for="item in InformationList[activeInformationLable]">
  57. <view class="news-item" @click.stop="openNewsDetail(item.informationId)">
  58. <view class="news-info">
  59. <view class="news-title">
  60. {{ item.informationTitle }}
  61. </view>
  62. <view class="news-tag">
  63. <text>{{ item.informationTypeName }}</text>
  64. <text>{{ item.createTime }}</text>
  65. </view>
  66. </view>
  67. <image :src="$getImgPath(item.informationThumbnail)" mode="scaleToFill"></image>
  68. </view>
  69. </block>
  70. </view>
  71. <template v-else>
  72. <view class="empty-box">
  73. <EmptyDate />
  74. </view>
  75. </template>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import Mixin from "./module/Mixin.js";
  81. import kongKim from "./module/kong-kim.vue"
  82. import rollMessage from "./module/roll-message.vue"
  83. import {
  84. getThemeModule
  85. } from "@/api/government.js"
  86. import {
  87. getInformation_Api,
  88. getInformationList_Api
  89. } from "./../government/conmon.js"
  90. export default {
  91. mixins: [Mixin],
  92. components: {
  93. kongKim,
  94. rollMessage
  95. },
  96. data() {
  97. return {
  98. list: [],
  99. AggregationService: null,
  100. groupService: null,
  101. InformationLable: null,
  102. activeInformationLable: null,
  103. InformationList: {}
  104. }
  105. },
  106. onShow() {
  107. },
  108. created() {
  109. this.initPage()
  110. },
  111. mounted() {
  112. },
  113. methods: {
  114. init() {
  115. this.$refs.kongKimRef.init();
  116. this.$refs.rollMessage.init();
  117. this.initPage();
  118. },
  119. openNews() {
  120. uni.navigateTo({
  121. url: '/pages/news/index',
  122. fail: err => {
  123. console.log('条钻错误 = ', err)
  124. }
  125. })
  126. },
  127. openNewsDetail(informationId) {
  128. uni.navigateTo({
  129. url: `/pages/news/news_detail?informationId=${informationId}`,
  130. fail: err => {
  131. console.log('条钻错误 = ', err)
  132. }
  133. })
  134. },
  135. initPage() {
  136. // 获取 聚合
  137. // ZW_THEME: "page001", // 主题服务
  138. // ZW_GROUP: "page002",
  139. const keys = [this.$keys.ZW_THEME, this.$keys.ZW_GROUP]
  140. keys.forEach(el => {
  141. getThemeModule(el).then(res => {
  142. const {
  143. themeVo,
  144. themeModuleVoList
  145. } = res.data || {};
  146. if (!themeVo || !themeModuleVoList || !themeModuleVoList.length === 0) {
  147. throw new Error()
  148. } else {
  149. this.setService(res.data, el, keys)
  150. }
  151. }).catch(err => {
  152. this.setService(null, el, keys)
  153. })
  154. })
  155. getInformation_Api().then(res => {
  156. this.InformationLable = res || null
  157. if (this.InformationLable && this.InformationLable.length > 0) {
  158. this.getInformationList(this.InformationLable[0])
  159. }
  160. })
  161. },
  162. getInformationList(item) {
  163. this.activeInformationLable = item.informationTypeName;
  164. getInformationList_Api({
  165. informationTypeId: item.informationTypeId
  166. }).then(res => {
  167. this.$set(this.InformationList, item.informationTypeName, res.rows || [])
  168. })
  169. },
  170. setService(data, key, keys) {
  171. switch (key) {
  172. case keys[0]:
  173. // 主题服务
  174. this.AggregationService = data || null
  175. break;
  176. case keys[1]:
  177. // 群体服务
  178. this.groupService = data || null
  179. break;
  180. }
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .pages-content {
  187. .wrap-list {
  188. width: 100%;
  189. height: 200rpx;
  190. }
  191. .zw-interval {
  192. border-radius: $zw-border-radius;
  193. }
  194. .service-box {
  195. background-color: #fff;
  196. .service-title {
  197. width: 100%;
  198. height: 100rpx;
  199. font-size: 36rpx;
  200. font-family: PingFang SC, PingFang SC-Bold;
  201. font-weight: 700;
  202. color: #1a1a1a;
  203. border-bottom: 1rpx solid $zw-border-color;
  204. padding: 0 30rpx;
  205. line-height: 100rpx;
  206. }
  207. .service-content {
  208. padding: 30rpx;
  209. }
  210. }
  211. .theme-service {
  212. .service-item {
  213. width: 300rpx;
  214. height: 162rpx;
  215. margin-bottom: 20rpx;
  216. &:nth-child(n+3) {
  217. margin-bottom: 0;
  218. }
  219. .service-img {
  220. width: 100%;
  221. height: 100%;
  222. }
  223. }
  224. }
  225. .group-service {
  226. .service-item {
  227. width: 200rpx;
  228. height: 236rpx;
  229. .service-img {
  230. width: 100%;
  231. height: 100%;
  232. }
  233. }
  234. }
  235. }
  236. // 新闻
  237. .news-box {
  238. width: 100%;
  239. margin-top: $zw-gap;
  240. background-color: #fff;
  241. .news-lable {
  242. width: 100%;
  243. height: 82rpx;
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. padding: 0 30rpx;
  248. border-bottom: 1rpx solid $zw-border-color;
  249. .news-lable-title {
  250. height: 100%;
  251. line-height: 82rpx;
  252. display: flex;
  253. align-items: stretch;
  254. text {
  255. margin-left: 30rpx;
  256. font-size: 30rpx;
  257. font-family: PingFang SC, PingFang SC-Regular;
  258. font-weight: 400;
  259. color: #4d4d4d;
  260. &:first-child {
  261. margin-left: 0;
  262. }
  263. }
  264. .active-news-lable {
  265. font-weight: bold;
  266. font-size: 34rpx;
  267. font-family: PingFang SC, PingFang SC-Bold;
  268. font-weight: 700;
  269. color: #1a1a1a;
  270. position: relative;
  271. &::before {
  272. content: '';
  273. position: absolute;
  274. max-width: 70rpx;
  275. left: 50%;
  276. bottom: 0;
  277. transform: translateX(-50%);
  278. width: 100%;
  279. height: 8rpx;
  280. background: linear-gradient(127deg, #3cb8d2 0%, #45c7d4 95%);
  281. border-radius: 4rpx;
  282. }
  283. }
  284. }
  285. .news-lable-moer {
  286. flex-shrink: 0;
  287. color: #808080;
  288. font-size: 24rpx;
  289. }
  290. }
  291. .news-list-box {
  292. width: 100%;
  293. padding: 0 20rpx;
  294. .news-item {
  295. padding: 40rpx 0;
  296. width: 100%;
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: stretch;
  300. border-bottom: 2rpx solid $zw-border-color;
  301. image {
  302. flex-shrink: 0;
  303. width: 258rpx;
  304. height: 163rpx;
  305. border-radius: 20rpx;
  306. }
  307. .news-info {
  308. width: calc(100% - 258rpx);
  309. display: flex;
  310. justify-content: space-between;
  311. flex-direction: column;
  312. padding-right: 40rpx;
  313. .news-title {
  314. font-size: 28rpx;
  315. font-family: PingFang SC, PingFang SC-Regular;
  316. font-weight: 400;
  317. text-align: left;
  318. color: #1a1a1a;
  319. }
  320. .news-tag {
  321. font-size: 24rpx;
  322. line-height: 1;
  323. font-family: PingFang SC, PingFang SC-Regular;
  324. font-weight: 400;
  325. text-align: left;
  326. color: #999999;
  327. text {
  328. padding-right: 10rpx;
  329. line-height: 1;
  330. &+text {
  331. padding-right: 0;
  332. padding-left: 10rpx;
  333. // border-left: 1rpx solid #999999;
  334. position: relative;
  335. &::before {
  336. content: '';
  337. position: absolute;
  338. left: 0;
  339. top: 50%;
  340. transform: translateY(-50%);
  341. width: 1rpx;
  342. height: 60%;
  343. background-color: #999999;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. .empty-box {
  353. padding-top: 80rpx;
  354. }
  355. </style>