message.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="main">
  3. <view class="padding-lr">
  4. <view v-for="(item,index) in messageList" @click="gotoliaotian" :key="index" class="padding-lr-sm padding-tb-sm bg-white margin-top-sm"
  5. style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  6. <view class="flex justify-start align-center">
  7. <u-icon name="order"></u-icon>
  8. <text class="text-lg margin-left-xs">{{item.type}}</text>
  9. <text class="flex-sub text-right">{{item.create_time}}</text>
  10. </view>
  11. <view class="margin-top-sm text-cut">
  12. {{item.content}}
  13. </view>
  14. <view class="text-right" style="position: relative">
  15. <u-badge size="mini" :absolute="false" type="error" v-if="item.status==1" :is-dot="true"></u-badge>
  16. <text class="margin-left-xs" v-if="item.status==1">未读</text>
  17. <text class="margin-left-xs" v-if="item.status==2">已读</text>
  18. </view>
  19. </view>
  20. </view>
  21. <u-empty text="暂无数据" mode="order" :show="show" margin-top="250"></u-empty>
  22. <view class="cu-tabbar-height"></view>
  23. <view class="cu-tabbar-height"></view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. onLoad(options) {
  29. },
  30. mounted() {
  31. this.getMessage()
  32. },
  33. data() {
  34. return {
  35. messageList: [],
  36. pageindex: 1,
  37. show: false
  38. }
  39. },
  40. methods: {
  41. getMessage: async function() {
  42. let res = await this.$request.post("/api/v1/user/userMessageList", {
  43. page: this.pageindex
  44. })
  45. console.log(res)
  46. if (res.status == 0) {
  47. this.messageList = res.data.data
  48. if (this.messageList.length == 0) {
  49. this.show = true
  50. } else {
  51. this.show = false
  52. }
  53. }
  54. },
  55. gotoliaotian(e){
  56. uni.navigateTo({
  57. url:"../common_tools/my_consulting/conversation"
  58. })
  59. }
  60. }
  61. };
  62. </script>
  63. <style scoped lang="scss">
  64. .main {}
  65. </style>