message.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="content">
  3. <view class="resume-detail" :style="{ paddingTop: statusBarHeight + 'px' }">
  4. <view class="fixed-nav">
  5. <view class="navbar">
  6. <view class="navbar-content">
  7. <view class="navbar-left" @click="goBack">
  8. <u-icon name="arrow-leftward" size="38" color="#333"></u-icon>
  9. </view>
  10. <view class="navbar-title">消息通知</view>
  11. <view class="navbar-right"></view>
  12. </view>
  13. </view>
  14. </view>
  15. <view v-for="(item, index) in list" :key="index" class="item" @click="goDet(item.content)">
  16. <view class="flex justify-between"
  17. style="font-size: 30upx;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
  18. <view>{{ item.title }}</view>
  19. <view v-if="item.isSee == 0"
  20. style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
  21. </view>
  22. </view>
  23. <view style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  24. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  25. </view>
  26. </view>
  27. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  28. <empty v-if="list.length === 0" des="暂无消息" show="false"></empty>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  34. import empty from '@/components/empty';
  35. export default {
  36. components: {
  37. uniLoadMore,
  38. empty
  39. },
  40. data() {
  41. return {
  42. statusBarHeight: 0, // 状态栏高度
  43. tabFromIndex: 5,
  44. tabCurrentIndex: 0,
  45. fromInfo: 5,
  46. list: [],
  47. page: 1,
  48. limit: 10,
  49. scrollTop: false,
  50. tabList: [{
  51. state: 5,
  52. text: '用户消息',
  53. totalElements: 0
  54. },
  55. {
  56. state: 4,
  57. text: '订单消息',
  58. totalElements: 0
  59. }
  60. ]
  61. };
  62. },
  63. onPageScroll: function(e) {
  64. this.scrollTop = e.scrollTop > 200;
  65. },
  66. onReachBottom: function() {
  67. this.page = this.page + 1;
  68. this.loadData();
  69. },
  70. onPullDownRefresh: function() {
  71. this.page = 1;
  72. this.loadData();
  73. },
  74. onLoad(options) {
  75. // 获取状态栏高度
  76. let systemInfo = uni.getSystemInfoSync();
  77. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  78. this.$queue.showLoading("加载中...")
  79. this.loadData();
  80. },
  81. methods: {
  82. goDet(e) {
  83. console.log(e.indexOf('下单'))
  84. if (e.indexOf('下单') != -1) {
  85. uni.navigateTo({
  86. url: '/my/order/index'
  87. })
  88. } else if (e.indexOf('接单') != -1) {
  89. uni.navigateTo({
  90. url: '/my/takeOrder/index'
  91. })
  92. } else if (e.indexOf('订单审核通过') != -1) {
  93. uni.navigateTo({
  94. url: '/my/publish/index'
  95. })
  96. }
  97. },
  98. goBack() {
  99. uni.navigateBack();
  100. },
  101. //顶部渠道点击
  102. tabClicks(index) {
  103. this.list = [];
  104. this.page = 1;
  105. this.tabFromIndex = index;
  106. this.$queue.showLoading("加载中...")
  107. this.loadData();
  108. },
  109. //获取消息列表
  110. loadData() {
  111. let that = this;
  112. let number = 10;
  113. let token = this.$queue.getData('token');
  114. if (token) {
  115. let data = {
  116. page: this.page,
  117. limit: this.limit,
  118. // state: this.tabFromIndex
  119. }
  120. this.$Request.getT('/app/message/selectMessageByUserId', data).then(res => {
  121. if (res.code === 0) {
  122. if (this.page == 1) {
  123. this.list = res.data.list
  124. } else {
  125. res.data.list.forEach(d => {
  126. this.list.push(d);
  127. });
  128. }
  129. }
  130. uni.hideLoading();
  131. uni.stopPullDownRefresh();
  132. });
  133. }
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="scss">
  139. page,
  140. page {
  141. background: #ffffff;
  142. }
  143. .content {
  144. background: #ffffff;
  145. height: 100%;
  146. }
  147. .swiper-box {
  148. height: calc(100% - 40px);
  149. }
  150. .list-scroll-content {
  151. height: 100%;
  152. }
  153. .resume-detail {
  154. height: 100vh;
  155. padding-bottom: 120rpx;
  156. // padding-top 已改为动态计算,在模板中通过 :style 设置
  157. }
  158. .uni-swiper-item {
  159. height: auto;
  160. }
  161. page {
  162. background-color: #F7F7F7;
  163. }
  164. .fixed-nav {
  165. height: 88rpx;
  166. display: flex;
  167. flex-direction: column;
  168. }
  169. // 顶部导航栏
  170. .navbar {
  171. background: #fff;
  172. height: 88rpx;
  173. display: flex;
  174. align-items: center;
  175. padding: 0 8rpx;
  176. flex: 1;
  177. .navbar-content {
  178. display: flex;
  179. align-items: center;
  180. justify-content: space-between;
  181. padding: 0 30rpx;
  182. height: 60rpx;
  183. flex: 1;
  184. .navbar-left {
  185. width: 60rpx;
  186. height: 60rpx;
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. }
  191. .navbar-title {
  192. color: rgba(23, 23, 37, 1);
  193. font-family: DM Sans;
  194. font-size: 38rpx;
  195. font-weight: 700;
  196. line-height: 52rpx;
  197. letter-spacing: 0%;
  198. text-align: center;
  199. }
  200. .navbar-right {
  201. width: 60rpx;
  202. height: 60rpx;
  203. }
  204. }
  205. }
  206. .item {
  207. background: #FFFFFF;
  208. padding: 16rpx;
  209. // margin: 16rpx;
  210. margin: 0 16rpx 16rpx 16rpx;
  211. font-size: 28rpx;
  212. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  213. // border-radius: 16upx;
  214. border-bottom: 1rpx solid #E6E6E6;
  215. }
  216. /* load-more */
  217. .uni-load-more {
  218. display: flex;
  219. flex-direction: row;
  220. height: 40px;
  221. align-items: center;
  222. justify-content: center;
  223. }
  224. .uni-load-more__text {
  225. font-size: 14px;
  226. // color: #999;
  227. }
  228. .uni-load-more__img {
  229. height: 24px;
  230. width: 24px;
  231. margin-right: 10px;
  232. }
  233. .uni-load-more__img>view {
  234. position: absolute;
  235. }
  236. .uni-load-more__img>view view {
  237. width: 6px;
  238. height: 2px;
  239. border-top-left-radius: 1px;
  240. border-bottom-left-radius: 1px;
  241. background: #999;
  242. position: absolute;
  243. opacity: 0.2;
  244. transform-origin: 50%;
  245. animation: load 1.56s ease infinite;
  246. }
  247. .uni-load-more__img>view view:nth-child(1) {
  248. transform: rotate(90deg);
  249. top: 2px;
  250. left: 9px;
  251. }
  252. .uni-load-more__img>view view:nth-child(2) {
  253. transform: rotate(180deg);
  254. top: 11px;
  255. right: 0;
  256. }
  257. .uni-load-more__img>view view:nth-child(3) {
  258. transform: rotate(270deg);
  259. bottom: 2px;
  260. left: 9px;
  261. }
  262. .uni-load-more__img>view view:nth-child(4) {
  263. top: 11px;
  264. left: 0;
  265. }
  266. .load1,
  267. .load2,
  268. .load3 {
  269. height: 24px;
  270. width: 24px;
  271. }
  272. .load2 {
  273. transform: rotate(30deg);
  274. }
  275. .load3 {
  276. transform: rotate(60deg);
  277. }
  278. .load1 view:nth-child(1) {
  279. animation-delay: 0s;
  280. }
  281. .load2 view:nth-child(1) {
  282. animation-delay: 0.13s;
  283. }
  284. .load3 view:nth-child(1) {
  285. animation-delay: 0.26s;
  286. }
  287. .load1 view:nth-child(2) {
  288. animation-delay: 0.39s;
  289. }
  290. .load2 view:nth-child(2) {
  291. animation-delay: 0.52s;
  292. }
  293. .load3 view:nth-child(2) {
  294. animation-delay: 0.65s;
  295. }
  296. .load1 view:nth-child(3) {
  297. animation-delay: 0.78s;
  298. }
  299. .load2 view:nth-child(3) {
  300. animation-delay: 0.91s;
  301. }
  302. .load3 view:nth-child(3) {
  303. animation-delay: 1.04s;
  304. }
  305. .load1 view:nth-child(4) {
  306. animation-delay: 1.17s;
  307. }
  308. .load2 view:nth-child(4) {
  309. animation-delay: 1.3s;
  310. }
  311. .load3 view:nth-child(4) {
  312. animation-delay: 1.43s;
  313. }
  314. @-webkit-keyframes load {
  315. 0% {
  316. opacity: 1;
  317. }
  318. 100% {
  319. opacity: 0.2;
  320. }
  321. }
  322. </style>