message.vue 7.9 KB

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