index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div class="layout" :class="{wide: isWide}" @touchmove.prevent>
  3. <div>
  4. <ViewOperation height="100%" v-if="!isWide" :scale="0.7">
  5. <div class="address">
  6. <!-- <img src="@/assets/images/address.png" alt=""> -->
  7. <maps />
  8. <!-- <img :src="item.img" v-for="item in maps" :key="item.cls" class="map-item" :class="'map-' + item.cls"> -->
  9. <a v-for="item in address" :key="item.name" :class="item.name" @click="to(item)">
  10. {{item.text}}<span>{{item.count}}</span>
  11. </a>
  12. </div>
  13. </ViewOperation>
  14. <div class="address wide" v-else>
  15. <!-- <img src="@/assets/images/address.png" alt=""> -->
  16. <maps />
  17. <!-- <img :src="item.img" v-for="item in maps" :key="item.cls" class="map-item" :class="'map-' + item.cls"> -->
  18. <a v-for="item in address" :key="item.name" :class="item.name" @click="to(item)">
  19. {{item.text}}<span>{{item.count}}</span>
  20. </a>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import data from '@/data'
  27. import browser from '@/util/browser'
  28. import ViewOperation from '@/components/ViewOperation'
  29. import maps from '@/components/maps'
  30. const setting = [
  31. {name: 'yf', text: '永丰社区'},
  32. {name: 'bs', text: '北沙社区'},
  33. {name: 'sc', text: '上栅社区'},
  34. {name: 'jf', text: '金峰社区'},
  35. {name: 'nz', text: '那洲社区'},
  36. {name: 'gt', text: '官塘社区'},
  37. {name: 'ht', text: '会同社区'},
  38. {name: 'nt', text: '宁堂社区'},
  39. {name: 'xc', text: '下栅社区'},
  40. {name: 'da', text: '东岸社区'},
  41. {name: 'js', text: '鸡山社区'},
  42. {name: 'yx', text: '银星社区'},
  43. {name: 'hh', text: '后环社区'},
  44. {name: 'tl', text: '唐乐社区'},
  45. {name: 'tj', text: '唐家社区'},
  46. {name: 'qa', text: '淇澳社区'}
  47. ]
  48. const wh = {width: window.innerWidth, height: window.innerHeight}
  49. setting.forEach(item => {
  50. item.count = data.modules.find(m => m.title === item.text).children.length
  51. })
  52. window.addEventListener('resize', function () {
  53. wh.width = window.innerWidth
  54. wh.height = window.innerHeight
  55. })
  56. export default {
  57. data () {
  58. return {
  59. ismobile: browser.mobile,
  60. address: setting,
  61. wh: wh
  62. }
  63. },
  64. computed: {
  65. isWide () {
  66. return this.wh.width > 1085
  67. }
  68. },
  69. components: {
  70. ViewOperation,
  71. maps
  72. },
  73. methods: {
  74. to (item) {
  75. let link = this.$isLocal ? {name: 'list', params: {title: item.text, type: '全部'}} : {name: 'map', params: {title: item.text}}
  76. this.$router.push(link)
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. @import url('./style.css');
  83. </style>