Window.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!--除主页意外的其他窗口-->
  2. <template>
  3. <div>
  4. <div v-for="item in windows"
  5. :style="{
  6. position: 'absolute',
  7. left:item ? item.Left*bigScale+'px' : '',
  8. top:item ? item.Top*bigScale+'px' : '',
  9. width:item ? item.Width*bigScale + 'px' : '',
  10. height:item ? item.Height*bigScale + 'px' : '',
  11. zIndex:item ? item.ZIndex : '',
  12. display:item ? (item.IsVisibility ? 'block' : 'none') : '',
  13. backgroundRepeat:'no-repeat',
  14. backgroundSize:'100% 100%',
  15. }"
  16. :ref="item.ID"
  17. >
  18. <Button :window="item"/>
  19. <Label :window="item"/>
  20. <Img :window="item"/>
  21. <BigShow :window="item"/>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import {mapState} from "vuex"
  27. import {getNeedMoutedEleArr, getStaticFile} from "../../utils/tools"
  28. import Button from "./Button"
  29. import Label from './Label'
  30. import Img from './Image'
  31. import BigShow from './BigShow'
  32. export default {
  33. components: {
  34. Button,
  35. Label,
  36. Img,
  37. BigShow
  38. },
  39. data() {
  40. return {
  41. windows:[],
  42. eleObj:{},
  43. staticUrl:this.$store.state.staticUrl, // 静态资源路径
  44. }
  45. },
  46. async beforeCreate() {
  47. const eleObj = {}
  48. this.windows = await getStaticFile('EnityWindow.Data')
  49. for(const item of this.windows){
  50. eleObj[item.ID] = await getNeedMoutedEleArr(item.ID)
  51. }
  52. this.eleObj = eleObj
  53. },
  54. updated() {
  55. // 设置背景图片
  56. const keyArr = Object.keys(this.$refs)
  57. keyArr.forEach(item => {
  58. if(this.eleObj[item]){
  59. const arr = this.eleObj[item].filter(item => item.BackIcon)
  60. for(const a of arr){
  61. this.$refs[a.ID][0].style.backgroundImage = a.BackIcon ? 'url('+`${this.staticUrl}/Data/${a.BackIcon}`+')' : null
  62. }
  63. }
  64. })
  65. },
  66. computed: {
  67. ...mapState(['bigScale'])
  68. }
  69. }
  70. </script>