Browse Source

书本接口 / 投诉 帮助 创建页面

hjr 3 months ago
parent
commit
5111f2d2eb

+ 17 - 2
src/components/book-detail/info.ux

@@ -1,5 +1,20 @@
 <template>
   <div class="info">
+    <image class="info-left" src="{{ info.novelImg }}"></image>
+    <div class="info-right">
+      <text class="text-title">{{ info.novelName }}</text>
+      <rating
+        class="rate"
+        numstars="5"
+        rating="5"
+        indicator="true"
+      ></rating>
+      <text class="text-remark">{{ info.novelAuthor }}</text>
+      <text class="text-remark">{{ info.novelWords }}万字</text>
+      <!-- <text class="button" onclick="onBtnClick">到书城查看更多好书 </text> -->
+    </div>
+  </div>
+  <!-- <div class="info">
     <image class="info-left" src="{{ info.image }}"></image>
     <div class="info-right">
       <text class="text-title">{{ info.title }}</text>
@@ -11,9 +26,9 @@
       ></rating>
       <text class="text-remark">{{ info.author }}</text>
       <text class="text-remark">{{ info.words }}万字</text>
-      <!-- <text class="button" onclick="onBtnClick">{{ 到书城查看更多好书 }}</text> -->
+      <text class="button" onclick="onBtnClick">{{ 到书城查看更多好书 }}</text>
     </div>
-  </div>
+  </div> -->
 </template>
 
 <script>

+ 4 - 4
src/components/bookshelf/index.ux

@@ -22,7 +22,7 @@
       >
         <stack class="bookshelf-img">
           <div class="img-container">
-            <image src="{{$item.image}}" @click="clickImg($item)"></image>
+            <image src="{{$item.novelImg}}" @click="clickImg($item)"></image>
           </div>
           <div class="delete-icon" @click="deleteBook($item)">
             <image
@@ -31,7 +31,7 @@
             ></image>
           </div>
         </stack>
-        <text class="bookshelf-title">{{ $item.title }}</text>
+        <text class="bookshelf-title">{{ $item.novelName }}</text>
       </div>
     </div>
   </div>
@@ -57,8 +57,8 @@ export default {
   gotoBookContent(item) {
     $utils.route2theUrl('pages/book-content', {
       bookId: item.id,
-      bookTitle: item.title,
-      total: item.count
+      bookTitle: item.novelName,
+      total: item.novelChapterCount || 100,
     })
   },
   deleteBook(item) {

+ 0 - 2
src/components/center-modal.ux

@@ -79,7 +79,6 @@
     bottom: 0;
     left: 0;
     background-color: rgba(0, 0, 0, 0.5);
-    z-index: 0;
   }
 
   /* 弹窗内容的核心样式 */
@@ -96,7 +95,6 @@
     animation-duration: 200ms;
     animation-timing-function: ease-in-out;
     position: absolute;
-    z-index: 9;
   }
 
   /* 弹窗标题栏 */

+ 41 - 0
src/components/fab-button.ux

@@ -0,0 +1,41 @@
+<template>
+  <div class="fab-btn" @click="onTap">
+    <slot>
+      <!-- 默认内容,可自定义覆盖 -->
+      <text class="fab-icon">+</text>
+    </slot>
+  </div>
+</template>
+
+<script>
+export default {
+  methods: {
+    onTap() {
+      this.$emit('tap')
+    }
+  }
+}
+</script>
+
+<style>
+.fab-btn {
+  position: fixed;
+  right: 40px;
+  bottom: 60px;
+  width: 90px;
+  height: 90px;
+  background-color: #399bfc;
+  border-radius: 50%;
+  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  /* z-index: 999; */
+}
+.fab-icon {
+  color: #fff;
+  font-size: 60px;
+  font-weight: bold;
+  text-align: center;
+}
+</style>

+ 18 - 6
src/components/library/book-list.ux

@@ -9,6 +9,18 @@
       <text class="rank-title">收藏榜单</text>
     </list-item>
     <list-item type="rank-item" for="{{rankList}}">
+      <stack class="rank-item {{`rank-${$idx}`}}" onclick="goToDetail($item)">
+        <div class="rank-bg"></div>
+        <div class="rank-icon">
+          <text>{{ $idx + 1 }}</text>
+        </div>
+        <div class="rank-text">
+          <text>{{ $item.novelName }}</text>
+          <text>{{ $item.novelAuthor }}</text>
+        </div>
+      </stack>
+    </list-item>
+    <!-- <list-item type="rank-item" for="{{rankList}}">
       <stack class="rank-item {{`rank-${$idx}`}}" onclick="goToDetail($item)">
         <div class="rank-bg"></div>
         <div class="rank-icon">
@@ -19,7 +31,7 @@
           <text>{{ $item.author }}</text>
         </div>
       </stack>
-    </list-item>
+    </list-item> -->
     <list-item type="title">
       <text class="list-title">图书列表</text>
     </list-item>
@@ -30,15 +42,15 @@
       onclick="goToDetail($item)"
     >
       <div class="list-image">
-        <image src="{{$item.image}}"></image>
+        <image src="{{$item.novelImg}}"></image>
       </div>
       <div class="list-text">
-        <text class="book-title text-title">{{ $item.title }}</text>
-        <text class="book-author text-remark">{{ $item.author }}</text>
+        <text class="book-title text-title">{{ $item.novelName }}</text>
+        <text class="book-author text-remark">{{ $item.novelAuthor }}</text>
         <text class="book-description text-remark-black">{{
-          $item.description
+          $item.novelIntroduction
         }}</text>
-        <text class="book-count text-remark">{{ $item.words }}万字</text>
+        <text class="book-count text-remark">{{ $item.novelWords }}万字</text>
       </div>
     </list-item>
     <list-item type="loadMore" class="load-status" if="showLoad">

+ 39 - 45
src/components/library/index.ux

@@ -4,7 +4,12 @@
 <template>
   <div class="page-container">
     <search-input-bar onsearch="search" is-click="{{ true }}"></search-input-bar>
-
+    <!-- <book-list
+      list="{{library.list}}"
+      show-load="{{library.load}}"
+      onload-more="queryLibraryList"
+      rank-list="{{rankList}}"
+    > -->
     <book-list
       list="{{library.list}}"
       show-load="{{library.load}}"
@@ -12,13 +17,21 @@
       rank-list="{{rankList}}"
     >
       <div class="sub-container">
-        <swiper autoplay="true" class="swiper">
+        <!-- <swiper autoplay="true" class="swiper">
           <image
             class="swiper-image"
             src="{{$item.swiper}}"
             for="swiperList"
             onclick="goToDetail($item)"
           ></image>
+        </swiper> -->
+        <swiper autoplay="true" class="swiper">
+          <image
+            class="swiper-image"
+            src="{{$item.novelImg}}"
+            for="bannerList"
+            onclick="goToDetail($item)"
+          ></image>
         </swiper>
       </div>
     </book-list>
@@ -35,13 +48,16 @@ export default {
     library: {
       list: [],
       pageNo: 1,
-      pageSize: 5,
+      pageSize: 10,
       total: null,
       load: true,
     },
     swiperList: bookListData,
-    rankList: bookListData.slice(0, 3),
-    content: '' // 存储文本内容
+    rankList: [],//bookListData.slice(0, 3),
+    content: '', // 存储文本内容
+    bannerList:[],
+    hotList:[], // 热门图书
+    bookList:[],// 图书列表
   },
   search(info) {
     let searchText = info.detail
@@ -51,44 +67,19 @@ export default {
     // $utils.route2theUrl('pages/search', { initValue: text })
     $utils.route2theUrl('pages/search-book', { initValue: text })
   },
-  onInit() {
+  async onInit() {
     this.queryLibraryList(1)
-    // this.getTxtContent('https://ytnovels.oss-cn-shanghai.aliyuncs.com/novels/2025/01945026620890304513-1752828963340.txt')
-  },
-  // 解析TXT文件的主方法
-  getTxtContent(url) {
-    console.log('url',url)
-    fetch.fetch({
-      url: url,
-      responseType: 'arraybuffer', // 关键!用于处理二进制数据
-      success: (res) => {
-        if (res.code === 200) {
-          // 处理文本编码
-          const text = this.decodeData(res.data);
-          console.log('text',text)
-          this.content = text;
-        } else {
-          console.error('请求失败:', res.code);
-        }
-      },
-      fail: (err) => {
-        console.error('网络请求失败:', err);
-      }
-    })
-  },
-    // 处理文本编码(支持UTF-8/GBK)
-  decodeData(arrayBuffer) {
-    try {
-      // 尝试UTF-8解码
-      return decodeURIComponent(escape(
-        String.fromCharCode.apply(null, new Uint8Array(arrayBuffer))
-      ));
-    } catch (e) {
-      // UTF-8失败时尝试GBK(需要第三方库)
-      // const gbk = require('gbk.js'); // 需自行引入GBK库
-      // return gbk.decode(new Uint8Array(arrayBuffer));
-      return ''
-    }
+    const res = await $apis.common.novelBanner({bannerType: 1, pageNum: 1,pageSize: 10})
+    this.bannerList = res.data.result.list
+    const res1 = await $apis.common.novelModulePage({moduleType: 1, pageNum: 1,pageSize: 10,statu:1})
+    // this.hotList = res1.data.result.list
+    this.rankList = res1.data.result.list.slice(0, 3)
+    const res2 = await $apis.common.novelPage({bannerType: 1, pageNum: 1,pageSize: 10})
+    this.library.list = res2.data.result.list
+    this.library.total = res2.data.result.total
+    this.library.pageSize = res2.data.result.pageSize
+    console.log('url',this.bookList )
+    console.log('urhotListl',this.rankList )
   },
   /* -------------------SelfCustomEvent------------------ */
   queryLibraryList(pageNo) {
@@ -104,20 +95,23 @@ export default {
     }
     this.queryFn()
   },
-  queryFn() {
+  async queryFn() {
     /* 
     开发时,根据pageNo和pageSize查询列表
     返回total和对应pageNo的list
     */
-    this.library.total = 5
+   console.log('queryFn',this.library)
+    // this.library.total = 5
     // 模拟查询
     let total = this.library.pageNo * this.library.pageSize
     let end = this.library.total < total ? this.library.total : total
     let start = total - this.library.pageSize
-    let concatList = bookListData.slice(start, end)
+    const res =  await $apis.common.novelPage({bannerType: 1, pageNum: this.library.pageNo,pageSize: 10}) //bookListData.slice(start, end)
+    let concatList = res.data.result.list
     // 更新列表
     this.library.list = this.library.list.concat(concatList)
     this.library.pageNo++
+    console.log('3333-----',total,end,start,concatList)
   },
   goToDetail(item) {
     console.log(item)

+ 65 - 0
src/components/my/index.ux

@@ -0,0 +1,65 @@
+<template>
+  <div class="content">
+     <div class="top"> 
+       <image src="/assets/images/source/jiasu.png"></image>
+       <text>秀丽的窗帘</text>
+     </div>
+     <div class="item_tab" @click="toPage('pages/setting')">
+       <div>
+         <text>设置</text> 
+       </div>
+        <text>></text> 
+     </div>
+     <div class="item_tab">
+       <div>
+         <text>关于我们</text>
+       </div>
+        <text>></text> 
+     </div>
+  </div>
+</template>
+
+<script>
+import router from '@system.router'
+export default {
+  props: [],
+  data: {
+    page: 1
+  },
+  onReady() {
+
+  },
+  toPage(path) {
+    router.push({
+        uri: `${ path }`,
+        params: { key: 1 }
+      })
+  },
+}
+</script>
+
+<style lang="less">
+.content{
+  background-color: #fff;
+  height: 100%;
+  flex-direction: column;
+  .top{
+    display: flex;
+    padding: 30px;
+    margin-bottom: 50px;
+    image{
+      width: 120px;
+      height: 120px;
+      border-radius: 50%;
+      margin-right: 30px;
+    }
+  }
+  .item_tab{
+    padding: 0 30px 50px;
+    font-size: 25px;
+    display: flex;
+    justify-content: space-between;
+  }
+}
+
+</style>

+ 8 - 3
src/helper/ajax.js

@@ -1,15 +1,20 @@
 import $fetch from '@system.fetch'
 import $utils from './utils'
-
+var requestUrl = 'https://ltnovel8.xyz/pro-api/'
 function requestHandle(params) {
   console.log(`🤖 当前正在发起请求的 Url 是: ${params.url}`)
   return new Promise((resolve, reject) => {
     $fetch.fetch({
-      url: params.url,
+      url: requestUrl + params.url,
       method: params.method,
       data: params.data,
+      header:{
+        'content-type':'application/json',
+        Authorization:`eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc1MzIzNzQxNCwiZXhwIjoxNzYxMTg2MjE0fQ.ExgeLAdVkf-2KccGvg7sSzxeUfAr-8g5GgmzZPjHs1o`,
+      },
       success: data => {
-        resolve(data)
+        // console.log(`🐛 request success`,  JSON.parse(data.data).data.result)
+        resolve(JSON.parse(data.data)) // .data.result
       },
       fail: (data, code) => {
         console.log(`🐛 request fail, code = ${code} `, data)

+ 27 - 4
src/helper/apis/common.js

@@ -1,7 +1,30 @@
 import $ajax from '../ajax'
-var url = ''
 export default {
-  getPositionByLocation(data) {
-    return $ajax.get('https://apis.map.qq.com/ws/geocoder/v1/', data)
-  }
+  // getPositionByLocation(data) {
+  //   return $ajax.get('https://apis.map.qq.com/ws/geocoder/v1/', data)
+  // },
+  // 首页轮播图
+  novelBanner(data) {
+    return $ajax.post('novelBanner/page', data)
+  },
+  // 榜单
+  novelModulePage(data) {
+    return $ajax.post('novelModule/page', data)
+  },
+  // 小说列表
+  novelPage(data) {
+    return $ajax.post('novel/page', data)
+  },
+  // 章节列表 chapter novelId
+  novelChapterPage(data) {
+    return $ajax.post('novelChapter/page', data)
+  },
+  // 文章内容 fileUrl
+  downLoadFile(data) {
+    return $ajax.post('file/downLoadFile', data)
+  },
+  // 小说类型
+  novelType(data) {
+    return $ajax.post('novelType/page', data)
+  },
 }

+ 51 - 1
src/manifest.json

@@ -51,7 +51,9 @@
     {
       "name": "system.wifi"
     },
-    { "name": "system.geolocation" }
+    {
+      "name": "system.geolocation"
+    }
   ],
   "permissions": [
     {
@@ -143,6 +145,30 @@
       },
       "components/loading-progress": {
         "component": "index"
+      },
+      "components/my": {
+        "component": "index"
+      },
+      "pages/setting": {
+        "component": "index"
+      },
+      "pages/commonModule/complaint": {
+        "component": "index"
+      },
+      "pages/commonModule/complaintResult": {
+        "component": "index"
+      },
+      "pages/commonModule/help": {
+        "component": "index"
+      },
+      "pages/commonModule/redPacket": {
+        "component": "index"
+      },
+      "pages/commonModule/agreement": {
+        "component": "index"
+      },
+      "pages/commonModule/privacy": {
+        "component": "index"
       }
     }
   },
@@ -230,6 +256,30 @@
       },
       "components/loading-progress": {
         "titleBarText": ""
+      },
+      "components/my": {
+        "titleBarText": "我的"
+      },
+      "pages/setting": {
+        "titleBarText": "设置"
+      },
+      "pages/commonModule/complaint": {
+        "titleBarText": "投诉"
+      },
+      "pages/commonModule/complaintResult": {
+        "titleBarText": "投诉结果"
+      },
+      "pages/commonModule/help": {
+        "titleBarText": "帮助"
+      },
+      "pages/commonModule/redPacket": {
+        "titleBarText": "红包"
+      },
+      "pages/commonModule/agreement": {
+        "titleBarText": "用户协议"
+      },
+      "pages/commonModule/privacy": {
+        "titleBarText": "隐私政策"
       }
     }
   }

+ 50 - 4
src/pages/book-content/index.ux

@@ -116,6 +116,7 @@
 import texttoaudio from '@service.texttoaudio'
 import { getBookContent } from '../../assets/data/book-content.js'
 import { contentsData } from '../../assets/data/contents.js'
+import fetch from '@system.fetch'
 export default {
   public: {
     bookId: 1,
@@ -186,8 +187,49 @@ export default {
     console.log('bookId', this.bookId)
     // 参数传入时会变成string类型,需要转换类型
     this.chapterId = Number(this.chapterId)
-    this.chapterTitle = contentsData[this.bookId][this.chapterId - 1]
-    this.content = await getBookContent(this.bookId, this.chapterId)
+    // this.chapterTitle = contentsData[this.bookId][this.chapterId - 1]
+    // this.content = await getBookContent(this.bookId, this.chapterId)
+    const res = await $apis.common.novelChapterPage({chapter: this.chapterId, novelId: this.bookId})
+    let infos = res.data.result.list[0]
+    this.chapterTitle = infos.chapterName
+    this.content = this.getTxtContent(infos.content)
+    console.log('this.content',this.content)
+    // this.getTxtContent('https://ytnovels.oss-cn-shanghai.aliyuncs.com/novels/2025/01945026620890304513-1752828963340.txt')
+  },
+  // 解析TXT文件的主方法
+  getTxtContent(url) {
+    console.log('url',url)
+    fetch.fetch({
+      url: url,
+      responseType: 'arraybuffer', // 关键!用于处理二进制数据
+      success: (res) => {
+        if (res.code === 200) {
+          // 处理文本编码
+          const text = this.decodeData(res.data);
+          console.log('text',text)
+          this.content = text;
+        } else {
+          console.error('请求失败:', res.code);
+        }
+      },
+      fail: (err) => {
+        console.error('网络请求失败:', err);
+      }
+    })
+  },
+    // 处理文本编码(支持UTF-8/GBK)
+  decodeData(arrayBuffer) {
+    try {
+      // 尝试UTF-8解码
+      return decodeURIComponent(escape(
+        String.fromCharCode.apply(null, new Uint8Array(arrayBuffer))
+      ));
+    } catch (e) {
+      // UTF-8失败时尝试GBK(需要第三方库)
+      // const gbk = require('gbk.js'); // 需自行引入GBK库
+      // return gbk.decode(new Uint8Array(arrayBuffer));
+      return ''
+    }
   },
   async onReady() {
     //获取用户自定义的样式,不存在自定义样式时使用默认样式
@@ -216,8 +258,12 @@ export default {
     if (!!this.showPop) this.showPop = false
     // 调用接口,用bookId和chapterId查询下一页的内容,更新content和title。以下代码为模拟翻页。
     this.chapterId = type === 'next' ? this.chapterId + 1 : this.chapterId - 1
-    this.content = await getBookContent(this.bookId, this.chapterId)
-    this.chapterTitle = contentsData[this.bookId][this.chapterId - 1]
+    const res = await $apis.common.novelChapterPage({chapter: this.chapterId, novelId: this.bookId})
+    let infos = res.data.result.list[0]
+    this.chapterTitle = infos.chapterName
+    this.content = this.getTxtContent(infos.content)
+    // this.content = await getBookContent(this.bookId, this.chapterId)
+    // this.chapterTitle = contentsData[this.bookId][this.chapterId - 1]
     this.$element('list').scrollTo({ index: 0 })
   },
   goToContents() {

+ 12 - 10
src/pages/book-detail/index.ux

@@ -11,28 +11,28 @@
       <list-item type="info"> <info info="{{bookInfo}}"></info> </list-item>
       <list-item type="description" class="description">
         <text class="description-title">作品简介</text>
-        <text class="text-remark">{{ bookInfo.description }}</text>
+        <text class="text-remark">{{ bookInfo.novelIntroduction }}</text>
       </list-item>
       <list-item type="sub-title" class="sub-title">
-        <text class="text-title">共{{ bookInfo.count }}章</text>
+        <text class="text-title">共{{ bookInfo.novelChapterCount || 100 }}章</text>
         <div @click="goToContents">
-          <text class="text-remark">2019-7-23更新</text>
+          <text class="text-remark">{{ bookInfo?.createTime?.split('T')[0] || '' }}更新</text>
           <text class="text-remark iconfont">&#xe6d7;</text>
         </div>
       </list-item>
-      <list-item type="sub-title" class="detail-title">
+      <!-- <list-item type="sub-title" class="detail-title">
         <text class="text-title">热门评论</text>
         <div @click="goToComment">
           <text class="text-remark">30人正在讨论</text>
           <text class="text-remark iconfont">&#xe6d7;</text>
         </div>
-      </list-item>
-      <list-item type="comment" for="{{commentList}}">
+      </list-item> -->
+      <!-- <list-item type="comment" for="{{commentList}}">
         <comment-item-simple
           item="{{$item}}"
           onreply-comment="replyComment"
         ></comment-item-simple>
-      </list-item>
+      </list-item> -->
       <list-item type="detail-title" class="detail-title">
         <text class="text-title">相似图书推荐</text>
       </list-item>
@@ -78,6 +78,7 @@ export default {
   onInit() {
     // 此处直接将图书内容传进来,实际开发中也可以传入id查询图书信息
     this.bookInfo = this.info ? JSON.parse(this.info) : {}
+    console.log('info',this.bookInfo)
     // $shelfList:全局变量
     this.shelfList = $shelfList
     this.isInShelf = !!this.shelfList.filter(book => {
@@ -91,7 +92,7 @@ export default {
   goToContents() {
     $utils.route2theUrl('pages/contents', {
       bookId: this.bookInfo.id,
-      bookTitle: this.bookInfo.title
+      bookTitle: this.bookInfo.novelName
     })
   },
   goToDetail(item) {
@@ -104,8 +105,9 @@ export default {
   goToContent() {
     $utils.route2theUrl('pages/book-content', {
       bookId: this.bookInfo.id,
-      bookTitle: this.bookInfo.title,
-      total: this.bookInfo.count
+      bookTitle: this.bookInfo.novelName,//title,
+      total: this.bookInfo.novelChapterCount,//count
+      chapterId:1,
     })
   },
   addToShelf() {

+ 27 - 0
src/pages/commonModule/agreement/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 27 - 0
src/pages/commonModule/complaint/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 27 - 0
src/pages/commonModule/complaintResult/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 27 - 0
src/pages/commonModule/help/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 27 - 0
src/pages/commonModule/privacy/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 27 - 0
src/pages/commonModule/redPacket/index.ux

@@ -0,0 +1,27 @@
+<template>
+  <div class="wrapper">
+    <text class="title">{{ title }}</text>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style>
+.wrapper {
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  text-align: center;
+  color: #212121;
+}
+</style>

+ 20 - 9
src/pages/contents/index.ux

@@ -32,6 +32,8 @@
 
 <script>
 import { contentsData } from '../../assets/data/contents.js'
+import fetch from '@system.fetch'
+
 export default {
   public: {
     bookId: '',
@@ -46,13 +48,22 @@ export default {
     reverse: false,
     contents: [],
     lastList: [],
-    nextList: []
+    nextList: [],
+    totalList:[],
   },
-  onInit() {
+  async onInit() {
     // 开发时应该调用接口,根据bookId,pageNo(1), reverse(false)获取章节目录,返回第一页内容contents,总章节数total,总页数pageCount,算出pageNumStart和pageNumEnd。
-    this.total = contentsData[this.bookId].length
-    this.lastList = contentsData[this.bookId].slice(0, 50)
-    this.nextList = contentsData[this.bookId].slice(50)
+    const res = await $apis.common.novelChapterPage({novelId: this.bookId,pageNUm:1,pageSize:9999})
+    let infos = res.data.result.list.map(item=>{ return item.chapterName })
+    this.totalList = infos
+    console.log('infos',infos)
+    this.total = infos.length
+    this.lastList = infos.slice(0, 50)
+    this.nextList = infos.slice(50)
+
+    // this.total = contentsData[this.bookId].length
+    // this.lastList = contentsData[this.bookId].slice(0, 50)
+    // this.nextList = contentsData[this.bookId].slice(50)
     console.log('bookId', this.bookId)
     this.contents = this.lastList
   },
@@ -75,7 +86,7 @@ export default {
     // 开发时应该调用接口,根据bookId,pageNo,reverse获取章节目录。此处是模拟翻页/改变顺序。
     if (this.reverse) {
       if (this.pageNo === 1) {
-        this.pageNumStart = contentsData[this.bookId].length
+        this.pageNumStart = this.totalList.length
         this.pageNumEnd = 51
         this.contents = this.nextList.reverse()
       } else if (this.pageNo === 2) {
@@ -90,7 +101,7 @@ export default {
         this.contents = this.lastList
       } else if (this.pageNo === 2) {
         this.pageNumStart = 51
-        this.pageNumEnd = contentsData[this.bookId].length
+        this.pageNumEnd = this.totalList.length
         this.contents = this.nextList
       }
     }
@@ -100,8 +111,8 @@ export default {
     $utils.route2theUrl('pages/book-content', {
       bookId: this.bookId,
       bookTitle: this.bookTitle,
-      chapterId: contentsData[this.bookId].indexOf(item) + 1 || 0,
-      total: contentsData[this.bookId].length
+      chapterId: this.totalList.indexOf(item) + 1 || 0,
+      total: this.totalList.length
     })
   }
 }

+ 8 - 1
src/pages/main/index.ux

@@ -2,6 +2,7 @@
 <import name="library" src="../../components/library"></import>
 <import name="search-book" src="../../components/search-book"></import>
 <import name="tools-mall" src="../../components/tools-mall"></import>
+<import name="my" src="../../components/my"></import>
 
 <template>
   <div class="page-wrapper">
@@ -14,6 +15,7 @@
         <library></library>
         <!-- <search-book></search-book> -->
         <tools-mall></tools-mall>
+        <my></my>
       </tab-content>
       <tab-bar mode="fixed" class="tab-bar">
         <div class="tab-item" for="tabList">
@@ -51,10 +53,15 @@ export default {
         title: '工具',
         icon: '\ue603',
         activatedIcon: '\ue604'
+      },
+      {
+        title: '我的',
+        icon: '\ue603',
+        activatedIcon: '\ue604'
       }
     ],
     selectedTab: 1,
-    defaultShelfList: bookListData.slice(0, 2),
+    defaultShelfList: [],//bookListData.slice(0, 2),
     shelfList: []
   },
   onInit() {

+ 9 - 5
src/pages/search-book/index.ux

@@ -8,8 +8,8 @@
         <text class="search-refresh" @click="refreshHostList">&#xe607;</text>
       </div>
       <div class="hot-list">
-        <text class="hot-item" for="hotList" @click="toSearch($item.title)">{{
-          $item.title
+        <text class="hot-item" for="hotList" @click="toSearch($item.typeName)">{{
+          $item.typeName
         }}</text>
       </div>
     </div>
@@ -39,12 +39,16 @@ export default {
   toSearch(text) {
     $utils.route2theUrl('pages/search', { initValue: text })
   },
-  refreshHostList() {
+  async refreshHostList() {
     if (this.page === 1) {
-      this.hotList = bookListData.slice(0, 5)
+      const res = await $apis.common.novelType({pageNum: 1,pageSize: 10})
+      this.hotList = res.data.result.list
+      // this.hotList = bookListData.slice(0, 5)
       this.page = 2
     } else if (this.page === 2) {
-      this.hotList = bookListData.slice(0, 5)
+      const res = await $apis.common.novelType({pageNum: 2,pageSize: 10})
+      this.hotList = res.data.result.list
+      // this.hotList = bookListData.slice(0, 5)
       this.page = 1
     }
   }

+ 12 - 10
src/pages/search/index.ux

@@ -20,13 +20,13 @@
         type="book-item"
       >
         <div class="list-image">
-          <image src="{{$item.image}}"></image>
+          <image src="{{$item.novelImg}}"></image>
         </div>
         <div class="list-text">
-          <text class="book-title text-black">{{ $item.title }}</text>
-          <text class="book-author text-remark">{{ $item.author }}</text>
+          <text class="book-title text-black">{{ $item.novelName }}</text>
+          <text class="book-author text-remark">{{ $item.novelAuthor }}</text>
           <text class="book-description text-remark-black">{{
-            $item.description
+            $item.novelIntroduction
           }}</text>
         </div>
       </list-item>
@@ -53,13 +53,15 @@ export default {
     this.searchText = info.detail
     this.queryFn()
   },
-  queryFn() {
+  async queryFn() {
     // 根据关键字,查询接口,返回resultList。此处模拟接口查询,只能查询到bookListData中的图书。
-    this.resultList = this.searchText
-      ? bookListData.filter(item => {
-          return item.title.indexOf(this.searchText) !== -1
-        })
-      : []
+    const res = await $apis.common.novelPage({pageNum: 1,pageSize: 10,novelName:this.searchText})
+    this.resultList = res.data.result.list
+    // this.resultList = this.searchText
+    //   ? bookListData.filter(item => {
+    //       return item.title.indexOf(this.searchText) !== -1
+    //     })
+    //   : []
   },
   goToDetail(item) {
     // 根据id查询详情

+ 35 - 0
src/pages/setting/index.ux

@@ -0,0 +1,35 @@
+<template>
+  <div class="content">
+    <div class="item_tab">
+       <div>
+         <text>当前版本</text> 
+       </div>
+        <text>v1.0.0</text> 
+     </div>
+  </div>
+</template>
+
+<script>
+export default {
+  private: {
+    title: '欢迎体验快应用开发'
+  },
+
+  onInit() {}
+}
+</script>
+
+<style lang="less">
+.content{
+  width: 100%;
+  height: 100%;
+}
+.item_tab{
+  width: 100%;
+  padding: 30px;
+  font-size: 25px;
+  display: flex;
+  height: 100px;
+  justify-content: space-between;
+}
+</style>

+ 1 - 0
src/pages/tools/wangLuoXinXi/index.ux

@@ -73,6 +73,7 @@ export default {
         console.log(`handling fail, code = ${code}, errorMsg=${data}`)
       }
     })
+    // https://restapi.amap.com/v3/geocode/regeo?output=xml&location=116.310003,39.991957&key=<用户的key>&radius=1000&extensions=all 
     geolocation.reverseGeocodeQuery({
         latitude: 30.513070973744515,
         longitude: 114.41322124959942,

+ 6 - 4
src/pages/tools/wifiGuanLi/index.ux

@@ -25,7 +25,7 @@
 <script>
 import prompt from '@system.prompt'
 import storage from '@system.storage'
-
+import wifi from '@system.wifi'
 export default {
   data() {
     return {
@@ -49,10 +49,12 @@ export default {
   },
   onInit() {
     let that = this
-    storage.get({
-      key: 'statusBarHeight',
+    wifi.getConnectedWifi({
       success: function(data) {
-        that.statusBarHeight = data
+        console.log(`handling success: ${data.SSID}`)
+      },
+      fail: function(data, code) {
+        console.log(`handling fail, code = ${code}`)
       }
     })
   },