discoverInfo.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="detail" v-if="detail">
  5. <view class="title">
  6. {{detail.informationTitle}}
  7. </view>
  8. <view class="postMessage">
  9. <view class="message-info">
  10. <text>{{detail.informationAuthor}}</text>
  11. <view @click.stop="onFollow(detail)"
  12. :class="['follow-status', detail.followStatus ? 'is-follow' : '' ]">
  13. {{detail.followStatus ? '已关注' : '关注' }}
  14. </view>
  15. </view>
  16. <view class="message-time">{{detail.createTime}}</view>
  17. </view>
  18. <view class="content">
  19. <view class="ql-editor-box" v-html="detail.informationContent">
  20. </view>
  21. <!-- <u-parse :domain="$mConfig.imgURL" :html="detail.informationContent"></u-parse> -->
  22. </view>
  23. <view class="browse">
  24. <view class="collect-box look-box" @click.stop="onCollect(detail)">
  25. <text v-if="detail.collectStatus" class="look-icon is-ok iconfont_yige">&#xe8c3;</text>
  26. <text v-else class="collect-icon iconfont_yige">&#xe8ab;</text>
  27. <text class="look-name">{{detail.collectStatus ? '已收藏' : '收藏' }}</text>
  28. </view>
  29. <view class="look-box">
  30. <text class="iconfont_yige look-icon">&#xe6a2;</text>
  31. <text class="look-name">浏览量:{{detail.browseNum||0}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- <view class="footer-box">
  36. <view class="btn" @click="openKongKim" v-if="detail.jumpType !== null || detail.jumpType !== undefined">
  37. <text v-if="detail.jumpType == 2">{{detail.resourceModelTitle || '一键前往'}}</text>
  38. <text v-else>一键前往</text>
  39. </view>
  40. <view class="footer-tools">
  41. <view>
  42. <text class="iconfont3 look-icon">&#xe63b;</text>
  43. <text>{{detail.browseNum||0}}</text>
  44. </view>
  45. </view>
  46. </view> -->
  47. <!-- <share ref="shares" :contentHeight="580"></share> -->
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. newsDetial,
  53. setUserFollow,
  54. setUserCollect
  55. } from '@/api/government.js';
  56. import share from "@/pages/public/share";
  57. import rate from "@/components/rate.vue"
  58. export default {
  59. components: {
  60. share,
  61. rate
  62. },
  63. data() {
  64. return {
  65. config: {
  66. back: true,
  67. title: '资讯详情',
  68. color: '#1A1A1A',
  69. backgroundColor: [1, "#fff"],
  70. statusBarFontColor: '#1A1A1A',
  71. leftSlot: true
  72. },
  73. detail: null,
  74. FollowLoad: false,
  75. CollectLoad: false,
  76. }
  77. },
  78. onLoad(options) {
  79. if (options && options.informationId) {
  80. this.getDetail(options.informationId)
  81. }
  82. },
  83. methods: {
  84. getDetail(id) {
  85. newsDetial(id).then(res => {
  86. if (res.code === 200) {
  87. this.detail = res.data
  88. }
  89. })
  90. },
  91. openKongKim() {
  92. this.$openPage(this.detail)
  93. },
  94. // 关注
  95. onFollow(info) {
  96. if (!info) return;
  97. if (this.FollowLoad) {
  98. return false;
  99. };
  100. this.FollowLoad = true;
  101. uni.showLoading({
  102. title: '',
  103. mask: false
  104. });
  105. setUserFollow({
  106. // followId: info.informationId,
  107. followSourceId: info.informationId,
  108. // followType: 0
  109. }).then(res => {
  110. uni.hideLoading();
  111. this.detail.followStatus = !this.detail.followStatus;
  112. uni.showToast({
  113. title: info.followStatus ? '关注成功' : '取消关注'
  114. })
  115. }).catch(err => {
  116. uni.hideLoading();
  117. }).finally(() => {
  118. setTimeout(() => {
  119. this.FollowLoad = false;
  120. }, 300)
  121. })
  122. },
  123. // 收藏
  124. onCollect(info) {
  125. if (!info) return;
  126. if (this.CollectLoad) {
  127. return false;
  128. };
  129. this.CollectLoad = true;
  130. setUserCollect({
  131. collectSourceId: info.resourceModelId,
  132. }).then(res => {
  133. uni.hideLoading();
  134. this.detail.collectStatus = !this.detail.collectStatus;
  135. uni.showToast({
  136. title: info.collectStatus ? '收藏成功' : '取消收藏'
  137. })
  138. }).catch(err => {
  139. uni.hideLoading();
  140. }).finally(() => {
  141. setTimeout(() => {
  142. this.CollectLoad = false;
  143. }, 300)
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style>
  150. page {
  151. background: #fff;
  152. }
  153. </style>
  154. <style lang="scss" scoped>
  155. .container {
  156. // padding-bottom: 100rpx;
  157. }
  158. .detail {
  159. padding: 42rpx 30rpx 40rpx 30rpx;
  160. // margin: 30rpx;
  161. background-color: #fff;
  162. border-radius: 20rpx;
  163. .title {
  164. margin-bottom: 40rpx;
  165. font-size: 35rpx;
  166. font-family: PingFang SC, PingFang SC-Bold;
  167. font-weight: 700;
  168. color: #1a1a1a;
  169. line-height: 56rpx;
  170. letter-spacing: -0.7rpx;
  171. }
  172. .postMessage {
  173. display: flex;
  174. align-items: center;
  175. flex-wrap: wrap;
  176. padding: 0 10rpx;
  177. margin-bottom: 30rpx;
  178. font-size: 26rpx;
  179. font-family: PingFang SC, PingFang SC-Medium;
  180. font-weight: 500;
  181. color: #999999;
  182. .message-info {
  183. width: 100%;
  184. display: flex;
  185. align-items: center;
  186. flex-wrap: wrap;
  187. justify-content: space-between;
  188. .follow-status {
  189. margin-left: 20rpx;
  190. flex-shrink: 0;
  191. padding: 5rpx 20rpx;
  192. background-color: #3CBACF;
  193. color: #fff;
  194. border-radius: 8rpx;
  195. }
  196. .is-follow {
  197. background-color: #ccc;
  198. }
  199. }
  200. .message-time {
  201. width: 100%;
  202. padding-top: 10rpx;
  203. }
  204. .mb20 {
  205. margin-bottom: 20rpx;
  206. }
  207. .icon-img {
  208. margin-right: 8rpx;
  209. color: #FA6138;
  210. font-size: 36rpx;
  211. }
  212. }
  213. .look-box {
  214. display: flex;
  215. align-items: center;
  216. .collect-icon{
  217. font-size: 32rpx;
  218. margin-right: 8rpx;
  219. }
  220. .look-icon {
  221. font-size: 36rpx;
  222. margin-right: 8rpx;
  223. }
  224. }
  225. * {
  226. word-break: break-all;
  227. }
  228. .content /deep/ img {
  229. max-width: 100%;
  230. }
  231. .content /deep/ .ql-align-center {
  232. text-align: center;
  233. }
  234. .content /deep/ .ql-align-right {
  235. text-align: right;
  236. }
  237. .content /deep/ blockquote {
  238. display: block;
  239. border-left: 8px solid #d0e5f2;
  240. padding: 5px 10px;
  241. margin: 10px 0;
  242. line-height: 1.4;
  243. font-size: 100%;
  244. background-color: #f1f1f1;
  245. }
  246. .content /deep/ .ql-indent-1 {
  247. margin-left: 60rpx;
  248. }
  249. .content /deep/ .ql-indent-2 {
  250. margin-left: 120rpx;
  251. }
  252. .content /deep/ .ql-indent-3 {
  253. margin-left: 180rpx;
  254. }
  255. .content /deep/ .ql-indent-4 {
  256. margin-left: 240rpx;
  257. }
  258. .content /deep/ .ql-indent-5 {
  259. margin-left: 300rpx;
  260. }
  261. .content {
  262. /deep/ .ql-editor-box {
  263. .ql-video {
  264. width: 100%;
  265. // height: 45vw;
  266. }
  267. }
  268. }
  269. .browse {
  270. margin-top: 30rpx;
  271. font-size: 24rpx;
  272. font-family: PingFang SC, PingFang SC-Medium;
  273. font-weight: 500;
  274. color: #999999;
  275. display: flex;
  276. align-items: center;
  277. .collect-box {
  278. margin-right: 20rpx;
  279. // .look-icon {
  280. // margin-right: 10rpx;
  281. // }
  282. .is-ok {
  283. color: red;
  284. }
  285. }
  286. }
  287. }
  288. .footer-box {
  289. position: fixed;
  290. left: 0;
  291. bottom: 0;
  292. width: 100%;
  293. padding: 30rpx;
  294. display: flex;
  295. justify-content: space-between;
  296. align-items: center;
  297. background-color: #fff;
  298. box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .1);
  299. }
  300. .btn {
  301. max-width: 400rpx;
  302. padding: 0 20rpx;
  303. line-height: 60rpx;
  304. text-align: center;
  305. color: #fff;
  306. background-color: #3775F6;
  307. border-radius: 8rpx;
  308. overflow: hidden;
  309. text-overflow: ellipsis;
  310. white-space: nowrap;
  311. }
  312. .footer-tools {
  313. flex-shrink: 0;
  314. .look-icon {
  315. margin-right: 4rpx;
  316. font-size: 40rpx;
  317. }
  318. &>view {
  319. display: flex;
  320. align-items: center;
  321. font-size: 30rpx;
  322. }
  323. }
  324. </style>