Ver código fonte

fix(app): 任务

EvilDragon 4 meses atrás
pai
commit
3d2561c516

+ 2 - 2
packages/app/env/.env.development

@@ -12,9 +12,9 @@ VITE_SHOW_SOURCEMAP = true
 # VITE_SERVER_BASEURL = 'http://192.168.2.39:48080'
 # VITE_SERVER_BASEURL = 'http://192.168.0.157:48080'
 # 刘岁成
-# VITE_SERVER_BASEURL = 'http://192.168.2.38:48080'
+VITE_SERVER_BASEURL = 'http://192.168.2.38:48080'
 # 赵要军
 # VITE_SERVER_BASEURL = 'http://192.168.2.41:48080'
 # 姚逊涛
-VITE_SERVER_BASEURL = 'http://192.168.2.42:48080'
+# VITE_SERVER_BASEURL = 'http://192.168.2.42:48080'
 

+ 47 - 0
packages/app/src/core/libs/requests.ts

@@ -619,6 +619,53 @@ export const getMemberLevels = () =>
       createTime: number
     }[]
   >('/app-api/basicsetting/set-member-level-config/list')
+/**
+ * 获取设计师信息
+ */
+export const getDesignerInfo = (userId) =>
+  httpGet<
+    Partial<{
+      id: number
+      userId: number
+      brokerId: number
+      brokerName: string
+      status: string
+      authTime: number
+      points: number
+      headImgUrl: string
+      shareCount: number
+      viewCount: number
+      winCustomerCount: number
+      serviceYears: string
+      serviceCustomerCount: number
+      designFee: string
+      memberValidTime: number
+      personalIdentity: string
+      designDesc: string
+      followFocus: string
+      homePageUrl: string
+      sharePageUrl: string
+      retryStatus: number
+    }>
+  >('/app-api/member/designer/getDesignerInfo', { userId })
+/**
+ * 更新设计师信息
+ */
+export const updateDesignerInfo = (data) =>
+  httpPost<any>('/app-api/member/designer/updateDesignerInfo', data)
+/**
+ * 预约设计师
+ */
+export const reserveDesigner = (data: {
+  stylistId: number
+  stylistName: string
+  appointmentName: string
+  appointmentPhone: string
+}) => httpPost<any>('/app-api/member/designer/reserveDesigner', data)
+/**
+ * 通过ID获取用户信息
+ */
+export const getUserInfoById = (id) => httpGet('/app-api/member/user/getByUserId', { id })
 export const refreshToken = (refreshToken: string) =>
   httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
 export const httpGetMock = <T>(data: T) =>

+ 27 - 2
packages/app/src/pages/mine/components/tasks-card.vue

@@ -1,6 +1,9 @@
 <script setup lang="ts">
 import { Task } from '../../../core/models/moment'
 import { taskCenterBg } from '../../../core/libs/pngs'
+import { useRouter } from '../../../core/utils/router'
+
+const router = useRouter()
 defineProps({
   customClass: {
     type: String,
@@ -24,6 +27,20 @@ const styles = ref({
     background: `url(${taskCenterBg}) -9px -9px`,
   },
 })
+const taskExtends = ref([
+  {
+    id: 1,
+    action: () => router.push('/pages/publish/moment/index?circleType=1'),
+    completed: false,
+  },
+])
+const taskExtendsById = computed(() =>
+  taskExtends.value.reduce((acc, item) => {
+    acc[item.id] = item
+    return acc
+  }, {}),
+)
+onMounted(async () => {})
 </script>
 <template>
   <view class="relative w-full box-border">
@@ -36,7 +53,7 @@ const styles = ref({
           任务中心
         </div>
         <div class="flex-grow mt-4 overflow-auto">
-          <template v-for="({ taskKey, taskValue, status }, i) in items" :key="i">
+          <template v-for="({ taskKey, taskValue, status, id }, i) in items" :key="i">
             <div class="flex items-center my-6">
               <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
                 {{ taskKey }}
@@ -47,7 +64,15 @@ const styles = ref({
                 +{{ taskValue }}积分
               </div>
               <div class="flex-1"></div>
-              <wd-button type="info" plain size="small" :disabled="status">去完成</wd-button>
+              <wd-button
+                type="info"
+                plain
+                size="small"
+                :disabled="status"
+                @click="taskExtendsById[id]?.action()"
+              >
+                {{ taskExtendsById[id]?.completed ? '已完成' : '去完成' }}
+              </wd-button>
             </div>
           </template>
         </div>

+ 28 - 6
packages/app/src/pages/mine/homepage/consult/index.vue

@@ -6,21 +6,21 @@
 }
 </route>
 <script setup lang="ts">
-import MomentItem from '@/components/moment-item.vue'
-import { getByDictType, getCircles } from '../../../../core/libs/requests'
+import { getByDictType, getCircles, reserveDesigner } from '../../../../core/libs/requests'
 import { useUserStore } from '../../../../store'
 import { storeToRefs } from 'pinia'
 import { NetImages } from '../../../../core/libs/net-images'
-import PageHelper from '@/components/page-helper.vue'
 import BottomAppBar from '@/components/bottom-app-bar.vue'
 import { useRouter } from '../../../../core/utils/router'
 import NavbarEvo from '@/components/navbar-evo.vue'
+import { requestToast } from '../../../../core/utils/common'
 
 const router = useRouter()
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
 const id = ref()
 const tab = ref('2')
+const form = ref({ appointmentName: '', appointmentPhone: '' })
 const { data: circleTypes, run: getCircleType } = useRequest(() =>
   getByDictType('member_circle_type'),
 )
@@ -52,6 +52,20 @@ onLoad(async (query: { id: string }) => {
   await setCirclesData(tab.value)
   console.log(circleTypes.value)
 })
+const handleSubmit = async () => {
+  const { code } = await requestToast(
+    () =>
+      reserveDesigner({
+        ...form.value,
+        stylistId: id.value,
+        stylistName: '',
+      }),
+    { success: true, successTitle: '设计师预约成功' },
+  )
+  if (code === 0) {
+    form.value = { appointmentName: '', appointmentPhone: '' }
+  }
+}
 onShareAppMessage(() => ({ title: `${userInfo.value.nickname}` }))
 defineExpose({
   navBarFixed: false,
@@ -81,7 +95,11 @@ defineExpose({
           </div>
         </div>
         <div class="flex-1 flex items-center">
-          <wd-input placeholder="请填写您的真实姓名" no-border></wd-input>
+          <wd-input
+            placeholder="请填写您的真实姓名"
+            no-border
+            v-model="form.appointmentName"
+          ></wd-input>
         </div>
       </div>
 
@@ -94,14 +112,18 @@ defineExpose({
           </div>
         </div>
         <div class="flex-1 flex items-center">
-          <wd-input placeholder="请输入您的手机号" no-border></wd-input>
+          <wd-input
+            placeholder="请输入您的手机号"
+            no-border
+            v-model="form.appointmentPhone"
+          ></wd-input>
         </div>
       </div>
     </div>
     <BottomAppBar fixed placeholder>
       <div class="flex gap-7.5">
         <div class="flex-1">
-          <wd-button block :round="false">提交预约</wd-button>
+          <wd-button block :round="false" @click="handleSubmit">提交预约</wd-button>
         </div>
       </div>
     </BottomAppBar>

+ 5 - 2
packages/app/src/pages/mine/homepage/edit/index.vue

@@ -2,7 +2,6 @@
 { "style": { "navigationBarTitleText": "编辑", "navigationBarBackgroundColor": "#fff" } }
 </route>
 <script setup lang="ts">
-import BottomAppBar from '@/components/bottom-app-bar.vue'
 import Card from '@/components/card.vue'
 import SectionHeading from '@/components/section-heading.vue'
 
@@ -11,7 +10,11 @@ const action = ref(`${import.meta.env.VITE_SERVER_BASEURL}/app-api/infra/file/up
 const tab = ref()
 const tabs = ref([{ label: '商品优惠券' }, { label: '销售积分券' }])
 const data = ref([{}])
+const form = ref({})
 const handleChange = () => {}
+const handleSubmit = () => {
+  console.log(form.value)
+}
 </script>
 <template>
   <div class="flex-grow flex flex-col gap-6 px-3.5 py-6">
@@ -111,6 +114,6 @@ const handleChange = () => {}
     <!-- <BottomAppBar>
       
     </BottomAppBar> -->
-    <div class=""><wd-button block :round="false">保存</wd-button></div>
+    <div class=""><wd-button block :round="false" @click="handleSubmit">保存</wd-button></div>
   </div>
 </template>

+ 13 - 5
packages/app/src/pages/mine/homepage/index.vue

@@ -7,7 +7,7 @@
 </route>
 <script setup lang="ts">
 import MomentItem from '@/components/moment-item.vue'
-import { getByDictType, getCircles } from '../../../core/libs/requests'
+import { getCircles, getDesignerInfo } from '../../../core/libs/requests'
 import { useUserStore } from '../../../store'
 import { storeToRefs } from 'pinia'
 import { NetImages } from '../../../core/libs/net-images'
@@ -27,6 +27,9 @@ const tabs = ref([
   { label: '动态', value: '1' },
   { label: '视频', value: '0' },
 ])
+const { data: designerInfo, run: setDesignerInfo } = useRequest(() => getDesignerInfo(id.value), {
+  initialData: {},
+})
 onMounted(async () => {})
 function getVideoListByAccessToken(accessToken, openid) {
   const VIDEO_API = 'https://api.weixin.qq.com/wxa/business/getuservideo'
@@ -57,10 +60,11 @@ onLoad(async (query: { id: string }) => {
   } else {
     id.value = userInfo.value.userId
   }
+  await setDesignerInfo()
   // uni.request({
   //   url: '',
   // })
-  getVideoListByAccessToken(userInfo.value.accessToken, userInfo.value.openid)
+  // getVideoListByAccessToken(userInfo.value.accessToken, userInfo.value.openid)
 })
 onShareAppMessage(() => ({ title: `${userInfo.value.nickname}` }))
 defineExpose({
@@ -83,11 +87,15 @@ defineExpose({
             <div
               class="w-18 h-18 border-white border border-solid mx-3.5 rounded-full overflow-hidden"
             >
-              <wd-img width="100%" height="100%" :src="userInfo?.avatar"></wd-img>
+              <wd-img
+                width="100%"
+                height="100%"
+                :src="designerInfo?.headImgUrl || userInfo?.avatar"
+              ></wd-img>
             </div>
             <div>
               <div class="text-white text-2xl font-normal font-['PingFang_SC'] leading-normal">
-                {{ userInfo?.nickname }}
+                {{ designerInfo?.brokerName || userInfo?.nickname }}
               </div>
               <div>
                 <div
@@ -106,7 +114,7 @@ defineExpose({
       </div>
     </div>
     <div class="flex-grow flex flex-col bg-white rounded-t-2xl relative bottom-4">
-      <wd-tabs v-model="tab" @change="handleTabsChange" custom-class="bg-transparent!">
+      <wd-tabs v-model="tab" custom-class="bg-transparent!">
         <template v-for="({ label, value }, index) in tabs" :key="index">
           <wd-tab :title="label" :name="value"></wd-tab>
         </template>

+ 14 - 9
packages/app/src/pages/mine/index.vue

@@ -8,7 +8,7 @@ import CardMenu from '@/components/card-menu.vue'
 import SectionHeading from '@/components/section-heading.vue'
 import { designer, settled, treaty, vipBg } from '../../core/libs/pngs'
 import { integral, coupon, order, agent, setting, vip, scan } from '../../core/libs/svgs'
-import { getMemberUserInfo, getTasks } from '../../core/libs/requests'
+import { getDesignerInfo, getMemberUserInfo, getTasks } from '../../core/libs/requests'
 import { useUserStore } from '../../store'
 import { storeToRefs } from 'pinia'
 import { isEmpty } from 'radash'
@@ -23,6 +23,10 @@ const { data, run } = useRequest(getMemberUserInfo)
 const { data: taskData, run: getTaskData } = useRequest(() => getTasks({}), {
   initialData: { list: [] },
 })
+const { data: designerInfo, run: setDesignerInfo } = useRequest(
+  () => getDesignerInfo(userInfo.value.userId),
+  { initialData: {} },
+)
 const menus = ref([
   { title: '积分明细', icon: integral, path: '/pages/mine/points/index' },
   { title: '优惠券包', icon: coupon, path: '/pages/mine/coupons/index' },
@@ -75,7 +79,6 @@ const pieces = ref([
     path: '/pages/mine/convention/index',
   },
 ])
-
 const avatar = computed(() =>
   !isEmpty(userInfo.value.avatar) ? userInfo.value.avatar : 'https://via.placeholder.com/72x72',
 )
@@ -90,6 +93,9 @@ onShow(async () => {
       ...userInfo.value,
       ...data.value,
     })
+    await setDesignerInfo()
+    await getTaskData()
+    console.log(taskData.value)
   }
 })
 const handleToAuthentication = () => {
@@ -102,11 +108,7 @@ const handleToHomepage = () => {
 const handleMenuClick = (path) => {
   path && uni.navigateTo({ url: path })
 }
-onMounted(async () => {
-  // await run()
-  // console.log(data.value)
-  await getTaskData()
-})
+onMounted(async () => {})
 const navBarProps = ref({ customClass: 'bg-transparent!' })
 onPageScroll(({ scrollTop }: { scrollTop: number }) => {
   // console.log(scrollTop)
@@ -169,7 +171,8 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
       <div class="px-3.5 flex items-center">
         <div class="flex items-center">
           <div class="text-white text-base font-normal font-['PingFang_SC'] leading-normal mr-1">
-            0
+            <!-- 0 -->
+            {{ designerInfo?.shareCount }}
           </div>
           <div
             class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang_SC'] leading-normal"
@@ -183,6 +186,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
         <div class="flex items-center">
           <div class="text-white text-base font-normal font-['PingFang_SC'] leading-normal mr-1">
             0
+            <!-- {{designerInfo.c}} -->
           </div>
           <div
             class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang_SC'] leading-normal"
@@ -195,7 +199,8 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
 
         <div class="flex items-center">
           <div class="text-white text-base font-normal font-['PingFang_SC'] leading-normal mr-1">
-            0
+            <!-- 0 -->
+            {{ designerInfo?.viewCount }}
           </div>
           <div
             class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang_SC'] leading-normal"