This commit is contained in:
liuye
2023-12-14 15:42:33 +08:00
parent dbb6706b21
commit 63cd10ccbf

View File

@@ -0,0 +1,496 @@
<template>
<div class="page">
<div class="header-content">
<u-navbar :is-back="false" title="积分" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar"></u-navbar>
<div class="header-bg">
<!-- <div class="weather-info" v-if="weatherInfo.wea">
<img :src="weatherInfo.icon" alt="" />
<p>今天{{weatherInfo.wea}}{{weatherInfo.tem2}}~{{weatherInfo.tem1}},{{weatherInfo.air_tips}}</p>
</div> -->
<div class="swiper-content">
<u-swiper :list="swiperList" mode="none" height="364" bg-color="none" @click="handleBannerClick"/>
</div>
<div class="user-info">
<p>张珊珊欢迎进入清风社区</p>
<div>签到</div>
</div>
</div>
</div>
<div class="banner-list">
<div class="item" v-for="(item, index) in bannerList" :key="index">
<img :src="item.imgUrl" alt="">
</div>
</div>
<tempalte>
<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="#687DA6"></u-icon>
</div>
</div>
<div class="list-news">
<div class="item">
<p class="title">关山街道关山社区第五网格</p>
<div class="user-flex">
<span>袁维宏</span>
<p>房前屋后打扫</p>
<div>
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">8
</div>
</div>
<p class="item-content">百年征和波澜壮阔百年初心历争议弥坚7月1日上午庆祝中国共产党成立100周年</p>
<div class="img-list">
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">
<img src="https://cdn.cunwuyun.cn/wechat/biaopin/integral/dianzan.png" alt="">
</div>
</div>
</div>
</tempalte>
<!-- <div class="app-list" v-for="(item, index) in appList" :key="index">
<div class="title-content">
<h2>{{item.name}}</h2>
<div @click="toService()">更多<img src="https://cdn.cunwuyun.cn/wechat/wuxi/right-icon-blue.png" alt=""></div>
</div>
<div class="banner-flex" v-if="item.bannerApp && item.bannerApp.length">
<div class="item-banner" v-for="(banner, bannerIndex) in item.bannerApp" :key="bannerIndex" @click="openApp(banner)">
<img :src="banner.pictureUrl" alt="">
</div>
</div>
<div class="app-content" v-if="item.apps && item.apps.length">
<div class="item-app" v-for="(app, appIndex) in item.apps" :key="appIndex" @click="openApp(app)">
<img :src="app.pictureUrl">
<p>{{app.name}}</p>
</div>
</div>
</div>
<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 {
customNavigation: true,
name: 'AppIntegral',
appName: "积分",
data() {
return {
cdn: "https://cdn.cunwuyun.cn/wxmp",
swiperList: ['https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-swiper1.png'],
index: 0,
grids: [],
activeList: [],
notices: [],
categorys: [],
categoryList: [],
search: {areaId: ''},
backgroundNavbar: {
background: 'url(https://cdn.cunwuyun.cn/wechat/wuxi/wuxi-nav-bg.png) no-repeat',
backgroundSize: 'cover',
},
appList: [], //应用列表
weatherInfo: {},
bannerList: [
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-jfsq.png',
path: ''
},
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-jfrw.png',
path: ''
},
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-jfph.png',
path: ''
},
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-jfsc.png',
path: ''
},
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-jfgs.png',
path: ''
},
{
imgUrl: 'https://cdn.cunwuyun.cn/wechat/biaopin/integral/integral-banner-wdjf.png',
path: ''
}
]
}
},
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: "基层治理"})
},
onLoad() {
this.autoLogin().then(() => {
// this.getSwiperList();
this.getName();
// this.getGrids();
this.getActive();
this.getNotice();
this.getAppList()
this.getWeather()
})
},
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
})
}
},
getAppList() {
this.$instance.get("/wuxi_home.json", null, { withoutToken: true }).then(res => {
if (res.length) {
this.appList = res
}
})
},
toService() {
uni.switchTab({
url: '/pages/AppModules/AppModules'
})
},
openApp(row) {
if(row.type == 1) { //type 0:内置应用, 1:外链, 2tabbar页面
uni.navigateToMiniProgram({appId: row.appId});
}else if(row.type == 2) {
uni.switchTab({url: row.modulePath})
}else {
uni.navigateTo({url: row.modulePath})
}
},
getWeather() {
this.$instance.post("/app/weather/queryWeather", {cityId: 101041800}, { withoutToken: true }).then(res => {
if (res.data) {
this.weatherInfo = res.data
this.weatherInfo.icon = 'https://cdn.cunwuyun.cn/wuxi/home/weather-'+this.weatherInfo.wea_img+'.png'
}
})
},
},
onShareAppMessage() {
return {
title: '欢迎使用基层治理~',
path: `/pages/AppHome/AppHome`
}
},
}
</script>
<style scoped lang="scss">
@import "~dvcp-wui/common";
.page {
width: 100%;
min-height: 100%;
position: relative;
.header-content {
.header-bg {
background: url('https://cdn.cunwuyun.cn/wechat/wuxi/wuxi-header-bg.png') center;
background-size: 100% 100%;
}
.swiper-content {
width: 686px;
height: 364px;
margin: 0 auto 24px;
}
.user-info {
display: flex;
justify-content: space-between;
padding: 14px 32px 18px;
p {
font-family: PingFangSC-Regular;
font-size: 28px;
color: #222;
line-height: 56px;
}
div {
font-family: PingFangSC-Regular;
font-size: 24px;
color: #0262F2;
line-height: 52px;
padding: 0 24px;
border: 1px solid #0262f280;
border-radius: 28px;
}
}
}
.banner-list {
padding: 32px 0 0 32px;
background-color: #fff;
.item {
display: inline-block;
width: 330px;
height: 160px;
margin: 0 26px 32px 0;
img {
width: 100%;
height: 100%;
}
}
}
.title-wrap {
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 32px 32px 24px;
.title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 34px;
color: #222;
line-height: 40px;
}
.right {
.title-more {
font-size: 28px;
font-weight: 400;
line-height: 40px;
color: #687DA6;
}
}
}
.list-news {
width: 686px;
margin: 0 0 0 32px;
.item {
padding: 32px 24px 16px 24px;
background-color: #fff;
border-radius: 16px;
.title {
font-family: PingFangSC-SNaNpxibold;
font-weight: 600;
font-size: 34px;
color: #333;
line-height: 40px;
word-break: break-all;
margin-bottom: 16px;
}
.user-flex {
line-height: 40px;
font-family: PingFangSC-Regular;
span {
display: inline-block;
font-size: 34px;
color: #2D7DFF;
margin-right: 20px;
}
p {
display: inline-block;
font-size: 26px;
color: #666;
}
div {
float: right;
font-size: 28px;
color: #687DA6;
line-height: 40px;
img {
width: 40px;
height: 40px;
margin-right: 4px;
vertical-align: sub;
}
}
}
.item-content {
margin-top: 30px;
font-family: PingFangSC-Regular;
font-size: 28px;
color: #333;
line-height: 42px;
word-break: break-all;
}
.img-list {
margin-top: 24px;
img {
width: 200px;
height: 200px;
margin: 0 16px 16px 0;
}
img:nth-of-type(3n) {
margin-right: 0;
}
}
}
}
}
</style>