policyInfoDetails.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. },
  33. methods:{
  34. // 获取详情
  35. getDetails(id) {
  36. this.$u.api.policyInfo.getPolicyInfoDetails({ id: id })
  37. .then(res=>{
  38. if (res.code === 200) {
  39. this.policyInfoDetailsObj = res.data;
  40. } else {
  41. this.$refs.uToast.show({
  42. title: res.msg,
  43. type: 'error'
  44. });
  45. }
  46. })
  47. .catch(err => {
  48. this.$refs.uToast.show({
  49. title: '操作失败!',
  50. type: 'error'
  51. });
  52. })
  53. },
  54. /**
  55. * 初始化日期 MM-dd hh:mm
  56. */
  57. formatDate(date) {
  58. let value;
  59. if (date) {
  60. value = this.$u.timeFormat(date.replace(/-/g, '/'), 'mm-dd hh:MM')
  61. }
  62. return value;
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. @import '@/static/css/quill.bubble.scss';
  69. @import '@/static/css/quill.core.scss';
  70. @import '@/static/css/quill.snow.scss';
  71. .policyinfodetails {
  72. padding: 30rpx 44rpx;
  73. font-family: 'PingFangSC-Regular, PingFang SC';
  74. &-header {
  75. border-bottom: solid 1px #DBDBDB;
  76. padding-bottom: 22rpx;
  77. &-title {
  78. color: #000;
  79. font-size: 36rpx;
  80. }
  81. &-subtitle {
  82. margin-top: 20rpx;
  83. display: flex;
  84. justify-content: space-between;
  85. color: #6F6F6F;
  86. font-size: 24rpx;
  87. }
  88. }
  89. &-content {
  90. padding: 18rpx 0;
  91. }
  92. }
  93. </style>