安徽博创起重uniapp
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.
 
 
 
 

133 lines
3.8 KiB

<template>
<view class="community">
<template v-if="appConfig.is_open_community">
<like-header @change="handleNav" :current="currentNav" />
<view class="container">
<follow :active="currentNav" v-show="currentNav===0" @share="handleShare"></follow>
<!-- 找服务 -->
<explore :active="currentNav" :cid="cid" v-show="currentNav===1"></explore>
<!-- 找需求 -->
<explore :active="currentNav" :cid="cid" v-show="currentNav===2"></explore>
<!-- 检测机构 -->
<!-- <organ :active="currentNav" v-show="currentNav===3"></organ> -->
<!-- 专家服务 -->
<!-- <team :active="currentNav" v-show="currentNav===4"></team> -->
</view>
</template>
<template v-else>
<view class="community-empty flex-col col-center row-center">
<image class="img-null" src="/static/images/follow_null.png"></image>
<view class="muted mt20">当前页面暂无内容~</view>
</view>
</template>
<!-- <tabbar></tabbar> -->
</view>
</template>
<script>
import LikeHeader from "../../components/components/like-header.vue"
import Explore from "../../components/components/explore.vue"
// import Organ from "../../components/components/organ.vue"
import Follow from "../../components/components/follow.vue"
// import Team from "../../components/components/team.vue"
export default {
components: {
LikeHeader,
Explore,
Follow,
// Xuqiu,
// Organ,
// Team
},
data() {
return {
cid:0,
currentNav: 1,
communityShareItem: {}
}
},
onShow(){
let queryString = uni.getStorageSync("params")
uni.removeStorageSync("params")
if(queryString){
// 使用URLSearchParams类解析查询参数
const regex =/([^=&]+)=([^&]*)/g;
let match, params = {};
while (match = regex.exec(queryString)) {
params[match[1]] = match[2];
}
// 使用get方法获取index和cate的值
let p_index = params['index'];
let p_cate = params['cate'];
if(p_index !=undefined && p_index!=""){
// this.current = parseInt(p_index)
this.currentNav = parseInt(p_index)
}
if(p_cate !=undefined && p_cate!=""){
this.cid = parseInt(p_cate)
console.log("cid数据",this.cid)
uni.setStorageSync("cid",this.cid)
}
}
},
onUnload() {
uni.$off("changeItem")
uni.$off("hasNew")
},
onShareAppMessage() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: `${this.communityShareItem.user.nickname},TA的内容超级棒`,
path: '/bundle_b/pages/community_user/community_user?id=' + this
.communityShareItem.id,
imageUrl: this.communityShareItem.image
})
}, 10)
})
return {
title: '自定义转发标题',
path: '/page/user/user',
promise
}
},
methods: {
handleNav(event) {
this.currentNav = Number(event)
console.log(this.currentNav,333)
},
// 关注页的分享信息
handleShare(event) {
this.communityShareItem = event
}
}
}
</script>
<style lang="scss">
page {
padding: 0;
}
.community {
display: flex;
height: calc(100vh - var(--window-bottom));
overflow: hidden;
flex-direction: column;
&-empty {
height: calc(100vh - var(--window-bottom));
}
.container {
flex: 1;
min-height: 0;
overflow: scroll;
}
}
</style>