index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="image-dialog" :class="{'i-show':isShow}" v-if="screensa" @click="exitHandle">
  3. <!-- <a @click="exitHandle"><i class="iconfont icon-left"></i>返回</a> -->
  4. <div class="image-layout" :class="{'m-image-layout':ismobile}">
  5. <Slide :screens="screensa" :current="0">
  6. <i class="iconfont icon-left" slot="up"></i>
  7. <div v-if="ismobile" slot="item" slot-scope="{data}" class="image-item" :style="{background:`url(${data}) no-repeat center center`,backgroundSize:'contain'}" @click.stop></div>
  8. <img v-else slot="item" slot-scope="{data}" :src="data" class="image-item" @click.stop>
  9. <i class="iconfont icon-right" slot="next"></i>
  10. </Slide>
  11. <div class="image-introduce" v-if="ismobile">
  12. <div class="intro-title">{{name}}</div>
  13. <div class="intro-detail" @touchmove.stop>
  14. <p v-for="(item,i) in introduce" :key="i">{{item}}</p>
  15. </div>
  16. </div>
  17. </div>
  18. <template v-if="showAside&&!ismobile">
  19. <div class="r-aside" @click.stop>
  20. <div class="image-title">{{name}}</div>
  21. <div class="image-detail">
  22. <p v-for="(item,i) in introduce" :key="i">{{item}}</p>
  23. </div>
  24. <div class="switch" @click="show = !show" @touchmove.prevent>
  25. <i class="iconfont" :class="show ? 'icon-left' : 'icon-right'"></i>
  26. </div>
  27. </div>
  28. </template>
  29. </div>
  30. </template>
  31. <script>
  32. import Slide from '@/components/Slide'
  33. import browser from '@/util/browser'
  34. export default {
  35. components: { Slide },
  36. props: ['screens', 'show', 'showAside', 'name', 'introduce'],
  37. data () {
  38. return {
  39. screensa: this.screens,
  40. ismobile: browser.mobile
  41. }
  42. },
  43. computed: {
  44. isShow () {
  45. return !this.show && !this.ismobile
  46. }
  47. },
  48. watch: {
  49. screens () {
  50. this.screensa = this.screens
  51. }
  52. },
  53. methods: {
  54. exitHandle () {
  55. this.screensa = null
  56. this.$emit('exitHandle')
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .image-dialog {
  63. position: fixed;
  64. z-index: 99999;
  65. left: 0;
  66. top: 0;
  67. right: 0;
  68. bottom: 0;
  69. background-color: rgba(0,0,0,0.8);
  70. transform: translateX(0);
  71. transition: width .3s ease;
  72. width: 100%;
  73. }
  74. .image-dialog.i-show{
  75. transition: width .3s ease;
  76. width: calc(100% - 350px);
  77. }
  78. .image-dialog a {
  79. position: absolute;
  80. color: #fff;
  81. background-color: #fa3800;
  82. left: 10px;
  83. top: 10px;
  84. padding: 8px 15px;
  85. cursor: pointer;
  86. border-radius: 3px;
  87. }
  88. .image-layout {
  89. width: 100%;
  90. padding-left: 20px;
  91. padding-right: 20px;
  92. position: absolute;
  93. top: 50%;
  94. left: 50%;
  95. transform: translateY(-50%) translateX(-50%);
  96. }
  97. .image-item {
  98. width: 100%;
  99. height: 100%;
  100. }
  101. .r-aside{
  102. box-sizing: border-box;
  103. position: absolute;
  104. right: -350px;
  105. top: 0;
  106. bottom: 0;
  107. width: 350px;
  108. height: 100%;
  109. background-color: #fffbf8;
  110. display: flex;
  111. flex-direction: column;
  112. padding: 20px 0;
  113. border-left: 1px solid #f1c4a3;
  114. z-index: 999999;
  115. }
  116. .r-aside .image-title{
  117. font-weight: bold;
  118. font-size: 18px;
  119. padding-bottom: 15px;
  120. border-bottom: 1px solid #f1c4a3;
  121. margin: 0 20px;
  122. }
  123. .r-aside .image-detail{
  124. padding: 15px 0;
  125. height: 100%;
  126. overflow-y: scroll;
  127. margin: 0 10px 0 20px;
  128. }
  129. .r-aside .image-detail p{
  130. text-indent: 32px;
  131. line-height: 1.8;
  132. }
  133. .switch {
  134. position: absolute;
  135. right: 100%;
  136. top: 50%;
  137. transform: translateY(-50%);
  138. background-color: #fa3800;
  139. width: 14px;
  140. height: 80px;
  141. color: #fff;
  142. line-height: 80px;
  143. text-align: center;
  144. cursor: pointer;
  145. z-index: 9999999;
  146. }
  147. .image-introduce{
  148. color:#fff;
  149. padding:20px 10px;
  150. line-height:1.5;
  151. }
  152. .image-introduce .intro-title{
  153. font-size:18px;
  154. font-weight:bold;
  155. margin-bottom:20px;
  156. }
  157. .image-introduce .intro-detail{
  158. height: 150px;
  159. overflow-y: auto;
  160. overflow-x: hidden;
  161. }
  162. .image-introduce .intro-detail p{
  163. text-indent:32px;
  164. }
  165. .m-image-layout >>> .ctrl{
  166. top:25%;
  167. }
  168. </style>