瀏覽代碼

📦 申请认证页面基础

快乐的梦鱼 1 月之前
父節點
當前提交
6ebc87909b

+ 4 - 0
README.md

@@ -2,6 +2,10 @@
 
 本项目为亮乡源·大众版小程序项目源代码。
 
+## ⭐ 赞
+
+亮乡源,数字之舟,渡乡愁于无垠。承华夏之文脉,聚游子之幽情。线上精神原乡,记忆得以安放;云端社群雅集,乡贤共话桑麻。借科技之光,破时空之障,使桑梓文化。诚乃乡村振兴之良策,文化传承之新章。
+
 ## 技术栈
 
 ### 前端核心技术

+ 56 - 0
src/common/components/CommonDialog.vue

@@ -0,0 +1,56 @@
+<template>
+  <Dialog
+    v-bind="props"
+    mask
+    closeable
+    closeIcon=""
+    backgroundColor="transparent"
+    @update:show="emit('update:show', $event)"
+  >
+    <BackgroundBox 
+      backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxDialog.png"
+      :backgroundCutBorder="48"
+      :backgroundCutBorderSize="48"
+      :padding="24"
+      direction="column"
+      gap="gap.md"
+    >
+      <template v-if="props.title">
+        <Height :size="24" />
+        <FlexCol center gap="gap.lg">
+          <H3 fontConfig="primaryTitle">{{ props.title }}</H3>
+          <CommonDivider />
+        </FlexCol>
+      </template>
+      <slot></slot>
+      <Height :size="24" />
+    </BackgroundBox>
+    <Height :size="24" />
+    <ImageButton 
+      src="https://xy.wenlvti.net/app_static/images/ButtonClose.png"
+      :width="80"
+      :height="80"
+      @click="emit('update:show', false)"
+    />
+  </Dialog>
+</template>
+
+<script setup lang="ts">
+import Dialog, { type DialogProps } from '@/components/dialog/Dialog.vue';
+import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+import Height from '@/components/layout/space/Height.vue';
+import H3 from '@/components/typography/H3.vue';
+import CommonDivider from './CommonDivider.vue';
+import ImageButton from '@/components/basic/ImageButton.vue';
+
+const props = defineProps<DialogProps & {
+  title?: string;
+}>();
+const emit = defineEmits<{
+  (e: 'update:show', value: boolean): void;
+}>();
+
+
+
+</script>

+ 3 - 0
src/common/components/CommonDivider.vue

@@ -0,0 +1,3 @@
+<template>
+  <image src="https://xy.wenlvti.net/app_static/images/Divider.png" style="width: 460rpx; height: 10rpx;" mode="widthFix" />
+</template>

+ 6 - 2
src/common/components/FrameButton.vue

@@ -5,9 +5,11 @@
     :backgroundCutBorder="32"
     :backgroundCutBorderSize="36"
     :padding="padding"
+    :width="width"
+    center
     @click="emit('click')"
   >
-    <Text :text="text" fontConfig="contentText" :color="primary ? 'white' : 'black'" />
+    <Text :text="text" fontConfig="lightTitle" :fontSize="36" :color="primary ? 'white' : 'black'" />
   </BackgroundImageButton>
 </template>
 
@@ -20,6 +22,8 @@ const props = withDefaults(defineProps<{
   text: string;
   primary?: boolean;
   size?: 'large' | 'small';
+  width?: string|number;
+  innerStyle?: object;
 }>(), {
   text: '去发布',
   primary: false,
@@ -28,7 +32,7 @@ const props = withDefaults(defineProps<{
 
 const padding = computed(() => {
   if (props.size === 'large') {
-    return [32, 36];
+    return [22, 36];
   } else {
     return [24, 25];
   }

+ 3 - 1
src/components/basic/ImageButton.vue

@@ -2,11 +2,12 @@
   <Touchable 
     :activeOpacity="activeOpacity" 
     :touchable="touchable"
+    :innerStyle="innerStyle"
     position="relative" 
     center
     @click="emit('click')"
   >
-    <Image v-bind="props" />
+    <Image v-bind="props" :innerStyle="imageStyle" />
     <slot>
       <FlexCol center position="absolute" inset="0">
         <Text v-if="text" :text="text" v-bind="textProps" />
@@ -27,6 +28,7 @@ const props = withDefaults(defineProps<ImageProps & {
   touchable?: boolean;
   text?: string;
   textProps?: TextProps;
+  imageStyle?: object;
 }>(), {
   activeOpacity: 0.7,
   touchable: true,

+ 0 - 7
src/pages.json

@@ -285,13 +285,6 @@
           }
         },
         {
-          "path": "sharereg/share-reg-page",
-          "style": {
-            "navigationBarTitleText": "注册成为志愿者",
-            "enablePullDownRefresh": false
-          }
-        },
-        {
           "path": "sharereg/bind",
           "style": {
             "navigationBarTitleText": "绑定志愿者",

+ 1 - 1
src/pages/dig/details.vue

@@ -8,7 +8,7 @@
     />
     <FlexRow align="center" :gap="10" backgroundColor="white" :padding="20" radius="radius.md">
       <FlexRow flexBasis="50%">
-        <Text :fontSize="30" text="已认领:" />
+        <Text :fontSize="30" text="已点亮:" />
         <Width :width="20" />
         <Text :fontSize="30" color="primary" :text="decodeURIComponent(querys.name)" />
       </FlexRow>

+ 1 - 1
src/pages/dig/sharereg/bind.vue

@@ -89,7 +89,6 @@ async function registerSubmit() {
       password: registerFormModel.value.password,
     });
     await authStore.loginResultHandle(loginRes, UserApi.LOGIN_TYPE_USER);
-    await init();
     toast({ content: '注册成功' });
     setTimeout(() => navTo('/pages/index'), 800);
   } catch (e) {
@@ -97,6 +96,7 @@ async function registerSubmit() {
   } finally {
     registerFormLoading.value = false;
   }
+  await init();
 }
 function cancel() {
   navTo('/pages/index');

+ 0 - 182
src/pages/dig/sharereg/share-reg-page.vue

@@ -1,182 +0,0 @@
-<template>
-  <CommonRoot>
-    <FlexCol :gap="20" :padding="30">
-      <!--完成-->
-      <Result 
-        v-if="step === 'already'" 
-        status="success"
-        title="您已经是志愿者"
-        description="赶快去采编村社文化资源信息吧"
-      >
-        <Height :size="20" />
-        <Button type="primary" @click="redirectTo('/pages/index')">返回首页</Button>
-      </Result>
-      <!--注册-->
-      <FlexCol v-else-if="step === 'register'">
-        <DynamicForm
-          ref="registerFormRef"
-          :model="registerFormModel"
-          :options="registerFormDefine"
-        />
-        <Height :height="20" />
-        <Button block type="primary" @click="registerSubmit" :loading="registerFormLoading">提交</Button>
-      </FlexCol>
-      <!--注册完成-->
-      <Result 
-        v-else-if="step === 'finished'" 
-        status="success"
-        title="注册志愿者成功"
-        description="请等待管理员审核,在此期间,可以在社区中先逛逛,学习如何采编村社文化资源信息吧"
-      >
-        <Height :size="20" />
-        <Button type="primary" @click="redirectTo('/pages/index')">进入首页</Button>
-      </Result>
-      <!--错误-->
-      <Result 
-        v-else-if="step === 'error'" 
-        status="error"
-        title="分享链接参数有误"
-        description="请联系管理员,或稍后重试"
-      />
-      <!--登录-->
-      <FlexCol v-else center :height="400">
-        
-        <Icon icon="smile-filling" color="primary" :size="156" />
-        <Height :height="20" />
-        <Text :fontSize="26" color="primary" text="欢迎注册,加入志愿者队伍" />
-        <Height :size="40" />
-
-        <!-- #ifdef MP-WEIXIN -->
-        <Button type="primary" block text="微信登录" @click="loginWechat" />
-        <Height :size="20" />
-        <!-- #endif -->
-        <!-- #ifndef MP-WEIXIN -->
-        <Result status="warning" title="提示" desc="当前环境不支持微信登录" />
-        <!-- #endif -->
-
-      </FlexCol>
-    </FlexCol>
-  </CommonRoot>
-</template>
-
-<script setup lang="ts">
-import Button from '@/components/basic/Button.vue';
-import Result from '@/components/feedback/Result.vue';
-import FlexCol from '@/components/layout/FlexCol.vue';
-import Height from '@/components/layout/space/Height.vue';
-import Icon from '@/components/basic/Icon.vue';
-import Text from '@/components/basic/Text.vue';
-import CommonRoot from '@/components/dialog/CommonRoot.vue';
-import DynamicForm from '@/components/dynamic/DynamicForm.vue';
-import { useAppInit } from '@/common/composeabe/AppInit';
-import { UserApi } from '@/api/auth/UserApi';
-import { useAuthStore } from '@/store/auth';
-import { redirectTo } from '@/components/utils/PageAction';
-import { closeToast, toast } from '@/components/dialog/CommonRoot';
-import { showError } from '@/common/composeabe/ErrorDisplay';
-import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
-import { onMounted, ref } from 'vue';
-import { getVolunteerForm } from '../admin/data/volunteer';
-import VillageApi, { VolunteerInfo } from '@/api/inhert/VillageApi';
-import type { IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
-
-/**
- * 分享注册页面
- * 
- * 用户从管理员分享链接进入,需要注册为志愿者
- * 0. 如果已经登录,且有志愿者信息,直接跳转已经注册页, 否则进入注册流程
- * 1. 登录微信, 登录成功后, 如果有志愿者信息, 直接跳转成功页, 否则进入注册流程
- * 2. 注册流程中, 提交成功后, 跳转成功页
- */
-
-const authStore = useAuthStore();
-const { init } = useAppInit();
-
-const { querys } = useLoadQuerys({ 
-  villageId: 0,  
-});
-const step = ref<''|'register'|'finished'|'already'|'error'>('');
-
-onMounted(async () => {
-  if (!querys.value.villageId) {
-    step.value = 'error';
-    return;
-  }
-  registerFormDefine.value = getVolunteerForm({
-    canSetCatalog: false,
-    villageId: querys.value.villageId,
-    onlyPassword: false,
-    isNew: ref(true),
-    formRef: registerFormRef,
-  });
-  if (authStore.isLogged) {
-    try {
-      await VillageApi.getVolunteerInfo();
-      step.value = 'already';
-    } catch {
-      step.value = 'register';
-    }
-  }
-});
-
-async function loginWechat() {
-  toast({
-    type: 'loading',  
-    content: '登录中...',
-  })
-
-  try {
-    const res = await Promise.all([
-      uni.login({ provider: 'weixin' }),
-      uni.getUserProfile({ desc: '用于完善会员资料' }),
-    ]);
-    await authStore.loginWechart(res[0].code, res[1]);
-    toast({
-      type: 'success',  
-      content: '登录成功',
-    });
-
-    try {
-      await VillageApi.getVolunteerInfo();
-      //有志愿者信息,表示是志愿者,直接跳转
-      step.value = 'already';
-      return;
-    } catch {
-      step.value = 'register';
-    }
-  } catch(e) {
-    showError(e);
-  } finally {
-    closeToast();
-  }
-}
-
-const registerFormLoading = ref(false);
-const registerFormRef = ref<IDynamicFormRef>();
-const registerFormModel = ref<VolunteerInfo>(new VolunteerInfo());
-const registerFormDefine = ref<IDynamicFormOptions>();
-
-async function registerSubmit() {
-  if (!registerFormRef.value || !registerFormModel.value)
-    return;
-  try {
-    await registerFormRef.value.validate();
-  } catch (e) {
-    toast({ content: '有必填项未填写,请检查' });
-    return;
-  }
-  try {
-    registerFormLoading.value = true;
-    registerFormModel.value!.villageId = querys.value.villageId;
-    const loginRes = await VillageApi.shareAddVolunteer(registerFormModel.value as VolunteerInfo);
-    await authStore.loginResultHandle(loginRes, UserApi.LOGIN_TYPE_USER);
-    await init();
-    toast({ content: '注册成功' });
-    step.value = 'finished';
-  } catch (e) {
-    showError(e);
-  } finally {
-    registerFormLoading.value = false;
-  }
-}
-</script>

+ 1 - 1
src/pages/home/dig.vue

@@ -30,7 +30,7 @@
           :loader="villageListLoader"
           :showEmpty="villageListLoader.content.value?.length == 0"
           :emptyView="{
-            text: '你还没有认领的村社,请联系管理员认领',
+            text: '您点亮的村社正在审核中,审核通过后您可以查看和管理',
             button: false,
           }"
         >

+ 2 - 1
src/pages/home/light/details.vue

@@ -1,6 +1,7 @@
 <template>
   <SimplePageContentLoader :loader="contentLoader">
     <FlexCol v-if="contentLoader.status.value == 'finished'">
+      
       <swiper 
         circular
         :indicator-dots="false"
@@ -49,7 +50,7 @@
           />
           <FlexCol :margin="[20, 0, 0, 0]">
             <Parse :content="data.overview" />
-            <Text v-if="!data.overview" fontConfig="subText">无内容,请添加内容! </Text>
+            <Text v-if="!data.overview" fontConfig="subText">村社暂无介绍,欢迎点亮成为志愿者,贡献村社文化! </Text>
           </FlexCol>
         </FlexCol>
 

+ 1 - 1
src/pages/home/light/submit.vue

@@ -185,7 +185,6 @@ async function registerSubmit() {
     registerFormModel.value!.villageId = querys.value.villageId;
     const loginRes = await VillageApi.shareAddVolunteer(registerFormModel.value as VolunteerInfo);
     await authStore.loginResultHandle(loginRes, UserApi.LOGIN_TYPE_USER);
-    await init();
     toast({ content: '注册成功' });
     finishedMode.value = 'register';
     step.value = 'finished';
@@ -194,6 +193,7 @@ async function registerSubmit() {
   } finally {
     registerFormLoading.value = false;
   }
+  await init();
 }
 
 const addFormLoading = ref(false);

+ 1 - 1
src/pages/home/village/details.vue

@@ -49,7 +49,7 @@
           />
           <FlexCol :margin="[20, 0, 0, 0]">
             <Parse :content="data.overview" />
-            <Text v-if="!data.overview" fontConfig="subText">无内容,请添加内容! </Text>
+            <Text v-if="!data.overview" fontConfig="subText">村社暂无介绍,欢迎点亮成为志愿者,贡献村社文化! </Text>
           </FlexCol>
         </FlexCol>
 

+ 99 - 0
src/pages/home/village/dialogs/ApplyGoodsDialog.vue

@@ -0,0 +1,99 @@
+<template>
+  <CommonDialog v-model:show="show" title="TODO:申请逻辑等着设计">
+    <FlexCol gap="gap.lg">
+      <FlexRow wrap justify="space-around" gap="gap.md">
+        <BackgroundBox 
+          v-for="(item, k) in infoGrids"
+          :key="k"
+          backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxMid.png"
+          :backgroundCutBorder="32"
+          :backgroundCutBorderSize="36"
+          :padding="24"
+          :innerStyle="{ width: 'calc(50% - 58rpx)' }"
+          direction="column"
+          align="center"
+          gap="gap.md"
+        >
+          <Text :text="item.label" fontConfig="lightImportantTitle"  />
+          <Text :text="item.desc" fontConfig="lightGoldTitle" :fontSize="30" />
+          <FlexRow align="center" gap="gap.sm">
+            <Text :text="item.value" fontConfig="lightGoldTitle" :fontSize="50" />
+            <Text :text="item.unit" fontConfig="contentText" />
+          </FlexRow>
+        </BackgroundBox>
+      </FlexRow>
+      <BackgroundBox 
+        backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxMid.png"
+        :backgroundCutBorder="32"
+        :backgroundCutBorderSize="36"
+        :padding="24"
+        direction="column"
+        center
+      >
+        <Text text="额外权益" fontConfig="lightImportantTitle" />
+        <Text text="平台首页展厅/阁楼名投、好图上传、村图券赠送、修改图片平台基础建设、花田引入正版授权歌曲+30%、乡源果奖励等" fontConfig="contentText" />
+      </BackgroundBox>
+      <FlexRow justify="space-around" gap="gap.md">
+        <FrameButton text="取消" @click="show = false" width="220rpx" />
+        <FrameButton primary text="去申请" @click="show = false" width="220rpx" />
+      </FlexRow>
+    </FlexCol>
+  </CommonDialog>
+</template>
+
+<script setup lang="ts">
+import CommonDialog from '@/common/components/CommonDialog.vue';
+import FrameButton from '@/common/components/FrameButton.vue';
+import Text from '@/components/basic/Text.vue';
+import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+import FlexRow from '@/components/layout/FlexRow.vue';
+import { ref } from 'vue';
+
+const show = ref(false);
+
+const infoGrids = ref([
+  {
+    label: '认证等级',
+    desc: '初级·年费',
+    value: '1000',
+    unit: '元/年',
+  },
+  {
+    label: '管理员',
+    desc: '乡源果',
+    value: '399',
+    unit: '个',
+  },
+  {
+    label: '认证等级',
+    desc: '中级·年费',
+    value: '1000',
+    unit: '元/年',
+  },
+  {
+    label: '管理员',
+    desc: '乡源果',
+    value: '399',
+    unit: '个',
+  },
+  {
+    label: '认证等级',
+    desc: '高级·年费',
+    value: '1000',
+    unit: '元/年',
+  },
+  {
+    label: '管理员',
+    desc: '乡源果',
+    value: '399',
+    unit: '个',
+  },
+]);
+
+defineExpose({
+  show: () => {
+    show.value = true;
+  },
+});
+</script>

+ 3 - 1
src/pages/home/village/introd/card.vue

@@ -50,7 +50,7 @@
             <Text :text="`存储空间内存:${villageInfoLoader.content.value?.sizeText}`" fontConfig="secondText" />
           </FlexCol>
           <FlexCol gap="gap.md">
-            <Button icon="https://xy.wenlvti.net/app_static/images/village/IconUser.png" radius="radius.lgr" :padding="[10, 30]" backgroundColor="white">申请管理者</Button>
+            <Button icon="https://xy.wenlvti.net/app_static/images/village/IconUser.png" radius="radius.lgr" :padding="[10, 30]" backgroundColor="white" @click="($refs.applyGoodsDialog as any).show()">申请管理者</Button>
           </FlexCol>
         </FlexRow>
       </Construction>
@@ -244,6 +244,7 @@
     @publishsuccess="onPublishSuccess"
   />
 
+  <ApplyGoodsDialog ref="applyGoodsDialog" />
 </template>
 
 <script setup lang="ts">
@@ -278,6 +279,7 @@ import GridItem from '@/components/layout/grid/GridItem.vue';
 import LightVillageApi from '@/api/light/LightVillageApi';
 import Construction from '@/common/components/Construction.vue';
 import OfficialAccountPublishWrap from '@/common/components/OfficialAccountPublishWrap.vue';
+import ApplyGoodsDialog from '../dialogs/ApplyGoodsDialog.vue';
 
 const authStore = useAuthStore();
 const { getIsVolunteer } = useUserTools();

+ 10 - 0
src/pages/index.vue

@@ -52,10 +52,20 @@ import DiscoverIndex from './home/discover/index.vue';
 import VillageIndex from './home/village/index.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';
 
 const tabIndex = ref(0);
 const themeContext = useTheme();
 
+useLoadQuerys({ 
+  openLogin: false,
+}, (querys) => {
+  if (querys.openLogin) {
+    navTo('/pages/user/login');
+  }
+});
+
 defineExpose({
   onPageBack: (name: string, data: Record<string, unknown>) => {
     if (data.type === 'goVillage') {