xy 1 рік тому
батько
коміт
cda24d5ac4

+ 1 - 2
xs-app/App.vue

@@ -3,8 +3,7 @@
 	export default {
 		onLaunch: function() {
 			console.log('App Launch')
-			tools.requestLogin(()=>{
-			})
+			tools.requestLogin(()=>{})
 		},
 		onShow: function() {
 			console.log('App Show')

+ 4 - 4
xs-app/components/read/chapterCatalog.vue

@@ -1,8 +1,8 @@
 <template>
-	<uni-popup  :animation="false" mask-background-color="rgba(0,0,0,0)" ref="catalog"  background-color="#fff"  @change="onChange">
-		<view style="'position': fixed;display: flex;
-		'justify-content': space-around;
-		'align-items': center;margin-left: auto;padding-left: 10%;padding-right: 10%;padding-top: 5%;" :style="{'backgroundColor':db_color}">
+	<uni-popup  @maskClick="emits('Close')" :animation="false" mask-background-color="rgba(0,0,0,0)" ref="catalog"  background-color="#fff"  @change="onChange">
+		<view style="position: fixed;display: flex;
+		justify-content: space-around;
+		align-items: center;margin-left: auto;padding-left: 10%;padding-right: 10%;padding-top: 5%;" :style="{'backgroundColor':db_color}">
 			<image :src="book_data.book_cover" style="width: 100rpx;height: 150rpx;"></image>
 			<view style="margin-left: 100rpx;">
 				<view style="font-size: 1.5ex;" :style="{'color':font_color}" >{{book_data.book_name}}</view>

+ 13 - 1
xs-app/config/config.ts

@@ -1,7 +1,7 @@
 export class config {	
 	//为小程序ID,后台生成
 	public static app_name = '卿卿小屋'
-	public static applet_id = '10000'  //douyin_卿卿小屋:10000 wx_卿卿小屋:10001
+	public static applet_id = '10001'  //douyin_卿卿小屋:10000 wx_卿卿小屋:10001
 	public static theme_color = '#2979ff'
 	/**
 	 * 平台
@@ -105,6 +105,7 @@ export class config {
 		 * 静态
 		 */
 		Static:{
+			book_store: config.url_addr.Static + `/bookstatic/store/${config.applet_id}.json`, //书城
 			book_details(book_id:number) {
 				return config.url_addr.Static + `/bookstatic/book/${book_id}.json`
 			},
@@ -174,4 +175,15 @@ export class config {
 		WAN_JIE:1,   //完结
 		QUAN_BU:100, //全部
 	}
+	
+	/**
+	 * 模版类型 1:banner 2:横版三封面 3:竖版三封面 4:竖版列表 5:搜索
+	 */
+	public static template_stype = {
+		BANNER:1,
+		H_3:2,
+		V_3:3,
+		LIST:4,
+		SEARCH:5,
+	}
 }

+ 14 - 0
xs-app/data/data.ts

@@ -11,6 +11,20 @@ export class user_data{
 	vip_effective_time_time:number;  //vip时间戳
 }
 
+export class bookstore_template_data {
+	name:string;            //名字
+	template_type:number;   //模版类型 1:banner 2:横版三封面 3:竖版三封面 4:竖版列表 5:搜索
+	list:[];
+}
+
+export class banner_data {
+	id:number;       
+	name:string;     
+	cover:string;     
+	jump_id:number;
+	jump_type:number;
+}
+
 export class chapter_item_data{
 	coin:number;
 	id:number;

+ 0 - 1
xs-app/framework/tools.ts

@@ -74,7 +74,6 @@ export class tools {
 	public static requestLogin(cb:Function) {
 		tools.requestGetUserOpenId((open_id:string)=>{
 			let opt = {'open_id':open_id, 'platform':tools.getPlatformID()}
-			// console.log('参数=',opt)
 			http.DynamicRequest(config.url_confg.Dynamic.user_login,opt, (err,data)=>{
 				if(!err) {
 					if(data.code==config.url_confg.StatesCode.SUCCESS){

+ 1 - 1
xs-app/manifest.json

@@ -50,7 +50,7 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "",
+        "appid" : "wx2fb9d32b2e25ec50",
         "setting" : {
             "urlCheck" : false
         },

+ 40 - 57
xs-app/pages/bookstore/bookstore.vue

@@ -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;
 		}

+ 0 - 82
xs-app/pages/bookstore/template/template-book-3.vue

@@ -1,82 +0,0 @@
-<template>
-	<view class="book-3-content">
-		<view class="book-3-content__container" v-for="(item,index) in dataList" :key="index">
-			<view class="book_box" @click="clickBook(item)">
-				<view class="book_box__image">
-					<image class="image" :src="item.book_cover" mode="aspectFill"></image>
-				</view>
-				<view class="book_box__name">{{item.book_name}}</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script setup lang="ts">
-    import { book_item_data } from '../../../data/data';
-	defineProps({
-		dataList: Array,
-	})
-	const emits = defineEmits(['clickBook'])
-	
-	function clickBook(data:book_item_data) {
-		emits('clickBook',data)
-	}
-	
-	// 传值并观察-例子
-	// import { watch } from 'vue';
-	// const props = defineProps({
-	// 	dataList: Array,
-	// })
-	// watch(()=>props.dataList, (new_v,old_v)=>{
-	//     console.log('dataList-观察    新值:',new_v,'旧值:',old_v)
-	// },{immediate:true})
-	
-</script>
-
-
-<style lang="scss">
-	.book-3-content{
-		display: flex;
-		flex-direction: row;
-		background-color: green;
-		margin-top: 20rpx;
-				
-		&__container{
-			width: 100%;
-						
-			.book_box{
-				display: flex;
-				flex-direction: column;
-				width: 100%;
-				background-color: deepskyblue;
-				
-				&__image {
-					display: flex;
-					height: 200rpx;
-					justify-content: center;
-					align-items: center;
-					.image{
-						width: 75%;
-						height: 100%;
-						border-radius: 6px;
-						background-color: greenyellow;
-					}
-				}
-				&__name {
-					display: -webkit-box;
-					align-items: center;
-					-webkit-line-clamp: 1;
-					-webkit-box-orient: vertical;
-					overflow: hidden;
-					text-overflow: ellipsis;
-					width: 90%;
-					margin-left: 5%;
-					margin-top: 10rpx;
-					text-align: center;
-					background-color: red;
-				}
-			}
-		}
-	}
-	
-</style>

+ 47 - 0
xs-app/pages/bookstore/template/template-book-Banner.vue

@@ -0,0 +1,47 @@
+<template>
+	<view class="book-Banner-content">
+		<swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500" :circular="true">
+			<swiper-item v-for="(item, index) in templateData.list" :key="index" @click="clickItem(item)">
+				<image class="image" :src="item.cover" mode=""></image>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
+
+<script setup lang="ts">
+    import { banner_data, book_item_data } from '../../../data/data';
+	defineProps({
+		templateData:Object,
+	})
+	const emits = defineEmits(['clickBook'])
+	
+	function clickItem(data:banner_data) {
+		// 跳转类型 0 不跳转 1 小说 2 公告
+		if(data.jump_type==1) {
+			let book_data = new book_item_data()
+			book_data.book_id = data.jump_id
+			emits('clickBook',book_data)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.book-Banner-content{
+		display: flex;
+		justify-content: center; //水平居中
+		align-items: center; //垂直居中
+		overflow: hidden;//内容超出隐藏
+		padding: 0px 20rpx;
+		margin-bottom: 36rpx;
+				
+		.swiper{
+			width: 100%;
+			height: 280rpx;
+			.image{
+				width: 100%;
+				height: 100%;
+				// background-color: orange;
+			}
+		}
+	}
+</style>

+ 136 - 0
xs-app/pages/bookstore/template/template-book-H-3.vue

@@ -0,0 +1,136 @@
+<template>
+	<view>
+		<view class="book-H-3-content">
+			<view class="title-content">{{templateData.name}}</view>
+			<view class="book-content">
+				<view class="book-content__box" v-for="(item,index) in dataList[page_index]" :key="index" @click="clickBook(item)">
+					<view class="book-content__box__book-cover">
+						<image class="image" :src="item.book_cover" mode="aspectFill"></image>
+					</view>
+					<view class="book-content__box__book-name">{{ item.book_name }}</view>
+				</view>
+			</view>
+			<view class="bottom" @click="clickChange">
+				<uni-icons class="bottom__icons" type="loop" size="25"></uni-icons>
+				<view class="bottom__text">换一换</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup lang="ts">
+    import { ref } from 'vue';
+    import { book_item_data } from '../../../data/data';
+	const props = defineProps({
+		templateData: Object,
+		dataList: Array,
+	})
+	const emits = defineEmits(['clickBook'])
+	
+	let page_index = ref(0)
+	
+	function clickChange() {
+		page_index.value += 1
+		if(page_index.value >= props.dataList.length) {
+			page_index.value = 0
+		}
+	}
+	
+	function clickBook(data:book_item_data) {
+		emits('clickBook',data)
+	}
+	
+	// 传值并观察-例子
+	// import { watch } from 'vue';
+	// const props = defineProps({
+	// 	dataList: Array,
+	// })
+	// watch(()=>props.dataList, (new_v,old_v)=>{
+	//     console.log('dataList-观察    新值:',new_v,'旧值:',old_v)
+	// },{immediate:true})
+	
+</script>
+
+
+<style lang="scss">
+	.book-H-3-content {
+		display: flex;
+		box-sizing: border-box;
+		flex-direction: column;
+		margin: 0px 20rpx;
+		margin-bottom: 30rpx;
+		border-radius: 10rpx;
+		// box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
+		background-color: #ffffff;
+		
+		.title-content {
+			display: flex;
+			box-sizing: border-box;
+			margin: 30rpx;
+			font-size: 18px;
+			font-weight: 500;
+		}
+		.book-content{
+			display: flex;
+			flex: 1;
+			box-sizing: border-box;
+			flex-direction: row;
+			flex-wrap: wrap;
+			text-align: center;
+			margin: 0px 10rpx;
+			// background-color: red;
+			
+			&__box{
+				width: 33.3%;
+				justify-content: center;
+				margin-bottom: 20rpx;
+				overflow: hidden;
+				// background-color: greenyellow;
+								
+				&__book-cover{
+					flex-shrink: 0;
+					display: flex;
+					box-sizing: border-box;
+					margin: 20rpx;
+					height: 240rpx;
+					.image{
+						width: 100%;
+						height: 100%;
+						border-radius: 20rpx;
+						// background-color: orange;
+					}
+				}
+				&__book-name {
+					font-size: 16px;
+					margin: 0px 20rpx;
+					display: -webkit-box;
+					-webkit-line-clamp: 1;
+					-webkit-box-orient: vertical;
+					overflow: hidden;
+					text-overflow: ellipsis;
+				}
+			}
+		}
+		
+		.bottom{
+			display: flex;
+			flex-direction: row;
+			justify-content: center;
+			align-items: center;
+			// background-color: red;
+			margin: 40rpx 0;
+			
+			&__icons {
+			}
+			
+			&__text{
+				margin-left: 20rpx;
+				font-size: 18px;
+				font-weight: 500;
+				color: #3D3D3D;
+				// background-color: purple;
+			}	
+		}
+	}
+	
+</style>

+ 37 - 0
xs-app/pages/bookstore/template/template-book-Search.vue

@@ -0,0 +1,37 @@
+<template>
+	<view class="book-Search-content" @click="clickGoSearch">
+		<uni-icons class="icons" type="search" size="30"></uni-icons>
+		<view class="text">搜索</view>
+	</view>
+</template>
+
+<script setup lang="ts">
+	function clickGoSearch() {
+		uni.navigateTo({
+			url: '/pages/search/search'
+		})
+	}
+	
+</script>
+
+<style lang="scss">
+	.book-Search-content{		
+		display: flex;
+		box-sizing: border-box;
+		align-items: center;
+		height: 80rpx;
+		margin: 15px;
+		border-radius: 35rpx;
+		background-color: #ffffff;
+		
+		.icons{
+			margin: 0 30rpx;
+		}
+		
+		.text{
+			font-size: 18px;
+			color: #B0AFAE;
+		}
+	}
+	
+</style>

+ 98 - 0
xs-app/pages/bookstore/template/template-book-V-3.vue

@@ -0,0 +1,98 @@
+<template>
+	<view class="book-V-3-content">
+		<view class="book-content">
+			<view class="book-content__box" v-for="(item,index) in templateData.list" :key="index"
+			@click="clickBook(item,index)">
+			    <view class="book-content__box__book-cover">
+			    	<image class="image" :src="item.book_cover" mode="aspectFill"></image>
+			    </view>
+				<view class="book-content__box__book-info">
+					<view class="book-content__box__book-info__name">
+						{{item.book_name}}
+					</view>
+					<view class="book-content__box__book-info__author book-content__box__book-info__name">
+						作者:{{item.author_name}}
+					</view>
+					<view class="book-content__box__book-info__readNum book-content__box__book-info__name">
+						阅读数量:{{item.book_read_num}}
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup lang="ts">
+	import { book_item_data } from '../../../data/data';
+	defineProps({
+		templateData: Object,
+	})
+	const emits = defineEmits(['clickBook'])
+	
+	function clickBook(data:book_item_data) {
+		emits('clickBook',data)
+	}
+</script>
+
+<style lang="scss">
+	.book-V-3-content{
+		display: flex;
+		flex-direction: column;
+		margin: 0px 20rpx;
+		margin-bottom: 30rpx;
+		border-radius: 10rpx;
+		background-color: #ffffff;
+		
+		.book-content{
+			display: flex;
+			flex-direction: column;
+			margin-top: 20rpx;
+			// background-color: red;
+			
+			&__box{
+				display: flex;
+				flex-direction: row;
+			    margin-bottom: 20rpx;
+				padding: 0 20rpx;
+				// background-color: green;
+				&__book-cover{
+					width: 200rpx;
+					height: 250rpx;
+					flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
+					.image {
+						width: 100%;
+						height: 100%;
+					}
+				}
+				&__book-info{
+					display: flex;
+					flex-direction: column;
+					margin-left: 20rpx;
+					// background-color: red;
+					&__name{
+						margin-top: 10rpx;
+						display: -webkit-box;
+						align-items: center;
+						-webkit-line-clamp: 2;
+						-webkit-box-orient: vertical;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						font-size: 20px;
+					}
+					&__author{
+						margin-top: 20rpx;
+						font-size: 16px;
+						-webkit-line-clamp: 1;
+					}
+					&__readNum{
+						margin-top: 20rpx;
+						font-size: 15px;
+						-webkit-line-clamp: 1;
+					}
+				}
+				
+			}
+		}
+	}
+	
+</style>

+ 56 - 5
xs-app/pages/bookstore/template/template-book-list.vue

@@ -1,19 +1,70 @@
 <template>
-	<view class="content">
-	    书-list
+	<view class="book-List-content">
+		<view class="book-content">
+			<view class="book-content__box" v-for="(item,index) in templateData.list" :key="index" @click="clickBook(item)">
+				<view class="book-content__box__book-cover">
+					<image class="image" :src="item.book_cover" mode="aspectFill"></image>
+				</view>
+				<view class="book-content__box__book-name">{{ item.book_name }}</view>
+			</view>
+		</view>
 	</view>
 </template>
 
 <script setup lang="ts">
+	import { book_item_data } from '../../../data/data';
+	defineProps({
+		templateData: Object,
+	})
+	const emits = defineEmits(['clickBook'])
 	
+	function clickBook(data:book_item_data) {
+		emits('clickBook',data)
+	}
 </script>
 
 <style lang="scss">
-	.content{
+	.book-List-content{
 		display: flex;
 		flex-direction: column;
-		height: 200rpx;
-		background-color: plum;
+		margin: 0px 20rpx;
+		margin-bottom: 30rpx;
+		border-radius: 10rpx;
+		background-color: #ffffff;
+		
+		.book-content{
+			display: flex;
+			flex: 1;
+			flex-direction: row;
+			flex-wrap: wrap;
+			text-align: center;
+			margin: 0px 10rpx;
+			&__box{
+				width: 50%;
+				justify-content: center;
+				margin-bottom: 20rpx;
+				overflow: hidden;
+				&__book-cover{
+					flex-shrink: 0;
+					display: flex;
+					box-sizing: border-box;
+					margin: 20rpx;
+					height: 480rpx;
+					.image{
+						width: 100%;
+						height: 100%;
+						border-radius: 20rpx;
+						// background-color: orange;
+					}
+				}
+				&__book-name{
+					text-align: left;
+					font-size: 16px;
+					margin: 0px 20rpx;
+				}
+			}
+			
+		}
 	}
 	
 </style>