my_log.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view>
  3. <nav-bar title="操作日志"></nav-bar>
  4. <view v-if="!listData.length"><u-empty text="操作日志为空" mode="message"></u-empty></view>
  5. <view v-else v-for="(item, index) in listData" :key="index" style="padding-bottom: 20rpx;" class="item">
  6. <view class="headers">
  7. <view class="header_left">
  8. <image :src="item.type === 1||item.type === 2 ? img1 : img2" style="width: 40rpx;height: 40rpx;margin-right: 10rpx;"></image>
  9. <text class="msgTitle">
  10. {{ (item.type === 1||item.type === 2 ? '登录日志' : '操作日志')}}
  11. </text>
  12. </view>
  13. <view class="header_right">{{ $method.timestampToTime(item.createTime, false) }}</view>
  14. </view>
  15. <u-line color="#D6D6DB" />
  16. <view style="display: flex;justify-content: space-between;padding: 25rpx;color: #666666;">
  17. 操作内容:{{ item.type==1?"登录":item.type==2?"退出登录":item.type==3?"修改密码":item.type==4?"修改个人信息":"其他"}}
  18. </view>
  19. <u-line color="#D6D6DB" />
  20. </view>
  21. <u-divider v-if="totals !== 0 && listData.length === totals" bg-color="#eaeef1">到底了</u-divider>
  22. </view>
  23. </template>
  24. <script>
  25. import { mapGetters } from 'vuex';
  26. export default {
  27. components: {},
  28. data() {
  29. return {
  30. current: 0,
  31. img1: '/static/icon/msg_icon1.png',
  32. img2: '/static/icon/msg_icon2.png',
  33. listData: [],
  34. totals: 0,
  35. formData: {
  36. pageNum: 1,
  37. pageSize: 10
  38. }
  39. };
  40. },
  41. onPullDownRefresh() {
  42. this.formData.pageNum = 1
  43. this.$api
  44. .userloglist(this.formData)
  45. .then(res => {
  46. if (res.data.code === 200) {
  47. this.listData = res.data.rows;
  48. this.totals = res.data.total;
  49. }
  50. })
  51. .finally(() => {
  52. uni.stopPullDownRefresh();
  53. });
  54. },
  55. onLoad(option) {
  56. this.$store.getters.dictObj;
  57. this.getInfo();
  58. },
  59. onShow() {
  60. // this.getInfo();
  61. },
  62. onShareAppMessage(res) {
  63. return {
  64. title: '中正',
  65. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  66. };
  67. },
  68. methods: {
  69. getInfo() {
  70. this.$api.userloglist(this.formData).then(res => {
  71. if (res.data.code === 200) {
  72. this.listData = res.data.rows;
  73. this.totals = res.data.total;
  74. }
  75. });
  76. },
  77. againGetApi() {
  78. this.$api.userloglist(this.formData).then(res => {
  79. if (res.data.code === 200) {
  80. this.listData = this.listData.concat(res.data.rows);
  81. }
  82. });
  83. }
  84. },
  85. onReachBottom() {
  86. if (this.listData.length < this.totals) {
  87. this.formData.pageNum++;
  88. this.againGetApi();
  89. }
  90. },
  91. computed: { ...mapGetters(['userInfo']) }
  92. };
  93. </script>
  94. <style>
  95. page {
  96. background: #eaeef1;
  97. }
  98. </style>
  99. <style lang="scss" scoped>
  100. .btn2 {
  101. width: 144rpx;
  102. height: 48rpx;
  103. background: #ffffff;
  104. border: 2rpx solid #007aff;
  105. border-radius: 16rpx;
  106. text-align: center;
  107. line-height: 48rpx;
  108. color: #007aff;
  109. margin: 0 8rpx;
  110. }
  111. .btn1 {
  112. width: 144rpx;
  113. height: 48rpx;
  114. background: #ffffff;
  115. border: 2rpx solid #999999;
  116. border-radius: 16rpx;
  117. text-align: center;
  118. line-height: 48rpx;
  119. color: #999999;
  120. margin: 0 8rpx;
  121. }
  122. .item {
  123. background: #ffffff;
  124. border-radius: 16rpx;
  125. padding: 15rpx;
  126. }
  127. .priceTag {
  128. font-size: 30rpx;
  129. font-family: PingFang SC;
  130. font-weight: bold;
  131. color: #ff2d55;
  132. display: flex;
  133. flex-direction: row-reverse;
  134. }
  135. .bottomBox {
  136. position: fixed;
  137. bottom: 0;
  138. width: 100%;
  139. left: 0;
  140. height: 98rpx;
  141. background-color: #ffffff;
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. padding: 0 30rpx;
  146. }
  147. .headers {
  148. display: flex;
  149. justify-content: space-between;
  150. align-items: center;
  151. height: 60rpx;
  152. .header_left {
  153. color: #333333;
  154. font-size: 30rpx;
  155. font-weight: bold;
  156. display: flex;
  157. align-items: center;
  158. }
  159. .header_right {
  160. color: #999999;
  161. font-size: 24rpx;
  162. }
  163. }
  164. .msgTitle {
  165. width: 420rpx;
  166. overflow: hidden;
  167. text-overflow:ellipsis;
  168. white-space: nowrap;
  169. }
  170. </style>