123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <div class="sld_store_list">
- <div class="sld_vendor_goods clearfix">
- <div class="hd">
- <a href="javascript:;" class="next" @click="slideWin(1)" ref="next">
- <i class="iconfont"></i>
- </a>
- <a href="javascript:;" class="prev" @click="slideWin(0)" ref="prev">
- <i class="iconfont"></i>
- </a>
- </div>
- <div class="slide_wrap">
- <ul class="bd clearfix">
- <li
- class="new_goods"
- v-for="(item, index) in itemData"
- :key="index"
- >
- <div class="sld_img sld-img-center" >
- <div
- class="img"
- :style="{
- backgroundImage: 'url(' + item.imgUrl + ')',
- }"
- ></div>
- <div class="magnifier_icon flex_row_center_center" @click="toggleBigImg(item.imgUrl)"><i class="iconfont icon-sousuo"></i></div>
- </div>
- </li>
- <div class="empty" v-show="itemData.length == 0">
- <img src="/goods/empty_data.png" alt="" />
- <p>{{L['暂无展示']}}</p>
- </div>
- </ul>
- </div>
- </div>
- <el-dialog
- v-if="showModel"
- align-center
- width="100%"
- class="self_modal"
- :model-value="modalVisible"
- :show-close="true"
- @close="toggleBigImg('')"
- >
- <img :src="imgBig"/>
- </el-dialog>
- </div>
- </template>
- <script setup>
- // import { lang_zn } from "@/assets/language/zh.js";
- import { getCurLanguage } from '@/composables/common.js';
- import {ElDialog} from 'element-plus';
- // const L = lang_zn;
- const L = getCurLanguage();
- const props = defineProps(["itemData", "itemIndex"]);
- const { proxy } = getCurrentInstance();
- const showModel = ref(false)
- const modalVisible = ref(true)
- const imgBig = ref()
- //查看大图
- const toggleBigImg = (val) => {
- showModel.value = !showModel.value
- imgBig.value = val
- }
- //滑动
- const notClickQuick = ref(true); //防止快速点击造成dom混乱
- const slideWin = (ltr) => {
- let ul = document.getElementsByClassName("bd")[props.itemIndex];
- let liLength =ul.getElementsByClassName("new_goods").length;
- let max =
- liLength % 1 == 0
- ? liLength * 170
- : (Math.floor(liLength / 6) + 1) * 1 * 170;
- let nowMg = parseInt(getComputedStyle(ul, null).marginLeft);
- let slide_wrap_width = max - document.getElementsByClassName("slide_wrap")[props.itemIndex].offsetWidth;
- ul.style.width = max + "px";
- if (notClickQuick.value) {
- notClickQuick.value = false;
- if (slide_wrap_width < 0) return;
- let n = 170;
- if (ltr) {
- nowMg = nowMg - n * 1;
- ul.style.marginLeft =
- (slide_wrap_width >= Math.abs(nowMg) ? nowMg : nowMg + n * 1) + "px";
- } else {
- nowMg = nowMg + n * 1;
- ul.style.marginLeft = (nowMg <= 0 ? nowMg : 0) + "px";
- }
- proxy.$refs.next.style.backgroundColor = slide_wrap_width > Math.abs(nowMg) + 1 * 170 ? "#8d8b8b" : "#ccc";
- proxy.$refs.prev.style.backgroundColor = nowMg >= 0 ? "#ccc" : "#8d8b8b";
- setTimeout(function () {
- notClickQuick.value = true;
- }, 500);
- }
- };
- onMounted(() => {
- setTimeout(function () {
- if (props.itemData.length < 7) {
- proxy.$refs.next.style.backgroundColor = "#ccc";
- proxy.$refs.prev.style.backgroundColor = "#ccc";
- }
- }, 1000);
- });
- </script>
- <style lang="scss">
- .self_modal{
- height: 95vh;
- display: flex;
- justify-content: center;
- align-items: center;
- background: transparent;
- header,.el-dialog__body{
- padding: 0;
- }
- img{
- display: block;
- margin: 0 auto;
- height: 95vh;
- }
- .el-dialog__headerbtn{
- background: #fff;
- }
- }
- </style>
- <style lang="scss" scoped>
- @use "@/assets/style/storeList.scss" as *;
- @use "@/assets/style/store/contac-about.scss" as *;
- </style>
|