allDynamic.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view>
  3. <view class="tab ddflex">
  4. <view class="tab-item fflex" :class="tabIndex==1?'tab-item-active':''" @click="tabChange(1)">今日动态</view>
  5. <view class="tab-item fflex" :class="tabIndex==2?'tab-item-active':''" @click="tabChange(2)">历史动态</view>
  6. </view>
  7. <view style="height: 120rpx;"></view>
  8. <view class="log">
  9. <view v-if="logsList && logsList.length > 0" v-for="(it, index) in logsList" :key="index" @click="jumpUrl('/mine/clientDetail/clientDetail?id='+it.uid)">
  10. <view class="time-year" v-if="todayYear!=it.year && index==0 || (index!=0 && (it.year!=logsList[index-1].year))">{{ it.year }}年</view>
  11. <view class="dflex">
  12. <view class="time-sort">
  13. <block v-if="index==0 || (index!=0 && (it.day!=logsList[index-1].day||it.month!=logsList[index-1].month||it.year!=logsList[index-1].year))">
  14. <text v-if="todayYear==it.year&&todayMonth==it.month&&todayDay==it.day">今日</text>
  15. <block v-else>
  16. <text>{{it.day}}</text>{{ it.month }}月
  17. </block>
  18. </block>
  19. </view>
  20. <view class="li fflex">
  21. <image src="/mine/static/images/jcico.png" class="jcico"></image>
  22. <view class="ddflex" style="width: 100%;margin-bottom: 20rpx;">
  23. <image style="width: 80rpx;height: 80rpx;border-radius: 100%;margin-right: 20rpx;" :src="it.avatar?it.avatar:'/static/images/userimg.png'"></image>
  24. <view class="fflex">
  25. <view style="font-size: 28rpx;font-weight: bold;" class="ddflex">
  26. <view class="tover " style="max-width: 250rpx;">{{it.nickName}}</view>
  27. <view v-if="it.realName">({{it.realName}})</view>
  28. </view>
  29. <view class="time">{{ it.time }}</view>
  30. </view>
  31. </view>
  32. <!-- <view class="des" v-if="it.brief">{{ it.brief }}</view> -->
  33. <rich-text class="des" :nodes="it.content"></rich-text>
  34. </view>
  35. </view>
  36. </view>
  37. <view v-if="!logsList || logsList.length == 0" class="nodata">
  38. <image src="/mine/static/images/empty.png" mode="aspectFill"></image>
  39. <view>暂无记录~</view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import util from "../../utils/util.js";
  46. const app = getApp();
  47. const req = require("../../utils/request.js");
  48. export default {
  49. components: {},
  50. props: {},
  51. data() {
  52. return {
  53. tabIndex:1,
  54. isLoad: true,
  55. form: {
  56. page: 1,
  57. limit: 10
  58. },
  59. logsList:[{
  60. createDate:'2023-03-04',
  61. brief:'阅读了《3·15|手把手教你读懂“食品标签”,拒绝被“坑”》',
  62. logsContent:'sss',
  63. year:"2022",
  64. month:"10",
  65. day:'30',
  66. time:'12:00'
  67. },{
  68. createDate:'2023-03-04',
  69. brief:'阅读了《3·15|手把手教你读懂“食品标签”,拒绝被“坑”》',
  70. logsContent:'sss',
  71. year:"2023",
  72. month:"4",
  73. day:'30',
  74. time:'12:00'
  75. },{
  76. createDate:'2023-03-04',
  77. brief:'浏览了中医馆私域解决方案',
  78. logsContent:'sss',
  79. year:"2023",
  80. month:"3",
  81. day:'04',
  82. time:'12:00'
  83. },{
  84. createDate:'2023-03-04',
  85. brief:'填写了表单《英才少儿教育精品VIP课程试听报名》',
  86. logsContent:'sss',
  87. year:"2023",
  88. month:"3",
  89. day:'03',
  90. time:'12:00'
  91. },{
  92. createDate:'2023-03-04',
  93. brief:'浏览了中医馆私域解决方案',
  94. logsContent:'sss',
  95. year:"2023",
  96. month:"3",
  97. day:'03',
  98. time:'12:00'
  99. },{
  100. createDate:'2023-03-04',
  101. brief:'填写了表单《英才少儿教育精品VIP课程试听报名》',
  102. logsContent:'sss',
  103. year:"2023",
  104. month:"2",
  105. day:'04',
  106. time:'12:00'
  107. },{
  108. createDate:'2023-03-04',
  109. brief:'浏览了中医馆私域解决方案',
  110. logsContent:'sss',
  111. year:"2022",
  112. month:"2",
  113. day:'04',
  114. time:'12:00'
  115. },{
  116. createDate:'2023-03-04',
  117. brief:'填写了表单《英才少儿教育精品VIP课程试听报名》',
  118. logsContent:'sss',
  119. year:"2022",
  120. month:"2",
  121. day:'03',
  122. time:'12:00'
  123. }],
  124. todayYear:'',
  125. todayMonth:'',
  126. todayDay:''
  127. }
  128. },
  129. onLoad(options) {
  130. this.todayYear = new Date().getFullYear()
  131. this.todayMonth = new Date().getMonth() + 1
  132. this.todayDay = new Date().getDate()
  133. this.getPageList()
  134. },
  135. onShow() {
  136. },
  137. onReachBottom: function() {
  138. this.form.page++;
  139. this.getPageList(false);
  140. },
  141. methods: {
  142. jumpUrl(url) {
  143. uni.navigateTo({
  144. url: url
  145. })
  146. },
  147. tabChange(index){
  148. if(this.tabIndex==index) return false
  149. this.tabIndex = index
  150. this.form.page = 1
  151. this.isLoad = true;
  152. this.getPageList(true)
  153. },
  154. getPageList(isShow) {
  155. if (!this.isLoad) return false;
  156. this.isLoad = false;
  157. let form = this.form;
  158. if(this.tabIndex==1) {
  159. form.startDate = util.formatTime(new Date()).t2 + ' 00:00:00'
  160. form.endDate = util.formatTime(new Date()).t2 + ' 23:59:59'
  161. }else{
  162. delete form.startDate
  163. delete form.endDate
  164. }
  165. uni.showLoading();
  166. req.getRequest(
  167. '/api/user/getUsersTrends',
  168. form,
  169. res => {
  170. res = res?res.list:[]
  171. if(res&&res.length>0){
  172. res.map(item=>{
  173. let t = this.getDate(item.createDate)
  174. item.year = t.year
  175. item.month = t.month
  176. item.day = t.day
  177. item.time = t.hour+':'+t.minute
  178. })
  179. }
  180. this.isShow = true;
  181. if (res && res.length == 10) {
  182. this.isLoad = true;
  183. }
  184. if (this.form.page > 1) {
  185. res = this.logsList.concat(res);
  186. }else{
  187. this.goTop()
  188. }
  189. this.logsList = res;
  190. uni.hideLoading();
  191. },
  192. isShow
  193. );
  194. },
  195. getDate(dateStr){
  196. if(!dateStr) return false
  197. let date = new Date(dateStr)
  198. const year = date.getFullYear();
  199. const month = date.getMonth() + 1;
  200. const day = date.getDate();
  201. const hour = date.getHours();
  202. const minute = date.getMinutes();
  203. const second = date.getSeconds();
  204. return {
  205. year:year,
  206. month:month,
  207. day:day,
  208. hour:hour,
  209. minute:minute,
  210. second:second,
  211. }
  212. },
  213. goTop(e) {
  214. // 一键回到顶部
  215. if (uni.pageScrollTo) {
  216. uni.pageScrollTo({
  217. scrollTop: 0,
  218. duration:100
  219. });
  220. }
  221. }
  222. },
  223. mounted() {
  224. },
  225. }
  226. </script>
  227. <style>
  228. @import "./allDynamic.css";
  229. </style>