detail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <view class="container">
  3. <!-- <u-navbar :is-fixed="false" :border-bottom="false" :is-back="true" back-icon-name="arrow-leftward" title="新闻详情页"
  4. :background="{ background: '#fff' }" title-color="#000000">
  5. <view class="right-nav" slot="right">
  6. <image src="/static/images/news/search.png" class="icon icon-search" mode="widthFix"></image>
  7. <image src="/static/images/news/menu.png" class="icon icon-menu" mode="widthFix"></image>
  8. </view>
  9. </u-navbar> -->
  10. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  11. @clickLeft="toBack" >
  12. <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  13. <text style="color: white;font-size: 1rem;">{{title}}</text>
  14. </view>
  15. </uni-nav-bar>
  16. <!-- <u-gap height="75px"></u-gap> -->
  17. <!-- <view class="header">
  18. <image src="" class="avatar" mode=""></image>
  19. <view class="info">
  20. <view class="name">
  21. 中国空间站
  22. <text class="tag">专栏作家</text>
  23. </view>
  24. <view class="date">06-17</view>
  25. </view>
  26. <view class="btn">+关注</view>
  27. </view> -->
  28. <view class="content" style="margin-top: 10px;">
  29. <view class="title">
  30. {{noticeInfo.title}}
  31. </view>
  32. <view class="static">
  33. <view class="left">
  34. <view class="block">
  35. {{noticeInfo.releaseTime}}
  36. <!-- <image src="/static/images/news/gf.png" class="gf"></image>
  37. 官方 -->
  38. </view>
  39. <!-- <view class="block">
  40. <image src="/static/images/news/x.png" class="gf"></image>
  41. 焦点新闻
  42. </view> -->
  43. </view>
  44. <!-- <view class="right">
  45. <image src="/static/images/news/l.png" class="l" mode="widthFix"></image>
  46. 66666
  47. </view> -->
  48. </view>
  49. <view class="detail">
  50. <u-parse :html="noticeInfo.content"></u-parse>
  51. </view>
  52. </view>
  53. <!-- <view class="footer">
  54. <input type="text" value="" placeholder="说点什么..." class="ipt" />
  55. <view class="control">
  56. <view class="block">
  57. <image src="/static/images/news/c.png" class="icon c" mode="widthFix"></image>
  58. 458
  59. </view>
  60. <view class="block">
  61. <image src="/static/images/news/s.png" class="icon s" mode="widthFix"></image>
  62. </view>
  63. <view class="block">
  64. <image src="/static/images/news/t.png" class="icon t" mode="widthFix"></image>
  65. </view>
  66. </view>
  67. </view> -->
  68. </view>
  69. </template>
  70. <script>
  71. import http from '@/http/api.js';
  72. export default {
  73. data() {
  74. return {
  75. title: '公告详情页',
  76. noticeInfo: {
  77. 'title': '',
  78. 'releaseTime': '',
  79. 'content': '',
  80. }
  81. };
  82. },
  83. onLoad(options) {
  84. console.log(options.id)
  85. this.getNotice(options.id);
  86. },
  87. methods:{
  88. toBack() {
  89. uni.navigateBack({
  90. delta: 1
  91. })
  92. },
  93. getNotice(id) {
  94. const that = this;
  95. http.request({
  96. url: '/galaxy-test/notice/detail',
  97. method: 'GET',
  98. params: {
  99. 'id':id,
  100. },
  101. }).then(res => {
  102. console.log(res.data)
  103. if (res.data != null) {
  104. that.noticeInfo=res.data;
  105. }
  106. }).catch(err => {
  107. console.log(err)
  108. })
  109. },
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. .container {
  115. padding: 0 0 150rpx;
  116. }
  117. .right-nav {
  118. display: flex;
  119. align-items: center;
  120. margin-right: 40rpx;
  121. .icon {
  122. height: auto;
  123. &-search {
  124. width: 40rpx;
  125. margin-right: 40rpx;
  126. }
  127. &-menu {
  128. width: 40rpx;
  129. }
  130. }
  131. }
  132. .header {
  133. display: flex;
  134. align-items: center;
  135. padding: 44rpx;
  136. .avatar {
  137. flex-shrink: 0;
  138. width: 69rpx;
  139. height: 69rpx;
  140. background: #ffffff;
  141. border: 1px solid #14b9c8;
  142. border-radius: 50%;
  143. }
  144. .info {
  145. flex: 1;
  146. margin-left: 14rpx;
  147. .name {
  148. display: flex;
  149. align-items: center;
  150. font-size: 28rpx;
  151. font-family: PingFang SC;
  152. font-weight: bold;
  153. color: #000000;
  154. line-height: 36rpx;
  155. .tag {
  156. margin-left: 10rpx;
  157. display: inline-block;
  158. padding: 8rpx 10rpx;
  159. font-size: 14rpx;
  160. font-family: PingFang SC;
  161. font-weight: 500;
  162. color: #4cbeca;
  163. line-height: 21rpx;
  164. border: 1px solid #0bb9c8;
  165. border-radius: 6px;
  166. }
  167. }
  168. .date {
  169. font-size: 24rpx;
  170. font-family: PingFang SC;
  171. font-weight: 500;
  172. color: #a3a3a3;
  173. line-height: 36rpx;
  174. }
  175. }
  176. .btn {
  177. padding: 8rpx 19rpx;
  178. background: #e6e6e6;
  179. border-radius: 6rpx;
  180. font-size: 20rpx;
  181. font-family: PingFang SC;
  182. font-weight: bold;
  183. color: #4cbeca;
  184. line-height: 1;
  185. }
  186. }
  187. .content {
  188. padding: 0 44rpx;
  189. .title {
  190. font-size: 40rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #000000;
  194. line-height: 47rpx;
  195. }
  196. .static {
  197. margin-top: 34rpx;
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. .left,
  202. .right {
  203. display: flex;
  204. align-items: center;
  205. .block {
  206. display: flex;
  207. align-items: center;
  208. margin-right: 10rpx;
  209. }
  210. }
  211. .left {
  212. font-size: 20rpx;
  213. font-family: PingFang SC;
  214. font-weight: bold;
  215. color: #787878;
  216. line-height: 1;
  217. .gf {
  218. width: 24rpx;
  219. height: 24rpx;
  220. margin-right: 8rpx;
  221. }
  222. }
  223. .right {
  224. font-size: 20rpx;
  225. font-family: PingFang SC;
  226. font-weight: bold;
  227. color: #787878;
  228. line-height: 1;
  229. .l {
  230. width: 25rpx;
  231. height: auto;
  232. margin-right: 6rpx;
  233. }
  234. }
  235. }
  236. .detail {
  237. font-size: 24rpx;
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. color: #000000;
  241. line-height: 47rpx;
  242. margin-top: 50rpx;
  243. }
  244. }
  245. .footer {
  246. position: fixed;
  247. bottom: 0;
  248. left: 0;
  249. right: 0;
  250. z-index: 999;
  251. height: 100rpx;
  252. padding: 20rpx;
  253. box-sizing: border-box;
  254. display: flex;
  255. align-items: center;
  256. justify-content: center;
  257. background-color: #ffffff;
  258. .ipt {
  259. width: 380rpx;
  260. height: 77rpx;
  261. background: #f7f7f7;
  262. border-radius: 38px;
  263. padding: 0 37rpx;
  264. box-sizing: border-box;
  265. margin-right: 20rpx;
  266. }
  267. .control {
  268. flex: 1;
  269. display: flex;
  270. align-items: center;
  271. justify-content: space-around;
  272. .block {
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. flex: 1;
  277. }
  278. .icon {
  279. height: auto;
  280. }
  281. .c {
  282. width: 41rpx;
  283. margin-right: 10rpx;
  284. }
  285. .s {
  286. width: 36rpx;
  287. }
  288. .t {
  289. width: 31rpx;
  290. }
  291. }
  292. }
  293. </style>