东盛街道小程序定制

This commit is contained in:
aixianling
2023-04-18 09:03:21 +08:00
parent 7ec0f7c45f
commit 4bdb61249b
8 changed files with 1642 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
<template>
<div class="AppCommunityInfo" v-if="pageShow">
<h2>{{ info.title }}</h2>
<div class="info-info">
<span>{{ info.areaName }}</span>
<span>{{ info.createDate }}</span>
</div>
<image class="banner" @click="preview(banner)" v-if="banner" mode="widthFix" :src="banner"/>
<div class="rich-content">
<u-parse :html="info.content"></u-parse>
</div>
<AiEmpty v-if="!info.title"></AiEmpty>
</div>
</template>
<script>
export default {
name: "AppCommunityInfo",
appName: "社区简介",
data() {
return {
pageShow: false,
info: {},
banner: ''
}
},
onLoad(query) {
if (query.type !== '0') {
uni.setNavigationBarTitle({
title: '社区公约'
})
}
this.$loading()
this.getInfo(query.type)
},
methods: {
getInfo(type) {
this.$instance.post(`/app/appcountrysidetourism/queryDetailByAreaIdForWX?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0 && res.data) {
this.info = res.data
this.banner = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl)[0].url : ''
}
this.$nextTick(() => {
this.pageShow = true
})
})
},
preview(url) {
uni.previewImage({
urls: [url],
current: url
})
}
}
}
</script>
<style lang="scss" scoped>
.AppCommunityInfo {
min-height: 100vh;
padding: 0 32px 40px;
box-sizing: border-box;
background-color: #fff;
.banner {
width: 100%;
margin-bottom: 20px;
}
h2 {
line-height: 1.3;
padding: 32px 0 16px;
font-size: 48px;
font-weight: 600;
color: #333;
}
.info-info {
display: flex;
align-items: center;
margin-bottom: 30px;
span {
color: #999999;
font-size: 30px;
&:last-child {
margin-left: 32px;
}
}
}
::v-deep.emptyWrap {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,664 @@
<template>
<div class="AppEnteringCommunity">
<div class="header" :class="[isFixed ? 'header-active' : '']">
<div class="status-bar" :style="{height: statusBarHeight + 'px'}"></div>
<div class="nav-bar">
<h2>社区</h2>
</div>
</div>
<header>
<image src="/static/img/top-bg.png"/>
<div>
<AiAreaPicker :selectRoot="false" ref="area" :value="areaId" :name.sync="areaName" :areaId="$areaId"
@input="areaSelect">
<div class="ai-area__wrapper">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<image src="/static/img/area-bottom.png"/>
</div>
</AiAreaPicker>
<div class="welcome">欢迎进入{{ areaName }}</div>
<div class="tag" v-if="user.homeArea === areaId">我的家乡</div>
<div class="tag1" @click="updateUserInfo" v-if="!user.homeArea && token">设为家乡</div>
</div>
</header>
<div class="card">
<div class="card-item" hover-class="text-hover" @click="$linkTo('./AppCommunityInfo?type=0')">
<image src="https://cdn.cunwuyun.cn/pingchang/sqjj.png"/>
</div>
<div class="card-item" hover-class="text-hover" @click="$linkTo('./AppCommunityInfo?type=4')">
<image src="https://cdn.cunwuyun.cn/pingchang/sqgy.png"/>
</div>
<div class="card-item" hover-class="text-hover"
@click="linkTo('/mods/AppCreditPoints/AppIntegralRanking', 'idNumber')">
<image src="/static/img/jfph.png"/>
</div>
<div class="card-item" hover-class="text-hover"
@click="linkTo('/mods/AppVillagerDiscussion/AppVillagerDiscussion', 'idNumber')">
<image src="https://cdn.cunwuyun.cn/pingchang/jmys.png"/>
</div>
</div>
<div class="banner" @click="linkTo('/mods/AppCreditPoints/AppCpSupermarket', 'idNumber')">
<image src="/static/img/jf-banner.png" class="banner"/>
</div>
<tempalte v-if="publicList.length">
<div class="title-wrap">
<span class="title">三务公开</span>
<div class="right" hover-class="text-hover"
@click="$linkTo(`/mods/AppContent/AppContent?names=三务公开&areaId=${areaId}`)">
<span class="title-more">更多专题</span>
<u-icon name="arrow-right" size="28" color="#999999"></u-icon>
</div>
</div>
<div class="list-news">
<div class="news-wrap" v-for="(item,index) in publicList" :key="index"
@click="$linkTo('/mods/AppContent/contentDetail?id='+ item.id)">
<div class="news-title">{{ item.title }}</div>
<div class="news-bottom">
<div class="tag">{{ item.categoryName }}</div>
<div class="date">{{ item.createTime ? item.createTime.split(' ')[0] : '' }}</div>
<div class="view">
<em>{{ item.viewCount }}</em>
人看过
</div>
</div>
</div>
</div>
</tempalte>
<div class="title-wrap" v-if="activityList.length">
<span class="title">居民活动</span>
<div class="right">
<span class="title-more" @click="$linkTo('/mods/AppVillageActivity/AppVillageActivity')">更多活动</span>
<u-icon name="arrow-right" size="28" color="#999999"></u-icon>
</div>
</div>
<scroll-view :scroll-x="true" style="width: 100%" class="scroll-wrap" v-if="activityList.length">
<div
class="scroll-card"
@click="$linkTo('/mods/AppVillageActivity/ActivityDetail?id=' + item.id)"
hover-class="text-hover"
v-for="(item, index) in activityList"
:key="index">
<image :src="item.url" mode="aspectFill"/>
<div class="text">
<span>{{ item.title }}</span>
</div>
</div>
<AiEmpty v-if="!activityList.length"></AiEmpty>
</scroll-view>
<div class="title-wrap">
<span class="title">社区相册</span>
</div>
<div class="album-list">
<div
class="album"
v-for="(item, index) in albumList"
hover-class="text-hover"
:key="index"
@click="$linkTo('./AppPhotoAlbum?type=' + item.type + '&name=' + item.name + '&url=' + item.coverImg)">
<image :src="item.coverImg"/>
<div class="total">{{ item.total }}</div>
<div class="desc">{{ item.name }}</div>
</div>
<AiEmpty style="width: 100%" v-if="!albumList.length"></AiEmpty>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: "AppEnteringCommunity",
appName: "社区",
customNavigation: true,
data() {
return {
isFixed: false,
statusBarHeight: 20,
top: 0,
areaName: '',
areaId: '',
$areaId: '',
albumList: [],
activityList: [],
publicList: [],
moduleId: "",
isInit: false
}
},
onLoad() {
this.areaId = this.$mp.query.areaId || this.$areaId
this.areaName = this.$mp.query.areaName || this.$areaName
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
this.autoLogin()
this.$nextTick(() => {
this.getAlbumList()
this.getActiveList()
this.getName()
})
uni.$on('update', () => {
this.getAlbumList()
})
},
computed: {
...mapState(['user', 'token'])
},
onShow() {
this.$nextTick(() => {
this.token && this.getUserInfo()
})
if (this.user.homeArea) {
if (!this.isInit) {
this.areaId = this.user.homeArea
this.areaName = this.user.homeName
uni.setStorageSync('areaId', this.user.homeArea)
uni.setStorageSync('areaName', this.user.homeName)
this.isInit = true
}
} else if (!this.isInit && !this.user.homeArea) {
setTimeout(() => {
this.$dialog.alert({
content: '请选择您的家乡'
}).then(() => {
this.$refs.area?.handleJump()
this.isInit = true
})
}, 600)
}
},
methods: {
...mapActions(['autoLogin', 'getUserInfo']),
getName() {
this.$instance.post("/app/appcontentmoduleinfo/listByNames", null, {
params: {names: "三务公开"}
}).then(res => {
if (res.data && res.data.length) {
this.moduleId = res.data[0]["id"];
this.getPublicList();
}
})
},
updateUserInfo() {
if (this.areaId.endsWith('000')) {
this.$dialog.alert({
content: '请选择村'
}).then(() => {
})
return false
}
this.$instance.post("/app/appwechatuser/updateById", {
id: this.user.id,
homeArea: this.areaId,
homeName: this.areaName
}).then(res => {
if (res.code === 0) {
this.getUserInfo()
}
})
},
getPublicList() {
this.$instance.post("/app/appcontentinfo/list", null, {
params: {moduleId: this.moduleId, size: 3, areaId: this.areaId}
}).then(res => {
if (res?.data) {
this.publicList = res.data.records;
}
})
},
linkTo(url, type) {
if (type) {
if (this.token) {
if (type === 'idNumber') {
if (!this.user.residentId) {
this.$linkTo('/mods/AppAuth/AppAuth')
} else {
this.$linkTo(url)
}
}
} else {
this.$refs.login.show()
}
} else {
this.$linkTo(url)
}
},
areaSelect(v) {
this.areaId = v
this.isMore = false
this.current = 0
this.newsList = []
this.$nextTick(() => {
this.getActiveList()
this.getAlbumList()
this.getPublicList()
uni.setStorageSync('areaId', this.areaId)
uni.setStorageSync('areaName', this.areaName)
})
},
getAlbumList() {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbumMenu?areaId=${this.areaId}`).then(res => {
if (res.code == 0) {
this.albumList = res.data.map(v => {
return {
...v,
coverImg: `${this.$cdn}/dvcp/album/album${v.type}.png`
}
})
}
})
},
getActiveList() {
this.$instance.post(`/app/appvillageactivityinfo/listUp`, null, {
params: {
current: 1,
size: 6,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {
this.activityList = res.data.records.map(v => {
return {
...v,
url: v.url ? JSON.parse(v.url)[0].url : ''
}
})
}
})
}
},
onShareAppMessage() {
return {
title: '欢迎使用数字乡村治理服务一体化平台~',
path: `/pages/AppEnteringCommunity/AppEnteringCommunity`
}
},
onPageScroll(params) {
this.isFixed = params.scrollTop > 60;
}
}
</script>
<style scoped lang="scss">
.AppEnteringCommunity {
min-height: 100%;
background: #F3F6F9;
::v-deep .emptyImg {
margin-top: 0 !important;
}
.header {
position: fixed;
left: 0;
top: 0;
z-index: 0;
width: 100%;
opacity: 0;
transition: all 0.2s ease;
&.header-active {
z-index: 1111;
opacity: 1;
background: #4181FF;
}
.nav-bar {
position: relative;
height: 88px;
line-height: 88px;
color: #fff;
font-size: 32px;
text-align: center;
}
}
& > header {
position: relative;
height: 656px;
box-sizing: border-box;
padding-left: 32px;
& > div {
position: relative;
z-index: 11;
}
.ai-area__wrapper {
display: flex;
align-items: center;
padding-top: 100px;
span {
margin-right: 16px;
color: #FFFFFF;
font-size: 44px;
}
image {
width: 16px;
height: 8px;
}
}
& > image {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 656px;
}
.welcome {
font-size: 28px;
font-weight: 400;
color: #FFFFFF;
line-height: 40px;
margin-top: 20px;
}
.tag {
width: 120px;
height: 44px;
background: rgba(0, 0, 0, 0.3);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 400;
color: #c0cae0;
margin-top: 16px;
}
.tag1 {
width: 120px;
height: 44px;
border: 1px solid #c0cae0;
background: rgba(0, 0, 0, 0.1);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 400;
color: #c0cae0;
margin-top: 16px;
}
}
.card {
position: relative;
z-index: 1;
background: #FFFFFF;
border-radius: 32px 32px 0 0;
margin-top: -336px;
box-sizing: border-box;
padding: 32px 32px 0 32px;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
.card-item {
width: 332px;
height: 160px;
margin-bottom: 32px;
border-radius: 16px;
image {
width: 332px;
height: 160px;
}
}
}
.banner {
position: relative;
z-index: 2;
height: 200px;
background: linear-gradient(180deg, #FFFFFF 0%, #F3F6F9 100%);
image {
display: block;
width: 692px;
height: 200px;
margin: 0 auto;
}
}
.title-wrap {
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 48px 32px 32px;
.title {
font-size: 44px;
font-weight: 600;
color: #333333;
}
.right {
.title-more {
font-size: 28px;
font-weight: 400;
line-height: 40px;
color: #999999;
}
}
}
.list-news {
box-sizing: border-box;
padding: 0 32px;
.news-wrap {
height: 186px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
box-sizing: border-box;
padding: 32px;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 24px;
&:last-child {
margin-bottom: 0;
}
.news-title {
font-size: 36px;
font-weight: 600;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.news-bottom {
display: flex;
align-items: center;
.tag {
width: 144px;
height: 48px;
background: #EEEEEE;
border-radius: 24px;
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
font-weight: 400;
color: #999999;
}
.date {
font-size: 28px;
font-weight: 400;
color: #999999;
margin-left: 16px;
}
.view {
font-size: 28px;
font-weight: 400;
color: #999999;
margin-left: auto;
display: flex;
align-items: center;
& > em {
color: #4181FF;
font-style: normal;
}
}
}
}
}
.scroll-wrap {
box-sizing: border-box;
padding: 0 32px;
width: 100%;
white-space: nowrap;
.scroll-card {
display: inline-block;
width: 400px;
height: 332px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
margin-right: 32px;
font-size: 0;
& > image {
width: 400px;
height: 240px;
border-radius: 16px 16px 0 0;
}
.text {
height: calc(100% - 240px);
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0 32px;
& > span {
font-size: 32px;
font-weight: 600;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
&:last-child {
margin-right: 0;
}
}
}
.album-list {
box-sizing: border-box;
padding: 0 32px 32px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 16px;
.album {
position: relative;
width: 218px;
height: 240px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
overflow: hidden;
image {
position: absolute;
left: 0;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
}
.total {
display: flex;
position: absolute;
align-items: center;
justify-content: center;
right: 8px;
top: 8px;
z-index: 2;
width: 74px;
height: 40px;
background: rgba(0, 0, 0, .6);
border-radius: 8px;
font-size: 22px;
font-weight: 400;
color: #FFFFFF;
}
.desc {
position: absolute;
bottom: 16px;
left: 0;
z-index: 2;
width: 100%;
height: 40px;
line-height: 40px;
padding: 0 12px;
font-size: 32px;
text-align: center;
color: #FFFFFF;
font-weight: 600;
box-sizing: border-box;
}
}
}
::v-deep .AiArea {
padding-top: 64px;
height: 88px;
._img {
display: none;
}
.area-name {
font-size: 44px;
font-weight: 600;
}
}
}
</style>

View File

@@ -0,0 +1,385 @@
<template>
<div class="photo" v-if="pageShow">
<div class="header" :class="[isFixed ? 'header-active' : '']">
<div class="status-bar" :style="{height: statusBarHeight + 'px'}"></div>
<div class="nav-bar">
<image src="/static/img/left.png" @click="back"/>
<h2>邻里相册</h2>
</div>
</div>
<div class="back-wrapper" @click="back" v-show="!isFixed" :style="{marginTop : statusBarHeight + 'px'}">
<image src="/static/img/left.png"/>
</div>
<div class="photo-header">
<image :src="coverImg" mode="aspectFill"/>
<h2>{{ name }}</h2>
</div>
<div class="photo-info">
<div class="photo-info__item">
<h2>{{ info.total }}</h2>
<span>照片</span>
</div>
<div class="photo-info__item">
<h2>{{ info.thisMonth }}</h2>
<span>本月</span>
</div>
<div class="photo-info__item">
<h2>{{ info.lastMonth }}</h2>
<span>上月</span>
</div>
<div class="photo-info__item">
<h2>{{ info.thisYear }}</h2>
<span>今年</span>
</div>
</div>
<div class="photo-list">
<div class="photo-group" v-for="(group, index) in list" :key="index">
<h2>{{ group.name }}</h2>
<div class="photo-wrapper">
<div class="photo-item" v-for="(item, i) in group.list" :key="i">
<image :src="item.url" @click="preview(item.url)" mode="aspectFill"/>
<div class="photo-item__text">
<span>{{ item.createUserName }} 上传</span>
</div>
</div>
</div>
</div>
<AiEmpty v-if="!list.length" description="暂无照片"></AiEmpty>
</div>
<div class="btn-wrapper">
<div class="btn" @click="upload" hover-class="text-hover">上传图片</div>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: "AppPhotoAlbum",
appName: "邻里相册",
customNavigation: true,
data() {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
type: '',
info: {},
name: '',
coverImg: '',
imgList: [],
hideStatus: false,
pageShow: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad(query) {
this.type = query.type
this.name = query.name
this.coverImg = query.url
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
this.$loading()
this.getList(query.type)
this.getTotalInfo(query.type)
},
onUnload() {
// uni.$off('update')
},
methods: {
back() {
uni.navigateBack({
delta: 1
})
},
preview(url) {
let imgs = []
this.list.forEach(item => {
imgs = [...imgs, ...item.list.map(v => v.url)]
})
uni.previewImage({
urls: imgs,
current: url
})
},
upload() {
if (!this.token) {
this.$refs.login.show()
return false
}
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: this.limit,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
return false
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length)
})
})
},
})
},
uploadFile(img, total) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
if (data.code === 0) {
this.imgList.push(data.data[0].split(';')[0])
} else {
this.$toast(data.msg)
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, {
areaName: uni.getStorageSync('areaName'),
areaId: uni.getStorageSync('areaId'),
type: this.type,
urlList: this.imgList
}).then(res => {
if (res.code == 0) {
this.getList(this.type)
this.getTotalInfo(this.type)
uni.$emit('update')
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getTotalInfo(type) {
this.$instance.post(`/app/appvillagepicturealbum/statistic?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0) {
this.info = res.data
}
})
},
getList(type) {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbum?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0) {
this.list = Object.keys(res.data).map(v => {
return {
name: v,
list: res.data[v]
}
})
this.$nextTick(() => {
this.pageShow = true
})
}
this.$hideLoading()
})
}
},
onPageScroll(params) {
this.isFixed = params.scrollTop > 60;
}
}
</script>
<style lang="scss" socped>
.photo {
width: 100vw;
overflow-x: hidden;
padding-bottom: 130px;
* {
box-sizing: border-box;
}
.back-wrapper {
position: fixed;
z-index: 11;
left: 20px;
top: 24px;
width: 40px;
height: 40px;
image {
width: 40px;
height: 40px;
}
}
.header {
position: fixed;
left: 0;
top: 0;
z-index: 0;
width: 100%;
opacity: 0;
transition: all 0.2s ease;
&.header-active {
z-index: 1111;
opacity: 1;
background: linear-gradient(180deg, #4670F5 0%, #4772F5 100%);
}
.nav-bar {
position: relative;
height: 88px;
line-height: 88px;
color: #fff;
font-size: 32px;
text-align: center;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 40px;
height: 40px;
padding: 24px 20px 0 20px;
box-sizing: content-box;
}
}
}
.photo-header {
position: relative;
height: 400px;
image {
width: 100%;
height: 400px;
filter: blur(2px);
}
h2 {
display: flex;
position: absolute;
align-items: center;
justify-content: center;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
color: #fff;
background: rgba(0, 0, 0, 0.1);
font-size: 56px;
}
}
.photo-info {
display: flex;
align-items: center;
height: 168px;
background: #FFFFFF;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.02);
& > div {
flex: 1;
text-align: center;
h2 {
margin-bottom: 10px;
font-weight: 600;
font-size: 38px;
color: #333333;
}
span {
color: #999999;
font-size: 26px;
}
}
}
.photo-list {
margin-top: 32px;
padding: 0 32px;
h2 {
margin-bottom: 32px;
color: #333333;
font-size: 38px;
}
.photo-wrapper {
display: flex;
flex-wrap: wrap;
.photo-item {
position: relative;
width: 328px;
height: 328px;
margin-right: 30px;
margin-bottom: 32px;
border-radius: 12px;
overflow: hidden;
&:nth-of-type(2n) {
margin-right: 0;
}
.photo-item__text {
position: absolute;
bottom: 0;
left: 0;
z-index: 1;
width: 100%;
height: 80px;
line-height: 80px;
padding: 0 16px;
color: #FFFFFF;
font-size: 26px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
}
image {
width: 328px;
height: 328px;
}
}
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,491 @@
<template>
<div class="page">
<div class="search-wrap">
<div class="search fill" @click="$linkTo('/mods/AppContent/contentManager?moduleId=' + search.moduleId)">
<u-icon name="search" color="#ffffff" size="40"></u-icon>
<span class="desc">请输入需要搜索的内容</span>
</div>
</div>
<div class="header-bg"></div>
<img class="border" :src="`${cdn}/border.png`" alt="">
<div class="swiper-content">
<u-swiper :list="swiperList" mode="none" height="240" bg-color="none" @click="handleBannerClick"/>
</div>
<div class="grid-content">
<u-grid :col="4" hover-class="text-hover" :border="false">
<u-grid-item v-for="(item, index) in grids" :key="index" :custom-style="{padding:'8px 0'}" bg-color="none"
class="grid-item" @click="handleClick(item)">
<img :src="item.pictureUrl" alt=""/>
<div class="grid-text">{{ item.name }}</div>
</u-grid-item>
</u-grid>
</div>
<div class="notice">
<img :src="`${cdn}/notice-new.png`" alt="">
<u-notice-bar mode="vertical" color="#4181FF" style="flex: 1;" :volume-icon="false" :is-circular="false"
duration="5000" speed="5000" :list="noticeList" @click="clickNotice"/>
</div>
<template v-if="activeList.length>0">
<header>推荐专题</header>
<scroll-view :scroll-x="true" style="width: 100%" class="scroll-wrap">
<div class="scroll-card"
:style="{background:'url(' + item.pictureUrl + ') no-repeat no-repeat;background-size:100% 100%;'}"
v-for="(item,index) in activeList" :key="index" @click="handleActive(item)"/>
</scroll-view>
</template>
<template v-if="categorys&&categorys.length>0">
<u-tabs :list="categorys.map(e=>({name:e.categoryName}))" font-size="40" bg-color="transparent"
inactive-color="#999999" :active-item-style="active"
:is-scroll="true" :current="index" @change="tabChange"/>
<div class="list-wrap" v-if="categoryList && categoryList.length>0">
<div class="list-card" v-for="(category,index) in categoryList" :key="index"
@click="$linkTo('/mods/AppContent/contentDetail?id='+category.id)">
<div class="header">{{ category.title }}</div>
<div class="content-wrap"
v-if="category.contentType==0 && category.files && category.files.length<3&&category.files.length>0">
<img class="img" :src="item.url" v-for="(item,index) in category.files.slice(0,1)" :key="index.id">
</div>
<div class="content-wrap" v-if="category.contentType==0 && category.files && category.files.length >= 3">
<img class="min-img" :src="item.url" v-for="(item,index) in category.files.slice(0,3)" :key="index.id">
</div>
<div class="content-wrap" v-if="category.contentType == 1">
<img class="img" :src="category.pictureUrl" alt=""/>
<img class="play-icon" :src="`${cdn}/play.png`" alt=""/>
</div>
<div class="bottom">
<div class="left">
<div class="tag">{{ category.categoryName }}</div>
{{ category.createTime }}
</div>
<div class="right">
<em>{{ category.viewCount }}</em>
人看过
</div>
</div>
</div>
</div>
<AiEmpty v-else/>
</template>
<AiLogin ref="login"/>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: 'AppHome',
appName: "首页",
data() {
return {
cdn: "https://cdn.cunwuyun.cn/wxmp",
swiperList: [],
index: 0,
grids: [],
activeList: [],
notices: [],
categorys: [],
categoryList: [],
search: {areaId: ''},
}
},
computed: {
...mapState(['user', 'token']),
active() {
return {
fontSize: '22px',
color: '#333333',
}
},
noticeList() {
let {notices} = this
return notices?.length > 0 ? notices?.map(e => e.title) || ['暂无公告'] : ['暂无公告']
}
},
onReady() {
uni.setNavigationBarTitle({title: "东盛e家"})
},
onLoad() {
this.autoLogin().then(() => {
this.getSwiperList();
this.getName();
this.getGrids();
this.getActive();
this.getNotice();
})
},
methods: {
...mapActions(['autoLogin', 'authCheck']),
getName() {
this.$instance.post("/app/appcontentmoduleinfo/listByName", null, {
params: {names: "新闻发布"},
withoutToken: true
}).then(res => {
if (res?.data[0]?.categoryList?.length) {
this.categorys = res.data[0]["categoryList"];
this.search.moduleId = res.data[0]['id']
this.search.categoryId = res.data[0]['categoryList'][0]['id']
this.getCategoryList()
}
})
},
tabChange(idx) {
this.index = idx
this.search.categoryId = this.categorys[idx]['id']
this.getCategoryList()
},
getCategoryList() {
this.$instance.post("/app/appcontentinfo/list", null, {
params: {...this.search, size: 100}
}).then(res => {
if (res?.data) {
this.categoryList = res.data.records;
}
})
},
clickNotice(val) {
const id = this.notices[val]["id"];
if (id) {
uni.navigateTo({
url: "/mods/AppNotice/AppNotice?id=" + id
})
}
},
handleActive({type, appId, url}) {
if (type == 0) {
uni.navigateToMiniProgram({appId})
} else if (type == 1) {
this.$linkTo("/subPages/h5/webview?link=" + url);
}
},
getNotice() {
this.$instance.post("/app/appmininotice/list", null, {
params: {size: 999},
withoutToken: true
}).then(res => {
if (res?.data) {
this.notices = res.data.records;
}
})
},
getActive() {
this.$instance.post("/app/appminitopicconfig/list", null, {
params: {size: 999},
withoutToken: true
}).then(res => {
if (res?.data) {
this.activeList = res.data.records;
}
})
},
/**
* 获取顶部九宫格
*/
getGrids() {
this.$instance.post("/app/appminihomeconfig/list", null, {
params: {picked: 1},
withoutToken: true
}).then(res => {
if (res?.data) {
this.grids = res.data.records;
}
})
},
getSwiperList() {
this.$instance.post('/app/appbanner/listForWx', null, {
withoutToken: true
}).then((res) => {
if (res?.data) {
this.swiperList = res.data?.map((e) => ({...e, image: e.imgUrl})) || []
}
})
},
handleClick({type, appId, modulePath, url, checkType, corpId}) {
//先判读是不是系统应用
if (type != "0") {
if (type == "1") {
uni.navigateToMiniProgram({appId});
} else if (type == "2") {
uni.navigateTo({url: "/subPages/h5/webview?link=" + url});
} else if (type == "3") {
this.$linkTo(url);
} else if (type == "4") {
uni.openCustomerServiceChat({
extInfo: {url: url},
corpId: corpId,
fail: () => {
this.$u.toast('请使用普通微信打开小程序进行咨询');
}
});
}
} else if (type && type == "0") {
uni.showLoading({title: '正在进入应用...'})
this.authCheck({checkType, modulePath}).finally(() => uni.hideLoading())
}
},
handleBannerClick(index) {
if (!this.swiperList[index].linkUrl) return
if (this.swiperList[index].type == '0') { //0 h5链接 1 小程序链接; 2外部小程序
this.$linkTo(`/subPages/h5/webview?link=${this.swiperList?.[index]?.linkUrl}&title=${this.swiperList?.[index]?.title}`)
} else if (this.swiperList[index].type == '1') {
this.$linkTo(`${this.swiperList?.[index]?.linkUrl}`)
} else {
wx.navigateToMiniProgram({
appId: this.swiperList[index].linkUrl
})
}
},
},
onShareAppMessage() {
return {
title: '欢迎使用东盛e家治理服务一体化平台~',
path: `/pages/AppHome/AppHome`
}
},
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
min-height: 100%;
background-color: #F3F6F9;
position: relative;
.search-wrap {
width: 750px;
height: 112px;
box-sizing: border-box;
padding: 0 32px;
display: flex;
align-items: center;
justify-content: center;
background-color: #4181FF;
.search {
width: 100%;
height: 64px;
background: #000000;
border-radius: 32px;
opacity: 0.2;
box-sizing: border-box;
padding: 0 32px;
display: flex;
align-items: center;
.desc {
font-size: 28px;
color: #FFFFFF;
margin-left: 16px;
}
}
}
.area-content {
height: 96px;
line-height: 96px;
background-color: #2d80fb;
.area-ai {
display: block;
width: 200px;
margin-left: 34px;
text-align: left;
}
.picker-location {
text-align: left;
}
}
.header-bg {
width: 100%;
height: 160px;
background-color: #4181FF;
}
.border {
width: 100%;
height: 40px;
}
.swiper-content {
width: 686px;
height: 240px;
margin: -176px auto 24px;
}
.grid-content {
box-sizing: border-box;
.grid-item {
img {
width: 108px;
height: 108px;
object-fit: fill;
}
.grid-text {
font-size: 26px;
font-weight: 400;
color: #333333;
line-height: 36px;
}
}
}
::v-deep .notice {
width: 686px;
height: 88px;
box-sizing: border-box;
padding: 0 24px;
margin: 30px auto 48px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
& > img {
width: 128px;
height: 52px;
}
.u-news-item {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
.list-wrap {
box-sizing: border-box;
padding: 32px;
.list-card {
width: 100%;
min-height: 100px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
box-sizing: border-box;
padding: 32px;
margin-bottom: 24px;
.header {
font-size: 36px;
font-weight: 600;
color: #333333;
line-height: 50px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.content-wrap {
display: flex;
gap: 4px;
flex-wrap: wrap;
margin-top: 24px;
position: relative;
.img {
width: 100%;
height: 350px;
}
.min-img {
width: 204px;
height: 204px;
}
.play-icon {
width: 80px;
height: 80px;
border-radius: 50%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 24px;
.left {
display: flex;
align-items: center;
font-size: 28px;
font-weight: 400;
color: #999999;
.tag {
width: 144px;
height: 48px;
background: #EEEEEE;
border-radius: 24px;
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
font-weight: 400;
color: #999999;
margin-right: 16px;
}
}
.right {
font-size: 28px;
font-weight: 400;
color: #999999;
display: flex;
align-items: center;
em {
font-style: normal;
color: #4181FF;
}
}
}
}
}
header {
font-size: 44px;
font-weight: 600;
color: #333333;
padding: 0 32px;
margin-bottom: 32px;
}
.scroll-wrap {
box-sizing: border-box;
padding: 0 32px;
width: 100%;
white-space: nowrap;
margin-bottom: 24px;
.scroll-card {
display: inline-block;
width: 440px;
height: 240px;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
border-radius: 16px;
margin-right: 32px;
&:last-child {
margin-right: 0;
}
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B