policyInfoDetails.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="policyinfodetails">
  3. <u-navbar back-text="" title="" back-icon-color="#FFFFFF" :background="{ background: '#3D5D4C' }"></u-navbar>
  4. <view class="policyinfodetails-header">
  5. <view class="policyinfodetails-header-title">{{ policyInfoDetailsObj.artTitle }}</view>
  6. <view class="policyinfodetails-header-subtitle">
  7. <view>来源:{{ policyInfoDetailsObj.artAuthor }}</view>
  8. <view>{{ formatDate(policyInfoDetailsObj.createTime) }}</view>
  9. </view>
  10. </view>
  11. <view class="policyinfodetails-content">
  12. <view class="ql-editor">
  13. <u-parse :html="policyInfoDetailsObj.artContent"></u-parse>
  14. </view>
  15. </view>
  16. <u-toast ref="uToast" />
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. policyInfoDetailsObj: ''
  24. };
  25. },
  26. onLoad(page) {
  27. if (page.artId) {
  28. this.getDetails(page.artId);
  29. }
  30. },
  31. onShow() {},
  32. methods: {
  33. // 获取详情
  34. getDetails(id) {
  35. this.$u.api.policyInfo
  36. .getPolicyInfoDetails({
  37. id: id
  38. })
  39. .then((res) => {
  40. if (res.code === 200) {
  41. this.policyInfoDetailsObj = res.data;
  42. } else {
  43. this.$refs.uToast.show({
  44. title: res.msg,
  45. type: 'error'
  46. });
  47. }
  48. })
  49. .catch((err) => {
  50. this.$refs.uToast.show({
  51. title: '操作失败!',
  52. type: 'error'
  53. });
  54. });
  55. },
  56. /**
  57. * 初始化日期 MM-dd hh:mm
  58. */
  59. formatDate(date) {
  60. let value;
  61. if (date) {
  62. value = this.$u.timeFormat(date.replace(/-/g, '/'), 'mm-dd hh:MM');
  63. }
  64. return value;
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. .policyinfodetails {
  71. padding: 30rpx 44rpx;
  72. font-family: 'PingFangSC-Regular, PingFang SC';
  73. &-header {
  74. border-bottom: solid 1px #dbdbdb;
  75. padding-bottom: 22rpx;
  76. &-title {
  77. color: #000;
  78. font-size: 36rpx;
  79. }
  80. &-subtitle {
  81. margin-top: 20rpx;
  82. display: flex;
  83. justify-content: space-between;
  84. color: #6f6f6f;
  85. font-size: 24rpx;
  86. }
  87. }
  88. &-content {
  89. padding: 18rpx 0;
  90. }
  91. }
  92. </style>