index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="app-page">
  3. <view class="app-page">
  4. <text class="name">{{mData.name}}</text>
  5. <text class="create_at">发布时间:{{mData.create_at}}</text>
  6. <u-line color="#E9E9E9" length="calc(100%)" customStyle="margin-top:20rpx;"></u-line>
  7. <view class="content">
  8. <u-parse :content="mData.content"></u-parse>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. getNews
  16. } from "@/common/api/common.js";
  17. export default {
  18. data() {
  19. return {
  20. code: null,
  21. mData: {}
  22. }
  23. },
  24. onLoad(options) {
  25. uni.hideShareMenu({
  26. })
  27. if (options.code) {
  28. this.code = options.code;
  29. this.getNews()
  30. }
  31. },
  32. methods: {
  33. getNews() {
  34. uni.showLoading({
  35. })
  36. const data = {
  37. code: this.code,
  38. }
  39. getNews(data)
  40. .then((res) => {
  41. uni.hideLoading();
  42. console.log("getNews==>", res.data)
  43. if (res.data) {
  44. this.mData = res.data.list[0]
  45. }
  46. })
  47. .catch(() => {
  48. uni.hideLoading();
  49. });
  50. },
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .app-page {
  56. width: 100%;
  57. display: flex;
  58. min-height: 100vh;
  59. background: white;
  60. align-items: center;
  61. flex-direction: column;
  62. }
  63. .name {
  64. font-size: 32rpx;
  65. font-family: PingFang SC-Bold, PingFang SC;
  66. font-weight: bold;
  67. color: #1D161F;
  68. margin-top: 40rpx;
  69. }
  70. .create_at {
  71. font-size: 26rpx;
  72. margin-left: 25rpx;
  73. font-family: PingFang SC-Medium, PingFang SC;
  74. font-weight: 500;
  75. color: #BDBDBD;
  76. margin-top: 20rpx;
  77. }
  78. .content{
  79. margin: 20rpx;
  80. }
  81. </style>