소스 검색

添加页岩

lex 2 년 전
부모
커밋
d332c4f4bf

+ 1 - 1
src/school/manage-teacher/manage-teacher-register.tsx

@@ -66,7 +66,7 @@ export default defineComponent({
       state.btnLoading = true
       try {
         const forms = state.forms
-        await request.post('/api-school/open/schoolTeacherStudent/registerTeacher', {
+        await request.post('/api-school/open/schoolStaff/registerTeacher', {
           data: {
             ...forms,
             schoolId: state.id

BIN
src/school/orchestra/images/icon1.png


BIN
src/school/orchestra/images/icon2.png


BIN
src/school/orchestra/images/icon3.png


BIN
src/school/orchestra/images/icon4.png


+ 35 - 0
src/school/orchestra/modal/add-information.module.less

@@ -0,0 +1,35 @@
+.addInformation {
+  padding: 0 13px;
+
+  .title {
+    padding: 15px 0;
+    font-size: 16px;
+    font-weight: 500;
+    color: #333333;
+    display: flex;
+    align-items: center;
+  }
+
+  .icon {
+    display: inline-block;
+    width: 18px;
+    height: 18px;
+    margin-right: 6px;
+  }
+  .icon1 {
+    background: url('../images/icon1.png') no-repeat center center;
+    background-size: contain;
+  }
+  .icon2 {
+    background: url('../images/icon2.png') no-repeat center center;
+    background-size: contain;
+  }
+  .icon3 {
+    background: url('../images/icon3.png') no-repeat center center;
+    background-size: contain;
+  }
+  .icon4 {
+    background: url('../images/icon4.png') no-repeat center center;
+    background-size: contain;
+  }
+}

+ 40 - 0
src/school/orchestra/modal/add-information.tsx

@@ -0,0 +1,40 @@
+import OUpload from '@/components/o-upload'
+import { Button, Field } from 'vant'
+import { defineComponent } from 'vue'
+import styles from './add-information.module.less'
+
+export default defineComponent({
+  name: 'add-information',
+  emits: ['close'],
+  setup(props, { slots, attrs, emit }) {
+    return () => (
+      <div class={styles.addInformation}>
+        <div class={styles.title}>
+          <i class={[styles.icon, styles.icon1]}></i>请上传封面图片
+        </div>
+        <OUpload style={{ margin: 0, background: '#fff' }} />
+
+        <div class={styles.title}>
+          <i class={[styles.icon, styles.icon2]}></i>资讯标题
+        </div>
+        <Field placeholder="请输入资讯标题" />
+
+        <div class={styles.title}>
+          <i class={[styles.icon, styles.icon3]}></i>内容简介
+        </div>
+        <Field placeholder="请输入资讯内容简要概述" type="textarea" rows={2} />
+
+        <div class={styles.title}>
+          <i class={[styles.icon, styles.icon4]}></i>添加链接
+        </div>
+        <Field placeholder="请输入链接" />
+
+        <div class={'btnGroup'}>
+          <Button type="primary" size="large" block round>
+            发布资讯
+          </Button>
+        </div>
+      </div>
+    )
+  }
+})

+ 1 - 0
src/school/orchestra/orchestra-information.module.less

@@ -22,6 +22,7 @@
     font-weight: 500;
     color: #333333;
     line-height: 21px;
+    padding-bottom: 2px;
   }
   .content {
     font-size: 12px;

+ 87 - 22
src/school/orchestra/orchestra-information.tsx

@@ -1,35 +1,100 @@
-import { Button, Cell, Image } from 'vant'
-import { defineComponent } from 'vue'
+import OEmpty from '@/components/o-empty'
+import OPopup from '@/components/o-popup'
+import request from '@/helpers/request'
+import dayjs from 'dayjs'
+import { Button, Cell, Image, List } from 'vant'
+import { defineComponent, onMounted, reactive } from 'vue'
+import { useRoute } from 'vue-router'
+import AddInformation from './modal/add-information'
 import styles from './orchestra-information.module.less'
 
 export default defineComponent({
   name: 'orchestra-information',
   setup() {
+    const route = useRoute()
+    const state = reactive({
+      addStatus: false,
+      isLoading: false,
+      list: [] as any,
+      listState: {
+        dataShow: true, // 判断是否有数据
+        loading: false,
+        finished: false
+      },
+      params: {
+        page: 1,
+        rows: 20
+      }
+    })
+
+    const getList = async () => {
+      try {
+        if (state.isLoading) return
+        state.isLoading = true
+        const res = await request.post('/api-school/sysNewsInformation/page', {
+          data: {
+            ...state.params,
+            orchestraPhotoAlbumId: route.query.photoId
+          }
+        })
+        state.listState.loading = false
+        const result = res.data || {}
+        // 处理重复请求数据
+        if (state.list.length > 0 && result.pageNo === 1) {
+          return
+        }
+        const rows = result.rows || []
+        state.list = state.list.concat(rows)
+        state.listState.finished = result.current >= result.pages
+        state.params.page = result.current + 1
+        state.listState.dataShow = state.list.length > 0
+        state.isLoading = false
+      } catch {
+        state.listState.dataShow = false
+        state.listState.finished = true
+        state.isLoading = false
+      }
+    }
+
+    onMounted(() => {
+      getList()
+    })
     return () => (
       <div class={styles.information}>
-        <Button icon="plus" block class={styles.addPhone}>
+        <Button icon="plus" block class={styles.addPhone} onClick={() => (state.addStatus = true)}>
           添加资讯
         </Button>
 
-        <Cell center class={styles.cell}>
-          {{
-            icon: () => (
-              <Image
-                src="https://daya.ks3-cn-beijing.ksyuncs.com/12/1670329682459.png"
-                class={styles.img}
-              />
-            ),
-            title: () => (
-              <div>
-                <div class={[styles.title, 'van-ellipsis']}>2021世界大学排名公布</div>
-                <div class={[styles.content, 'van-multi-ellipsis--l2']}>
-                  2021世界大学排名公布,中国64所招音2021世界大学排名公布,中国64所招音
-                </div>
-                <div class={styles.time}>2021年10月15日</div>
-              </div>
-            )
-          }}
-        </Cell>
+        {state.listState.dataShow ? (
+          <List
+            v-model:loading={state.listState.loading}
+            finished={state.listState.finished}
+            finishedText=" "
+            onLoad={getList}
+            immediateCheck={false}
+          >
+            {state.list.map((item: any, index: number) => (
+              <Cell center class={styles.cell}>
+                {{
+                  icon: () => <Image src={item.coverImage} class={styles.img} />,
+                  title: () => (
+                    <div>
+                      <div class={[styles.title, 'van-ellipsis']}>{item.title}</div>
+                      <div class={[styles.content, 'van-multi-ellipsis--l2']}>{item.memo}</div>
+                      <div class={styles.time}>{dayjs(item.createBy).format('YYYY年MM月DD日')}</div>
+                    </div>
+                  )
+                }}
+              </Cell>
+            ))}
+          </List>
+        ) : (
+          <OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无资讯" />
+        )}
+
+        <OPopup v-model:modelValue={state.addStatus} style={{ background: '#f8f8f8' }}>
+          <AddInformation onClose={() => (state.addStatus = false)} />
+        </OPopup>
       </div>
     )
   }