hudong.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <block v-for="(item,index) in list" :key="index">
  5. <view class="item">
  6. <view class="avator">
  7. <image class="icon" :src="item.avator" mode="aspectFill">
  8. </image>
  9. </view>
  10. <view class="tit">
  11. <view class="name">{{item.nickname}}</view>
  12. <view class="desc">{{item.content}}</view>
  13. </view>
  14. <view class="state">
  15. <view class="status_9">{{item.create_time}}</view>
  16. </view>
  17. </view>
  18. <view class="line">
  19. </view>
  20. </block>
  21. <view class="blankHeight"></view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. components: {},
  28. data() {
  29. return {
  30. tab: 1,
  31. list: [],
  32. stype: 'like'
  33. }
  34. },
  35. onLoad() {},
  36. onShow() {
  37. let that = this;
  38. // uni.setNavigationBarTitle({
  39. // titleNView: that.titleNView
  40. // });
  41. // this.setStyle(1, '收到的点赞')
  42. this.loadData();
  43. },
  44. onNavigationBarButtonTap(e) {
  45. if (e.index === 0) {
  46. // 执行代码块
  47. // console.log("ee", e.index)
  48. // if (this.stype == 'comment') {
  49. // this.stype = 'like';
  50. // this.setStyle(1, '收到的评论');
  51. // uni.setNavigationBarTitle({
  52. // title: "收到的点赞"
  53. // })
  54. // } else {
  55. // this.stype = 'comment';
  56. // this.setStyle(1, '收到的点赞');
  57. // uni.setNavigationBarTitle({
  58. // title: "收到的评论"
  59. // })
  60. // }
  61. // this.loadData()
  62. }
  63. },
  64. methods: {
  65. setStyle(index, text) {
  66. try {
  67. let pages = getCurrentPages();
  68. let page = pages[pages.length - 1];
  69. // #ifdef APP-PLUS
  70. let currentWebview = page.$getAppWebview();
  71. let titleNView = currentWebview.getStyle().titleNView;
  72. // 添加文字过长截取为3个字符,请根据自己业务需求更改
  73. titleNView.buttons[0].text = text;
  74. currentWebview.setStyle({
  75. titleNView: titleNView
  76. });
  77. // #endif
  78. // #ifdef H5
  79. // h5 临时方案
  80. const btn = document.getElementsByClassName('uni-btn-icon')[index]
  81. btn.innerText = text;
  82. // #endif
  83. } catch (e) {
  84. }
  85. },
  86. onClickButton1() {
  87. console.log('点击了按钮1')
  88. },
  89. onClickButton2() {
  90. console.log('点击了按钮2')
  91. },
  92. onBack() {},
  93. loadData() {
  94. uni.request({
  95. url: this.$apiHost + '/Member/getComments',
  96. data: {
  97. uuid: getApp().globalData.uuid,
  98. stype: this.stype,
  99. },
  100. header: {
  101. 'content-type': 'application/json'
  102. },
  103. success: (res) => {
  104. console.log("res", res.data)
  105. this.list = res.data.list;
  106. }
  107. });
  108. },
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. @import 'hudong.scss';
  114. </style>