浏览代码

fix(app/mine): 添加扫二维码功能和圈子相关接口

EvilDragon 5 月之前
父节点
当前提交
57f97d0f75

文件差异内容过多而无法显示
+ 2 - 0
packages/app/src/assets/svgs/scan.svg


+ 2 - 2
packages/app/src/components/start-menu-button.vue

@@ -32,8 +32,8 @@ onMounted(async () => {
 <template>
   <div>
     <div :style="{ height: menuBtnClientRect.top + 'px' }"></div>
-    <div class="bg-red rounded-full flex items-center px-3 box-border" :style="startMenuBtnStyle">
-      扫一扫
+    <div class="rounded-full flex items-center px-3 box-border" :style="startMenuBtnStyle">
+      <slot></slot>
     </div>
   </div>
 </template>

+ 22 - 2
packages/app/src/core/libs/requests.ts

@@ -149,7 +149,7 @@ export const weixinMiniAppLogin = (phoneCode: string, loginCode: string, state:
     state,
   })
 export const getMemberUserInfo = () => httpGet<any>('/app-api/member/user/get')
-export const getByDictType = (dictType: string | 'member_channel_source') =>
+export const getByDictType = (type: string | 'member_channel_source') =>
   httpGet<
     {
       label: string
@@ -157,7 +157,7 @@ export const getByDictType = (dictType: string | 'member_channel_source') =>
       dictType: string
       status: number
     }[]
-  >('/app-api/member/dict-data/getByDictType', { dictType })
+  >('/app-api/system/dict-data/type', { type })
 export const createUserAuthInfo = (
   data: Partial<{
     id: number
@@ -174,5 +174,25 @@ export const createUserAuthInfo = (
     remark: string
   }>,
 ) => httpPost<any>('/app-api/member/user-auth-info/create', data)
+export const getCircles = (query) => httpGet<any>('/app-api/member/circle/page', query)
+export const createCircle = (
+  data: Partial<{
+    headUrl: string
+    stylistId: string
+    stylistName: string
+    marketing: string
+    circleDesc: string
+    tagName: string
+    detailsType: string
+    detailsUrl: string
+    detailsDesc: string
+    circleType: string
+    spaceType: string
+    designStyle: string
+    spaceAddr: string
+    customerDemand: string
+    bannerUrls: string[]
+  }>,
+) => httpPost<any>('/app-api/member/circle/create', data)
 export const httpGetMock = <T>(data: T) =>
   new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))

+ 7 - 0
packages/app/src/pages.json

@@ -222,6 +222,13 @@
       }
     },
     {
+      "path": "pages/mine/homepage/index",
+      "type": "page",
+      "style": {
+        "navigationStyle": "custom"
+      }
+    },
+    {
       "path": "pages/publish/cases/index",
       "type": "page",
       "style": {

+ 6 - 0
packages/app/src/pages/home/index.vue

@@ -19,6 +19,7 @@ import useRequest from '@/hooks/useRequest'
 import dayjs from 'dayjs'
 import Menus from './components/menus.vue'
 import ScheduleCard from './components/schedule-card.vue'
+import { getCircles } from '@/core/libs/requests'
 
 defineOptions({
   name: 'Home',
@@ -94,7 +95,12 @@ const { data } = useRequest(async () => ({ code: 0, msg: '', data: {} }) as IRes
     studyTour: null,
   },
 })
+const { data: circles, run } = useRequest(() => getCircles({}))
 console.log(data.value)
+onShow(async () => {
+  await run()
+  console.log(circles.value)
+})
 onLoad(() => {})
 onShareAppMessage(() => ({}))
 </script>

+ 38 - 0
packages/app/src/pages/mine/homepage/index.vue

@@ -0,0 +1,38 @@
+<route lang="yaml">
+style:
+  navigationStyle: custom
+</route>
+<script setup lang="ts">
+import { getByDictType, getCircles } from '@/core/libs/requests'
+import { useUserStore } from '@/store'
+import { storeToRefs } from 'pinia'
+
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
+const tab = ref('2')
+const { data: circleTypes, run: getCircleType } = useRequest(() =>
+  getByDictType('member_circle_type'),
+)
+const { data: circles, run } = useRequest(() =>
+  getCircles({ circleType: tab.value, stylistName: userInfo.value.nickname }),
+)
+const tabs = ref([
+  { label: '案例', value: '2' },
+  { label: '动态', value: '1' },
+])
+onMounted(async () => {
+  await getCircleType()
+  console.log(circleTypes.value)
+
+  await run()
+})
+</script>
+<template>
+  <div class="">
+    <wd-tabs v-model="tab">
+      <template v-for="({ label, value }, index) in tabs" :key="index">
+        <wd-tab :title="label" :name="value"></wd-tab>
+      </template>
+    </wd-tabs>
+  </div>
+</template>

+ 10 - 1
packages/app/src/pages/publish/moment/index.vue

@@ -5,13 +5,22 @@ style:
 </route>
 <script setup lang="ts">
 import SectionHeading from '@/components/section-heading.vue'
+import { createCircle } from '@/core/libs/requests'
+import { useToast } from 'wot-design-uni'
 
+const { error } = useToast()
 const value = ref('')
 const fileList = ref([])
 const action = ref('')
 const handleChange = (e: any) => {
   console.log(e)
 }
+const handleSubmit = async () => {
+  const { code, msg } = await createCircle({ bannerUrls: [], tagName: '', headUrl: '' })
+  if (code !== 0) {
+    error(msg)
+  }
+}
 </script>
 <template>
   <div class="flex-grow bg-white p-3.5 flex flex-col">
@@ -38,7 +47,7 @@ const handleChange = (e: any) => {
     ></SectionHeading>
     <div class="flex-1"></div>
     <div class="w-full">
-      <wd-button type="primary" :round="false" block>发布</wd-button>
+      <wd-button type="primary" :round="false" block @click="handleSubmit">发布</wd-button>
     </div>
   </div>
 </template>

+ 1 - 0
packages/app/src/types/uni-pages.d.ts

@@ -24,6 +24,7 @@ interface NavigateToOptions {
        "/pages/material/detail/index" |
        "/pages/material/recommend/index" |
        "/pages/mine/authentication/index" |
+       "/pages/mine/homepage/index" |
        "/pages/publish/cases/index" |
        "/pages/publish/moment/index" |
        "/pages/publish/tags/index" |

部分文件因为文件数量过多而无法显示