فهرست منبع

排行榜提交

gdy96 4 سال پیش
والد
کامیت
def2903c74
4فایلهای تغییر یافته به همراه50 افزوده شده و 49 حذف شده
  1. 2 2
      src/api/config.js
  2. 11 6
      src/api/index.js
  3. 18 0
      src/assets/less/leaderboard.less
  4. 19 41
      src/views/Leaderboard/index.ux

+ 2 - 2
src/api/config.js

@@ -6,8 +6,8 @@
  * @Description: api配置文件
  */
 const apiConfig = {
-  baseURL: "https://quickapp.leyuee.com/api",
- // baseURL: "https://quickapptest.leyuee.com/api",
+  // baseURL: "https://quickapp.leyuee.com/api",
+ baseURL: "https://quickapptest.leyuee.com/api",
 };
 
 export default apiConfig;

+ 11 - 6
src/api/index.js

@@ -175,26 +175,31 @@ export const userTaskList = () => {
 };
 
 //完成任务
-export const getTaskAward = (id) => {
+export const getTaskAward = id => {
   return fly.get(`/user/task/get/${id}`);
 };
 
 //获取签到信息
 export const getSignInfo = () => {
-  return fly.get('/sign/info');
+  return fly.get("/sign/info");
 };
 
 //非VIP用户签到
 export const noVipSign = () => {
-  return fly.get('/sign/new');
+  return fly.get("/sign/new");
 };
 
 //任务页面书籍位置
 export const taskBook = () => {
-  return fly.get('/books/recommen');
-}
+  return fly.get("/books/recommen");
+};
 
 //获取全局变量
 export const userOptions = () => {
   return fly.get("/options");
-};
+};
+
+//获取排行榜
+export const getRank = sex => {
+  return fly.get("/books/rank", { sex: sex });
+};

+ 18 - 0
src/assets/less/leaderboard.less

@@ -54,6 +54,24 @@
     flex-direction: column;
     .book-item {
       margin-bottom: 40px;
+      display: flex;
+      image {
+        width: 45px;
+        height: 45px;
+        margin: auto 0;
+      }
+      .book-index_follow {
+        text {
+          width: 60px;
+          height: 45px;
+          margin: auto 0;
+          border-radius: 50px;
+          border: 1px solid #e6e6e6;
+          color: #999;
+          background-color: #f7f7f7;
+          text-align: center;
+        }
+      }
     }
     .book-info__multi {
       flex: 1;

+ 19 - 41
src/views/Leaderboard/index.ux

@@ -15,6 +15,12 @@
                 <div class="book-list__multi">
                     <block for="book in list">
                         <div class="book-item">
+                            <div style="width:60px;margin-right:15px">
+                                <image if="$idx<3" src="{{img[$idx]}}" class="book-index"></image>
+                                <div else class="book-index_follow">
+                                    <text>{{$idx+1}}</text>
+                                </div>
+                            </div>
                             <x-book multi="{{true}}" width="{{150}}" book="{{book}}">
                                 <div class="book-info__multi">
                                     <text class="name">{{book.book_name}}</text>
@@ -30,6 +36,7 @@
 </template>
 
 <script>
+import { getRank } from "../../api";
 
 export default {
     data() {
@@ -44,53 +51,24 @@ export default {
                     index: 1
                 },
             ],
-            list: [{
-                "book_id": "DZ18V4EoMXNAkgqopVKrjLzebmWvdYPQ",
-                "book_name": "最后赢家",
-                "book_summary": "我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。我为了钱做了上门女婿。",
-                "book_author": "小豌豆",
-                "cover_url": "https://cdn-novel.iycdm.com/book/cover/201907241708063365.jpeg?x-oss-process=image/resize,w_200/format,jpg",
-                "book_word_count": 3872962,
-                "book_chapter_total": 1806,
-                "book_category_id": 40,
-                "book_category": "女婿文",
-                "book_end_status": 1,
-                "book_published_time": "",
-                "copyright": "",
-                "charge_type": "CHAPTER",
-                "force_subscribe_chapter_id": 8,
-                "update_time": null,
-                "is_on_shelf": 2,
-                "book_price": "8.99",
-                "keyword": "",
-                "recommend_index": "100.00",
-                "is_show_index_content": 1,
-                "click_count": 0,
-                "product_id": 3375,
-                "sex_preference": "男频",
-                "last_cid": 1413448,
-                "last_chapter": "后续一百七十四章",
-                "first_cid": 1414575,
-                "is_on_user_shelf": null,
-                "last_chapter_is_vip": null,
-                "is_need_charge": 0,
-                "record_chapter_id": null,
-                "record_chapter_name": null
-            }],
-            current: 0
-        }
-    },
-    onInit() {
-        for (var i = 0; i < 5; i++) {
-            this.list.push(this.list[0])
+            list: [],
+            current: 0,
+            img: ['../../assets/imgs/rank_1.png', '../../assets/imgs/rank_2.png', '../../assets/imgs/rank_3.png']
         }
     },
-    onShow() {
-
+    async onInit() {
+        await this.getCityListByTabChange();
+        this.$watch('current', 'getCityListByTabChange')
     },
+    onShow() { },
     typeChange(index) {
         this.current = index;
     },
+    async getCityListByTabChange(index = 0) {
+        let sex = index ? "1" : "2";
+        let ret = await getRank(sex);
+        this.list = ret;
+    }
 }
 </script>