policyInfoDetails.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="policyinfodetails">
  3. <view class="policyinfodetails-header">
  4. <view class="policyinfodetails-header-title">{{ policyInfoDetailsObj.artTitle }}</view>
  5. <view class="policyinfodetails-header-subtitle">
  6. <view>来源:{{ policyInfoDetailsObj.artAuthor }}</view>
  7. <view>{{ formatDate(policyInfoDetailsObj.createTime) }}</view>
  8. </view>
  9. </view>
  10. <view class="policyinfodetails-content">
  11. <view class="ql-editor">
  12. <u-parse :html="policyInfoDetailsObj.artContent"></u-parse>
  13. </view>
  14. </view>
  15. <u-toast ref="uToast" />
  16. </view>
  17. </template>
  18. <script>
  19. export default{
  20. data(){
  21. return{
  22. policyInfoDetailsObj: ''
  23. }
  24. },
  25. onLoad(page){
  26. if (page.artId) {
  27. this.getDetails(page.artId);
  28. }
  29. },
  30. onShow(){
  31. },
  32. methods:{
  33. // 获取详情
  34. getDetails(id) {
  35. this.$u.api.policyInfo.getPolicyInfoDetails({ id: id })
  36. .then(res=>{
  37. if (res.code === 200) {
  38. this.policyInfoDetailsObj = res.data;
  39. } else {
  40. this.$refs.uToast.show({
  41. title: res.msg,
  42. type: 'error'
  43. });
  44. }
  45. })
  46. .catch(err => {
  47. this.$refs.uToast.show({
  48. title: '操作失败!',
  49. type: 'error'
  50. });
  51. })
  52. },
  53. /**
  54. * 初始化日期 MM-dd hh:mm
  55. */
  56. formatDate(date) {
  57. let value;
  58. if (date) {
  59. value = this.$u.timeFormat(date.replace(/-/g, '/'), 'mm-dd hh:MM')
  60. }
  61. return value;
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. @import '@/static/css/quill.bubble.scss';
  68. @import '@/static/css/quill.core.scss';
  69. @import '@/static/css/quill.snow.scss';
  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: 20rpx;
  86. }
  87. }
  88. &-content {
  89. padding: 18rpx 0;
  90. }
  91. }
  92. </style>