|
@@ -1,79 +1,62 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
- <view class="item_demo" @click="onClickTest"> 测试util </view>
|
|
|
- <view class="item_demo" @click="onClickNav">跳转</view>
|
|
|
- <view class="container">
|
|
|
- <template-book3 :dataList='book_3_data_list' @clickBook='clickBook'></template-book3>
|
|
|
- <template-book3 :dataList='book_3_data_list_1' @clickBook='clickBook'></template-book3>
|
|
|
- <template-book-list></template-book-list>
|
|
|
+ <view class="content__container" v-for="(item,index) in data_list" :key="index">
|
|
|
+ <templateSearch v-if="item.template_type==config.template_stype.SEARCH" ></templateSearch>
|
|
|
+ <templateBanner v-if="item.template_type==config.template_stype.BANNER" :templateData='item' @clickBook='clickBook'></templateBanner>
|
|
|
+ <templateBookH3 v-if="item.template_type==config.template_stype.H_3" :templateData='item' :dataList='H3_data_list' @clickBook='clickBook'></templateBookH3>
|
|
|
+ <templateBookV3 v-if="item.template_type==config.template_stype.V_3" :templateData='item' @clickBook='clickBook'></templateBookV3>
|
|
|
+ <templateBookList v-if="item.template_type==config.template_stype.LIST" :templateData='item' @clickBook='clickBook'></templateBookList>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import templateBook3 from '../bookstore/template/template-book-3.vue'
|
|
|
- import templateBookList from '../bookstore/template/template-book-list.vue'
|
|
|
+ import templateSearch from '../bookstore/template/template-book-Search.vue'
|
|
|
+ import templateBanner from '../bookstore/template/template-book-Banner.vue'
|
|
|
+ import templateBookH3 from '../bookstore/template/template-book-H-3.vue'
|
|
|
+ import templateBookV3 from '../bookstore/template/template-book-V-3.vue'
|
|
|
+ import templateBookList from '../bookstore/template/template-book-List.vue'
|
|
|
import { ref } from 'vue';
|
|
|
- import { util } from '../../framework/util';
|
|
|
- import { book_item_data } from '../../data/data';
|
|
|
+ import { bookstore_template_data, book_item_data } from '../../data/data';
|
|
|
import { tools } from '../../framework/tools';
|
|
|
-
|
|
|
- let book_3_data_list = ref<Array<book_item_data>>([])
|
|
|
- let book_3_data_list_1 = ref<Array<book_item_data>>([])
|
|
|
+ import { http } from '../../framework/http';
|
|
|
+ import { config } from '../../config/config';
|
|
|
+ import { log } from '../../framework/log';
|
|
|
+ import { util } from '../../framework/util'
|
|
|
+
|
|
|
+ let data_list = ref<Array<bookstore_template_data>>([])
|
|
|
+ let H3_data_list = ref<Array<Array<book_item_data>>>([])
|
|
|
|
|
|
requestData()
|
|
|
|
|
|
function requestData() {
|
|
|
- let test_data =
|
|
|
- [{'id':1,'n':'玄鉴仙族','c':'https://www.uuks5.com/cover/766295.jpg'},
|
|
|
- {'id':2,'n':'走进不科学','c':'https://www.mayiwsk.com/files/article/image/88/88817/88817s.jpg'},
|
|
|
- {'id':3,'n':'光阴之外','c':'https://www.deqixs.com/files/cover/202304/91c935a0-be7c-450f-bedb-aab07a242207.jpg'},
|
|
|
- {'id':4,'n':'全球灾变:我召唤无限军团横推万物','c':'https://bookcover.yuewen.com/qdbimg/349573/1036611416/600.webp'},
|
|
|
- {'id':5,'n':'这游戏也太真实了','c':'https://img.22biqu.com/4/4729/4729s.jpg'},
|
|
|
- {'id':6,'n':'全球冰封,我囤积了千亿物资','c':'http://img.shulala.org/90/90967/90967s.jpg'}]
|
|
|
-
|
|
|
- for (let i = 0; i < test_data.length; i++) {
|
|
|
- let element = test_data[i]
|
|
|
- let book_data = new book_item_data()
|
|
|
- book_data.book_id = element.id
|
|
|
- book_data.book_name = element.n
|
|
|
- book_data.book_cover = element.c
|
|
|
- if(i<3) {
|
|
|
- book_3_data_list.value.push(book_data)
|
|
|
+ util.showLoading()
|
|
|
+ http.StaticRequest(config.url_confg.Static.book_store,(err,data)=>{
|
|
|
+ util.hideLoading()
|
|
|
+ console.log('data=',data)
|
|
|
+ if(!err) {
|
|
|
+ if(data.code==config.url_confg.StatesCode.SUCCESS){
|
|
|
+ data_list.value = data.content
|
|
|
+ for (let i = 0; i < data_list.value.length; i++) {
|
|
|
+ let element = data_list.value[i]
|
|
|
+ if(element.template_type==config.template_stype.H_3) {
|
|
|
+ // 横-3分页数据
|
|
|
+ for(var j=0; j<element.list.length; j+=3) {
|
|
|
+ let pagingData = element.list.slice(j, j+3)
|
|
|
+ H3_data_list.value.push(pagingData)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
- book_3_data_list_1.value.push(book_data)
|
|
|
+ log.Error(err)
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function clickBook(data:book_item_data) {
|
|
|
tools.gotoBookdetails(data.book_id)
|
|
|
}
|
|
|
-
|
|
|
- function onClickTest() {
|
|
|
- util.showLoading()
|
|
|
- util.hideLoading(1000)
|
|
|
- // util.showInfoToast('信息')
|
|
|
- // util.showSuccessToast('成功')
|
|
|
- // util.showErrorToast('失败')
|
|
|
-
|
|
|
- // util.showModal('标题',null,()=>{
|
|
|
- // console.log('11111111')
|
|
|
- // },null,'是吧')
|
|
|
-
|
|
|
- // util.showModalNoCancel('标题',null)
|
|
|
-
|
|
|
- // util.showActionSheet('你好', ['1','2','3'], (index:number)=>{
|
|
|
- // console.log('确定index=',index)
|
|
|
- // })
|
|
|
- }
|
|
|
-
|
|
|
- function onClickNav() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/search/search'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
</script>
|
|
|
|
|
@@ -83,7 +66,7 @@
|
|
|
flex-direction: column;
|
|
|
width: 100%;
|
|
|
|
|
|
- .container{
|
|
|
+ &__container{
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
}
|