message.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <u-no-network></u-no-network>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. onLoad(options) {
  30. },
  31. mounted() {
  32. this.getMessage()
  33. },
  34. data() {
  35. return {
  36. messageList: [],
  37. pageindex: 1,
  38. show: false
  39. }
  40. },
  41. methods: {
  42. getMessage: async function() {
  43. let res = await this.$request.post("/api/v1/user/userMessageList", {
  44. page: this.pageindex
  45. })
  46. console.log(res)
  47. if (res.status == 0) {
  48. this.messageList = res.data.data
  49. if (this.messageList.length == 0) {
  50. this.show = true
  51. } else {
  52. this.show = false
  53. }
  54. }
  55. },
  56. gotoliaotian(e){
  57. uni.navigateTo({
  58. url:"../common_tools/my_consulting/conversation"
  59. })
  60. }
  61. }
  62. };
  63. </script>
  64. <style scoped lang="scss">
  65. .main {}
  66. </style>