|  | @@ -27,7 +27,9 @@ import iconClose from './images/icon-close.png'
 | 
	
		
			
				|  |  |  import topBanner1 from './images/top-banner.png'
 | 
	
		
			
				|  |  |  import { checkPhone } from '@/helpers/validate'
 | 
	
		
			
				|  |  |  import dayjs from 'dayjs'
 | 
	
		
			
				|  |  | -import { browser } from '@/helpers/utils'
 | 
	
		
			
				|  |  | +import { browser, getUrlCode } from '@/helpers/utils'
 | 
	
		
			
				|  |  | +import OUpload from '@/components/o-upload'
 | 
	
		
			
				|  |  | +import qs from 'query-string'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'companion-teacher-register',
 | 
	
	
		
			
				|  | @@ -42,6 +44,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        name: route.query.name,
 | 
	
		
			
				|  |  |        t: route.query.t as any, // 过期时间
 | 
	
		
			
				|  |  |        qrCodeStatus: false, // 二维码是否失效
 | 
	
		
			
				|  |  | +      qrCodeMessage: '',
 | 
	
		
			
				|  |  |        pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
 | 
	
		
			
				|  |  |        columns: [] as any,
 | 
	
		
			
				|  |  |        pickerType: null, // 下拉类型
 | 
	
	
		
			
				|  | @@ -50,7 +53,9 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          phone: null,
 | 
	
		
			
				|  |  |          gender: 1,
 | 
	
		
			
				|  |  |          idCardNo: null,
 | 
	
		
			
				|  |  | -        smsValidCode: ''
 | 
	
		
			
				|  |  | +        smsValidCode: '',
 | 
	
		
			
				|  |  | +        idcardFrontImg: '',
 | 
	
		
			
				|  |  | +        idcardBackImg: '' // 身份证反面照
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        btnLoading: false,
 | 
	
		
			
				|  |  |        checkPhone: false,
 | 
	
	
		
			
				|  | @@ -60,16 +65,17 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        countDownTime: 120, // 倒计时时间
 | 
	
		
			
				|  |  |        // countDownRef: null as any, // 倒计时实例
 | 
	
		
			
				|  |  |        imgCodeStatus: false,
 | 
	
		
			
				|  |  | -      showPopup: false
 | 
	
		
			
				|  |  | +      showPopup: false,
 | 
	
		
			
				|  |  | +      code: ''
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const onSubmit = async () => {
 | 
	
		
			
				|  |  |        if (state.qrCodeStatus) {
 | 
	
		
			
				|  |  |          showDialog({
 | 
	
		
			
				|  |  |            title: '提示',
 | 
	
		
			
				|  |  | -          message: '二维码已失效',
 | 
	
		
			
				|  |  | +          message: state.qrCodeMessage,
 | 
	
		
			
				|  |  |            theme: 'round-button',
 | 
	
		
			
				|  |  | -          confirmButtonColor: '#64A9FF'
 | 
	
		
			
				|  |  | +          confirmButtonColor: '#ff8057'
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          return
 | 
	
		
			
				|  |  |        }
 | 
	
	
		
			
				|  | @@ -122,10 +128,28 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        // 判断是否是微信,只能微信中打开
 | 
	
		
			
				|  |  | -      // if (!browser().weixin) {
 | 
	
		
			
				|  |  | -      //   state.showPopup = true
 | 
	
		
			
				|  |  | -      //   return
 | 
	
		
			
				|  |  | -      // }
 | 
	
		
			
				|  |  | +      if (!browser().weixin) {
 | 
	
		
			
				|  |  | +        state.showPopup = true
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        //授权
 | 
	
		
			
				|  |  | +        const code = getUrlCode()
 | 
	
		
			
				|  |  | +        if (!code) {
 | 
	
		
			
				|  |  | +          const newUrl =
 | 
	
		
			
				|  |  | +            window.location.origin +
 | 
	
		
			
				|  |  | +            window.location.pathname +
 | 
	
		
			
				|  |  | +            '#' +
 | 
	
		
			
				|  |  | +            route.path +
 | 
	
		
			
				|  |  | +            '?' +
 | 
	
		
			
				|  |  | +            qs.stringify({
 | 
	
		
			
				|  |  | +              ...route.query
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +          getAppIdAndCode(newUrl)
 | 
	
		
			
				|  |  | +          return
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          state.code = code
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        // t: route.query.t, // 过期时间
 | 
	
		
			
				|  |  |        try {
 | 
	
	
		
			
				|  | @@ -138,13 +162,15 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          if (res.code === 999) {
 | 
	
		
			
				|  |  | -          state.qrCodeStatus = true
 | 
	
		
			
				|  |  |            showDialog({
 | 
	
		
			
				|  |  |              title: '提示',
 | 
	
		
			
				|  |  |              message: res.message,
 | 
	
		
			
				|  |  |              theme: 'round-button',
 | 
	
		
			
				|  |  |              confirmButtonColor: '#64A9FF'
 | 
	
		
			
				|  |  |            })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          state.qrCodeStatus = true
 | 
	
		
			
				|  |  | +          state.qrCodeMessage = res.message
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } catch (e: any) {
 | 
	
		
			
				|  |  |          //
 | 
	
	
		
			
				|  | @@ -200,11 +226,44 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const onPreview = () => {
 | 
	
		
			
				|  |  | -      window.open(
 | 
	
		
			
				|  |  | -        window.location.origin + window.location.pathname + '#/preview-protocol',
 | 
	
		
			
				|  |  | -        '_blank'
 | 
	
		
			
				|  |  | -      )
 | 
	
		
			
				|  |  | +    const getAppIdAndCode = async (url?: string) => {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const { data } = await request.get('/api-school/open/paramConfig/wechatAppId')
 | 
	
		
			
				|  |  | +        // 判断是否有微信appId
 | 
	
		
			
				|  |  | +        if (data) {
 | 
	
		
			
				|  |  | +          closeToast()
 | 
	
		
			
				|  |  | +          goAuth(data, url)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } catch {
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    const goAuth = (wxAppId: string, urlString?: string) => {
 | 
	
		
			
				|  |  | +      // 用户授权
 | 
	
		
			
				|  |  | +      console.log(urlString || window.location.href, 'urlString || window.location.href')
 | 
	
		
			
				|  |  | +      const urlNow = encodeURIComponent(urlString || window.location.href)
 | 
	
		
			
				|  |  | +      console.log(urlNow, 'urlNow')
 | 
	
		
			
				|  |  | +      const scope = 'snsapi_base' //snsapi_userinfo   //静默授权 用户无感知
 | 
	
		
			
				|  |  | +      const appid = wxAppId || 'wx8654c671631cfade'
 | 
	
		
			
				|  |  | +      const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${urlNow}&response_type=code&scope=${scope}&state=STATE&connect_redirect=1#wechat_redirect`
 | 
	
		
			
				|  |  | +      window.location.replace(url)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const onPreview = (type: string) => {
 | 
	
		
			
				|  |  | +      if (type === 'REGISTER') {
 | 
	
		
			
				|  |  | +        window.open(
 | 
	
		
			
				|  |  | +          window.location.origin + window.location.pathname + '#/preview-protocol',
 | 
	
		
			
				|  |  | +          '_blank'
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +      } else if (type === 'PRIVACY') {
 | 
	
		
			
				|  |  | +        window.open(
 | 
	
		
			
				|  |  | +          window.location.origin + window.location.pathname + '#/privacyProtocol',
 | 
	
		
			
				|  |  | +          '_blank'
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +      } else if (type === 'WITHDRAW') {
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +        window.open(window.location.origin + window.location.pathname + '#/cashProtocol', '_blank')
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      return () => (
 | 
	
	
		
			
				|  | @@ -258,6 +317,43 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                placeholder="请输入身份证号码"
 | 
	
		
			
				|  |  |              ></Field>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            <Field
 | 
	
		
			
				|  |  | +              label="身份证照片正面"
 | 
	
		
			
				|  |  | +              v-model={state.forms.idcardFrontImg}
 | 
	
		
			
				|  |  | +              readonly
 | 
	
		
			
				|  |  | +              name="idcardFrontImg"
 | 
	
		
			
				|  |  | +              rules={[{ required: true, message: '请上传身份证正面', trigger: 'onChange' }]}
 | 
	
		
			
				|  |  | +              placeholder="请上传身份证正面"
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  | +              {{
 | 
	
		
			
				|  |  | +                input: () => (
 | 
	
		
			
				|  |  | +                  <OUpload
 | 
	
		
			
				|  |  | +                    style={{ width: '100%' }}
 | 
	
		
			
				|  |  | +                    tips="上传身份证正面"
 | 
	
		
			
				|  |  | +                    v-model:modelValue={state.forms.idcardFrontImg}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +              }}
 | 
	
		
			
				|  |  | +            </Field>
 | 
	
		
			
				|  |  | +            <Field
 | 
	
		
			
				|  |  | +              label="身份证照片反面"
 | 
	
		
			
				|  |  | +              v-model={state.forms.idcardBackImg}
 | 
	
		
			
				|  |  | +              readonly
 | 
	
		
			
				|  |  | +              name="idcardBackImg"
 | 
	
		
			
				|  |  | +              rules={[{ required: true, message: '请上传身份证反面', trigger: 'onChange' }]}
 | 
	
		
			
				|  |  | +              placeholder="请上传身份证反面"
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  | +              {{
 | 
	
		
			
				|  |  | +                input: () => (
 | 
	
		
			
				|  |  | +                  <OUpload
 | 
	
		
			
				|  |  | +                    style={{ width: '100%' }}
 | 
	
		
			
				|  |  | +                    tips="上传身份证反面"
 | 
	
		
			
				|  |  | +                    v-model:modelValue={state.forms.idcardBackImg}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +              }}
 | 
	
		
			
				|  |  | +            </Field>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              <Field label="性别" name="gender" rules={[{ required: true, message: '请选择性别' }]}>
 | 
	
		
			
				|  |  |                {{
 | 
	
		
			
				|  |  |                  input: () => (
 | 
	
	
		
			
				|  | @@ -328,16 +424,26 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                style="margin-right: 6px"
 | 
	
		
			
				|  |  |                checked-color="#64A9FF"
 | 
	
		
			
				|  |  |              ></Checkbox>
 | 
	
		
			
				|  |  | -            <span
 | 
	
		
			
				|  |  | -              onClick={() => {
 | 
	
		
			
				|  |  | -                state.checked = !state.checked
 | 
	
		
			
				|  |  | -              }}
 | 
	
		
			
				|  |  | -            >
 | 
	
		
			
				|  |  | -              请认真阅读并勾选
 | 
	
		
			
				|  |  | -            </span>
 | 
	
		
			
				|  |  | -            <span class={styles.c} onClick={onPreview}>
 | 
	
		
			
				|  |  | -              《乐团管理老师注册协议》
 | 
	
		
			
				|  |  | -            </span>
 | 
	
		
			
				|  |  | +            <div>
 | 
	
		
			
				|  |  | +              <span
 | 
	
		
			
				|  |  | +                onClick={() => {
 | 
	
		
			
				|  |  | +                  state.checked = !state.checked
 | 
	
		
			
				|  |  | +                }}
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                请认真阅读并勾选
 | 
	
		
			
				|  |  | +              </span>
 | 
	
		
			
				|  |  | +              <span class={styles.c} onClick={() => onPreview('REGISTER')}>
 | 
	
		
			
				|  |  | +                《管乐团用户注册协议》
 | 
	
		
			
				|  |  | +              </span>
 | 
	
		
			
				|  |  | +              、
 | 
	
		
			
				|  |  | +              <span class={styles.c} onClick={() => onPreview('PRIVACY')}>
 | 
	
		
			
				|  |  | +                《隐私协议》
 | 
	
		
			
				|  |  | +              </span>
 | 
	
		
			
				|  |  | +              、
 | 
	
		
			
				|  |  | +              <span class={styles.c} onClick={() => onPreview('WITHDRAW')}>
 | 
	
		
			
				|  |  | +                《共享经济平台注册经营者协议》
 | 
	
		
			
				|  |  | +              </span>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |            <Button
 | 
	
	
		
			
				|  | @@ -355,15 +461,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          <Popup v-model:show={state.submitStatus} round style="width: 75%" closeOnClickOverlay>
 | 
	
		
			
				|  |  |            <div class={styles.stautsS}>
 | 
	
		
			
				|  |  | -            {/* <img
 | 
	
		
			
				|  |  | -              class={styles['icon-close']}
 | 
	
		
			
				|  |  | -              src={iconClose}
 | 
	
		
			
				|  |  | -              onClick={() => {
 | 
	
		
			
				|  |  | -                state.submitStatus = false
 | 
	
		
			
				|  |  | -                window.location.href =
 | 
	
		
			
				|  |  | -                  window.location.origin + '/orchestra-student/#/download?type=manage'
 | 
	
		
			
				|  |  | -              }}
 | 
	
		
			
				|  |  | -            /> */}
 | 
	
		
			
				|  |  |              <img src={topBanner1} class={styles['submit-img']} />
 | 
	
		
			
				|  |  |              <div class={styles['submit-container']}>
 | 
	
		
			
				|  |  |                <p class={styles['submit-title']}>恭喜您已成功登记为</p>
 |