jiazhipeng 4 months ago
parent
commit
cef5331379
  1. 10
      mixins/myMixins.js
  2. 13
      pages.json
  3. 194
      pages/index/index.vue
  4. 47
      pages/stratIndex.vue
  5. 15
      subPackages/letter/index.vue

10
mixins/myMixins.js

@ -15,10 +15,10 @@ export const myMixins ={
// 分享到朋友圈
onShareTimeline() {
return {
title: '智游常熟',
title: 'CGC-ICH',
type: 0,
summary: "edewdewdewf",
imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg"
imageUrl: "https://static.ticket.sz-trip.com/uploads/20250612/e022a1b7c8df621cb15082d0b0f5bba3.jpg"
}
},
onShareAppMessage() {
@ -33,10 +33,10 @@ export const myMixins ={
console.log(111,url,`${view.route}?url=${url}`)
return {
title: '智游常熟', // 分享的名称
title: 'CGC-ICH', // 分享的名称
path: `${view.route}?url=${url}`, // 将 url 作为参数传递
imageUrl: "https://static.ticket.sz-trip.com/dongtai/images/index/share.jpg",
mpId: 'wxb8f15afe2765976d' // 此处配置微信小程序的 AppId
imageUrl: "https://static.ticket.sz-trip.com/uploads/20250612/e022a1b7c8df621cb15082d0b0f5bba3.jpg",
mpId: 'wx9d68934300b1fe90' // 此处配置微信小程序的 AppId
};
}
}

13
pages.json

@ -1,9 +1,16 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/stratIndex",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "大美非遗"
// "navigationStyle": "custom",
"navigationBarTitleText": "CGC-ICH"
}
},
{
@ -16,7 +23,7 @@
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "大美非遗"
"navigationBarTitleText": "CGC-ICH"
}
}
],
@ -26,7 +33,7 @@
{
"path": "index",
"style": {
"navigationBarTitleText": "uni-app"
"navigationBarTitleText": "CGC-ICH"
}
},
{

194
pages/index/index.vue

@ -1,5 +1,10 @@
<template>
<view class="content">
<view class="content" style="overflow-x: auto;">
<!-- <view class="search-header" :style="{'height': height+'px','padding-top':statusBarHeight+'px'}">
<view class="title">CGC-ICH</view>
<view class="subtitle">大运河非遗</view>
</view>
<div :style="{'height':height+'px','flex-shrink':0}"></div> -->
<!-- 头部banner -->
<view class="top-box">
<!-- 搜索 -->
@ -21,36 +26,37 @@
<view class="menu-box flex-between">
<view class="menu-left flex-around">
<view class="" v-for="(item,index) in menuList" :key="index" @click="gotoPath(item.path)">
<image :src="`https://static.ticket.sz-trip.com/cgc/images/index/${index + 1}.png`" class="topImg" mode="heightFix"></image>
<image :src="`https://static.ticket.sz-trip.com/cgc/images/index/${index + 1}s.png`" class="titleImg" mode="heightFix"></image>
<image :src="`https://static.ticket.sz-trip.com/cgc/images/indexs/${index + 1}.png`" class="topImg" mode="heightFix"></image>
<image :src="`https://static.ticket.sz-trip.com/cgc/images/indexs/${index + 1}s.png`" class="titleImg" mode="heightFix"></image>
</view>
</view>
<view class="menu-right flex-around">
<!-- <view class="menu-right flex-around">
<swiper class="menu-right" :circular="true" :interval="6000"
:duration="800" :indicator-dots="false" :autoplay="true" v-if="smallBanner">
<swiper-item v-for="(item, index) in smallBanner" :key="index" @click.stop="gotoUrlNew(item)">
<image class="menu-right" :src="showImg(item.head_img)" mode="aspectFill" lazy-load="true"></image>
</swiper-item>
</swiper>
</view>
</view> -->
</view>
<!-- 非遗手札 -->
<view v-if="handwrittenList && handwrittenList.length > 0">
<view class="title-box flex-between">
<image src="https://static.ticket.sz-trip.com/cgc/images/index/title1.png" mode=""></image>
<image src="https://cgc.js-dyyj.com/uploads/20250618/0cc227827073c9ab16dd2ce9b9e3b579.png" mode="heightFix"></image>
<image src="https://static.ticket.sz-trip.com/cgc/images/index/more.png" mode="" @click="gotoPath('/subPackages/letter/index')"></image>
</view>
<view class="handwritten-box flex-between">
<image :src="showImg(item.image)" mode="aspectFill" v-for="(item,index) in handwrittenList" :key="index"
@click="gotoPath('/subPackages/letter/detail?id='+item.id)"></image>
@click="viewDetail(item)"></image>
</view>
</view>
<!-- 非遗时光 -->
<view v-if="shiguang && shiguang.image">
<view class="title-box flex-between">
<image src="https://static.ticket.sz-trip.com/cgc/images/index/title2.png" mode=""></image>
<image src="https://cgc.js-dyyj.com/uploads/20250618/496fdd2ccccc9f8a00ec698549532185.png" mode="heightFix"></image>
<image src="https://static.ticket.sz-trip.com/cgc/images/index/more.png" mode="" @click="gotoPath('/subPackages/shiguang/index')"></image>
</view>
<view class="time-box" :style="{backgroundImage: 'url('+showImg(shiguang.image)+')'}" @click="gotoVideo(shiguang)">
@ -69,18 +75,20 @@
<view v-for="(item,indexs) in getColumnItems(index)" :key="indexs" class="hot-item" @click="gotoHotDetail(item)">
<view class="image-container">
<image :src="item.src" mode="widthFix" class="hot-img" lazy-load="true"></image>
<image src="https://static.ticket.sz-trip.com/cgc/images/index/plays.png" mode="widthFix" class="play-img" v-if="hotIndex && item.genre == 'video'" lazy-load="true"></image>
<!-- <image src="https://static.ticket.sz-trip.com/cgc/images/index/plays.png" mode="widthFix" class="play-img" v-if="hotIndex && item.genre == 'video'" lazy-load="true"></image> -->
</view>
<view class="hot-content">
<view class="title text-overflowRows">{{item.title || item.goods.title}}</view>
<view class="subtitle" v-if="hotIndex && item.genre == 'video'">
<!-- <view class="subtitle" v-if="hotIndex && item.genre == 'video'">
<image src="https://static.ticket.sz-trip.com/tongli/images/index/user.png" mode="aspectFill"></image>
{{item.author}}
</view>
</view> -->
</view>
</view>
</view>
</view>
</view>
</template>
@ -88,26 +96,36 @@
export default {
data() {
return {
//
height: 0,
statusBarHeight: 0,
topBanner: [],
smallBanner: [],
menuList: [
{
path: '/subPackages/techan/index?idIndex=0'
path: '/subPackages/techan/index?idIndex=0',
image: '',
},
{
path: '/subPackages/techan/index?idIndex=1'
path: '/subPackages/techan/index?idIndex=1',
image: '',
},
{
path: '/subPackages/techan/index?idIndex=2'
path: '/subPackages/techan/index?idIndex=2',
image: '',
},
{
path: '/subPackages/techan/index?idIndex=3'
path: '/subPackages/techan/index?idIndex=3',
image: '',
},
{
path: '/subPackages/techan/index?idIndex=4'
path: '/subPackages/techan/index?idIndex=4',
image: '',
},
{
path: '/subPackages/techan/index?idIndex=5'
path: '/subPackages/techan/index?idIndex=5',
image: '',
}
],
handwrittenList: [],
@ -118,14 +136,14 @@
id: '41'
},
{
title: '猜你喜欢',
title: '苏州非遗',
id: '41'
}
],
hotIndex: 0,
hotList: [],
isLoading: false,
limit: 4
limit: 4,
}
},
onLoad() {
@ -136,6 +154,7 @@
if(!uni.getStorageSync('location')) {
this.getLocation()
}
this.initRectInfo()
this.getList()
this.changeType(0)
@ -146,6 +165,23 @@
}, 1000);
},
methods: {
viewDetail(item) {
if (item.url) {
uni.navigateTo({
url:"/subPackages/webPage/webPage?url="+encodeURIComponent(item.url)
})
return
}
uni.navigateTo({
url:'/subPackages/letter/detail?id='+item.id
})
},
initRectInfo () {
const sysInfo = uni.getSystemInfoSync()
this.statusBarHeight = sysInfo.statusBarHeight
//
this.height = sysInfo.statusBarHeight + 40
},
getList() {
//
this.Post({
@ -164,6 +200,7 @@
}, '/api/adv/getAdv').then(res => {
if(res.data) {
this.smallBanner = res.data;
this.screenPng = res.data[0]
}
});
@ -171,7 +208,7 @@
this.Post({
type_id: 1,
offset: 0,
limit: 4
limit: 1
}, '/api/article/getArticleByType').then(res => {
if(res.data) {
this.handwrittenList = res.data
@ -229,13 +266,14 @@
getColumnItems(columnIndex) {
const columnItems = [];
this.hotList.forEach((item, index) => {
switch (this.hotIndex) {
case 1:
item.src = this.showImg(item.image);
break;
default:
item.src = this.showImg(item.goods.image);
}
// switch (this.hotIndex) {
// case 1:
// item.src = this.showImg(item.image);
// break;
// default:
// item.src = this.showImg(item.goods.image);
// }
item.src = this.showImg(item.goods.image);
if (index % 2 === columnIndex) {
columnItems.push(item);
@ -252,15 +290,23 @@
},
getHotList() {
if(this.hotIndex == 1) {
// this.Post({
// type_id: 3,
// offset: this.hotList.length,
// limit: this.limit
// },'/api/Article/getArticleByType').then(res => {
// if(res) {
// if(res.data.length < this.limit) this.isLoading = true
// this.hotList = this.hotList.concat(res.data)
// }
// })
this.Post({
type_id: 3,
tag_id: 52,
offset: this.hotList.length,
limit: this.limit
},'/api/Article/getArticleByType').then(res => {
if(res) {
if(res.data.length < this.limit) this.isLoading = true
this.hotList = this.hotList.concat(res.data)
}
limit: this.limit,
},'/api/tag/getGoodsByTagId').then(res => {
if(res.data.length < this.limit) this.isLoading = true
this.hotList = this.hotList.concat(res.data)
})
}else {
this.Post({
@ -279,29 +325,50 @@
})
},
gotoHotDetail(item) {
if(this.hotIndex == 1) {
if(item.genre == 'video') {
//
this.gotoVideo(item)
}else {
//
uni.navigateTo({
url: '/subPackages/letter/detail?id=' + item.id
})
}
}else {
uni.navigateTo({
url: '/subPackages/techan/detail?id=' + item.goods_id
})
}
// if(this.hotIndex == 1) {
// if(item.genre == 'video') {
// //
// this.gotoVideo(item)
// }else {
// //
// uni.navigateTo({
// url: '/subPackages/letter/detail?id=' + item.id
// })
// }
// }else {
// uni.navigateTo({
// url: '/subPackages/techan/detail?id=' + item.goods_id
// })
// }
}
}
}
</script>
<style lang="scss" scoped>
.search-header{
width: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
background: white;
text-align: center;
z-index:99;
.title{
font-size: 30rpx
}
.subtitle{
font-size: 22rpx;
}
}
.content {
min-height: 100vh;
background: #F9F0EA;
@ -349,28 +416,33 @@
}
.menu-box {
margin: 54rpx 33rpx 0;
width: 100%;
padding: 54rpx 33rpx 0;
overflow: hidden;
box-sizing: border-box;
.menu-left {
flex-wrap: wrap;
// flex-wrap: wrap;
width: 100%;
display: flex;
justify-content: space-between;
&>view {
width: 33%;
flex: 1;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
}
&>view:nth-child(n+4) {
margin-top: 36rpx;
}
.topImg {
height: 108rpx;
height: 84rpx;
}
.titleImg {
height: 22rpx;
margin-top: 8rpx;
height: 21rpx;
margin-top: 19rpx;
}
}
@ -400,13 +472,13 @@
flex-wrap: wrap;
image {
width: 322rpx;
width: 100%;
height: 181rpx;
border-radius: 10rpx;
}
&>image:nth-child(n+3) {
margin-top: 13rpx;
}
// &>image:nth-child(n+3) {
// margin-top: 13rpx;
// }
}
.time-box {

47
pages/stratIndex.vue

@ -0,0 +1,47 @@
<template>
<view class="bg" @click="goIndex()">
<image :src="showImg(screenPng)"></image>
</view>
</template>
<script>
export default {
data() {
return {
screenPng: ""
}
},
onLoad() {
},
onReady () {
//
this.Post({
type_id: 3,
position: 5,
}, '/api/adv/getAdv').then(res => {
if(res.data && res.data.length>0) {
this.screenPng = res.data[0].head_img
}
});
},
methods: {
goIndex () {
uni.switchTab({
url:"/pages/index/index"
})
},
}
}
</script>
<style lang="scss" scoped>
.bg{
height: 100vh;
image{
width: 100%;
height: 100%;
}
}
</style>

15
subPackages/letter/index.vue

@ -3,7 +3,7 @@
<img :src="showImg(headImg)" class="topImg" />
<div class="article-container">
<navigator :url="'/subPackages/letter/detail?id='+item.id" v-for="(item,index) in list" :key="index" class="item">
<view @click="viewDetail(item)" v-for="(item,index) in list" :key="index" class="item">
<image class="img" :src="showImg(item.image)" mode="aspectFill"></image>
<view class="content flex-column">
<view class="title text-overflowRows">{{item.title}}</view>
@ -22,7 +22,7 @@
</view>
</view>
</view>
</navigator>
</view>
</div>
</view>
@ -57,6 +57,17 @@
},
likeAricle (item) {
},
viewDetail(item) {
if (item.url) {
uni.navigateTo({
url:"/subPackages/webPage/webPage?url="+encodeURIComponent(item.url)
})
return
}
uni.navigateTo({
url:'/subPackages/letter/detail?id='+item.id
})
},
handleNum (num) {
if (num<=0) { return 0 }

Loading…
Cancel
Save