|  | @@ -4,6 +4,7 @@ import styles from './index.module.less'
 | 
	
		
			
				|  |  |  import { postMessage, promisefiyPostMessage } from '@/helpers/native-message'
 | 
	
		
			
				|  |  |  import html2canvas from 'html2canvas'
 | 
	
		
			
				|  |  |  import ShareItem from './share-item'
 | 
	
		
			
				|  |  | +import request from '@/helpers/request'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default defineComponent({
 | 
	
		
			
				|  |  |    name: 'col-share',
 | 
	
	
		
			
				|  | @@ -18,20 +19,34 @@ export default defineComponent({
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | -      qrCode: '',
 | 
	
		
			
				|  |  | -      image: null as any
 | 
	
		
			
				|  |  | +      image: null as any,
 | 
	
		
			
				|  |  | +      codeUrl: ''
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | -  mounted() {
 | 
	
		
			
				|  |  | -    this.$nextTick(async () => {
 | 
	
		
			
				|  |  | -      const container: any = document.getElementById('share-preview-container')
 | 
	
		
			
				|  |  | -      html2canvas(container, { allowTaint: true, useCORS: true }).then(
 | 
	
		
			
				|  |  | -        canvas => {
 | 
	
		
			
				|  |  | -          const url = canvas.toDataURL('image/png')
 | 
	
		
			
				|  |  | -          this.image = url
 | 
	
		
			
				|  |  | +  async mounted() {
 | 
	
		
			
				|  |  | +    try {
 | 
	
		
			
				|  |  | +      const shortRes = await request.post('/api-teacher/sysConfig/shortURL', {
 | 
	
		
			
				|  |  | +        requestType: 'form',
 | 
	
		
			
				|  |  | +        data: {
 | 
	
		
			
				|  |  | +          orginURL: this.shareUrl
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -      )
 | 
	
		
			
				|  |  | -    })
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +      this.codeUrl = shortRes.data
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      this.$nextTick(async () => {
 | 
	
		
			
				|  |  | +        const container: any = document.getElementById(
 | 
	
		
			
				|  |  | +          'share-preview-container'
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        html2canvas(container, { allowTaint: true, useCORS: true }).then(
 | 
	
		
			
				|  |  | +          canvas => {
 | 
	
		
			
				|  |  | +            const url = canvas.toDataURL('image/png')
 | 
	
		
			
				|  |  | +            this.image = url
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    } catch {
 | 
	
		
			
				|  |  | +      //
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      async onSaveImg() {
 | 
	
	
		
			
				|  | @@ -76,38 +91,51 @@ export default defineComponent({
 | 
	
		
			
				|  |  |    render() {
 | 
	
		
			
				|  |  |      return (
 | 
	
		
			
				|  |  |        <>
 | 
	
		
			
				|  |  | -        <div class={styles.shareContainer}>
 | 
	
		
			
				|  |  | -          <Swipe
 | 
	
		
			
				|  |  | -            showIndicators={false}
 | 
	
		
			
				|  |  | -            loop={false}
 | 
	
		
			
				|  |  | -            style={{ borderRadius: '10px', overflow: 'hidden' }}
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | -            <SwipeItem>
 | 
	
		
			
				|  |  | -              <ShareItem teacherId={this.teacherId} shareUrl={this.shareUrl} />
 | 
	
		
			
				|  |  | -            </SwipeItem>
 | 
	
		
			
				|  |  | -            <SwipeItem>
 | 
	
		
			
				|  |  | -              <ShareItem teacherId={this.teacherId} shareUrl={this.shareUrl} />
 | 
	
		
			
				|  |  | -            </SwipeItem>
 | 
	
		
			
				|  |  | -            <SwipeItem>
 | 
	
		
			
				|  |  | -              <ShareItem teacherId={this.teacherId} shareUrl={this.shareUrl} />
 | 
	
		
			
				|  |  | -            </SwipeItem>
 | 
	
		
			
				|  |  | -          </Swipe>
 | 
	
		
			
				|  |  | -        </div>
 | 
	
		
			
				|  |  | +        {this.codeUrl && (
 | 
	
		
			
				|  |  | +          <>
 | 
	
		
			
				|  |  | +            <div class={styles.shareContainer}>
 | 
	
		
			
				|  |  | +              <Swipe
 | 
	
		
			
				|  |  | +                showIndicators={false}
 | 
	
		
			
				|  |  | +                loop={false}
 | 
	
		
			
				|  |  | +                style={{ borderRadius: '10px', overflow: 'hidden' }}
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                <SwipeItem>
 | 
	
		
			
				|  |  | +                  <ShareItem
 | 
	
		
			
				|  |  | +                    teacherId={this.teacherId}
 | 
	
		
			
				|  |  | +                    shareUrl={this.codeUrl}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  | +                </SwipeItem>
 | 
	
		
			
				|  |  | +                <SwipeItem>
 | 
	
		
			
				|  |  | +                  <ShareItem
 | 
	
		
			
				|  |  | +                    teacherId={this.teacherId}
 | 
	
		
			
				|  |  | +                    shareUrl={this.codeUrl}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  | +                </SwipeItem>
 | 
	
		
			
				|  |  | +                <SwipeItem>
 | 
	
		
			
				|  |  | +                  <ShareItem
 | 
	
		
			
				|  |  | +                    teacherId={this.teacherId}
 | 
	
		
			
				|  |  | +                    shareUrl={this.codeUrl}
 | 
	
		
			
				|  |  | +                  />
 | 
	
		
			
				|  |  | +                </SwipeItem>
 | 
	
		
			
				|  |  | +              </Swipe>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        <div class={['btnGroup', styles.shareGroupBtn]}>
 | 
	
		
			
				|  |  | -          <Button type="primary" round onClick={this.onSaveImg}>
 | 
	
		
			
				|  |  | -            保存图片
 | 
	
		
			
				|  |  | -          </Button>
 | 
	
		
			
				|  |  | -          <Button
 | 
	
		
			
				|  |  | -            type="primary"
 | 
	
		
			
				|  |  | -            round
 | 
	
		
			
				|  |  | -            onClick={() => {
 | 
	
		
			
				|  |  | -              this.shareShow()
 | 
	
		
			
				|  |  | -            }}
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | -            立即分享
 | 
	
		
			
				|  |  | -          </Button>
 | 
	
		
			
				|  |  | -        </div>
 | 
	
		
			
				|  |  | +            <div class={['btnGroup', styles.shareGroupBtn]}>
 | 
	
		
			
				|  |  | +              <Button type="primary" round onClick={this.onSaveImg}>
 | 
	
		
			
				|  |  | +                保存图片
 | 
	
		
			
				|  |  | +              </Button>
 | 
	
		
			
				|  |  | +              <Button
 | 
	
		
			
				|  |  | +                type="primary"
 | 
	
		
			
				|  |  | +                round
 | 
	
		
			
				|  |  | +                onClick={() => {
 | 
	
		
			
				|  |  | +                  this.shareShow()
 | 
	
		
			
				|  |  | +                }}
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                立即分享
 | 
	
		
			
				|  |  | +              </Button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +          </>
 | 
	
		
			
				|  |  | +        )}
 | 
	
		
			
				|  |  |        </>
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |    }
 |