rankTop.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="rankTop">
  3. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
  4. :title="i18n('ClickRank')" :background="background">
  5. </u-navbar>
  6. <view class="rank-list-box">
  7. <!-- <view>
  8. <image class="topImg" v-if="topImg" :src="websiteUrl + topImg" mode=""></image>
  9. </view> -->
  10. <view class="rank-list" v-for="(list,index) in hitsList" v-if="informationMap[list]"
  11. :key="informationMap[list].baseEntityId" @tap="toRankDetail"
  12. :data-key="informationMap[list].baseEntityId">
  13. <view class="order">
  14. <text class="order-text">{{ index+1 }}</text>
  15. </view>
  16. <view class="cont" :style="{width: informationMap[list].pictureUrl? '420rpx': '628rpx'}">
  17. <view>
  18. <text class="cont-title u-line-2">{{informationMap[list]?informationMap[list].title:''}}</text>
  19. </view>
  20. <view class="cont-sm">
  21. <text class="cont-text">{{informationMap[list]?informationMap[list].auther:''}}</text>
  22. <text
  23. class="time">{{ formatDate(informationMap[list]?informationMap[list].publishDate:'') }}</text>
  24. </view>
  25. </view>
  26. <view class="cont-img" v-if="informationMap[list].pictureUrl ">
  27. <img class="img" :src="informationMap[list]?websiteUrl + informationMap[list].pictureUrl:''"
  28. mode="" />
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. background: {
  39. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  40. },
  41. backStyle: {
  42. color: '#fff'
  43. },
  44. hitsList: [],
  45. topImg: '',
  46. topClickList: {},
  47. informationMap: {},
  48. }
  49. },
  50. onLoad() {
  51. uni.setNavigationBarTitle({
  52. title: this.$i18n.locale == 'zh' ? '点击排行' : 'Click ranking'
  53. });
  54. },
  55. onShow() {
  56. this.getHitsList();
  57. },
  58. methods: {
  59. i18n(data) {
  60. return this.$t('common.' + data);
  61. },
  62. async getHitsList() { //点击排行
  63. let that = this;
  64. let list = {
  65. pageSize: 3,
  66. language: getApp().$i18n.locale.toUpperCase(),
  67. businessType: "information",
  68. }
  69. const res = await getApp().$myRequest({
  70. url: '/cms/cmsInformationClicks/topClickList',
  71. data: {
  72. ...list
  73. }
  74. });
  75. // console.log(res);
  76. that.topClickList = res.data.topClickList;
  77. that.hitsList = that.topClickList[1];
  78. that.informationMap = res.data.informationMap;
  79. },
  80. toRankDetail(e) { //去点击详情
  81. let key = e.currentTarget.dataset.key;
  82. uni.navigateTo({
  83. url: './rankDetail?key=' + key
  84. });
  85. },
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .rankTop {
  91. padding: 0 30upx;
  92. background-color: #FFFFFF;
  93. .topImg {
  94. width: 100%;
  95. height: 300upx;
  96. margin-top: 20upx;
  97. }
  98. .rank-list {
  99. padding: 30upx 0;
  100. border-bottom-width: 1px;
  101. border-bottom-style: solid;
  102. border-bottom-color: #f1f1f1;
  103. /* #ifndef APP-PLUS-NVUE */
  104. display: flex;
  105. /* #endif */
  106. flex-direction: row;
  107. justify-content: space-between;
  108. }
  109. .rank-list:last-child {
  110. border-bottom: none;
  111. }
  112. .order-text {
  113. display: inline-block;
  114. width: 40upx;
  115. height: 40upx;
  116. line-height: 40upx;
  117. text-align: center;
  118. color: #FFFFFF;
  119. border-radius: 8upx;
  120. background-color: #53a6ff;
  121. margin-top: 4upx;
  122. font-size: 26upx;
  123. }
  124. .rank-list:nth-child(1) .order-text {
  125. background-color: #f66600;
  126. }
  127. .rank-list:nth-child(2) .order-text {
  128. background-color: #ff995f;
  129. }
  130. .rank-list:nth-child(3) .order-text {
  131. background-color: #ffcd5d;
  132. }
  133. .cont-title {
  134. height: 92upx;
  135. color: #333333;
  136. font-size: 32upx;
  137. font-weight: 700;
  138. text-align: left;
  139. lines: 2;
  140. text-overflow: ellipsis;
  141. overflow: hidden;
  142. display: -webkit-box;
  143. -webkit-line-clamp: 2;
  144. -webkit-box-orient: vertical;
  145. }
  146. .cont-sm {
  147. margin-top: 16upx;
  148. flex-direction: row;
  149. }
  150. .cont-text {
  151. font-size: 28upx;
  152. color: #999999;
  153. }
  154. .time {
  155. margin-left: 30upx;
  156. font-size: 28upx;
  157. color: #999999;
  158. }
  159. .img {
  160. width: 185upx;
  161. height: 140upx;
  162. }
  163. }
  164. </style>