小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

424 lines
9.9 KiB

<template>
<view class="page">
<navbar/>
<view class="content">
<!-- 顶部横幅广告 -->
<view class="banner">
<image src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="widthFix"></image>
</view>
<!-- 通知区域 -->
<view class="notice">
<view class="notice-icon">
<image src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="widthFix"></image>
</view>
<view class="notice-text">
2025年2月平台福利活动截稿作品公示
</view>
<view class="notice-more">
<uv-icon name="arrow-right" color="#999" size="24rpx"></uv-icon>
</view>
</view>
<!-- 最近更新 -->
<view class="section">
<view class="section-header">
<text class="section-title">最近更新</text>
</view>
<view class="recommend-list">
<view class="recommend-item" v-for="(item, index) in recommendList" :key="index" @click="$utils.navigateTo('/pages_order/product/productDetail?id='+index)">
<image class="recommend-cover" :src="item.cover" mode="aspectFill"></image>
<view class="recommend-title">{{item.title}}</view>
</view>
</view>
</view>
</view>
<!-- 精品推荐 -->
<view class="section1">
<view class="section-header">
<text class="section-title">精品推荐</text>
<text class="section-more" @click="$utils.navigateTo('/pages/index/category')">查看更多 ></text>
</view>
<view class="novel-list">
<view class="novel-item" v-for="(item, index) in 5" :key="index" @click="$utils.navigateTo('/pages_order/product/productDetail?id='+index)">
<image class="novel-cover" :src="novelCovers[index]" mode="aspectFill"></image>
<view class="novel-info">
<view class="novel-title">{{novelTitles[index]}}</view>
<view class="novel-desc">{{novelDescs[index]}}</view>
</view>
</view>
</view>
</view>
<PrivacyAgreementPoup/>
<tabber select="home"/>
</view>
</template>
<script>
import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
import Position from '@/utils/position.js'
import tabber from '@/components/base/tabbar.vue'
import productList from '@/components/user/productList.vue'
import { mapGetters } from 'vuex'
// import selectArea from '../../components/selectArea.vue';
export default {
components : {
tabber,
productList,
PrivacyAgreementPoup,
},
data() {
return {
area: '长沙',
text : '长沙市刘师傅在服务过程中客户投诉"服务过程中有不文明的行为".....',
queryParams: {
pageNo: 1,
pageSize: 10,
title: ''
},
bannerList: [
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
},
],
productList: [],
// 精品推荐
novelCovers: [
'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
],
// 小说标题数据
novelTitles: [
'我是半妖',
'兽王进化',
'魔法少女纯爷们',
'我是一条小青龙',
'女帝归来'
],
// 小说描述数据
novelDescs: [
'都市玄幻小说,主角获得半妖化能力,通过吸收妖气不断变强...',
'一场意外让主角获得兽王血脉,开始了进化之路...',
'一个普通男孩意外获得魔法少女的力量,开始了奇妙冒险...',
'重生为一条小青龙,主角在修仙世界中成长的故事...',
'曾经的女帝重生归来,开始了复仇之路...'
],
// 最近更新
recommendList: [
{
title: '重生后,我给妹妹假装动漫女主角',
cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
},
{
title: '我在亮剑提前帮助',
cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
},
{
title: '斗罗:开局魂师测试99级',
cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
}
]
}
},
computed : {
...mapGetters(['userShop']),
},
methods: {
//显示选择地区
showSelectArea() {
// this.$refs.selectArea.open()
},
//搜索地址
searchAddress() {
Position.getLocation(res => {
Position.selectAddress(res.longitude, res.latitude, success => {
let address = this.extractProvinceAndCity(success)
this.queryParams.title = address.city
})
})
},
//提取用户选择的地址信息(省市县信息)
extractProvinceAndCity(res) { //提取用户选择的地址信息(省市)
if (!res.address && res.name) { //用户直接选择城市的逻辑
return {
province: '',
city: res.name
};
}
if (res.address) { //用户选择了详细地址,要从详细地址中提取出省市县信息
// 使用正则表达式匹配省市县
const regex = /(?<province>[\u4e00-\u9fa5]+?省)(?<city>[\u4e00-\u9fa5]+?(?:市|自治州|盟|地区))/;
const match = res.address.match(regex);
if (match) { // 如果匹配成功,则返回省和市的信息
return {
province: match.groups.province,
city: match.groups.city
};
}
}
return { //用户没选择地址就点了确定按钮
province: '',
city: ''
}
},
}
}
</script>
<style scoped lang="scss">
.page {
background-color: #f5f5f5;
// min-height: 100vh;
.content {
padding-bottom: 75rpx;
}
.banner {
padding: 0;
image {
width: 100%;
height: 250rpx;
border-radius: 0;
}
}
.notice {
display: flex;
align-items: center;
background-color: #fff;
margin: 0;
padding: 20rpx 30rpx;
border-radius: 0;
.notice-icon {
margin-right: 20rpx;
image {
width: 80rpx;
height: 80rpx;
}
}
.notice-text {
flex: 1;
font-size: 28rpx;
color: #333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.notice-more {
margin-left: 20rpx;
}
}
.section {
background-color: #fff;
margin: 30rpx 0 0 0;
padding: 10rpx 30rpx;
border-radius: 0;
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.section-more {
font-size: 24rpx;
color: #999;
}
}
.novel-list {
.novel-item {
display: flex;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
.novel-cover {
width: 160rpx;
height: 200rpx;
border-radius: 8rpx;
margin-right: 20rpx;
}
.novel-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.novel-title {
font-size: 28rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.novel-desc {
font-size: 24rpx;
color: #999;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
}
}
}
.recommend-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.recommend-item {
width: 30%;
margin-bottom: 20rpx;
.recommend-cover {
width: 100%;
height: 200rpx;
border-radius: 8rpx;
margin-bottom: 10rpx;
}
.recommend-title {
font-size: 24rpx;
color: #333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
.section1 {
background-color: #fff;
margin: 0rpx 0 0 0;
padding: 20rpx 30rpx;
border-radius: 0;
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.section-more {
font-size: 24rpx;
color: #999;
}
}
.novel-list {
.novel-item {
display: flex;
padding: 20rpx 0;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
.novel-cover {
width: 160rpx;
height: 200rpx;
border-radius: 8rpx;
margin-right: 20rpx;
}
.novel-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.novel-title {
font-size: 28rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.novel-desc {
font-size: 24rpx;
color: #999;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
}
}
}
.recommend-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.recommend-item {
width: 30%;
margin-bottom: 20rpx;
.recommend-cover {
width: 100%;
height: 200rpx;
border-radius: 8rpx;
margin-bottom: 10rpx;
}
.recommend-title {
font-size: 24rpx;
color: #333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
}
}
</style>