Browse Source

单元评测

skyblued 2 years ago
parent
commit
bf516c45d2

+ 0 - 18
index.html

@@ -8,25 +8,7 @@
     <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
     <link href="/vant.css" rel="stylesheet">
 
-    <script type="text/javascript">
-      document.write(
-        unescape(
-          "%3Cspan id='cnzz_stat_icon_1279349593'%3E%3C/span%3E%3Cscript src='https://s9.cnzz.com/z_stat.php%3Fid%3D1279349593%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"
-        )
-      )
-    </script>
-    <script type="text/javascript">
-      // if (window.location.hostname !== 'mstuonline.dayaedu.com') {
-      //   document.write(unescape("%3Cscript%20src%3D%22https%3A//cdn.jsdelivr.net/npm/eruda@2.4.1/eruda.min.js%22%3E%3C/script%3E"))
-      // }
-      if (window._czc) {
-        window._czc.push(['_setAutoPageView', false])
-      }
-    </script>
     <script>
-      // if (window.location.hostname !== 'mstuonline.dayaedu.com') {
-      //   eruda.init()
-      // }
       if (window.navigator && navigator.serviceWorker) {
         navigator.serviceWorker.getRegistrations().then(function (registrations) {
           for (let registration of registrations) {

BIN
public/favicon.ico


+ 18 - 15
src/subpages/colexiu/buttons/evaluating.tsx

@@ -437,6 +437,21 @@ const submitEvaluationScore = async (data: any) => {
 /** 活动使用,只有在全部评测完成后才能提交,避免只是一小节就高分的情况 */
 const canSubmit = ref(false)
 
+/** 有单元测验时,存储分数缓存 */
+const setUnitReuslt = () => {
+  // 评测结束,如果是单元测验
+  const search = useOriginSearch()
+  if (search.unitId){
+    postMessage({
+      api: 'setCache',
+      content:{
+        key: 'h5-orchestra-unit',
+        value: (endResult.value as any)?.score || 0
+      }
+    })
+  }
+}
+
 const sendResult = (evt?: IPostMessage) => {
   console.log('评测返回',evt?.content)
   if (evt?.content) {
@@ -447,7 +462,7 @@ const sendResult = (evt?: IPostMessage) => {
       endResult.value = data
       evaluatingShow.value = true
       submitEvaluationScore(data)
-      // this.endloading = false
+      setUnitReuslt()
     } else if (evt?.content.header.commond === 'checkDone') {
       // 此处已经在校音中单独监听不做处理
     } else if (evt?.content.header.commond === 'checking') {
@@ -546,18 +561,6 @@ export default defineComponent({
       removeListenerMessage('cancelEvaluating', cancelEvaluating)
       removeListenerMessage('cloudTimeUpdae', onProgress)
       RuntimeUtils.event.off('tickEnd', start)
-      // 评测结束,如果是单元测验
-      const search = useOriginSearch()
-      if (search.unitId){
-        postMessage({
-          api: 'setCache',
-          content:{
-            key: 'h5-orchestra-unit',
-            value: (endResult.value as any)?.score || 0
-          }
-        })
-
-      }
     })
 
     expose({
@@ -575,7 +578,7 @@ export default defineComponent({
     return () => {
       return (
         <>
-          <Button
+          {/* <Button
             v-animate
             class={[styles.button, styles.hasText]}
             style={{ display: detailState.frozenMode ? 'none' : '' }}
@@ -588,7 +591,7 @@ export default defineComponent({
           >
             <ButtonIcon name="practise" />
             <span>练习</span>
-          </Button>
+          </Button> */}
           {/* 评测 */}
           <Evaluating data={endResult.value} />
 

+ 9 - 15
src/subpages/colexiu/buttons/icons/icon-back.svg

@@ -1,18 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg width="32px" height="33px" viewBox="0 0 32 33" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-    <title>编组 11</title>
+<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>切片</title>
     <defs>
         <linearGradient x1="-5.48380785e-12%" y1="5.38483651%" x2="100%" y2="100%" id="linearGradient-1">
             <stop stop-color="#FF9C63" offset="0%"></stop>
             <stop stop-color="#FF7144" offset="100%"></stop>
         </linearGradient>
         <circle id="path-2" cx="15" cy="15" r="15"></circle>
-        <filter x="-8.3%" y="-5.0%" width="116.7%" height="120.0%" filterUnits="objectBoundingBox" id="filter-3">
-            <feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
-            <feGaussianBlur stdDeviation="0.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
-            <feColorMatrix values="0 0 0 0 0.741508152   0 0 0 0 0.472091343   0 0 0 0 0.43649793  0 0 0 0.273082386 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
-        </filter>
-        <filter x="-10.0%" y="-6.7%" width="120.0%" height="123.3%" filterUnits="objectBoundingBox" id="filter-4">
+        <filter x="-6.7%" y="-6.7%" width="113.3%" height="113.3%" filterUnits="objectBoundingBox" id="filter-3">
             <feGaussianBlur stdDeviation="1.5" in="SourceAlpha" result="shadowBlurInner1"></feGaussianBlur>
             <feOffset dx="0" dy="1" in="shadowBlurInner1" result="shadowOffsetInner1"></feOffset>
             <feComposite in="shadowOffsetInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
@@ -26,8 +21,8 @@
                 <feMergeNode in="shadowMatrixInner2"></feMergeNode>
             </feMerge>
         </filter>
-        <polyline id="path-5" points="7.5 15 0 7.5 7.5 0"></polyline>
-        <filter x="-100.0%" y="-47.5%" width="335.0%" height="221.6%" filterUnits="objectBoundingBox" id="filter-6">
+        <polyline id="path-4" points="7.5 15 0 7.5 7.5 0"></polyline>
+        <filter x="-100.0%" y="-47.5%" width="335.0%" height="221.6%" filterUnits="objectBoundingBox" id="filter-5">
             <feMorphology radius="1.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
             <feOffset dx="1" dy="2" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
             <feMorphology radius="1.5" operator="erode" in="SourceAlpha" result="shadowInner"></feMorphology>
@@ -38,17 +33,16 @@
         </filter>
     </defs>
     <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
-        <g id="云教练主界面" transform="translate(-34.000000, -22.000000)">
+        <g id="云教练主界面" transform="translate(-35.000000, -22.000000)">
             <g id="编组-11" transform="translate(35.000000, 22.000000)">
                 <g id="椭圆形">
-                    <use fill="black" fill-opacity="1" filter="url(#filter-3)" xlink:href="#path-2"></use>
                     <use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
-                    <use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-2"></use>
+                    <use fill="black" fill-opacity="1" filter="url(#filter-3)" xlink:href="#path-2"></use>
                 </g>
                 <g id="图标/通用/返回" transform="translate(10.500000, 7.500000)" stroke-linecap="round" stroke-linejoin="round">
                     <g id="Stroke-1">
-                        <use fill="black" fill-opacity="1" filter="url(#filter-6)" xlink:href="#path-5"></use>
-                        <use stroke="#FFFFFF" stroke-width="3" xlink:href="#path-5"></use>
+                        <use fill="black" fill-opacity="1" filter="url(#filter-5)" xlink:href="#path-4"></use>
+                        <use stroke="#FFFFFF" stroke-width="3" xlink:href="#path-4"></use>
                     </g>
                 </g>
             </g>

+ 21 - 25
src/subpages/colexiu/buttons/index.module.less

@@ -12,9 +12,8 @@
   display: flex;
   align-items: center;
   justify-content: center;
-  height: calc(34px + var(--header-padding-top));
+  height: 28px;
   box-sizing: border-box;
-  overflow: hidden;
   padding: 0 16px;
   background: #fff;
 }
@@ -22,6 +21,9 @@
 .moreButton {
   display: flex;
   justify-content: flex-end;
+  .button {
+    margin: 0;
+  }
 }
 
 .centerButton {
@@ -51,32 +53,28 @@
   }
 }
 .button {
-  height: 23px;
+  height: auto;
+  line-height: normal;
   padding: 0;
   margin: 0;
   border: none;
   background: none;
   font-size: 0;
   &.hasText {
-    height: 27px;
-    border: none;
-    font-size: 12px;
-    margin: 0 4px;
+    color: #777;
+    font-size: 5px;
+    padding: 0 4.5px;
+    white-space: nowrap;
     img {
-      width: 15px;
-      height: 14px;
+      width: 13px;
+      height: 13px;
       display: block;
-      margin: auto;
-      margin-bottom: 1px;
     }
-    :global(.van-button__text) {
-      display: flex;
-      font-size: 5px;
-      color: #828282;
-      flex-direction: column;
-      > span {
-        display: block;
-        white-space: nowrap;
+    :global {
+      .van-button__text{
+        display: flex;
+        align-items: center;
+        flex-direction: column;
       }
     }
   }
@@ -130,10 +128,8 @@
   }
 }
 .backbtn {
-  display: inline-block;
-  padding: 0;
-  width: 32px;
-  height: 32px;
+  width: 15px;
+  height: 15px;
 }
 
 .speed {
@@ -331,9 +327,9 @@
   width: 32px;
   height: 14px;
   font-size: 6px;
-  background: linear-gradient(180deg, #FF975B, #FF6A3A);
+  background: linear-gradient(180deg, #ff975b, #ff6a3a);
   border-radius: 7px;
-  border: 1Px solid #ffffff;
+  border: 1px solid #ffffff;
   color: #fff;
   line-height: 12px;
   box-sizing: border-box;

+ 9 - 10
src/subpages/colexiu/buttons/index.tsx

@@ -21,14 +21,13 @@ import evastyles from '../popups/evaluating/index.module.less'
 import ModelWraper from './model-wraper'
 import Follow from '../popups/follow'
 import { switchProps } from '../popups/setting/evaluat'
+import iconBack from './icons/icon-back.svg'
 import iconFollowEndBtn from '../popups/follow/icons/icon-followEndBtn.png'
 import iconEvaluatingEnd from './icons/icon-evaluatingEnd.png'
 import store from 'store'
-import { useRoute } from 'vue-router'
 import styles from './index.module.less'
 export const confirmShow: Ref<boolean> = ref(false)
 
-
 export const startButtonShow = ref(true)
 
 export const evaluatingRef: Ref<any> = ref({})
@@ -153,8 +152,9 @@ export default defineComponent({
 
     //根据路由传参设置模式
     const useRouteSetModelType = () => {
-      if (route.query.modelType) {
-        // onChangeModelType(route.query.modelType as IModelType)
+      const modelType: IModelType = route.query.modelType as IModelType
+      if (modelType && modelType != 'evaluation') {
+        onChangeModelType(modelType)
       }
     }
     onMounted(() => {
@@ -214,10 +214,8 @@ export default defineComponent({
           }
         >
           <div class={styles.leftButton}>
-            {!route.query?.modelType && (
-              <Button class={[styles.button, styles.backbtn]} onClick={back}>
-                <ButtonIcon name="icon-back" />
-              </Button>
+            {route.query?.modelType && !route.query.unitId ? null : (
+              <img class={styles.backbtn} src={iconBack} onClick={back} />
             )}
             <div class={styles.titleWrap}>
               <div class={styles.title}>{detailState.activeDetail?.musicSheetName}</div>
@@ -236,7 +234,8 @@ export default defineComponent({
                   }}
                 ></Button>
               )}
-
+            </Transition>
+            <Transition name="finish">
               {followRef?.value?.data.start && (
                 <Button
                   style={{ backgroundImage: `url(${iconFollowEndBtn})` }}
@@ -250,7 +249,7 @@ export default defineComponent({
           </div>
           <div class={[styles.moreButton]} style={{ opacity: detailState.initRendered ? 1 : 0 }}>
             {/* route.query?.modelType 就不显示模式按钮  */}
-            {route.query?.modelType == 'practice' && modelType.value !== 'init' && !detailState.frozenMode && (
+            {!route.query?.modelType && modelType.value !== 'init' && !detailState.frozenMode && (
               <Button
                 data-step="m1"
                 class={[styles.button, styles.hasText]}

+ 2 - 4
src/subpages/colexiu/index.module.less

@@ -2,7 +2,6 @@
   --header-padding-top: 0.1px;
   height: 100vh;
   position: relative;
-  // padding: 12px 22px;
   box-sizing: border-box;
   height: 100vh;
   background-size: cover;
@@ -11,8 +10,7 @@
   font-size: 12px;
   font-weight: bold;
   text-align: center;
-  padding: 0 10px;
-  margin: 8px 0 0 0;
+  padding: 7px 0 0 0;
 }
 :global(.openCamera) {
   opacity: 0.7;
@@ -40,7 +38,7 @@
   height: 100vh;
   background-color: #fff;
   box-sizing: border-box;
-  padding-top: calc(35px + var(--header-padding-top));
+  padding-top: 28px;
   overflow: hidden;
   overflow-y: auto;
   &:global(.evaluating) {

+ 3 - 2
src/subpages/colexiu/index.tsx

@@ -251,9 +251,10 @@ export default defineComponent({
         modelType.value = 'evaluation'
       }
 
-      if (route.query.modelType) {
+      const _modelType: IModelType = route.query.modelType as IModelType
+      if (_modelType && _modelType == 'evaluation') {
         nextTick(() => {
-          onChangeModelType(route.query.modelType as IModelType)
+          onChangeModelType(_modelType)
         })
       }
     }

+ 9 - 5
src/subpages/colexiu/popups/evaluating/content.tsx

@@ -28,6 +28,7 @@ import iconShare from './icons/icon-share.svg'
 import iconUpload from './icons/icon-upload.svg'
 import { useOriginSearch } from '../../uses'
 import { onChangeModelType } from '../../buttons'
+import { useRoute } from 'vue-router'
 
 const scoreInfos: any = {
   1: {
@@ -70,6 +71,9 @@ export default defineComponent({
   },
   emits: ['restart', 'upload'],
   setup(props, { emit }) {
+    const route = useRoute()
+    /** 是否是单元测试 */
+    const isUnitTest = route.query.unitId
     const search = useOriginSearch()
     const shareShow = ref(false)
     const shareLoadedPngData = ref('')
@@ -232,7 +236,7 @@ export default defineComponent({
                 
               </div>
               <div class={styles.btns}>
-                {detailState.frozenMode ? null : (
+                {detailState.frozenMode || isUnitTest ? null : (
                   <Button onClick={() => {
                     runtime.evaluatingStatus = false
                     onChangeModelType('practice')
@@ -243,11 +247,11 @@ export default defineComponent({
                 <Button style={{ margin: '0 4px' }} onClick={() => emit('restart')}>
                   <img class={styles.btnIcon} src={TryIcon} />
                 </Button>
-                <Button onClick={viewReport}>
+                {isUnitTest ? null : <Button onClick={viewReport}>
                   <img class={styles.btnIcon} src={iconReport} alt="查看报告" />
-                </Button>
+                </Button>}
               </div>
-              <div class={styles.rigthBtns}>
+              {isUnitTest ? null : <div class={styles.rigthBtns}>
                 <div class={styles.skepBtn} onClick={() => emit('upload')}>
                   <img src={iconUpload} />
                   上传
@@ -256,7 +260,7 @@ export default defineComponent({
                   <img src={iconShare} />
                   分享
                 </div>
-              </div>
+              </div>}
             </div>
             <Popup
               teleport="body"

+ 5 - 0
src/subpages/colexiu/tips/index.tsx

@@ -6,10 +6,13 @@ import styles from './index.module.less'
 import Tip1 from './tip1'
 import Tip2 from './tip2'
 import { modelType } from '../buttons'
+import { useRoute } from 'vue-router'
 
 export default defineComponent({
   name: 'tips-step',
   setup(props, ctx) {
+    const route = useRoute()
+    const _modelType = route.query.modelType
     const tipShow = ref(false)
     const guide = reactive({
       tip1: false,
@@ -18,6 +21,7 @@ export default defineComponent({
     watch(
       () => state.initRendered,
       () => {
+        if (_modelType) return
         const isFirstTip = localStorage.getItem('isFirstTip')
         if (state.initRendered && modelType.value === 'init' && !isFirstTip) {
           tipShow.value = true
@@ -28,6 +32,7 @@ export default defineComponent({
       }
     )
     watch(modelType, () => {
+      if (_modelType) return
       console.log(modelType.value)
       const isFirstModel = localStorage.getItem('isFirstModel')
       if (state.initRendered && modelType.value === 'practice' && !isFirstModel) {