Browse Source

添加功能

lex 2 years ago
parent
commit
b79fe83438

+ 14 - 0
src/constant/index.ts

@@ -126,3 +126,17 @@ export const orderType = {
   VIP: '开通会员',
   ORCHESTRA: '乐团报名'
 }
+
+// 发送方式
+export const sendType = {
+  IMMEDIATELY: '即时发送',
+  SCHEDULED: '定时发送'
+}
+
+// 发送状态
+export const snedStatus = {
+  WAIT: "待发送",
+  SEND: "已发送",
+  DISABLE: "已停用",
+  EXPIRE: "已失效",
+}

+ 9 - 0
src/router/routes-common.ts

@@ -26,6 +26,7 @@ export const router = [
       title: '课程播放'
     }
   },
+
 ]
 
 // 不需要登录的路由
@@ -63,6 +64,14 @@ export const rootRouter = [
     }
   },
   {
+    path: '/preview-protocol',
+    name: 'preview-protocol',
+    component: () => import('@/views/preview-protocol/index'),
+    meta: {
+      title: '管乐团用户注册协议'
+    }
+  },
+  {
     path: '/:pathMatch(.*)*',
     component: () => import('@/views/404'),
     meta: {

+ 7 - 1
src/school/companion-teacher/companion-teacher-register.tsx

@@ -222,6 +222,10 @@ export default defineComponent({
       }
     })
 
+    const onPreview = () => {
+      window.open(window.location.origin + '/#/preview-protocol', '_blank')
+    }
+
     return () => (
       <div class={styles.register}>
         <div class={styles.title}>
@@ -483,7 +487,9 @@ export default defineComponent({
             >
               请认真阅读并勾选
             </span>
-            <span class={styles.c}>《乐团伴学老师注册协议》</span>
+            <span class={styles.c} onClick={onPreview}>
+              《乐团伴学老师注册协议》
+            </span>
           </div>
 
           <Button

+ 6 - 2
src/school/companion-teacher/index.tsx

@@ -195,14 +195,17 @@ export default defineComponent({
       }
     }
     const onShare = () => {
+      console.log('1')
       if (imgs.shareLoading) {
         return
       }
       imgs.shareLoading = true
       if (imgs.image) {
+        console.log('1')
         openShare()
       } else {
-        const container: any = document.getElementById(`share-preview-container`)
+        console.log('2')
+        const container: any = document.getElementById(`preview-container`)
         html2canvas(container, {
           allowTaint: true,
           useCORS: true,
@@ -211,7 +214,7 @@ export default defineComponent({
           .then(async (canvas) => {
             const url = canvas.toDataURL('image/png')
             imgs.image = url
-
+            console.log('4')
             openShare()
           })
           .catch(() => {
@@ -221,6 +224,7 @@ export default defineComponent({
       }
     }
     const openShare = () => {
+      console.log('5')
       const image = imgs.image
       setTimeout(() => {
         imgs.shareLoading = false

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

@@ -151,6 +151,10 @@ export default defineComponent({
       }
     })
 
+    const onPreview = () => {
+      window.open(window.location.origin + '/#/preview-protocol', '_blank')
+    }
+
     return () => (
       <div class={styles.register}>
         <div class={styles.title}>
@@ -286,7 +290,9 @@ export default defineComponent({
             >
               请认真阅读并勾选
             </span>
-            <span class={styles.c}>《乐团伴学老师注册协议》</span>
+            <span class={styles.c} onClick={onPreview}>
+              《乐团伴学老师注册协议》
+            </span>
           </div>
 
           <Button

+ 18 - 6
src/school/mass-message/create-message.tsx

@@ -1,5 +1,7 @@
 import OHeader from '@/components/o-header'
-import { Cell, CellGroup, Field, Uploader } from 'vant'
+import { sendType } from '@/constant'
+import { state } from '@/state'
+import { ActionSheet, Cell, CellGroup, Field, Uploader } from 'vant'
 import { defineComponent, reactive } from 'vue'
 import styles from './index.module.less'
 
@@ -7,15 +9,23 @@ export default defineComponent({
   name: 'create-message',
   setup() {
     const forms = reactive({
-      type: null,
-      content: null
+      sendStatus: false,
+      sendType: null as any,
+      textMessage: null
     })
     return () => (
       <div class={styles['create-message']}>
         <OHeader />
 
-        <CellGroup inset>
-          <Cell title="发送方式" value={''} isLink />
+        <CellGroup inset class={styles.cellGroup}>
+          {/* <Cell title="发送方式" value={sendType[forms.sendType]} isLink /> */}
+          <Field
+            inputAlign="right"
+            label="发送方式"
+            modelValue={sendType[forms.sendType]}
+            placeholder="请选择发送方式"
+            onClick={() => (forms.sendStatus = true)}
+          />
           <Cell title="发送时间" value={''} isLink />
           <Cell title="发送内容">
             {{
@@ -23,7 +33,7 @@ export default defineComponent({
                 <Field
                   style={{ padding: '0' }}
                   placeholder="请输入发送内容"
-                  v-model={forms.content}
+                  v-model={forms.textMessage}
                   type="textarea"
                   rows={3}
                 />
@@ -36,6 +46,8 @@ export default defineComponent({
 
           <Cell title="发送对象"></Cell>
         </CellGroup>
+
+        {/* <ActionSheet v-model:show={} /> */}
       </div>
     )
   }

+ 9 - 0
src/school/mass-message/index.module.less

@@ -46,3 +46,12 @@
     padding-bottom: 4px;
   }
 }
+
+.cellGroup {
+  margin-top: 12px;
+  :global {
+    .van-cell {
+      padding: 18px 15px;
+    }
+  }
+}

+ 38 - 33
src/school/mass-message/index.tsx

@@ -2,9 +2,10 @@ import OEmpty from '@/components/o-empty'
 import OHeader from '@/components/o-header'
 import OSearch from '@/components/o-search'
 import OSticky from '@/components/o-sticky'
+import { snedStatus } from '@/constant'
 import request from '@/helpers/request'
 import { Cell, CellGroup, Icon, List, Tab, Tabs } from 'vant'
-import { defineComponent, reactive } from 'vue'
+import { defineComponent, onMounted, reactive } from 'vue'
 import { useRouter } from 'vue-router'
 import styles from './index.module.less'
 
@@ -25,26 +26,30 @@ export default defineComponent({
     })
     const getList = async () => {
       try {
-        // const res = await request.post(url, {
-        //   data: {
-        //     ...params
-        //   }
-        // })
-        // state.loading = false
-        // const result = res.data || {}
+        const res = await request.post('/api-school/imMessageBatchSending/page', {
+          data: {
+            ...state.params
+          }
+        })
+        state.loading = false
+        const result = res.data || {}
         // 处理重复请求数据
-        // if (state.list.length > 0 && result.current === 1) {
-        //   return
-        // }
-        // state.list = state.list.concat(result.rows || [])
-        // state.finished = result.current >= result.totalPage
-        // state.params.page = result.current + 1
-        // state.dataShow = state.list.length > 0
+        if (state.list.length > 0 && result.current === 1) {
+          return
+        }
+        state.list = state.list.concat(result.rows || [])
+        state.finished = result.current >= result.totalPage
+        state.params.page = result.current + 1
+        state.dataShow = state.list.length > 0
       } catch {
-        // state.dataShow = false
-        // state.finished = true
+        state.dataShow = false
+        state.finished = true
       }
     }
+
+    onMounted(() => {
+      getList()
+    })
     return () => (
       <div class={styles.massMessage}>
         <OSticky position="top">
@@ -86,22 +91,22 @@ export default defineComponent({
             onLoad={getList}
             immediateCheck={false}
           >
-            <CellGroup inset>
-              <Cell class={styles.waitSend} titleStyle={{ flex: '1 auto' }}>
-                {{
-                  title: () => (
-                    <div class={styles.time}>
-                      <Icon name="clock-o" class={styles.clockO} />
-                      2022年10月31日 13:00:00
-                    </div>
-                  ),
-                  value: () => <span>待发送</span>
-                }}
-              </Cell>
-              <Cell valueClass={styles.messageContent}>
-                乐团今日的训练课程由于学校举办运动会延至明天进行,请同学们按时参加运动会,明天带好乐器下午三点准时到教室训练。最近天气转凉了,大家也记得多穿点衣服,不要冻感冒了。
-              </Cell>
-            </CellGroup>
+            {state.list.map((item: any) => (
+              <CellGroup inset>
+                <Cell class={styles.waitSend} titleStyle={{ flex: '1 auto' }}>
+                  {{
+                    title: () => (
+                      <div class={styles.time}>
+                        <Icon name="clock-o" class={styles.clockO} />
+                        {item.sendTime}
+                      </div>
+                    ),
+                    value: () => <span>{snedStatus[item.sendStatus]}</span>
+                  }}
+                </Cell>
+                <Cell valueClass={styles.messageContent}>{item.textMessage}</Cell>
+              </CellGroup>
+            ))}
           </List>
         ) : (
           <OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无群发消息" />

+ 13 - 4
src/student/trade-record/component/wait-pay.tsx

@@ -114,7 +114,10 @@ export default defineComponent({
       })
     }
 
-    const onConfirmOrder = async (item: any) => {}
+    const onConfirmOrder = async (item: any) => {
+      console.log(item)
+      // const { data } = await request.get('/api-student/userPaymentOrder/unpaid')
+    }
 
     const onDetails = (item: any) => {
       router.push({
@@ -192,7 +195,10 @@ export default defineComponent({
                           size="small"
                           color="#777777"
                           class={styles.smallBtn}
-                          onClick={(item: any) => onCancelOrder(item)}
+                          onClick={(e: any) => {
+                            e.stopPropagation()
+                            onCancelOrder(item)
+                          }}
                         >
                           取消订单
                         </Button>
@@ -200,9 +206,12 @@ export default defineComponent({
                           plain
                           round
                           size="small"
-                          color="#777777"
+                          type="primary"
                           class={styles.smallBtn}
-                          onClick={(item: any) => onConfirmOrder(item)}
+                          onClick={(e: any) => {
+                            e.stopPropagation()
+                            onConfirmOrder(item)
+                          }}
                         >
                           继续支付
                         </Button>

+ 41 - 0
src/views/preview-protocol/index.tsx

@@ -0,0 +1,41 @@
+import request from '@/helpers/request'
+import { state } from '@/state'
+import { defineComponent } from 'vue'
+
+// 预览协议 - 原生实名认证使用
+export default defineComponent({
+  name: 'preview-protocol',
+  data() {
+    return {
+      protocolHTML: '' as any
+    }
+  },
+  async mounted() {
+    try {
+      // 判断是否有协议内容
+      if (!this.protocolHTML) {
+        const { data } = await request.get(
+          state.platformApi + '/open/userContractRecord/queryLatestContractTemplate',
+          {
+            params: {
+              contractType: 'REGISTER'
+            }
+          }
+        )
+        this.protocolHTML = data.contractTemplateContent || ''
+      }
+    } catch {
+      //
+    }
+  },
+  render() {
+    return (
+      <div id="mProtocol">
+        <div
+          style="font-size: 14px;padding: 12px;color: #333;line-height: 1.4;"
+          v-html={this.protocolHTML}
+        ></div>
+      </div>
+    )
+  }
+})