picture.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div>
  3. <ul>
  4. <li v-for="(item, i) in imgData" :key="i" @click="previewPic(item.list[0].attachmentSavePath)">
  5. <img :src="'./api/file/pub/'+item.list[0].attachmentSavePath" alt="" height="240">
  6. <p class="title">{{lang=='en'? item.titleEn: item.title}}</p>
  7. </li>
  8. </ul>
  9. <div class="mask" v-show="maskShow" @click="closeMask">
  10. <img :src="currentUrl" alt="">
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import { getConfrenceDetail } from "@/api/meeting/meetingOutInfo";
  16. export default {
  17. data(){
  18. return {
  19. imgData: [],
  20. lang: '',
  21. currentUrl: '',
  22. maskShow: false
  23. }
  24. },
  25. created(){
  26. this.lang = this.$i18n.locale;
  27. },
  28. watch: {
  29. '$i18n.locale'(val){
  30. this.lang = val;
  31. }
  32. },
  33. mounted(){
  34. getConfrenceDetail(this.$route.query.key).then((res) => {
  35. res.data.meetingOutInfo.image.forEach((item) => {
  36. if(item.photoType == "meeting_pro_img"){
  37. this.imgData.push(item)
  38. }
  39. });
  40. // console.log('图片数据',res.data.meetingOutInfo.image)
  41. });
  42. },
  43. methods: {
  44. closeMask(){
  45. this.maskShow = false;
  46. },
  47. previewPic(url){
  48. this.currentUrl = './api/file/pub/'+ url;
  49. this.maskShow = true;
  50. },
  51. }
  52. }
  53. </script>
  54. <style scoped>
  55. *{
  56. box-sizing: border-box;
  57. }
  58. ul{
  59. display: flex;
  60. flex-wrap: wrap;
  61. padding: 20px 10px;
  62. }
  63. li{
  64. width: 30%;
  65. margin: 0 1.5%;
  66. cursor: pointer;
  67. }
  68. .title{
  69. text-align: center;
  70. margin: 10px 0;
  71. }
  72. .mask{
  73. width: 100vw;
  74. height: 100vh;
  75. position: fixed;
  76. top: 0;
  77. left: 0;
  78. background: rgba(0 ,0 , 0, 0.7);
  79. z-index: 9;
  80. }
  81. .mask img{
  82. max-width: 100%;
  83. position: absolute;
  84. top: 50%;
  85. left: 50%;
  86. transform: translate(-50%, -50%);
  87. }
  88. </style>