phb.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view class="content">
  3. <view class="nav flex">
  4. <view class="nav-item" v-for="(item,index) in navList" @click="navClick(index)"
  5. :class="{'action': index == currentIndex}">
  6. {{item.title}}
  7. </view>
  8. </view>
  9. <image :src="top_bg" mode="" class="top-bg"></image>
  10. <view class="bd-wrap flex">
  11. <view class="bd" v-if="showList.length > 0">
  12. <image :src="tit_bg" mode="widthFix" class="bd-tit"></image>
  13. <view class="bd-top flex">
  14. <view class="top-item" @click="navTo('/pages/user/model/model?uid=' + showList[1].auth_info.uid + '&type=2&mtype=1')">
  15. <view class="top-logo yp">
  16. <image :src="showList[1].auth_info.avatar" mode=""></image>
  17. </view>
  18. <view class="top-name">
  19. {{showList[1].auth_info.name || ''}}
  20. </view>
  21. <view class="top-visit">
  22. {{showList[1].card_look_count || '0'}}
  23. </view>
  24. </view>
  25. <view class="top-item-center" @click="navTo('/pages/user/model/model?uid=' + showList[0].auth_info.uid + '&type=2&mtype=1')">
  26. <view class="top-logo jp">
  27. <image :src="showList[0].auth_info.avatar" mode=""></image>
  28. </view>
  29. <view class="top-name">
  30. {{showList[0].auth_info.name || ''}}
  31. </view>
  32. <view class="top-visit">
  33. {{showList[0].card_look_count || '0'}}
  34. </view>
  35. </view>
  36. <view class="top-item" @click="navTo('/pages/user/model/model?uid=' + showList[2].auth_info.uid + '&type=2&mtype=1')">
  37. <view class="top-logo tp">
  38. <image :src="showList[2].auth_info.avatar" mode=""></image>
  39. </view>
  40. <view class="top-name">
  41. {{showList[2].auth_info.name || ''}}
  42. </view>
  43. <view class="top-visit">
  44. {{showList[2].card_look_count || '0'}}
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bd-btm-item flex" v-for="(item,index) in showList" v-if="(index != 0 && index != 1 && index!= 2)" :key="index" @click="navTo('/pages/user/model/model?uid=' + item.auth_info.uid + '&type=2&mtype=1')">
  49. <image :src="item.auth_info.avatar" mode="" class="item-img"></image>
  50. <view class="flex item-info">
  51. <view class="item-name">
  52. {{item.auth_info.name || ''}} <image :src="rz" mode="" v-if="item.is_type_audit == 1"></image>
  53. </view>
  54. <view class="item-zy">
  55. {{item.user_work_type_id || ''}}
  56. </view>
  57. <!-- <view class="item-where">
  58. 48岁
  59. </view> -->
  60. <view class="" style="flex-grow: 1;">
  61. </view>
  62. <view class="item-vist">
  63. 浏览量:{{item.card_look_count || '0'}}
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="bd bd-no" v-else>
  69. 暂无榜单数据
  70. </view>
  71. </view>
  72. <view class="" style="height: 60rpx;">
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import { getInviteCountRank } from '@/api/user.js'
  78. import { getCardLookCountRank } from '@/api/index.js'
  79. export default {
  80. data() {
  81. return {
  82. times: '',
  83. top_bg: this.$store.state.baseURL + '/resource/icon/base/phb-bg.png',
  84. tit_bg: this.$store.state.baseURL + '/resource/icon/llph.png',
  85. rz: this.$store.state.baseURL + '/resource/icon/rz.png',
  86. navList: [{
  87. title: '周排行',
  88. time: ((new Date().setHours(0, 0, 0) - (new Date().getDay() - 1) *24 * 60 * 60 *1000)/1000).toFixed(0),
  89. times: ((new Date().setHours(0, 0, 0) + (7 - new Date().getDay()) *24 * 60 * 60 *1000)/1000).toFixed(0),
  90. list: [],
  91. loaded: false
  92. }, {
  93. title: '月排行',
  94. time: (new Date(new Date(new Date().getFullYear(), new Date().getMonth(), 1).setHours(0, 0, 0)).getTime()/1000).toFixed(0),
  95. times: ((new Date(new Date().getFullYear(), new Date().getMonth()+ 1, 0).setHours(23, 59, 59, 59))/1000).toFixed(0),
  96. list: [],
  97. loaded: false
  98. }],
  99. currentIndex: 0,
  100. }
  101. },
  102. onLoad() {
  103. },
  104. onShow() {
  105. console.log(this.$store.state.baseURL)
  106. this.times = ((new Date().setHours(0, 0, 0) - (new Date().getDay() - 1) *24 * 60 * 60 *1000)/1000).toFixed(0)
  107. this.getCardLookCountRank()
  108. },
  109. onReachBottom() {
  110. },
  111. onReady() {
  112. },
  113. computed: {
  114. showList() {
  115. return this.navList[this.currentIndex].list
  116. }
  117. },
  118. methods: {
  119. navClick(index) {
  120. this.currentIndex = index
  121. this.getCardLookCountRank()
  122. },
  123. getCardLookCountRank() {
  124. let that = this
  125. let navitem = that.navList[that.currentIndex]
  126. if(navitem.loaded) {
  127. return
  128. }
  129. getCardLookCountRank({
  130. time: navitem.time,
  131. times: navitem.times
  132. }).then(res => {
  133. console.log(res);
  134. navitem.list = res.data
  135. navitem.loaded = true
  136. }).catch(err => {
  137. navitem.loaded = false
  138. })
  139. },
  140. navTo(url) {
  141. console.log(url);
  142. if (url) {
  143. if (url.indexOf('http') > -1) {
  144. // #ifdef H5
  145. window.location.href = url
  146. // #endif
  147. // #ifdef APP
  148. plus.runtime.openURL(url)
  149. // #endif
  150. } else {
  151. uni.navigateTo({
  152. url: url
  153. })
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. page,
  162. .content {
  163. height: auto;
  164. min-height: 100%;
  165. background-color: #900408;
  166. }
  167. .nav {
  168. width: 750rpx;
  169. height: 88rpx;
  170. .nav-item {
  171. line-height: 88rpx;
  172. width: 50%;
  173. text-align: center;
  174. font-size: 30rpx;
  175. font-weight: 500;
  176. color: #333333;
  177. height: 100%;
  178. }
  179. .action {
  180. font-weight: bold;
  181. position: relative;
  182. &::after {
  183. content: '';
  184. width: 50rpx;
  185. height: 6rpx;
  186. background: #FE5B38;
  187. border-radius: 3rpx;
  188. position: absolute;
  189. left: 0;
  190. right: 0;
  191. bottom: 6rpx;
  192. margin: auto;
  193. }
  194. }
  195. background-color: #fff;
  196. }
  197. .top-bg {
  198. width: 750rpx;
  199. height: 742rpx;
  200. }
  201. .bd-wrap {
  202. width: 699rpx;
  203. background: #F6E7E4;
  204. border-radius: 14rpx;
  205. justify-content: center;
  206. margin: -150rpx auto 0;
  207. position: relative;
  208. padding: 16rpx;
  209. .bd {
  210. width: 666rpx;
  211. background: #FFFFFF;
  212. border: 2px solid #A30F0E;
  213. border-radius: 14rpx;
  214. position: relative;
  215. padding: 35rpx;
  216. .bd-tit {
  217. width: 443rpx;
  218. height: 69rpx;
  219. position: absolute;
  220. top: -35rpx;
  221. left: 0;
  222. right: 0;
  223. margin: auto;
  224. }
  225. .bd-top {
  226. height: 376rpx;
  227. width: 100%;
  228. padding-bottom: 47rpx;
  229. .jp,.yp,.tp {
  230. &::after {
  231. content: '';
  232. width: 58rpx;
  233. height: 66rpx;
  234. position: absolute;
  235. position: absolute;
  236. bottom: 10rpx;
  237. right: -10rpx;
  238. z-index: 999;
  239. }
  240. }
  241. .jp {
  242. &::after {
  243. background: url($base-url + '/resource/icon/jp.png') no-repeat;
  244. background-size: 100% 100%;
  245. }
  246. }
  247. .yp {
  248. &::after {
  249. right: -15rpx;
  250. background: url($base-url + '/resource/icon/yp.png') no-repeat;
  251. background-size: 100% 100%;
  252. }
  253. }
  254. .tp {
  255. &::after {
  256. right: -15rpx;
  257. background: url($base-url + '/resource/icon/tp.png') no-repeat;
  258. background-size: 100% 100%;
  259. }
  260. }
  261. .top-item, .top-item-center {
  262. height: 100%;
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: flex-end;
  266. align-items: center;
  267. .top-logo {
  268. border-radius: 50%;
  269. border: #900408 1px solid;
  270. position: relative;
  271. image {
  272. width: 100%;
  273. height: 100%;
  274. background-color: #eee;
  275. border-radius: 50%;
  276. }
  277. }
  278. .top-name {
  279. font-size: 26rpx;
  280. font-weight: bold;
  281. color: #A30F0E;
  282. margin: 15rpx 0;
  283. }
  284. .top-visit {
  285. font-size: 22rpx;
  286. font-weight: bold;
  287. color: #171717;
  288. }
  289. }
  290. .top-item {
  291. flex-grow: 3;
  292. .top-logo {
  293. width: 139rpx;
  294. height: 139rpx;
  295. }
  296. }
  297. .top-item-center {
  298. flex-grow: 4;
  299. .top-logo {
  300. width: 198rpx;
  301. height: 197rpx;
  302. }
  303. }
  304. }
  305. .bd-btm-item {
  306. height: 260rpx;
  307. border-top: #f2f2f2 1px solid;
  308. justify-content: flex-start;
  309. .item-info {
  310. height: 100%;
  311. flex-grow: 1;
  312. flex-direction: column;
  313. justify-content: flex-start;
  314. align-items: flex-start;
  315. padding: 34rpx 0 21rpx;
  316. .item-name {
  317. font-size: 31rpx;
  318. font-weight: bold;
  319. color: #333333;
  320. display: flex;
  321. align-items: center;
  322. justify-content: flex-start;
  323. image {
  324. width: 100rpx;
  325. height: 30rpx;
  326. margin-left: 10rpx;
  327. }
  328. }
  329. .item-zy {
  330. padding: 6rpx 20rpx;
  331. background: #fee7e4;
  332. border-radius: 5rpx;
  333. font-size: 22rpx;
  334. font-weight: 500;
  335. color: #F86859;
  336. margin: 16rpx 0 20rpx;
  337. }
  338. .item-vist,.item-where {
  339. font-weight: 500;
  340. color: #969696;
  341. }
  342. .item-vist {
  343. font-size: 22rpx;
  344. justify-items: flex-end;
  345. }
  346. .item-where {
  347. font-size: 24rpx;
  348. }
  349. }
  350. .item-img {
  351. flex-shrink: 0;
  352. width: 160rpx;
  353. height: 220rpx;
  354. margin-right: 22rpx;
  355. background-color: #eee;
  356. }
  357. }
  358. }
  359. }
  360. .bd-no {
  361. height: 500rpx;
  362. text-align: center;
  363. line-height: 500rpx;
  364. }
  365. </style>