同步资源

This commit is contained in:
aixianling
2022-07-15 19:16:43 +08:00
parent 729a3eb8ee
commit d9e5f2bf43
2 changed files with 54 additions and 69 deletions

View File

@@ -14,8 +14,7 @@
<div class="grid-content"> <div class="grid-content">
<u-grid :col="4" hover-class="text-hover" :border="false"> <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" <u-grid-item v-for="(item, index) in grids" :key="index" :custom-style="{padding:'8px 0'}" bg-color="none"
class="grid-item" class="grid-item" @click="handleClick(item)">
@click="handleClick(item)">
<img :src="item.pictureUrl" alt=""/> <img :src="item.pictureUrl" alt=""/>
<div class="grid-text">{{ item.name }}</div> <div class="grid-text">{{ item.name }}</div>
</u-grid-item> </u-grid-item>
@@ -49,9 +48,9 @@
<div class="content-wrap" v-if="category.contentType==0 && category.files && category.files.length >= 3"> <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"> <img class="min-img" :src="item.url" v-for="(item,index) in category.files.slice(0,3)" :key="index.id">
</div> </div>
<div class="content-wrap" v-if="category.contentType==1"> <div class="content-wrap" v-if="category.contentType == 1">
<img class="img" :src="category.pictureUrl" alt=""> <img class="img" :src="category.pictureUrl" alt=""/>
<img class="play-icon" :src="`${cdn}/play.png`" alt=""> <img class="play-icon" :src="`${cdn}/play.png`" alt=""/>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="left"> <div class="left">
@@ -485,6 +484,5 @@ export default {
} }
} }
} }
} }
</style> </style>

View File

@@ -11,7 +11,7 @@
</div> </div>
</div> </div>
<div class="header-bg"></div> <div class="header-bg"></div>
<img class="border" src="../../static/img/border.png" alt=""/> <img class="border" :src="`${cdn}/border.png`" alt="">
<div class="swiper-content"> <div class="swiper-content">
<u-swiper :list="swiperList" mode="none" height="240" bg-color="none" @click="handleBannerClick"/> <u-swiper :list="swiperList" mode="none" height="240" bg-color="none" @click="handleBannerClick"/>
</div> </div>
@@ -54,7 +54,7 @@
</div> </div>
<div class="content-wrap" v-if="category.contentType == 1"> <div class="content-wrap" v-if="category.contentType == 1">
<img class="img" :src="category.pictureUrl" alt=""/> <img class="img" :src="category.pictureUrl" alt=""/>
<img class="play-icon" src="../../static/img/play.png" alt=""/> <img class="play-icon" :src="`${cdn}/play.png`" alt=""/>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="left"> <div class="left">
@@ -81,6 +81,7 @@ export default {
appName: "首页", appName: "首页",
data() { data() {
return { return {
cdn: "https://cdn.cunwuyun.cn/wxmp",
areaName: '', areaName: '',
swiperList: [], swiperList: [],
index: 0, index: 0,
@@ -93,7 +94,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState(['global', 'user', 'token']), ...mapState(['user', 'token']),
active() { active() {
return { return {
fontSize: '22px', fontSize: '22px',
@@ -102,8 +103,8 @@ export default {
}, },
noticeList() { noticeList() {
let {notices} = this let {notices} = this
return notices?.length > 0 ? notices?.map((e) => e.title) || ['暂无公告'] : ['暂无公告'] return notices?.length > 0 ? notices?.map(e => e.title) || ['暂无公告'] : ['暂无公告']
}, }
}, },
onLoad() { onLoad() {
this.autoLogin().then(() => { this.autoLogin().then(() => {
@@ -117,14 +118,12 @@ export default {
methods: { methods: {
...mapActions(['autoLogin', 'authCheck']), ...mapActions(['autoLogin', 'authCheck']),
getName() { getName() {
this.$instance this.$instance.post("/app/appcontentmoduleinfo/listByName", null, {
.post('/app/appcontentmoduleinfo/listByName', null, { params: {names: "新闻发布"},
params: {names: '新闻发布'}, withoutToken: true
withoutToken: true, }).then(res => {
}) if (res?.data[0]?.categoryList?.length) {
.then((res) => { this.categorys = res.data[0]["categoryList"];
if (res?.data?.[0]?.categoryList?.length) {
this.categorys = res.data[0]['categoryList']
this.search.moduleId = res.data[0]['id'] this.search.moduleId = res.data[0]['id']
this.search.categoryId = res.data[0]['categoryList'][0]['id'] this.search.categoryId = res.data[0]['categoryList'][0]['id']
this.getCategoryList() this.getCategoryList()
@@ -136,23 +135,20 @@ export default {
this.search.categoryId = this.categorys[idx]['id'] this.search.categoryId = this.categorys[idx]['id']
this.getCategoryList() this.getCategoryList()
}, },
getCategoryList() { getCategoryList() {
this.$instance this.$instance.post("/app/appcontentinfo/list", null, {
.post('/app/appcontentinfo/list', null, { params: {...this.search, size: 100}
params: {...this.search, size: 100}, }).then(res => {
})
.then((res) => {
if (res?.data) { if (res?.data) {
this.categoryList = res.data.records this.categoryList = res.data.records;
} }
}) })
}, },
clickNotice(val) { clickNotice(val) {
const id = this.notices[val]['id'] const id = this.notices[val]["id"];
if (id) { if (id) {
uni.navigateTo({ uni.navigateTo({
url: '/mods/AppNotice/AppNotice?id=' + id, url: "/mods/AppNotice/AppNotice?id=" + id
}) })
} }
}, },
@@ -160,30 +156,26 @@ export default {
if (type == 0) { if (type == 0) {
uni.navigateToMiniProgram({appId}) uni.navigateToMiniProgram({appId})
} else if (type == 1) { } else if (type == 1) {
this.$linkTo('/subPages/h5/webview?link=' + url) this.$linkTo("/subPages/h5/webview?link=" + url);
} }
}, },
getNotice() { getNotice() {
this.$instance this.$instance.post("/app/appmininotice/list", null, {
.post('/app/appmininotice/list', null, {
params: {size: 999}, params: {size: 999},
withoutToken: true, withoutToken: true
}) }).then(res => {
.then((res) => {
if (res?.data) { if (res?.data) {
this.notices = res.data.records this.notices = res.data.records;
} }
}) })
}, },
getActive() { getActive() {
this.$instance this.$instance.post("/app/appminitopicconfig/list", null, {
.post('/app/appminitopicconfig/list', null, {
params: {size: 999}, params: {size: 999},
withoutToken: true, withoutToken: true
}) }).then(res => {
.then((res) => {
if (res?.data) { if (res?.data) {
this.activeList = res.data.records this.activeList = res.data.records;
} }
}) })
}, },
@@ -191,23 +183,19 @@ export default {
* 获取顶部九宫格 * 获取顶部九宫格
*/ */
getGrids() { getGrids() {
this.$instance this.$instance.post("/app/appminihomeconfig/list", null, {
.post('/app/appminihomeconfig/list', null, {
params: {picked: 1}, params: {picked: 1},
withoutToken: true, withoutToken: true
}) }).then(res => {
.then((res) => {
if (res?.data) { if (res?.data) {
this.grids = res.data.records this.grids = res.data.records;
} }
}) })
}, },
getSwiperList() { getSwiperList() {
this.$instance this.$instance.post('/app/appbanner/listForWx', null, {
.post('/app/appbanner/listForWx', null, { withoutToken: true
withoutToken: true, }).then((res) => {
})
.then((res) => {
if (res?.data) { if (res?.data) {
this.swiperList = res.data?.map((e) => ({...e, image: e.imgUrl})) || [] this.swiperList = res.data?.map((e) => ({...e, image: e.imgUrl})) || []
} }
@@ -215,21 +203,21 @@ export default {
}, },
handleClick({type, appId, modulePath, url, checkType, corpId}) { handleClick({type, appId, modulePath, url, checkType, corpId}) {
//先判读是不是系统应用 //先判读是不是系统应用
if (type != '0') { if (type != "0") {
if (type == '1') { if (type == "1") {
uni.navigateToMiniProgram({appId}) uni.navigateToMiniProgram({appId});
} else if (type == '2') { } else if (type == "2") {
uni.navigateTo({url: '/subPages/h5/webview?link=' + url}) uni.navigateTo({url: "/subPages/h5/webview?link=" + url});
} else if (type == '3') { } else if (type == "3") {
this.$linkTo(url) this.$linkTo(url);
} else if (type == '4') { } else if (type == "4") {
uni.openCustomerServiceChat({ uni.openCustomerServiceChat({
extInfo: {url: url}, extInfo: {url: url},
corpId: corpId, corpId: corpId,
fail: () => { fail: () => {
this.$u.toast('请使用普通微信打开小程序进行咨询') this.$u.toast('请使用普通微信打开小程序进行咨询');
}, }
}) });
} }
} else if (type && type == "0") { } else if (type && type == "0") {
uni.showLoading({title: '正在进入应用...'}) uni.showLoading({title: '正在进入应用...'})
@@ -239,14 +227,13 @@ export default {
handleBannerClick(index) { handleBannerClick(index) {
if (!this.swiperList[index].linkUrl) return if (!this.swiperList[index].linkUrl) return
if (this.swiperList[index].type == '0') { if (this.swiperList[index].type == '0') { //0 h5链接 1 小程序链接; 2外部小程序
//0 h5链接 1 小程序链接; 2外部小程序
this.$linkTo(`/subPages/h5/webview?link=${this.swiperList?.[index]?.linkUrl}&title=${this.swiperList?.[index]?.title}`) this.$linkTo(`/subPages/h5/webview?link=${this.swiperList?.[index]?.linkUrl}&title=${this.swiperList?.[index]?.title}`)
} else if (this.swiperList[index].type == '1') { } else if (this.swiperList[index].type == '1') {
this.$linkTo(`${this.swiperList?.[index]?.linkUrl}`) this.$linkTo(`${this.swiperList?.[index]?.linkUrl}`)
} else { } else {
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: this.swiperList[index].linkUrl, appId: this.swiperList[index].linkUrl
}) })
} }
}, },
@@ -255,19 +242,19 @@ export default {
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '欢迎使用数字乡村治理服务一体化平台~', title: '欢迎使用数字乡村治理服务一体化平台~',
path: `/pages/home/home`, path: `/pages/home/home`
} }
}, },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~dvcp-wui/common'; @import "~dvcp-wui/common";
.page { .page {
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;
background-color: #f3f6f9; background-color: #F3F6F9;
position: relative; position: relative;
.search-wrap { .search-wrap {