|  | @@ -22,7 +22,9 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        playType: '',
 | 
	
		
			
				|  |  |        desc: '',
 | 
	
		
			
				|  |  |        videoImg: '', // 视频封面
 | 
	
		
			
				|  |  | -      img: ''
 | 
	
		
			
				|  |  | +      img: '',
 | 
	
		
			
				|  |  | +      needCheckDevice: true,
 | 
	
		
			
				|  |  | +      hasDeviceAuth: false, // 有设备相机权限
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const onSubmit = async () => {
 | 
	
	
		
			
				|  | @@ -49,7 +51,39 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          //
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    // 初始化获取是否已经授权
 | 
	
		
			
				|  |  | +    const initDeviceAuth = () => {
 | 
	
		
			
				|  |  | +      postMessage(
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          api: 'checkDeviceCamera',
 | 
	
		
			
				|  |  | +          content: {
 | 
	
		
			
				|  |  | +            hideAlert: true
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        res => {
 | 
	
		
			
				|  |  | +          if (res?.content.status) {
 | 
	
		
			
				|  |  | +            state.hasDeviceAuth = true
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      )
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    // 校验是否已经授权
 | 
	
		
			
				|  |  | +    const checkDeviceAuth = () => {
 | 
	
		
			
				|  |  | +      console.log('校验app',state.needCheckDevice)
 | 
	
		
			
				|  |  | +      if (state.needCheckDevice) {
 | 
	
		
			
				|  |  | +        postMessage({ api: 'checkDeviceCamera' }, res => {
 | 
	
		
			
				|  |  | +          const { content } = res as any
 | 
	
		
			
				|  |  | +          if (content?.status) {
 | 
	
		
			
				|  |  | +            state.hasDeviceAuth = true
 | 
	
		
			
				|  |  | +          } else {
 | 
	
		
			
				|  |  | +            // 没有权限不能获取图片
 | 
	
		
			
				|  |  | +            state.hasDeviceAuth = false
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        state.hasDeviceAuth = true
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      // 截图
 | 
	
		
			
				|  |  |      const onCropper = () => {
 | 
	
		
			
				|  |  |        postMessage(
 | 
	
	
		
			
				|  | @@ -74,6 +108,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      onMounted(async () => {
 | 
	
		
			
				|  |  | +      initDeviceAuth();
 | 
	
		
			
				|  |  |        setStatusBarTextColor(false);
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  |          const { data } = await api_userMusicDetail(state.id)
 | 
	
	
		
			
				|  | @@ -107,6 +142,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                cropper
 | 
	
		
			
				|  |  |                tips={''}
 | 
	
		
			
				|  |  |                deletable={false}
 | 
	
		
			
				|  |  | +              needCheckDevice={true}
 | 
	
		
			
				|  |  |                v-model:modelValue={state.img}
 | 
	
		
			
				|  |  |              />
 | 
	
		
			
				|  |  |              {/* <div class={styles.tip}>选封面</div> */}
 | 
	
	
		
			
				|  | @@ -120,19 +156,22 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            <div class={[styles.section, styles.sectionVideo]}>
 | 
	
		
			
				|  |  |              <img src={state.videoImg || videoBg} class={styles.videoBg} />
 | 
	
		
			
				|  |  |              <div class={styles.btnGroup}>
 | 
	
		
			
				|  |  | -              <MUploader
 | 
	
		
			
				|  |  | -                class={styles.btnImg}
 | 
	
		
			
				|  |  | -                cropper
 | 
	
		
			
				|  |  | -                tips=""
 | 
	
		
			
				|  |  | -                deletable={false}
 | 
	
		
			
				|  |  | -                onUploadChange={img => {
 | 
	
		
			
				|  |  | -                  console.log(img, 'img')
 | 
	
		
			
				|  |  | -                  state.videoImg = img
 | 
	
		
			
				|  |  | -                }}
 | 
	
		
			
				|  |  | -                options={{
 | 
	
		
			
				|  |  | -                  fixedNumber: [16, 9]
 | 
	
		
			
				|  |  | -                }}
 | 
	
		
			
				|  |  | -              />
 | 
	
		
			
				|  |  | +              <div onClick={checkDeviceAuth}>
 | 
	
		
			
				|  |  | +                <MUploader
 | 
	
		
			
				|  |  | +                  class={styles.btnImg}
 | 
	
		
			
				|  |  | +                  cropper
 | 
	
		
			
				|  |  | +                  tips=""
 | 
	
		
			
				|  |  | +                  deletable={false}
 | 
	
		
			
				|  |  | +                  hasDeviceAuth={state.hasDeviceAuth}
 | 
	
		
			
				|  |  | +                  onUploadChange={img => {
 | 
	
		
			
				|  |  | +                    console.log(img, 'img')
 | 
	
		
			
				|  |  | +                    state.videoImg = img
 | 
	
		
			
				|  |  | +                  }}
 | 
	
		
			
				|  |  | +                  options={{
 | 
	
		
			
				|  |  | +                    fixedNumber: [16, 9]
 | 
	
		
			
				|  |  | +                  }}
 | 
	
		
			
				|  |  | +                />
 | 
	
		
			
				|  |  | +              </div>
 | 
	
		
			
				|  |  |                <div class={styles.btnCropper} onClick={onCropper}>
 | 
	
		
			
				|  |  |                  视频截取封面
 | 
	
		
			
				|  |  |                </div>
 |