musicPreView.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import { defineComponent } from 'vue'
  2. import { useUserStore } from '@/store/modules/user'
  3. export default defineComponent({
  4. name: 'musicPreView',
  5. props: {
  6. item: {
  7. type: Object,
  8. default: () => {}
  9. }
  10. },
  11. setup(props, { emit }) {
  12. const userStore = useUserStore()
  13. const token = userStore.getToken
  14. const apiUrls = {
  15. 'dev': 'https://dev.kt.colexiu.com',
  16. 'test': 'https://test.lexiaoya.cn',
  17. 'online': 'https://kt.colexiu.com'
  18. }
  19. const environment = location.origin.includes('//dev') ? 'dev' : location.origin.includes('//test') ? 'test' : location.origin.includes('//online') ? 'online' : 'dev'
  20. const apiUrl = apiUrls[environment]
  21. // const prefix = /(localhost|192)/.test(location.host) ? 'http://dev.resource.colexiu.com/' : location.origin
  22. const prefix = /(localhost|192)/.test(location.host) ? 'https://dev.kt.colexiu.com/' : apiUrl
  23. const src = prefix + `/instrument/?_t=${Date.now()}&id=${props.item.id}&modelType=practise&modeType=json&Authorization=${token}&isMove=1&isCbs=true`
  24. return () => (
  25. <div>
  26. <iframe width={'667px'} height={'375px'} frameborder="0" src={src}></iframe>
  27. </div>
  28. )
  29. }
  30. })