msg.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <gui-page :fullPage="true" :isLoading="pageLoading" ref="guiPage" :footerSets="{height:150, zIndex:100, bg:'none'}" :customFooter="true">
  3. <view slot="gBody" class="gui-flex1">
  4. <view>
  5. <view class="gui-margin gui-margin-top">
  6. <text class="gui-h5 gui-color-gray gui-bold">消息列表</text>
  7. </view>
  8. <view class="my-list" v-if="fetch.msg.length > 0">
  9. <view class="gui-list-items" v-for="(v, k) in fetch.msg" :key="k" @click="view(v)">
  10. <block v-if="v.type == 1">
  11. <text class="gui-list-icon gui-icons gui-color-blue">&#xe666;</text>
  12. <view class="gui-list-body gui-border-b">
  13. <view class="gui-list-title">
  14. <text class="gui-list-title-text gui-primary-color gui-list-one-line gui-ellipsis"
  15. style="width:320rpx; height:60rpx;">{{v.name}}</text>
  16. </view>
  17. </view>
  18. <text class="gui-list-arrow-right gui-icons gui-color-gray-light">&#xe601;</text>
  19. </block>
  20. <block v-if="v.type > 1">
  21. <view class="gui-list-image gui-relative">
  22. <image class="gui-list-image"
  23. :src="v.avatar"></image>
  24. <view class="gui-badge-point" style="display: none;"></view>
  25. </view>
  26. <view class="gui-list-body gui-border-b">
  27. <view class="gui-list-title">
  28. <text class="gui-list-title-text gui-primary-color">{{v.name}}</text>
  29. <text class="gui-list-title-desc gui-color-gray">{{v.date}}</text>
  30. </view>
  31. <text class="gui-list-body-desc gui-color-gray">{{v.content}}</text>
  32. </view>
  33. <text class="gui-list-arrow-right gui-icons gui-color-gray-light">&#xe601;</text>
  34. </block>
  35. </view>
  36. </view>
  37. <gui-empty v-if="fetch.msg.length <= 0">
  38. <view slot="img" class="gui-flex gui-rows gui-justify-content-center">
  39. <image class="gui-empty-img" src="@/static/dreamland/img/kong.png"></image>
  40. </view>
  41. <text slot="text"
  42. class="gui-text-small gui-block-text gui-text-center gui-margin-top" style="color:#9DABFF;">您还没有消息</text>
  43. </gui-empty>
  44. <gui-modal ref="alert"
  45. :title="title" :isTitle="true">
  46. <view slot="content" class="gui-padding gui-bg-gray">
  47. <text class="gui-block-text gui-text-center gui-text gui-color-gray"
  48. style="line-height:100rpx; padding:10rpx;">{{content}}</text>
  49. </view>
  50. <!-- 利用 flex 布局 可以放置多个自定义按钮哦 -->
  51. <view slot="btns" class="gui-flex gui-rows gui-space-between">
  52. <view class="modal-btns gui-flex1">
  53. <text class="modal-btns gui-color-blue" @tap="close">确认</text>
  54. </view>
  55. </view>
  56. </gui-modal>
  57. </view>
  58. </view>
  59. <foot ref="foot" slot="gFooter" :value="foot_value"></foot>
  60. </gui-page>
  61. </template>
  62. <script>
  63. import foot from '@/pages/index/foot.vue';
  64. export default {
  65. data() {
  66. return {
  67. foot_value : 3,
  68. fetch : {
  69. msg : [],
  70. },
  71. title : '',
  72. content : '',
  73. }
  74. },
  75. components:{
  76. foot
  77. },
  78. onLoad() {
  79. this.getData(1);
  80. },
  81. onShow() {
  82. this.$nextTick(function() {
  83. this.$refs.foot.cur = this.foot_value;
  84. });
  85. },
  86. // 重新加载
  87. onPullDownRefresh: function() {
  88. this.getData(1);
  89. },
  90. //下拉加载
  91. onReachBottom() {
  92. this.getData(2);
  93. },
  94. methods:{
  95. getData : function(page) {
  96. var self = this;
  97. var data = {};
  98. data.id = -1;
  99. this.Dever.page([page, 'msg'], this, 'app/collection/?l=api.msg', data);
  100. },
  101. view : function(v) {
  102. this.title = v.name;
  103. this.content = v.content;
  104. this.$refs.alert.open();
  105. },
  106. close : function () {
  107. this.$refs.alert.close();
  108. },
  109. }
  110. }
  111. </script>
  112. <style>
  113. .my-list{margin:30rpx 0; padding:0 30rpx;}
  114. .modal-btns{line-height:88rpx; font-size:26rpx; text-align:center; width:200rpx;}
  115. </style>