Ver Fonte

Merge branch 'master' of iqiyoo:zhuishuyun_quickapp_front

xia há 4 anos atrás
pai
commit
99a2ddd339
5 ficheiros alterados com 204 adições e 13 exclusões
  1. 2 2
      src/api/config.js
  2. 11 6
      src/api/index.js
  3. 101 0
      src/assets/less/leaderboard.less
  4. 13 5
      src/manifest.json
  5. 77 0
      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 });
+};

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

@@ -0,0 +1,101 @@
+.leaderboard-wrap {
+  background-color: #fff;
+  flex-direction: column;
+  margin-top: 20px;
+
+  .type-bar {
+    background-color: #fff;
+
+    .type-item {
+      flex: 1;
+      justify-content: center;
+      align-items: center;
+      flex-direction: column;
+      position: relative;
+
+      text {
+        font-size: 30px;
+        color: #999;
+        // padding: 34px 0;
+      }
+
+      .cur {
+        color: #ef5952;
+        font-size: 36px;
+        font-weight: bold;
+      }
+
+      .choose-bar {
+        width: 38px;
+        height: 4px;
+        background-color: #ef5952;
+        border-radius: 2px;
+        margin-top: 10px;
+      }
+    }
+  }
+  .book-list__wrap {
+    background-color: #fff;
+    padding: 0 24px;
+    flex-direction: column;
+
+    .book-list__title {
+      padding: 30px 0;
+      align-items: center;
+
+      text {
+        color: #333;
+        font-size: 32px;
+      }
+    }
+  }
+  .book-list__multi {
+    margin-top: 30px;
+    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;
+      flex-direction: column;
+      justify-content: flex-start;
+      align-items: flex-start;
+      margin-left: 38px;
+      // margin-bottom: 40px;
+
+      .name {
+        font-size: 32px;
+        color: #333;
+        lines: 1;
+        text-overflow: ellipsis;
+      }
+
+      .intro {
+        font-size: 24px;
+        color: #666;
+        lines: 3;
+        text-overflow: ellipsis;
+        margin-top: 36px;
+        line-height: 36px;
+      }
+    }
+  }
+}

+ 13 - 5
src/manifest.json

@@ -39,8 +39,8 @@
     {
       "name": "service.alipay"
     },
-    { 
-      "name": "service.push" 
+    {
+      "name": "service.push"
     },
     {
       "name": "service.wxpay",
@@ -71,7 +71,7 @@
       "views/Home": {
         "component": "index"
       },
-       "views/Search": {
+      "views/Search": {
         "component": "index"
       },
       "views/Category": {
@@ -119,6 +119,9 @@
       "views/Raderover": {
         "component": "index"
       },
+      "views/Leaderboard": {
+        "component": "index"
+      },
       "views/Agreement": {
         "component": "index"
       },
@@ -129,8 +132,8 @@
     "widgets": {}
   },
   "display": {
-    "menuBarData":{
-      "menuBar" : false
+    "menuBarData": {
+      "menuBar": false
     },
     "titleBarBackgroundColor": "#fff",
     "titleBarTextColor": "#333",
@@ -218,6 +221,11 @@
         "titleBarText": "阅读器",
         "menu": false,
         "titleBar": false
+      },
+      "views/Leaderboard": {
+        "titleBarText": "排行榜",
+        "menu": false,
+        "titleBar": true
       }
     }
   }

+ 77 - 0
src/views/Leaderboard/index.ux

@@ -0,0 +1,77 @@
+<import name="x-book" src="../../components/book/book.ux"></import>
+
+<template>
+    <div class="leaderboard-wrap">
+        <div class="type-bar">
+            <block for="type in typeList">
+                <div class="type-item" @click="typeChange(type.index)">
+                    <text class="{{type.index === current ? 'cur' : ''}}">{{type.name}}</text>
+                    <text class="choose-bar" show="{{type.index === current}}"></text>
+                </div>
+            </block>
+        </div>
+        <list>
+            <list-item type="multi" class="book-list__wrap book-list__wrap--multi">
+                <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>
+                                    <text class="intro">{{book.book_summary}}</text>
+                                </div>
+                            </x-book>
+                        </div>
+                    </block>
+                </div>
+            </list-item>
+        </list>
+    </div>
+</template>
+
+<script>
+import { getRank } from "../../api";
+
+export default {
+    data() {
+        return {
+            typeList: [
+                {
+                    name: "女生",
+                    index: 0
+                },
+                {
+                    name: "男生",
+                    index: 1
+                },
+            ],
+            list: [],
+            current: 0,
+            img: ['../../assets/imgs/rank_1.png', '../../assets/imgs/rank_2.png', '../../assets/imgs/rank_3.png']
+        }
+    },
+    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>
+
+<style lang="less">
+@import "../../assets/less/leaderboard.less";
+</style>