|
@@ -41,6 +41,11 @@
|
|
|
import { onMounted, ref } from 'vue';
|
|
import { onMounted, ref } from 'vue';
|
|
|
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
|
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
|
|
import { useTheme } from '@/components/theme/ThemeDefine';
|
|
import { useTheme } from '@/components/theme/ThemeDefine';
|
|
|
|
|
+import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
|
|
+import { useVillageStore } from '@/store/village';
|
|
|
|
|
+import { useAuthStore } from '@/store/auth';
|
|
|
|
|
+import { isDevEnv } from '@/common/config/AppCofig';
|
|
|
|
|
+import { navTo } from '@/components/utils/PageAction';
|
|
|
import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
|
|
import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
|
|
|
import NavBar from '@/components/nav/NavBar.vue';
|
|
import NavBar from '@/components/nav/NavBar.vue';
|
|
|
import TabBar from '@/components/nav/TabBar.vue';
|
|
import TabBar from '@/components/nav/TabBar.vue';
|
|
@@ -51,21 +56,55 @@ import HomeIndex from './home/index.vue';
|
|
|
import DiscoverIndex from './home/discover/index.vue';
|
|
import DiscoverIndex from './home/discover/index.vue';
|
|
|
import VillageIndex from './home/village/index.vue';
|
|
import VillageIndex from './home/village/index.vue';
|
|
|
import CommonRoot from '@/components/dialog/CommonRoot.vue';
|
|
import CommonRoot from '@/components/dialog/CommonRoot.vue';
|
|
|
-import { isDevEnv } from '@/common/config/AppCofig';
|
|
|
|
|
-import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
|
|
-import { navTo } from '@/components/utils/PageAction';
|
|
|
|
|
|
|
+import LightVillageApi from '@/api/light/LightVillageApi';
|
|
|
|
|
|
|
|
const tabIndex = ref(0);
|
|
const tabIndex = ref(0);
|
|
|
const themeContext = useTheme();
|
|
const themeContext = useTheme();
|
|
|
|
|
+const villageStore = useVillageStore();
|
|
|
|
|
+const authStore = useAuthStore();
|
|
|
|
|
|
|
|
-useLoadQuerys({
|
|
|
|
|
|
|
+const { querys } = useLoadQuerys({
|
|
|
openLogin: false,
|
|
openLogin: false,
|
|
|
|
|
+ villageId: 0,
|
|
|
|
|
+ userId: 0,
|
|
|
}, (querys) => {
|
|
}, (querys) => {
|
|
|
if (querys.openLogin) {
|
|
if (querys.openLogin) {
|
|
|
navTo('/pages/user/login');
|
|
navTo('/pages/user/login');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (querys.villageId) {
|
|
|
|
|
+ loadShareVillageInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (querys.userId) {
|
|
|
|
|
+ villageStore.setShareFromVillageUserId(querys.userId);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+async function loadShareVillageInfo() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await LightVillageApi.getVillageDetails(querys.value.villageId as number);
|
|
|
|
|
+ villageStore.setCurrentVillage(res);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error(error);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ tabIndex.value = 1;
|
|
|
|
|
+}
|
|
|
|
|
+function getShareVillageInfo() {
|
|
|
|
|
+ if (villageStore.currentVillage) {
|
|
|
|
|
+ //分享村社信息
|
|
|
|
|
+ return {
|
|
|
|
|
+ title: `邀请您加入${villageStore.currentVillage.name}村社`,
|
|
|
|
|
+ path: `/pages/index?villageId=${villageStore.currentVillage.id}&userId=${authStore.userInfo?.id || 0}`,
|
|
|
|
|
+ imageUrl: villageStore.currentVillage.image || 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ title: '村社文化资源挖掘平台',
|
|
|
|
|
+ path: '/pages/index',
|
|
|
|
|
+ imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
|
|
|
|
|
+ };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
defineExpose({
|
|
defineExpose({
|
|
|
onPageBack: (name: string, data: Record<string, unknown>) => {
|
|
onPageBack: (name: string, data: Record<string, unknown>) => {
|
|
|
if (data.type === 'goVillage') {
|
|
if (data.type === 'goVillage') {
|
|
@@ -74,18 +113,10 @@ defineExpose({
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
onShareAppMessage(() => {
|
|
onShareAppMessage(() => {
|
|
|
- return {
|
|
|
|
|
- title: '村社文化资源挖掘平台',
|
|
|
|
|
- path: '/pages/index',
|
|
|
|
|
- imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return getShareVillageInfo();
|
|
|
})
|
|
})
|
|
|
onShareTimeline(() => {
|
|
onShareTimeline(() => {
|
|
|
- return {
|
|
|
|
|
- title: '村社文化资源挖掘平台',
|
|
|
|
|
- path: '/pages/index',
|
|
|
|
|
- imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return getShareVillageInfo();
|
|
|
})
|
|
})
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
if (isDevEnv) {
|
|
if (isDevEnv) {
|