detail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="wrap">
  3. <!-- 头部 -->
  4. <view class="header">
  5. <view class="header_title">{{allData.obj.name}}</view>
  6. <view class="tag">
  7. <view class="tag_title">{{allData.obj.typeName}} {{allData.obj.date}}</view>
  8. <view class="look"><view class="iconfont company_top_num_icon"></view>{{allData.obj.pv}}</view>
  9. </view>
  10. </view>
  11. <view :class="['content',showMore == 1?'showMore':'']">
  12. <!-- 富文本 -->
  13. <view class="show">
  14. <view class="title" v-html="allData.obj.detail"></view>
  15. </view>
  16. </view>
  17. <view class="news_more" @tap="lookMore">{{message}}<view class="iconfont header_bottom"></view></view>
  18. <view class="back"></view>
  19. <!-- 相关知识 -->
  20. <view class="news_about">
  21. <view class="news_about_header clear">
  22. <view class="news_about_lf">相关知识</view>
  23. <navigator hover-class="none" url="../list/list" class="news_about_rg">更多服务<view class="iconfont shuang_you"></view></navigator>
  24. </view>
  25. <view class="list">
  26. <view v-for="item,index in allData.detail" :key="index" class="list_item" @tap="toDetail(item)">
  27. <view class="news_title">{{item.name}}</view>
  28. <view :class="['image',item.imgs.length ===1?'one':'no_one', 'clear']">
  29. <image v-for="item,index in item.imgs" :key="index" :src="url + item"></image>
  30. </view>
  31. <view class="news_tag clear">
  32. <view class="news_tag_lf">{{item.tag}}</view>
  33. <view class="news_tag_rg">{{item.date}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import api from "../../../api.js";
  42. let app = getApp();
  43. export default {
  44. data() {
  45. return {
  46. id:'',//新闻id
  47. allData:null,//页面数据
  48. url:app.globalData.url,
  49. showMore:0,//是否查看更多,文本折叠
  50. message:'查看更多',
  51. }
  52. },
  53. onLoad(options) {
  54. this.id = options.id;
  55. this.getData();
  56. },
  57. methods: {
  58. //加载数据
  59. getData(){
  60. let data = {
  61. id:this.id
  62. }
  63. api.getNewsDetail(data).then((res)=>{
  64. console.log(res);
  65. this.allData = res.data.data;
  66. })
  67. },
  68. //查看更多
  69. lookMore(){
  70. if(this.showMore == 0){
  71. this.showMore = 1;
  72. this.message = '点击收起';
  73. }else{
  74. this.showMore = 0;
  75. this.message = '查看更多';
  76. }
  77. },
  78. //跳转详情
  79. toDetail(item){
  80. uni.redirectTo({
  81. url:'./detail?id=' + item.id
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style scoped>
  88. .clear:after{
  89. content: "";
  90. display: block;
  91. clear: both;
  92. }
  93. page{
  94. width:100%;
  95. height:100%;
  96. }
  97. .header{
  98. width:100%;
  99. overflow: hidden;
  100. padding:0 30rpx;
  101. box-sizing: border-box;
  102. }
  103. .header_title{
  104. font-size: 32rpx;
  105. color:#2A2A2A;
  106. font-weight: bold;
  107. }
  108. .tag{
  109. margin-top:16rpx;
  110. }
  111. .tag_title{
  112. font-size: 24rpx;
  113. color:#999999;
  114. display: inline-block;
  115. }
  116. .look{
  117. font-size: 24rpx;
  118. color:#999999;
  119. display: inline-block;
  120. margin-left: 40rpx;
  121. }
  122. .company_top_num_icon{
  123. color:#999999;
  124. font-size: 16rpx;
  125. display: inline-block;
  126. vertical-align:middle;
  127. margin-right: 8rpx;
  128. }
  129. .content{
  130. width:100%;
  131. height:200rpx;
  132. margin-top:20rpx;
  133. padding:0 30rpx;
  134. overflow: hidden;
  135. box-sizing: border-box;
  136. }
  137. .showMore{
  138. height: auto;
  139. }
  140. .hidden{
  141. display: none;
  142. }
  143. .showMore{
  144. display: block;
  145. }
  146. .title{
  147. font-size: 28rpx;
  148. color:#666666;
  149. line-height: 48rpx;
  150. }
  151. .news_img{
  152. display: block;
  153. width:100%;
  154. height:380rpx;
  155. margin:30rpx 0 30rpx 0;
  156. }
  157. .news_more{
  158. text-align: center;
  159. margin-top:16rpx;
  160. font-size: 24rpx;
  161. color:#E77817;
  162. margin-bottom: 30rpx;
  163. background-color: #ffffff
  164. }
  165. .header_bottom{
  166. display: inline-block;
  167. font-size:24rpx;
  168. margin-left: 10rpx;
  169. box-sizing: border-box;
  170. }
  171. .news_about{
  172. width:100%;
  173. padding-bottom:100rpx;
  174. overflow: hidden;
  175. }
  176. .news_about_header{
  177. height:94rpx;
  178. line-height: 94rpx;
  179. padding:0 30rpx;
  180. box-sizing: border-box;
  181. border-bottom:1px solid #f2f2f2;
  182. }
  183. .news_about_lf{
  184. font-size: 30rpx;
  185. color:#000000;
  186. font-weight: bold;
  187. float:left;
  188. }
  189. .news_about_rg{
  190. float:right;
  191. font-size: 24rpx;
  192. color:#E77817;
  193. }
  194. .shuang_you{
  195. display: inline-block;
  196. font-size: 24rpx;
  197. }
  198. .list{
  199. width:100%;
  200. overflow: hidden;
  201. padding:0 30rpx;
  202. box-sizing: border-box;
  203. }
  204. .list_item{
  205. width:100%;
  206. padding-bottom: 26rpx;
  207. border-bottom:1px solid #f2f2f2;
  208. }
  209. .news_title{
  210. font-size: 32rpx;
  211. color:#2a2a2a;
  212. margin:22rpx 0 14rpx 0;
  213. }
  214. .one image{
  215. display: block;
  216. width:100%;
  217. height:380rpx;
  218. }
  219. .no_one image{
  220. display: block;
  221. width:218rpx;
  222. height:144rpx;
  223. margin-right: 18rpx;
  224. float:left;
  225. }
  226. .no_one image:last-child{
  227. margin-right: 0;
  228. }
  229. .news_tag{
  230. width:100%;
  231. margin-top:12rpx;
  232. font-size: 24rpx;
  233. color:#999999;
  234. }
  235. .news_tag_lf{
  236. float:left;
  237. }
  238. .news_tag_rg{
  239. float:right;
  240. }
  241. .footer{
  242. width: 100%;
  243. height:100rpx;
  244. background:rgba(255,255,255,1);
  245. box-shadow:0px 4rpx 8rpx 0px rgba(0,0,0,0.5);
  246. overflow: hidden;
  247. padding:30rpx 0;
  248. box-sizing: border-box;
  249. position: fixed;
  250. bottom:0;
  251. left:0;
  252. }
  253. .footer_icon{
  254. font-size: 40rpx;
  255. color:#222222;
  256. padding:0 92rpx;
  257. display: inline-block;
  258. text-align: center;
  259. border-right: 1px solid #f2f2f2;
  260. }
  261. .footer_icon:last-child{
  262. border-right: none;
  263. }
  264. .enter{
  265. width:284rpx;
  266. height:72rpx;
  267. background:rgba(231,120,23,1);
  268. border-radius:6rpx;
  269. text-align: center;
  270. line-height: 72rpx;
  271. font-size: 30rpx;
  272. color:#ffffff;
  273. display: inline-block;
  274. margin:auto 0;
  275. position: absolute;
  276. right:30rpx;
  277. top:14rpx;
  278. }
  279. </style>