|  | @@ -1,51 +1,36 @@
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  defineComponent,
 | 
	
		
			
				|  |  | -  onMounted,
 | 
	
		
			
				|  |  | -  onUnmounted,
 | 
	
		
			
				|  |  | -  reactive,
 | 
	
		
			
				|  |  | -  ref,
 | 
	
		
			
				|  |  | -  nextTick
 | 
	
		
			
				|  |  | -} from 'vue';
 | 
	
		
			
				|  |  | +import { defineComponent, onMounted, onUnmounted, reactive, ref } from 'vue';
 | 
	
		
			
				|  |  |  import styles from './index.module.less';
 | 
	
		
			
				|  |  | -// import signinTips from './images/signin-tips.png';
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  Button,
 | 
	
		
			
				|  |  | -  CellGroup,
 | 
	
		
			
				|  |  | -  Field,
 | 
	
		
			
				|  |  | -  Picker,
 | 
	
		
			
				|  |  | -  Popup,
 | 
	
		
			
				|  |  | -  closeToast,
 | 
	
		
			
				|  |  | -  showToast,
 | 
	
		
			
				|  |  | -  Loading
 | 
	
		
			
				|  |  | -} from 'vant';
 | 
	
		
			
				|  |  | +import { closeToast } from 'vant';
 | 
	
		
			
				|  |  |  import { useRoute, useRouter } from 'vue-router';
 | 
	
		
			
				|  |  | -import threeMan from './images/update/three-man.png';
 | 
	
		
			
				|  |  |  import OWxTip from '@/components/m-wx-tip';
 | 
	
		
			
				|  |  | -import { browser, getHttpOrigin, getUrlCode } from '@/helpers/utils';
 | 
	
		
			
				|  |  | +import { browser, getHttpOrigin } from '@/helpers/utils';
 | 
	
		
			
				|  |  |  import qs from 'query-string';
 | 
	
		
			
				|  |  |  import request from '@/helpers/request';
 | 
	
		
			
				|  |  | -import { goWechatAuth, goWechatAuthTemp } from '@/state';
 | 
	
		
			
				|  |  | -import { useInterval, useIntervalFn } from '@vueuse/core';
 | 
	
		
			
				|  |  | -import MMessageTip from '@/components/m-message-tip';
 | 
	
		
			
				|  |  | -import TCPlayer from 'tcplayer.js';
 | 
	
		
			
				|  |  | +import { useInterval } from '@vueuse/core';
 | 
	
		
			
				|  |  |  import 'tcplayer.js/dist/tcplayer.css';
 | 
	
		
			
				|  |  |  import { _initVideo } from './initVideo';
 | 
	
		
			
				|  |  |  import nextBtn from './images/next_btn.png';
 | 
	
		
			
				|  |  |  import useWeChatShare from '@/hooks/useWeChatShare';
 | 
	
		
			
				|  |  | +import useAuthCode from '@/hooks/useAuthCode';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'intention-questionnaire',
 | 
	
		
			
				|  |  |    setup() {
 | 
	
		
			
				|  |  |      const route = useRoute();
 | 
	
		
			
				|  |  | -    const shareTitle = route.query.type === 'primarySchoolNo' ? '(小学)关于开展音乐(器乐)课堂数字化转型的调查问卷' :
 | 
	
		
			
				|  |  | -    route.query.type === 'juniorSchoolNo' ? '(初中)关于开展音乐(器乐)课堂数字化转型的调查问卷' :
 | 
	
		
			
				|  |  | -    '关于开展音乐(器乐)课堂数字化转型的调查问卷'
 | 
	
		
			
				|  |  | +    const shareTitle =
 | 
	
		
			
				|  |  | +      route.query.type === 'primarySchoolNo'
 | 
	
		
			
				|  |  | +        ? '(小学)关于开展音乐(器乐)课堂数字化转型的调查问卷'
 | 
	
		
			
				|  |  | +        : route.query.type === 'juniorSchoolNo'
 | 
	
		
			
				|  |  | +        ? '(初中)关于开展音乐(器乐)课堂数字化转型的调查问卷'
 | 
	
		
			
				|  |  | +        : '关于开展音乐(器乐)课堂数字化转型的调查问卷';
 | 
	
		
			
				|  |  |      const weChatShare = useWeChatShare(
 | 
	
		
			
				|  |  |        shareTitle,
 | 
	
		
			
				|  |  |        '科学的教育改变世界,科技的力量让音乐传播更远,让孩子奏响心中的乐章',
 | 
	
		
			
				|  |  |        window.location.origin + '/classroom-app/shareImg/question-share.png'
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    const authCode = useAuthCode();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // 页面定时
 | 
	
		
			
				|  |  |      const pageTimer = useInterval(1000, { controls: true });
 | 
	
		
			
				|  |  |      pageTimer.pause();
 | 
	
	
		
			
				|  | @@ -97,29 +82,25 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      onMounted(async () => {
 | 
	
		
			
				|  |  |        forms.meetingType = route.query.type || forms.meetingType;
 | 
	
		
			
				|  |  | -      forms.code = route.query.code || forms.code;
 | 
	
		
			
				|  |  | -      // nextTick(() => {
 | 
	
		
			
				|  |  | -      //   const videoRef: any = document.querySelector('#register-video')
 | 
	
		
			
				|  |  | -      //   const videoRef2: any = document.querySelector('#register-video2')
 | 
	
		
			
				|  |  | -      //   if(videoRef) {
 | 
	
		
			
				|  |  | -      //     const rect = videoRef?.getBoundingClientRect()
 | 
	
		
			
				|  |  | -      //     console.log(rect)
 | 
	
		
			
				|  |  | -      //     videoRef.style.height = rect.width / 16 * 9 + 'px'
 | 
	
		
			
				|  |  | -      //   }
 | 
	
		
			
				|  |  | -      //   if(videoRef2) {
 | 
	
		
			
				|  |  | -      //     const rect = videoRef2?.getBoundingClientRect()
 | 
	
		
			
				|  |  | -      //     console.log(rect)
 | 
	
		
			
				|  |  | -      //     videoRef2.style.height = rect.width / 16 * 9 + 'px'
 | 
	
		
			
				|  |  | -      //   }
 | 
	
		
			
				|  |  | -      // })
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  | -        // 判断是否获取微信code码
 | 
	
		
			
				|  |  | -        if (!forms.code  && browser().weixin) return;
 | 
	
		
			
				|  |  | +        const openId = await authCode.getOpenId(
 | 
	
		
			
				|  |  | +          getHttpOrigin() +
 | 
	
		
			
				|  |  | +            window.location.pathname +
 | 
	
		
			
				|  |  | +            '#' +
 | 
	
		
			
				|  |  | +            route.path +
 | 
	
		
			
				|  |  | +            '?' +
 | 
	
		
			
				|  |  | +            qs.stringify({
 | 
	
		
			
				|  |  | +              ...route.query
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +        // 获取微信分享签名
 | 
	
		
			
				|  |  | +        weChatShare.getAppSignature();
 | 
	
		
			
				|  |  | +        if (!browser().weixin) return;
 | 
	
		
			
				|  |  |          const { data } = await request.get(
 | 
	
		
			
				|  |  |            '/edu-app/open/meetingQuestionSetting/detail?type=' +
 | 
	
		
			
				|  |  |              forms.meetingType +
 | 
	
		
			
				|  |  | -            '&weChatCode=' +
 | 
	
		
			
				|  |  | -            forms.code
 | 
	
		
			
				|  |  | +            '&openId=' +
 | 
	
		
			
				|  |  | +            openId
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |          if (data) {
 | 
	
		
			
				|  |  |            forms.contentA = data.contentA || forms.contentA;
 | 
	
	
		
			
				|  | @@ -127,8 +108,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            forms.contentC = data.contentC || forms.contentC;
 | 
	
		
			
				|  |  |            forms.contentD = data.contentD || forms.contentD;
 | 
	
		
			
				|  |  |            forms.openId = data.openId || forms.openId;
 | 
	
		
			
				|  |  | -          sessionStorage.setItem('active-open-id', forms.openId);
 | 
	
		
			
				|  |  | -          sessionStorage.removeItem('isWxcode');
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          forms.contentShow = true;
 | 
	
		
			
				|  |  |        } catch {
 | 
	
	
		
			
				|  | @@ -138,53 +117,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        forms.player1 = _initVideo('one', forms, videoIntervalRef);
 | 
	
		
			
				|  |  |        forms.player2 = _initVideo('two', forms, videoIntervalRef2);
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    const getAppIdAndCode = async (url?: string) => {
 | 
	
		
			
				|  |  | -      try {
 | 
	
		
			
				|  |  | -        // const { data } = await request.get(
 | 
	
		
			
				|  |  | -        //   '/edu-app/open/paramConfig/wechatAppId'
 | 
	
		
			
				|  |  | -        // );
 | 
	
		
			
				|  |  | -        // // 判断是否有微信appId
 | 
	
		
			
				|  |  | -        // if (data) {
 | 
	
		
			
				|  |  | -        //   sessionStorage.setItem('isWxcode', '1');
 | 
	
		
			
				|  |  | -        //   closeToast();
 | 
	
		
			
				|  |  | -        //   goWechatAuth(data, url);
 | 
	
		
			
				|  |  | -        // }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        sessionStorage.setItem('isWxcode', '1');
 | 
	
		
			
				|  |  | -        closeToast()
 | 
	
		
			
				|  |  | -        goWechatAuthTemp('wx446ef0f1b0ad7338', url)
 | 
	
		
			
				|  |  | -      } catch (e) {
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -        console.log(e);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    if (browser().weixin) {
 | 
	
		
			
				|  |  | -      //授权
 | 
	
		
			
				|  |  | -      const openId = sessionStorage.getItem('active-open-id');
 | 
	
		
			
				|  |  | -      forms.openId = openId;
 | 
	
		
			
				|  |  | -      const code = getUrlCode();
 | 
	
		
			
				|  |  | -      const isWxcode = sessionStorage.getItem('isWxcode');
 | 
	
		
			
				|  |  | -      if (!code || isWxcode !== '1') {
 | 
	
		
			
				|  |  | -        const newUrl =
 | 
	
		
			
				|  |  | -          getHttpOrigin() +
 | 
	
		
			
				|  |  | -          window.location.pathname +
 | 
	
		
			
				|  |  | -          '#' +
 | 
	
		
			
				|  |  | -          route.path +
 | 
	
		
			
				|  |  | -          '?' +
 | 
	
		
			
				|  |  | -          qs.stringify({
 | 
	
		
			
				|  |  | -            ...route.query
 | 
	
		
			
				|  |  | -          });
 | 
	
		
			
				|  |  | -        getAppIdAndCode(newUrl);
 | 
	
		
			
				|  |  | -        return '';
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | -        forms.code = code;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 获取微信分享签名
 | 
	
		
			
				|  |  | -        weChatShare.getAppSignature()
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |      const nextSkip = () => {
 | 
	
		
			
				|  |  |        router.push({
 | 
	
		
			
				|  |  |          path: '/fill-questionnaire',
 | 
	
	
		
			
				|  | @@ -208,7 +140,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        forms.isPageHide = true;
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |      window.addEventListener('pagehide', onPageHide);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      onUnmounted(() => {
 | 
	
		
			
				|  |  |        window.removeEventListener('pageshow', onPageShow);
 | 
	
		
			
				|  |  |        window.removeEventListener('pagehide', onPageHide);
 |