Kaynağa Gözat

feat(classmates): 同学荟

EvilDragon 6 ay önce
ebeveyn
işleme
f433d8c822

+ 5 - 1
src/components/section-heading.vue

@@ -1,7 +1,7 @@
 <script lang="ts" setup>
 import { right } from '@/core/libs/svgs'
 
-defineProps({
+const props = defineProps({
   customClass: {
     type: String,
     default: () => '',
@@ -16,6 +16,9 @@ defineProps({
     required: false,
   },
 })
+const handleMore = async () => {
+  await uni.navigateTo({ url: props.path })
+}
 </script>
 <template>
   <view class="flex justify-between items-center" :class="[customClass]">
@@ -25,6 +28,7 @@ defineProps({
     <div
       v-if="path"
       class="text-right text-black/30 text-sm font-normal font-['PingFang SC'] leading-tight"
+      @click="handleMore"
     >
       查看全部
       <wd-img :src="right" width="10" height="10"></wd-img>

+ 16 - 0
src/core/libs/requests.ts

@@ -85,5 +85,21 @@ export const getMoment = () =>
       },
     ],
   })
+export const getClassmates = () =>
+  httpGetMock<any[]>([
+    {
+      avatar: 'https://via.placeholder.com/35x35',
+      nickname: '苏小萌',
+      level: '0',
+    },
+    {
+      avatar: 'https://via.placeholder.com/35x35',
+      nickname: '苏小萌',
+      level: '0',
+    },
+    {
+      avatar: 'https://via.placeholder.com/35x35',
+    },
+  ])
 export const httpGetMock = <T>(data: T) =>
   new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))

+ 8 - 0
src/pages.json

@@ -87,6 +87,14 @@
       }
     },
     {
+      "path": "pages/home/classmates/index",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "同学荟",
+        "navigationBarBackgroundColor": "#fff"
+      }
+    },
+    {
       "path": "pages/home/mall/index",
       "type": "page",
       "style": {

+ 20 - 0
src/pages/home/classmates/index.vue

@@ -0,0 +1,20 @@
+<route lang="yaml">
+style:
+  navigationBarTitleText: 同学荟
+  navigationBarBackgroundColor: '#fff'
+</route>
+<script setup lang="ts">
+import { getClassmates } from '@/core/libs/requests'
+import ClassItem from '../components/class-item.vue'
+
+const { data, run } = useRequest(getClassmates)
+onMounted(run)
+</script>
+<template>
+  <view class="mx-3.5">
+    <template v-for="it of data" :key="it.id">
+      <ClassItem></ClassItem>
+    </template>
+    <wd-loadmore custom-class="loadmore" state="finished" />
+  </view>
+</template>

+ 5 - 1
src/pages/home/study-tour/index.vue

@@ -88,7 +88,11 @@ import ClassItem from '../components/class-item.vue'
         参与专业的研讨会和工作坊,与同行们分享见解、碰撞思维火花,进一步深化对设计的理解。
       </div>
     </card>
-    <section-heading custom-class="my-6" title="同学荟"></section-heading>
+    <section-heading
+      custom-class="my-6"
+      title="同学荟"
+      path="/pages/home/classmates/index"
+    ></section-heading>
     <class-item></class-item>
     <class-item></class-item>
     <section-heading custom-class="my-6" title="设计圈"></section-heading>

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

@@ -10,6 +10,7 @@ interface NavigateToOptions {
        "/pages/messages/index" |
        "/pages/mine/index" |
        "/pages/publish/index" |
+       "/pages/home/classmates/index" |
        "/pages/home/mall/index" |
        "/pages/home/moment/index" |
        "/pages/home/offline-activity/index" |