Browse Source

Merge branch 'master' into online

lex 2 years ago
parent
commit
80c468ddc4

+ 17 - 5
src/components/o-sticky/index.tsx

@@ -29,6 +29,7 @@ export default defineComponent({
   data() {
     return {
       divStyle: {} as any,
+      heightV: 0,
       sectionStyle: {
         width: '100%',
         height: 'auto',
@@ -43,16 +44,27 @@ export default defineComponent({
       this.divStyle.bottom = this.offsetBottom || '0px'
     }
 
-    // nextTick(() => {
-    //   const { height } = useRect((this as any).$refs.div)
-    //   this.sectionStyle.height = `${height}px`
-    // })
     nextTick(() => {
       setTimeout(() => {
         const { height } = useRect((this as any).$refs.div)
+        console.log(height, this.position)
         this.sectionStyle.height = `${height}px`
+        this.heightV = height
         this.$emit('getHeight', height)
+        console.log(height, 'osticky height')
       }, 200)
+
+      // 为了处理头部第一次获取高度不对的问题
+      setTimeout(() => {
+        const { height } = useRect((this as any).$refs.div2)
+        console.log(height, this.position, 'next')
+        if (height !== this.heightV && this.position === 'top') {
+          this.sectionStyle.height = `${height}px`
+          this.heightV = height
+          this.$emit('getHeight', height)
+          console.log(height, 'next osticky height')
+        }
+      }, 1000)
     })
   },
   watch: {
@@ -75,7 +87,7 @@ export default defineComponent({
           ]}
           style={[this.divStyle, this.sectionStyle]}
         >
-          {this.$slots.default && this.$slots.default()}
+          <div ref="div2">{this.$slots.default && this.$slots.default()}</div>
         </div>
       </div>
     )

+ 3 - 5
src/school/mass-message/create-message.tsx

@@ -172,8 +172,8 @@ export default defineComponent({
         const tempAttachments: any = []
         forms.attachments.forEach((item: any) => {
           tempAttachments.push({
-            imgUrl: item.url,
-            imgMessage: item.url
+            imgUrl: item,
+            imgMessage: item
           })
         })
 
@@ -274,9 +274,7 @@ export default defineComponent({
         const attachments = data.attachments || []
         const tempAtt: any = []
         attachments.forEach((item: any) => {
-          tempAtt.push({
-            url: item.imgUrl || item.imgMessage
-          })
+          tempAtt.push(item.imgUrl || item.imgMessage)
         })
         forms.attachments = tempAtt
       } catch (e: any) {

+ 1 - 1
src/school/mass-message/select-sned.tsx

@@ -75,7 +75,7 @@ export default defineComponent({
         style={{ background: '#f6f6f6', minHeight: '100vh' }}
         id="select-send-message"
       >
-        <Tabs sticky lineWidth={20} lineHeight={4} v-model:active={state.tabValue} swipeable>
+        <Tabs sticky lineWidth={20} lineHeight={4} v-model:active={state.tabValue}>
           <Tab title="班级列表" name="class">
             <ClassList
               height={state.height}

+ 2 - 2
src/school/orchestra/compontent/information.tsx

@@ -254,9 +254,9 @@ export default defineComponent({
         })
         state.currentData = [year - 1 + '']
         state.actionText = '下学期'
-        state.actionType = 'up'
+        state.actionType = 'down'
         state.actionTerm.forEach((item: any) => {
-          if (item.value === 'up') {
+          if (item.value === 'down') {
             item.selected = true
           } else {
             item.selected = false

+ 10 - 7
src/school/orchestra/compontent/plan.tsx

@@ -92,6 +92,7 @@ export default defineComponent({
 
     const onConfirmDate = (date: any) => {
       state.currentData = date.selectedValues
+
       const year = Number(state.currentData[0]) + 1
       if (state.actionType === 'up') {
         state.params.startTime = dayjs(year + startTime.value).format('YYYY-MM-DD HH:mm:ss')
@@ -149,12 +150,15 @@ export default defineComponent({
     }
 
     onMounted(async () => {
-      const sysStartTime = dayjs(dayjs().year() + startTime.value).format('YYYY-MM-DD HH:mm:ss')
-      const sysEndTime = dayjs(dayjs().year() + endTime.value).format('YYYY-MM-DD HH:mm:ss')
+      const sysStartTime = dayjs(dayjs().year() + startTime.value).format('YYYY-MM-DD')
+      const sysEndTime = dayjs(dayjs().year() + endTime.value).format('YYYY-MM-DD')
       const nowTime = dayjs().format('YYYY-MM-DD')
-      const before = dayjs(nowTime).isSameOrBefore(dayjs(sysStartTime))
-      const after = dayjs(nowTime).isSameOrBefore(dayjs(sysEndTime))
+      console.log(nowTime, sysStartTime)
+      const before = dayjs(nowTime).isBefore(dayjs(sysStartTime))
+      const after = dayjs(nowTime).isBefore(dayjs(sysEndTime))
       const year = dayjs().year()
+
+      // console.log(before, after, year)
       if (before && after) {
         state.currentData = [year - 1 + '']
         state.params.startTime = dayjs(year - 1 + startTime.value).format('YYYY-MM-DD HH:mm:ss')
@@ -191,12 +195,11 @@ export default defineComponent({
             item.color = ''
           }
         })
-
         state.currentData = [year - 1 + '']
         state.actionText = '下学期'
-        state.actionType = 'up'
+        state.actionType = 'down'
         state.actionTerm.forEach((item: any) => {
-          if (item.value === 'up') {
+          if (item.value === 'down') {
             item.selected = true
           } else {
             item.selected = false

+ 40 - 0
src/school/school-detail/index.module.less

@@ -191,3 +191,43 @@
   top: -9999px;
   left: -9999px;
 }
+
+.codeContainer {
+  .close {
+    position: absolute;
+    top: 12px;
+    right: 15px;
+  }
+  .codeBottom {
+    position: relative;
+    margin-top: 32px;
+    background: #ffffff;
+    border-radius: 20px 20px 0px 0px;
+    padding-bottom: 10px;
+  }
+  .title {
+    font-size: 16px;
+    font-weight: 600;
+    color: #333333;
+    line-height: 22px;
+    padding: 15px 15px 0;
+    i {
+      display: inline-block;
+      margin-right: 6px;
+      width: 4px;
+      height: 12px;
+      background: #ff8057;
+      border-radius: 2px;
+    }
+  }
+  .shareImg {
+    width: 47px;
+    height: 47px;
+  }
+  .shareText {
+    padding-top: 6px;
+    font-size: 14px;
+    color: #333333;
+    line-height: 20px;
+  }
+}

+ 71 - 3
src/school/school-detail/index.tsx

@@ -1,6 +1,6 @@
 import OHeader from '@/components/o-header'
 import OSticky from '@/components/o-sticky'
-import { Tabs, Tab, showToast, Icon } from 'vant'
+import { Tabs, Tab, showToast, Icon, Popup, Grid, GridItem, Image } from 'vant'
 import { defineComponent, reactive, ref, onMounted, onDeactivated } from 'vue'
 import eidtIcon from './images/eidt-icon.png'
 import styles from './index.module.less'
@@ -10,6 +10,9 @@ import { useRouter } from 'vue-router'
 import { state as globalState } from '@/state'
 import TeacherItem from './modals/teacher-item'
 import { schoolSystem } from '@/constant/index'
+import iconCallPhone from '@common/images/icon-call-phone.png'
+import iconCallMessage from '@common/images/icon-call-message.png'
+import { postMessage } from '@/helpers/native-message'
 import request from '@/helpers/request'
 import OEmpty from '@/components/o-empty'
 export default defineComponent({
@@ -20,7 +23,9 @@ export default defineComponent({
       list: [],
       info: {} as any,
       heightV: 0 as number,
-      scrollTop: 0 as number
+      scrollTop: 0 as number,
+      showMessage: false,
+      selectItem: {} as any
     })
     const getSchoolDetail = async () => {
       const schoolId = (globalState.user.data.schoolInfos || [])
@@ -138,7 +143,13 @@ export default defineComponent({
             {state.list.length > 0 ? (
               <div>
                 {state.list.map((item) => (
-                  <TeacherItem item={item}></TeacherItem>
+                  <TeacherItem
+                    item={item}
+                    onToMsg={(item: any) => {
+                      state.selectItem = item
+                      state.showMessage = true
+                    }}
+                  ></TeacherItem>
                 ))}
               </div>
             ) : (
@@ -146,6 +157,63 @@ export default defineComponent({
             )}
           </div>
         </div>
+
+        <Popup
+          v-model:show={state.showMessage}
+          position="bottom"
+          style={{ background: 'transparent' }}
+        >
+          <div class={styles.codeContainer}>
+            <div class={styles.codeBottom}>
+              <Icon
+                name="cross"
+                size={22}
+                class={styles.close}
+                color="#666"
+                onClick={() => (state.showMessage = false)}
+              />
+
+              <h3 class={styles.title}>
+                <i></i>联系方式
+              </h3>
+              <Grid columnNum={2} border={false}>
+                <GridItem
+                  onClick={() => {
+                    postMessage({
+                      api: 'joinChatGroup',
+                      content: {
+                        type: 'single', // single 单人 multi 多人
+                        id: state.selectItem.imUserId
+                      }
+                    })
+                    state.showMessage = false
+                  }}
+                >
+                  {{
+                    icon: () => <Image class={styles.shareImg} src={iconCallMessage} />,
+                    text: () => <div class={styles.shareText}>发送消息</div>
+                  }}
+                </GridItem>
+                <GridItem
+                  onClick={() => {
+                    postMessage({
+                      api: 'callPhone',
+                      content: {
+                        phone: state.selectItem.phone
+                      }
+                    })
+                    state.showMessage = false
+                  }}
+                >
+                  {{
+                    icon: () => <Image class={styles.shareImg} src={iconCallPhone} />,
+                    text: () => <div class={styles.shareText}>拨打电话</div>
+                  }}
+                </GridItem>
+              </Grid>
+            </div>
+          </div>
+        </Popup>
       </>
     )
   }

+ 22 - 16
src/school/school-detail/modals/teacher-item.tsx

@@ -9,26 +9,32 @@ import { attType } from '@/constant'
 
 export default defineComponent({
   props: ['item'],
+  emits: ['toMsg'],
   name: 'teacher-item',
-  setup(props) {
+  setup(props, { emit }) {
     const router = useRouter()
-    const gotoMsg = async () => {
-      try {
-        await postMessage({
-          api: 'joinChatGroup',
-          content: {
-            type: 'single', // single 单人 multi 多人
-            id: props.item.imUserId
-          }
-        })
-      } catch (e) {
-        showToast('发起聊天失败')
-      }
-    }
-    console.log(props.item)
+    // const gotoMsg = async () => {
+    //   try {
+    //     await postMessage({
+    //       api: 'joinChatGroup',
+    //       content: {
+    //         type: 'single', // single 单人 multi 多人
+    //         id: props.item.imUserId
+    //       }
+    //     })
+    //   } catch (e) {
+    //     showToast('发起聊天失败')
+    //   }
+    // }
+    // console.log(props.item)
     return () => (
       <>
-        <div class={styles.itemWrap} onClick={gotoMsg}>
+        <div
+          class={styles.itemWrap}
+          onClick={() => {
+            emit('toMsg', props.item)
+          }}
+        >
           <div class={styles.topWrap}>
             <div class={styles.itemLeft}>
               <div class={styles.headerWrap}>

+ 1 - 0
src/school/train-planning/index.tsx

@@ -36,6 +36,7 @@ export default defineComponent({
         <OSticky
           position="top"
           onGetHeight={(height: any) => {
+            console.log(height, 'height')
             heightV.value = height
             document.documentElement.style.setProperty('--header-height', height + 'px')
           }}

+ 18 - 14
src/views/courseList/index.tsx

@@ -77,17 +77,24 @@ export default defineComponent({
       }
 
       if (!item.hasCache) {
-        if (browserInfo.isStudent || route.query.isdev) {
-          const hasVip = handleCheckVip()
-          if (!hasVip) return
-          try {
-            await showConfirmDialog({
-              message: '当前课程没有缓存,是否缓存?'
-            })
-          } catch (error) {
-            gotoPlay(item)
-            return
-          }
+        const hasVip = handleCheckVip()
+        if (!hasVip) return
+        // 下载中不提示
+        if (item.downloadStatus == 1) {
+          return
+        }
+        // 重新下载
+        if (item.downloadStatus == 3) {
+          downCatch(item)
+          return
+        }
+        try {
+          await showConfirmDialog({
+            message: '当前课程没有缓存,是否缓存?'
+          })
+        } catch (error) {
+          gotoPlay(item)
+          return
         }
         downCatch(item)
         return
@@ -231,9 +238,6 @@ export default defineComponent({
             )
           })}
         </Grid>
-        {/* <Button onClick={() => {
-          location.href = 'http://192.168.3.114:1000/teacher.html#/coursewarePlay?id=1613426640725217281'
-        }}>胜强测试老师端</Button> */}
         {!data.loading && !data.list.length && <OEmpty tips="暂无内容" />}
       </div>
     )

+ 1 - 1
src/views/information/index.tsx

@@ -114,7 +114,7 @@ export default defineComponent({
                   title: () => (
                     <>
                       <div class={[styles.title, 'van-ellipsis']}>{item.title}</div>
-                      <div class={[styles.content, 'van-multi-ellipsis--l2']}>{item.memo}</div>
+                      <div class={[styles.content, 'van-multi-ellipsis--l2']}>{item.summary}</div>
 
                       <div class={styles.time}>
                         {item.createTime ? dayjs(item.createTime).format('YYYY年MM月DD日') : ''}

+ 44 - 34
src/views/unit-test/model/drag-question/index.tsx

@@ -283,40 +283,50 @@ export default defineComponent({
                 ))}
             </div> */}
 
-            <Draggable
-              v-model:modelValue={state.options}
-              itemKey="itemIndex"
-              // componentData={{
-              //   on: {
-              //     change: () => {
-              //       console.log('input')
-              //     }
-              //   }
-              // }}
-            >
-              {{
-                item: (element: any) => {
-                  const item = element.element
-                  return (
-                    <div class={styles.itemsContainer}>
-                      {item.leftType === AnswerType.TXT && (
-                        <Tag class={[styles.items]} data-id={item.itemIndex}>
-                          {item.leftValue}
-                        </Tag>
-                      )}
-                      {item.leftType === AnswerType.IMAGE && (
-                        <Image
-                          src={item.leftValue}
-                          data-id={item.itemIndex}
-                          class={[styles.imgs, 'van-hairline--surround']}
-                          fit="cover"
-                        />
-                      )}
-                    </div>
-                  )
-                }
-              }}
-            </Draggable>
+            {props.readOnly ? (
+              state.options.map((item: any) => (
+                <div class={styles.itemsContainer}>
+                  {item.leftType === AnswerType.TXT && (
+                    <Tag class={[styles.items]} data-id={item.itemIndex}>
+                      {item.leftValue}
+                    </Tag>
+                  )}
+                  {item.leftType === AnswerType.IMAGE && (
+                    <Image
+                      src={item.leftValue}
+                      data-id={item.itemIndex}
+                      class={[styles.imgs, 'van-hairline--surround']}
+                      fit="cover"
+                    />
+                  )}
+                </div>
+              ))
+            ) : (
+              <Draggable v-model:modelValue={state.options} itemKey="itemIndex">
+                {{
+                  item: (element: any) => {
+                    const item = element.element
+                    return (
+                      <div class={styles.itemsContainer}>
+                        {item.leftType === AnswerType.TXT && (
+                          <Tag class={[styles.items]} data-id={item.itemIndex}>
+                            {item.leftValue}
+                          </Tag>
+                        )}
+                        {item.leftType === AnswerType.IMAGE && (
+                          <Image
+                            src={item.leftValue}
+                            data-id={item.itemIndex}
+                            class={[styles.imgs, 'van-hairline--surround']}
+                            fit="cover"
+                          />
+                        )}
+                      </div>
+                    )
+                  }
+                }}
+              </Draggable>
+            )}
           </div>
         </div>
         {props.showAnalysis && (