detail.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="contents">
  3. <view class="title"><text>{{item.title}}</text></view>
  4. <view class="ly">
  5. <text>{{item.author}}</text>
  6. <text class="day">4天前</text>
  7. </view>
  8. <view>
  9. <view class="fwb">
  10. <u-parse :html="item.content"></u-parse>
  11. </view>
  12. <view class="mt10">
  13. <view class="">来源:作者名称</view>
  14. <view class="">编辑丨编辑名称</view>
  15. <view class="">责编丨初审名称</view>
  16. <view class="">审核丨终审名称</view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. ip: this.$http.urls.ip,
  26. item: {}
  27. };
  28. },
  29. onLoad(e) {
  30. this.$http.request({
  31. url: this.$http.urls.getContentInfo+ e.id,
  32. success: res => {
  33. console.log("asd:"+JSON.stringify(res));
  34. this.item = res.data.data.info;
  35. //this.item.contents = res.data.data.contents.replace(/\<img/gi, '<img style=width:100%;height:auto');
  36. }
  37. });
  38. },
  39. methods: {
  40. //购物车
  41. car() {
  42. uni.switchTab({
  43. url: 'shopcar'
  44. });
  45. },
  46. //添加购物车
  47. add() {
  48. this.$http.request({
  49. url: this.$http.urls.cart_add,
  50. method: 'POST',
  51. data: { goodsId: this.item.id, userId: this.$getUser().id },
  52. success: res => {
  53. uni.showToast({ title: '已加入购物车', icon: 'none' });
  54. }
  55. });
  56. },
  57. //直接购买服务
  58. buy() {
  59. let list = [{ goodsId: this.item.id, goods: { title: this.item.title, price: this.item.price, pic: this.item.pic } }];
  60. uni.navigateTo({ url: 'pay?list=' + JSON.stringify(list) });
  61. }
  62. }
  63. };
  64. </script>
  65. <style lang="scss">
  66. .contents {
  67. padding: 20px;
  68. .ly {
  69. font-size: 14px;
  70. margin-bottom: 15px;
  71. color: #2196f3;
  72. .day {
  73. color: #818184;
  74. padding-left: 10px;
  75. }
  76. }
  77. .title {
  78. padding-top: 20px;
  79. font-size: 23px;
  80. font-weight: 400;
  81. margin-bottom: 20px;
  82. }
  83. .pic {
  84. width: 100%;
  85. border-radius: 3px;
  86. margin-top: 3px;
  87. }
  88. .fwb {
  89. margin-top: 15px;
  90. color: #909090;
  91. }
  92. }
  93. </style>