jinx 1 year ago
parent
commit
f7e7b65d6c

+ 1 - 1
packages/app-cdfg/.env.development

@@ -1,7 +1,7 @@
 # 场景资源地址
 VUE_APP_RESOURCE_URL=https://testeurs3.4dkankan.com/
 # sdk文件地址
-VUE_APP_SDK_DIR=sdk
+VUE_APP_SDK_DIR=https://eurs3.4dkankan.com/v4/cdfg/sdk-test
 # 静态资源地址
 VUE_APP_CDN_URL=
 # region

+ 4 - 3
packages/app-cdfg/src/components/Tags/brand-list.vue

@@ -90,13 +90,13 @@ const saveBrand = () => {
 
 const pageNum = ref(1)
 const getData = common.debounce(
-    (reset = false) => {
+    (reset = false, page) => {
         store
             .dispatch('tag/getBrandsList', {
                 keyword: searchKey.value,
                 reset,
                 // pageNum: Math.floor(brands.value.length / 20) + 1,
-                pageNum: pageNum.value,
+                pageNum: page || pageNum.value,
                 pageSize: 20,
             })
             .then(res => {
@@ -120,7 +120,8 @@ watch(
     () => searchKey.value,
     (newval, old) => {
         pageNum.value = 1
-        getData(true)
+        let page = 1
+        getData(true, page)
     }
 )
 onMounted(() => {

+ 399 - 400
packages/app-cdfg/src/components/Tags/goods-list.vue

@@ -1,400 +1,399 @@
-<!--  -->
-<template>
-    <teleport to="body">
-        <div class="goods-layer">
-            <div class="goods-info">
-                <div class="goods-header">
-                    <span>選擇商品</span>
-                    <ui-icon @click.stop="close" class="close-btn" type="close"></ui-icon>
-                </div>
-
-                <div class="goods-con">
-                    <div class="g-search">
-                        <ui-input type="text" width="260px" placeholder="輸入關鍵字" v-model="searchKey">
-                            <template v-slot:preIcon>
-                                <ui-icon type="search" class="icon" />
-                            </template>
-                        </ui-input>
-                        <ui-input
-                            :class="{ disabled: !canChangeOption && hotData.products.length > 0 }"
-                            v-if="isHongKong"
-                            @click.stop
-                            type="select"
-                            @update:modelValue="onSelect"
-                            :options="productSourceOptions"
-                            width="160px"
-                            v-model="productSource"
-                            placeholder="選擇店鋪"
-                        >
-                            <template v-slot:option="{ raw }">
-                                <span>{{ raw.label }}</span>
-                            </template>
-                        </ui-input>
-                    </div>
-                    <div
-                        v-show="showListPanel"
-                        class="table-layer"
-                        v-infinite-scroll="getData"
-                        infinite-scroll-disabled="disabled_x"
-                        :infinite-scroll-throttle-delay="500"
-                        :infinite-scroll-immediate-check="false"
-                        infinite-scroll-distance="30"
-                    >
-                        <table class="list">
-                            <thead>
-                                <tr>
-                                    <th width="10px">
-                                        <div class="checkbox">
-                                            <input type="checkbox" v-model="allSelect" @click="e => selectGoodAll(e.target.checked)" />
-                                            <span></span>
-                                        </div>
-                                    </th>
-                                    <th>序號</th>
-                                    <th>商品編號</th>
-                                    <th width="100px">商品圖片</th>
-                                    <th :width="isHongKong ? '300px' : '100px'">商品名稱</th>
-                                    <th v-if="!isHongKong">價格</th>
-                                    <th v-if="!isHongKong">庫存</th>
-                                </tr>
-                            </thead>
-                            <tbody>
-                                <tr v-for="(item, i) in list" :key="i">
-                                    <td width="10px">
-                                        <div class="checkbox" :class="{ disabled: item.isBind }">
-                                            <input type="checkbox" :disabled="item.isBind" @change="e => selectGood(item, e.target.checked)" :checked="item.isBind || item.isCheck" />
-                                            <span></span>
-                                        </div>
-                                    </td>
-                                    <td>{{ i + 1 }}</td>
-                                    <td>{{ item.id }}</td>
-                                    <td><img style="width: 100px" :src="item.pic" alt="" /></td>
-                                    <td>{{ item.name }}</td>
-                                    <td v-if="!isHongKong">{{ item.symbol }} {{ item.price }}</td>
-                                    <td v-if="!isHongKong">{{ item.stock }}</td>
-                                </tr>
-                                <tr class="nodata" v-if="list.length === 0">
-                                    <td colspan="7">暫無數據</td>
-                                </tr>
-                            </tbody>
-                        </table>
-                    </div>
-                </div>
-
-                <div class="goods-footer">
-                    <ui-button @click.stop="close" type="cancel">取消</ui-button>
-                    <ui-button @click.stop="submit" type="primary">保存</ui-button>
-                </div>
-            </div>
-        </div>
-    </teleport>
-</template>
-
-<script setup>
-import { reactive, defineEmits, onBeforeMount, onMounted, ref, watchEffect, computed, watch, nextTick } from 'vue'
-import { Dialog, Loading } from '@kankan/components'
-import metasImage from './metas/metas-image'
-import common from '@/utils/common'
-
-import { useStore } from 'vuex'
-const emit = defineEmits(['close'])
-
-const store = useStore()
-const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
-const hotData = computed(() => store.getters['tag/hotData'])
-
-console.log(hotData.value)
-
-const productSourceOptions = computed(() => {
-    let list = store.getters['tag/HKProductSourceList']
-    list.map(i => {
-        i.value = i.id
-        i.label = i.cdfName
-    })
-    return list
-})
-
-const list = computed(() => {
-    return store.getters['tag/goodsList'] || []
-})
-
-const requestLock = computed(() => store.getters['tag/requestLock'])
-const auth = computed(() => store.getters['scene/auth'])
-
-const productSource = ref(null)
-const searchKey = ref('')
-const allSelect = ref(false)
-const canChangeOption = ref(true)
-
-const select = ref([])
-const showListPanel = ref(false)
-
-const selectGoodAll = isSelect => {
-    list.value.forEach(item => {
-        selectGood(item, isSelect)
-    })
-}
-
-const selectGood = (item, isSelect) => {
-    item.isCheck = isSelect
-    let index = select.value.findIndex(i => i.id == item.id)
-    if (isSelect) {
-        !~index && select.value.push(item)
-    } else {
-        ~index && select.value.splice(index, 1)
-    }
-}
-
-const close = () => {
-    emit('close')
-}
-const onSelect = data => {
-    productSource.value = data
-}
-
-const getData = common.debounce(
-    (reset = false) => {
-        store.dispatch('tag/getGoodsList', {
-            keyword: searchKey.value,
-            pageNum: reset ? 1 : Math.floor(list.value.length / 20) + 1,
-            reset,
-            productSourceId: productSource.value
-        })
-        if (!showListPanel.value) {
-            showListPanel.value = true
-        }
-    },
-    700,
-    false
-)
-
-const getGoodsFrom = async () => {
-    console.log(1111)
-    await store.dispatch('tag/getGoodsFrom', {})
-
-    if (hotData.value?.productSourceId) {
-        productSource.value = hotData.value?.productSourceId
-        canChangeOption.value = false
-    } else {
-        productSource.value = productSourceOptions.value[0].id
-        hotData.value.productSourceId = productSourceOptions.value[0].id
-    }
-
-    console.log(productSource.value, 'productSource.value')
-}
-
-const submit = () => {
-    store.commit('tag/pushGoodsItems', select)
-    close()
-}
-
-watch(
-    () => productSource.value,
-    (newval, old) => {
-        if (productSource.value) {
-            selectGoodAll(false)
-            getData(true)
-            hotData.value.productSourceId = productSource.value
-        }
-    }
-)
-
-watch(
-    () => searchKey.value,
-    (newval, old) => {
-        getData(true)
-    }
-)
-
-onMounted(() => {
-    if (isHongKong.value) {
-        nextTick(() => {
-            //重置下选择
-            selectGoodAll(false)
-            getGoodsFrom()
-        })
-    } else {
-        showListPanel.value = true
-        getData(true)
-        nextTick(() => {
-            //重置下选择
-            selectGoodAll(false)
-        })
-    }
-})
-</script>
-<style lang="scss">
-.goods-layer {
-    width: 100vw;
-    height: 100vh;
-    z-index: 100000;
-    top: 0;
-    position: fixed;
-    left: 0;
-    // padding: calc(var(--editor-head-height) + 20px) calc(var(--editor-toolbox-width) + 20px) 60px calc(var(--editor-menu-width) + 20px);
-    // background-color: rgba(255, 255, 255, 0.7);
-    z-index: 999;
-    .goods-info {
-        color: #fff;
-        width: 800px;
-        height: 760px;
-        margin: 5% auto;
-        user-select: none;
-        filter: var(--editor-menu-filter);
-        background-color: var(--editor-menu-back);
-        backdrop-filter: blur(4px);
-        border: solid 1px #000;
-        border-radius: 4px;
-        overflow: hidden;
-        &::after {
-            position: absolute;
-            top: 0;
-            left: 0;
-            content: '';
-            width: 100%;
-            height: 100%;
-            z-index: -1;
-            border: solid 1px rgba(255, 255, 255, 0.16);
-        }
-
-        .goods-header {
-            width: 100%;
-            padding: 22px 20px;
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-            border-bottom: 1px solid rgba(255, 255, 255, 0.16);
-            .close-btn {
-                font-size: 16px;
-                cursor: pointer;
-            }
-        }
-
-        .goods-con {
-            padding: 20px;
-            height: calc(100% - 142px);
-            .g-search {
-            }
-
-            .table-layer {
-                overflow-y: auto;
-                height: calc(100% - 54px);
-                flex: 1;
-                margin-top: 20px;
-                background: rgba(176, 176, 176, 0.16);
-                border: 1px solid rgba(255, 255, 255, 0.1);
-                .list {
-                    border-collapse: collapse;
-                    width: 100%;
-                }
-
-                .list td,
-                .list th {
-                    font-size: 14px;
-                    line-height: 20px;
-                    text-align: left;
-                    padding: 15px;
-                    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
-                    &:not(&:first-of-type) {
-                        // min-width: 90px;
-                    }
-                }
-
-                .list th {
-                    color: rgba(255, 255, 255, 0.6);
-                    font-weight: normal;
-                    background: rgba(27, 27, 28, 0.8);
-                }
-
-                .nodata td,
-                .nodata th {
-                    text-align: center;
-                }
-
-                .list-info {
-                    height: 28px;
-                    padding-left: 33px;
-                    line-height: 28px;
-                    position: relative;
-                    text-align: left;
-                }
-
-                .list-info > img {
-                    position: absolute;
-                    left: 0;
-                    top: 0;
-                    width: 28px;
-                    height: 28px;
-                }
-            }
-        }
-
-        .goods-footer {
-            width: 100%;
-            padding: 22px 20px;
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            > button {
-                width: 105px;
-                margin: 0 10px;
-            }
-        }
-    }
-
-    .checkbox {
-        position: relative;
-        width: 14px;
-        height: 14px;
-        border-radius: 2px;
-        &.disabled {
-            opacity: 0.3;
-            > input {
-                cursor: default;
-            }
-        }
-    }
-
-    .checkbox > input,
-    .checkbox > span {
-        width: 100%;
-        height: 100%;
-        position: absolute;
-        left: 0;
-        top: 0;
-        border: 1px solid rgba(176, 176, 176, 0.5);
-    }
-
-    .checkbox > input {
-        z-index: 1;
-        opacity: 0;
-        cursor: pointer;
-    }
-
-    .checkbox > span {
-        z-index: 2;
-        pointer-events: none;
-        border-radius: 2px;
-    }
-
-    .checkbox > input:checked + span {
-        background: #00c8af;
-        border: 1px solid #00c8af;
-        &::after {
-            position: absolute;
-            display: table;
-            border: 2px solid #fff;
-            border-top: 0;
-            border-left: 0;
-            -webkit-transform: rotate(45deg) scale(0.6) translate(-50%, -50%);
-            transform: rotate(45deg) scale(0.6) translate(-50%, -50%);
-            opacity: 1;
-            -webkit-transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
-            transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
-            content: ' ';
-            width: 9px;
-            height: 16px;
-            top: 20%;
-        }
-    }
-}
-</style>
+<!--  -->
+<template>
+    <teleport to="body">
+        <div class="goods-layer">
+            <div class="goods-info">
+                <div class="goods-header">
+                    <span>選擇商品</span>
+                    <ui-icon @click.stop="close" class="close-btn" type="close"></ui-icon>
+                </div>
+
+                <div class="goods-con">
+                    <div class="g-search">
+                        <ui-input type="text" width="260px" placeholder="輸入關鍵字" v-model="searchKey">
+                            <template v-slot:preIcon>
+                                <ui-icon type="search" class="icon" />
+                            </template>
+                        </ui-input>
+                        <ui-input
+                            :class="{ disabled: !canChangeOption && hotData.products.length > 0 }"
+                            v-if="isHongKong"
+                            @click.stop
+                            type="select"
+                            @update:modelValue="onSelect"
+                            :options="productSourceOptions"
+                            width="160px"
+                            v-model="productSource"
+                            placeholder="選擇店鋪"
+                        >
+                            <template v-slot:option="{ raw }">
+                                <span>{{ raw.label }}</span>
+                            </template>
+                        </ui-input>
+                    </div>
+                    <div
+                        v-show="showListPanel"
+                        class="table-layer"
+                        v-infinite-scroll="getData"
+                        infinite-scroll-disabled="disabled_x"
+                        :infinite-scroll-throttle-delay="500"
+                        :infinite-scroll-immediate-check="false"
+                        infinite-scroll-distance="30"
+                    >
+                        <table class="list">
+                            <thead>
+                                <tr>
+                                    <th width="10px">
+                                        <div class="checkbox">
+                                            <input type="checkbox" v-model="allSelect" @click="e => selectGoodAll(e.target.checked)" />
+                                            <span></span>
+                                        </div>
+                                    </th>
+                                    <th>序號</th>
+                                    <th>商品編號</th>
+                                    <th width="100px">商品圖片</th>
+                                    <th :width="isHongKong ? '300px' : '100px'">商品名稱</th>
+                                    <th v-if="!isHongKong">價格</th>
+                                    <th v-if="!isHongKong">庫存</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                <tr v-for="(item, i) in list" :key="i">
+                                    <td width="10px">
+                                        <div class="checkbox" :class="{ disabled: item.isBind }">
+                                            <input type="checkbox" :disabled="item.isBind" @change="e => selectGood(item, e.target.checked)" :checked="item.isBind || item.isCheck" />
+                                            <span></span>
+                                        </div>
+                                    </td>
+                                    <td>{{ i + 1 }}</td>
+                                    <td>{{ item.id }}</td>
+                                    <td><img style="width: 100px" :src="item.pic" alt="" /></td>
+                                    <td>{{ item.name }}</td>
+                                    <td v-if="!isHongKong">{{ item.symbol }} {{ item.price }}</td>
+                                    <td v-if="!isHongKong">{{ item.stock }}</td>
+                                </tr>
+                                <tr class="nodata" v-if="list.length === 0">
+                                    <td colspan="7">暫無數據</td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+
+                <div class="goods-footer">
+                    <ui-button @click.stop="close" type="cancel">取消</ui-button>
+                    <ui-button @click.stop="submit" type="primary">保存</ui-button>
+                </div>
+            </div>
+        </div>
+    </teleport>
+</template>
+
+<script setup>
+import { reactive, defineEmits, onBeforeMount, onMounted, ref, watchEffect, computed, watch, nextTick } from 'vue'
+import { Dialog, Loading } from '@kankan/components'
+import metasImage from './metas/metas-image'
+import common from '@/utils/common'
+
+import { useStore } from 'vuex'
+const emit = defineEmits(['close'])
+
+const store = useStore()
+const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
+const hotData = computed(() => store.getters['tag/hotData'])
+
+console.log(hotData.value)
+
+const productSourceOptions = computed(() => {
+    let list = store.getters['tag/HKProductSourceList']
+    list.map(i => {
+        i.value = i.id
+        i.label = i.cdfName
+    })
+    return list
+})
+
+const list = computed(() => {
+    return store.getters['tag/goodsList'] || []
+})
+
+const requestLock = computed(() => store.getters['tag/requestLock'])
+const auth = computed(() => store.getters['scene/auth'])
+
+const productSource = ref(null)
+const searchKey = ref('')
+const allSelect = ref(false)
+const canChangeOption = ref(true)
+
+const select = ref([])
+const showListPanel = ref(false)
+
+const selectGoodAll = isSelect => {
+    list.value.forEach(item => {
+        selectGood(item, isSelect)
+    })
+}
+
+const selectGood = (item, isSelect) => {
+    item.isCheck = isSelect
+    let index = select.value.findIndex(i => i.id == item.id)
+    if (isSelect) {
+        !~index && select.value.push(item)
+    } else {
+        ~index && select.value.splice(index, 1)
+    }
+}
+
+const close = () => {
+    emit('close')
+}
+const onSelect = data => {
+    productSource.value = data
+}
+
+const getData = common.debounce(
+    (reset = false) => {
+        store.dispatch('tag/getGoodsList', {
+            keyword: searchKey.value,
+            pageNum: reset ? 1 : Math.floor(list.value.length / 20) + 1,
+            reset,
+            productSourceId: productSource.value,
+        })
+        if (!showListPanel.value) {
+            showListPanel.value = true
+        }
+    },
+    700,
+    false
+)
+
+const getGoodsFrom = async () => {
+    await store.dispatch('tag/getGoodsFrom', {})
+
+    if (hotData.value?.productSourceId) {
+        productSource.value = hotData.value?.productSourceId
+        canChangeOption.value = false
+    } else {
+        productSource.value = productSourceOptions.value[0].id
+        hotData.value.productSourceId = productSourceOptions.value[0].id
+    }
+
+    console.log(productSource.value, 'productSource.value')
+}
+
+const submit = () => {
+    store.commit('tag/pushGoodsItems', select)
+    close()
+}
+
+watch(
+    () => productSource.value,
+    (newval, old) => {
+        if (productSource.value) {
+            selectGoodAll(false)
+            getData(true)
+            hotData.value.productSourceId = productSource.value
+        }
+    }
+)
+
+watch(
+    () => searchKey.value,
+    (newval, old) => {
+        getData(true)
+    }
+)
+
+onMounted(() => {
+    if (isHongKong.value) {
+        nextTick(() => {
+            //重置下选择
+            selectGoodAll(false)
+            getGoodsFrom()
+        })
+    } else {
+        showListPanel.value = true
+        getData(true)
+        nextTick(() => {
+            //重置下选择
+            selectGoodAll(false)
+        })
+    }
+})
+</script>
+<style lang="scss">
+.goods-layer {
+    width: 100vw;
+    height: 100vh;
+    z-index: 100000;
+    top: 0;
+    position: fixed;
+    left: 0;
+    // padding: calc(var(--editor-head-height) + 20px) calc(var(--editor-toolbox-width) + 20px) 60px calc(var(--editor-menu-width) + 20px);
+    // background-color: rgba(255, 255, 255, 0.7);
+    z-index: 999;
+    .goods-info {
+        color: #fff;
+        width: 800px;
+        height: 760px;
+        margin: 5% auto;
+        user-select: none;
+        filter: var(--editor-menu-filter);
+        background-color: var(--editor-menu-back);
+        backdrop-filter: blur(4px);
+        border: solid 1px #000;
+        border-radius: 4px;
+        overflow: hidden;
+        &::after {
+            position: absolute;
+            top: 0;
+            left: 0;
+            content: '';
+            width: 100%;
+            height: 100%;
+            z-index: -1;
+            border: solid 1px rgba(255, 255, 255, 0.16);
+        }
+
+        .goods-header {
+            width: 100%;
+            padding: 22px 20px;
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            border-bottom: 1px solid rgba(255, 255, 255, 0.16);
+            .close-btn {
+                font-size: 16px;
+                cursor: pointer;
+            }
+        }
+
+        .goods-con {
+            padding: 20px;
+            height: calc(100% - 142px);
+            .g-search {
+            }
+
+            .table-layer {
+                overflow-y: auto;
+                height: calc(100% - 54px);
+                flex: 1;
+                margin-top: 20px;
+                background: rgba(176, 176, 176, 0.16);
+                border: 1px solid rgba(255, 255, 255, 0.1);
+                .list {
+                    border-collapse: collapse;
+                    width: 100%;
+                }
+
+                .list td,
+                .list th {
+                    font-size: 14px;
+                    line-height: 20px;
+                    text-align: left;
+                    padding: 15px;
+                    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
+                    &:not(&:first-of-type) {
+                        // min-width: 90px;
+                    }
+                }
+
+                .list th {
+                    color: rgba(255, 255, 255, 0.6);
+                    font-weight: normal;
+                    background: rgba(27, 27, 28, 0.8);
+                }
+
+                .nodata td,
+                .nodata th {
+                    text-align: center;
+                }
+
+                .list-info {
+                    height: 28px;
+                    padding-left: 33px;
+                    line-height: 28px;
+                    position: relative;
+                    text-align: left;
+                }
+
+                .list-info > img {
+                    position: absolute;
+                    left: 0;
+                    top: 0;
+                    width: 28px;
+                    height: 28px;
+                }
+            }
+        }
+
+        .goods-footer {
+            width: 100%;
+            padding: 22px 20px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            > button {
+                width: 105px;
+                margin: 0 10px;
+            }
+        }
+    }
+
+    .checkbox {
+        position: relative;
+        width: 14px;
+        height: 14px;
+        border-radius: 2px;
+        &.disabled {
+            opacity: 0.3;
+            > input {
+                cursor: default;
+            }
+        }
+    }
+
+    .checkbox > input,
+    .checkbox > span {
+        width: 100%;
+        height: 100%;
+        position: absolute;
+        left: 0;
+        top: 0;
+        border: 1px solid rgba(176, 176, 176, 0.5);
+    }
+
+    .checkbox > input {
+        z-index: 1;
+        opacity: 0;
+        cursor: pointer;
+    }
+
+    .checkbox > span {
+        z-index: 2;
+        pointer-events: none;
+        border-radius: 2px;
+    }
+
+    .checkbox > input:checked + span {
+        background: #00c8af;
+        border: 1px solid #00c8af;
+        &::after {
+            position: absolute;
+            display: table;
+            border: 2px solid #fff;
+            border-top: 0;
+            border-left: 0;
+            -webkit-transform: rotate(45deg) scale(0.6) translate(-50%, -50%);
+            transform: rotate(45deg) scale(0.6) translate(-50%, -50%);
+            opacity: 1;
+            -webkit-transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
+            transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
+            content: ' ';
+            width: 9px;
+            height: 16px;
+            top: 20%;
+        }
+    }
+}
+</style>

+ 176 - 174
packages/app-cdfg/src/components/Tags/metas/metas-exhibits.vue

@@ -1,174 +1,176 @@
-<!--  -->
-<template>
-    <div class="metas-exhibits" :class="{ noEdit: !isEdit }">
-        <div class="addcon" v-if="isEdit" @click.stop="store.commit('tag/setShowGoodsList', true)">
-            <div class="add">
-                <ui-icon type="add" class="icon" />
-            </div>
-            <span>添加商品關聯</span>
-        </div>
-        <div class="style-item" v-for="(item, i) in productsList" :key="i">
-            <div :style="`background-image:url(${item.pic});`">
-                <div v-if="isEdit" class="close-btn" @click.stop="delItem(i)">
-                    <ui-icon type="close"></ui-icon>
-                </div>
-            </div>
-            <span>{{ item.name }}</span>
-        </div>
-    </div>
-</template>
-
-<script setup>
-import { reactive, toRefs, onBeforeMount, watch, onMounted, nextTick, ref, computed, defineProps } from 'vue'
-import { useStore } from 'vuex'
-import common from '@/utils/common'
-import { customized } from '../constant.js'
-import { getApp, useApp } from '@/app'
-import { Dialog } from '@kankan/components'
-
-const unique = arr => {
-    for (var i = 0; i < arr.length; i++) {
-        for (var j = i + 1; j < arr.length; j++) {
-            if (arr[i].id === arr[j].id) {
-                arr.splice(j, 1)
-                j--
-            }
-        }
-    }
-    return arr
-}
-
-const store = useStore()
-const type = ref('exhibits')
-const isEdit = computed(() => store.getters['tag/isEdit'])
-
-const hotData = computed(() => store.getters['tag/hotData'])
-const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
-
-const productsList = computed(() => {
-    return hotData.value.products
-})
-const delItem = index => {
-    store.commit('tag/delMetas', { index, type: type.value })
-}
-
-watch(
-    () => store.getters['tag/seleteGoodsItems'],
-    (val, old) => {
-        setProductsList(val)
-    }
-)
-
-const setProductsList = data => {
-    let LENGTH = isHongKong.value ? 30 : 9
-    let list = productsList.value.concat(data)
-    if (unique(list).length > LENGTH) {
-        return Dialog.alert({ title: '提示', content: `單個熱點關聯商品不能超過${LENGTH}個`, okText: '確定' })
-    }
-    store.commit('tag/setProductsList', unique(list))
-}
-
-onMounted(async () => {
-    const app = await useApp()
-})
-</script>
-<style lang="scss" scoped>
-.metas-exhibits {
-    display: flex;
-    align-items: flex-start;
-    width: 100%;
-    flex-wrap: wrap;
-    padding-top: 10px;
-    max-height: 50vh;
-    overflow-y: auto;
-    .addcon {
-        color: rgba(255, 255, 255, 0.3);
-        margin-right: 8px;
-        .add {
-            cursor: pointer;
-            width: 80px;
-            height: 80px;
-            border: 1px solid rgba(255, 255, 255, 0.2);
-            background: rgba(255, 255, 255, 0.1);
-            border-radius: 4px;
-            text-align: center;
-            display: flex;
-            flex-direction: column;
-            justify-content: center;
-        }
-        > span {
-            font-size: 12px;
-            margin-top: 6px;
-            text-align: center;
-            width: 100%;
-            display: inline-block;
-        }
-    }
-    .style-item {
-        width: 80px;
-        margin-right: 8px;
-        margin-bottom: 10px;
-        color: rgba(255, 255, 255, 0.3);
-        > div {
-            width: 80px;
-            height: 80px;
-            box-sizing: border-box;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-            background-repeat: no-repeat;
-            background-size: cover;
-            position: relative;
-            border-radius: 4px;
-            &.default {
-            }
-            &.active {
-                border: 1px solid var(--editor-main-color);
-            }
-            .close-btn {
-                width: 16px;
-                height: 16px;
-                border-radius: 50%;
-                position: absolute;
-                display: flex;
-                align-items: center;
-                justify-content: center;
-                background: rgba(250, 63, 72, 1);
-                opacity: 0.6;
-                right: -6px;
-                top: -6px;
-                z-index: 101;
-                cursor: pointer;
-                display: none;
-                &:hover {
-                    opacity: 1;
-                }
-                > i {
-                    font-size: 12px;
-                    color: #fff;
-                    transform: scale(0.8);
-                }
-            }
-            &:hover {
-                .close-btn {
-                    display: flex;
-                }
-            }
-        }
-        > span {
-            font-size: 12px;
-            margin-top: 6px;
-            display: inline-block;
-            width: 100%;
-            overflow: hidden;
-            display: -webkit-box; /*彈性伸縮盒子*/
-            -webkit-box-orient: vertical; /*子元素垂直排列*/
-            -webkit-line-clamp: 2; /*可以顯示的行數,超出部分用...表示*/
-            text-overflow: ellipsis; /*(多行文本的情況下,用省略號「…」隱藏溢出範圍的文本)*/
-        }
-    }
-}
-.noEdit {
-    padding: 10px;
-}
-</style>
+<!--  -->
+<template>
+    <div class="metas-exhibits" :class="{ noEdit: !isEdit }">
+        <div class="addcon" v-if="isEdit" @click.stop="store.commit('tag/setShowGoodsList', true)">
+            <div class="add">
+                <ui-icon type="add" class="icon" />
+            </div>
+            <span>添加商品關聯</span>
+        </div>
+        <div class="style-item" v-for="(item, i) in productsList" :key="i">
+            <div :style="`background-image:url(${item.pic});`">
+                <div v-if="isEdit" class="close-btn" @click.stop="delItem(i)">
+                    <ui-icon type="close"></ui-icon>
+                </div>
+            </div>
+            <span>{{ item.name }}</span>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import { reactive, toRefs, onBeforeMount, watch, onMounted, nextTick, ref, computed, defineProps } from 'vue'
+import { useStore } from 'vuex'
+import common from '@/utils/common'
+import { customized } from '../constant.js'
+import { getApp, useApp } from '@/app'
+import { Dialog } from '@kankan/components'
+
+const unique = arr => {
+    for (var i = 0; i < arr.length; i++) {
+        for (var j = i + 1; j < arr.length; j++) {
+            if (arr[i].id === arr[j].id) {
+                arr.splice(j, 1)
+                j--
+            }
+        }
+    }
+    return arr
+}
+
+const store = useStore()
+const type = ref('exhibits')
+const isEdit = computed(() => store.getters['tag/isEdit'])
+
+const hotData = computed(() => store.getters['tag/hotData'])
+const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
+
+const productsList = computed(() => {
+    return hotData.value.products
+})
+const delItem = index => {
+    store.commit('tag/delMetas', { index, type: type.value })
+}
+
+watch(
+    () => store.getters['tag/seleteGoodsItems'],
+    (val, old) => {
+        setProductsList(val)
+    }
+)
+
+const setProductsList = data => {
+    // let LENGTH = isHongKong.value ? 30 : 9
+    //唐發說要統一30個  http://192.168.0.21/index.php?m=bug&f=view&bugID=41973
+    let LENGTH = 30
+    let list = productsList.value.concat(data)
+    if (unique(list).length > LENGTH) {
+        return Dialog.alert({ title: '提示', content: `單個熱點關聯商品不能超過${LENGTH}個`, okText: '確定' })
+    }
+    store.commit('tag/setProductsList', unique(list))
+}
+
+onMounted(async () => {
+    const app = await useApp()
+})
+</script>
+<style lang="scss" scoped>
+.metas-exhibits {
+    display: flex;
+    align-items: flex-start;
+    width: 100%;
+    flex-wrap: wrap;
+    padding-top: 10px;
+    max-height: 50vh;
+    overflow-y: auto;
+    .addcon {
+        color: rgba(255, 255, 255, 0.3);
+        margin-right: 8px;
+        .add {
+            cursor: pointer;
+            width: 80px;
+            height: 80px;
+            border: 1px solid rgba(255, 255, 255, 0.2);
+            background: rgba(255, 255, 255, 0.1);
+            border-radius: 4px;
+            text-align: center;
+            display: flex;
+            flex-direction: column;
+            justify-content: center;
+        }
+        > span {
+            font-size: 12px;
+            margin-top: 6px;
+            text-align: center;
+            width: 100%;
+            display: inline-block;
+        }
+    }
+    .style-item {
+        width: 80px;
+        margin-right: 8px;
+        margin-bottom: 10px;
+        color: rgba(255, 255, 255, 0.3);
+        > div {
+            width: 80px;
+            height: 80px;
+            box-sizing: border-box;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            background-repeat: no-repeat;
+            background-size: cover;
+            position: relative;
+            border-radius: 4px;
+            &.default {
+            }
+            &.active {
+                border: 1px solid var(--editor-main-color);
+            }
+            .close-btn {
+                width: 16px;
+                height: 16px;
+                border-radius: 50%;
+                position: absolute;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                background: rgba(250, 63, 72, 1);
+                opacity: 0.6;
+                right: -6px;
+                top: -6px;
+                z-index: 101;
+                cursor: pointer;
+                display: none;
+                &:hover {
+                    opacity: 1;
+                }
+                > i {
+                    font-size: 12px;
+                    color: #fff;
+                    transform: scale(0.8);
+                }
+            }
+            &:hover {
+                .close-btn {
+                    display: flex;
+                }
+            }
+        }
+        > span {
+            font-size: 12px;
+            margin-top: 6px;
+            display: inline-block;
+            width: 100%;
+            overflow: hidden;
+            display: -webkit-box; /*彈性伸縮盒子*/
+            -webkit-box-orient: vertical; /*子元素垂直排列*/
+            -webkit-line-clamp: 2; /*可以顯示的行數,超出部分用...表示*/
+            text-overflow: ellipsis; /*(多行文本的情況下,用省略號「…」隱藏溢出範圍的文本)*/
+        }
+    }
+}
+.noEdit {
+    padding: 10px;
+}
+</style>

+ 176 - 174
packages/app-cdfg/src/components/Tags/metas/metas-waterfall.vue

@@ -1,174 +1,176 @@
-<!--  -->
-<template>
-    <div class="metas-waterfall" :class="{ noEdit: !isEdit }">
-        <div class="addcon" v-if="isEdit" @click.stop="store.commit('tag/setShowGoodsList', true)">
-            <div class="add">
-                <ui-icon type="add" class="icon" />
-            </div>
-            <span>添加商品關聯</span>
-        </div>
-        <div class="style-item" v-for="(item, i) in productsList" :key="i">
-            <div :style="`background-image:url(${item.pic});`">
-                <div v-if="isEdit" class="close-btn" @click.stop="delItem(i)">
-                    <ui-icon type="close"></ui-icon>
-                </div>
-            </div>
-            <span>{{ item.name }}</span>
-        </div>
-    </div>
-</template>
-
-<script setup>
-import { reactive, toRefs, onBeforeMount, watch, onMounted, nextTick, ref, computed, defineProps } from 'vue'
-import { useStore } from 'vuex'
-import common from '@/utils/common'
-import { customized } from '../constant.js'
-import { getApp, useApp } from '@/app'
-import { Dialog } from '@kankan/components'
-
-const unique = arr => {
-    for (var i = 0; i < arr.length; i++) {
-        for (var j = i + 1; j < arr.length; j++) {
-            if (arr[i].id === arr[j].id) {
-                arr.splice(j, 1)
-                j--
-            }
-        }
-    }
-    return arr
-}
-
-const store = useStore()
-const type = ref('waterfall')
-const isEdit = computed(() => store.getters['tag/isEdit'])
-
-const hotData = computed(() => store.getters['tag/hotData'])
-const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
-
-const productsList = computed(() => {
-    return hotData.value.products
-})
-const delItem = index => {
-    store.commit('tag/delMetas', { index, type: type.value })
-}
-
-watch(
-    () => store.getters['tag/seleteGoodsItems'],
-    (val, old) => {
-        setProductsList(val)
-    }
-)
-
-const setProductsList = data => {
-    let LENGTH = isHongKong.value ? 30 : 10
-    let list = productsList.value.concat(data)
-    if (unique(list).length > LENGTH) {
-        return Dialog.alert({ title: '提示', content: `單個熱點關聯商品不能超過${LENGTH}個`, okText: '確定' })
-    }
-    store.commit('tag/setProductsList', unique(list))
-}
-
-onMounted(async () => {
-    const app = await useApp()
-})
-</script>
-<style lang="scss" scoped>
-.metas-waterfall {
-    display: flex;
-    align-items: flex-start;
-    width: 100%;
-    flex-wrap: wrap;
-    padding-top: 10px;
-    max-height: 50vh;
-    overflow-y: auto;
-    .addcon {
-        color: rgba(255, 255, 255, 0.3);
-        margin-right: 8px;
-        .add {
-            cursor: pointer;
-            width: 80px;
-            height: 80px;
-            border: 1px solid rgba(255, 255, 255, 0.2);
-            background: rgba(255, 255, 255, 0.1);
-            border-radius: 4px;
-            text-align: center;
-            display: flex;
-            flex-direction: column;
-            justify-content: center;
-        }
-        > span {
-            font-size: 12px;
-            margin-top: 6px;
-            text-align: center;
-            width: 100%;
-            display: inline-block;
-        }
-    }
-    .style-item {
-        width: 80px;
-        margin-right: 8px;
-        margin-bottom: 10px;
-        color: rgba(255, 255, 255, 0.3);
-        > div {
-            width: 80px;
-            height: 80px;
-            box-sizing: border-box;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-            background-repeat: no-repeat;
-            background-size: cover;
-            position: relative;
-            border-radius: 4px;
-            &.default {
-            }
-            &.active {
-                border: 1px solid var(--editor-main-color);
-            }
-            .close-btn {
-                width: 16px;
-                height: 16px;
-                border-radius: 50%;
-                position: absolute;
-                display: flex;
-                align-items: center;
-                justify-content: center;
-                background: rgba(250, 63, 72, 1);
-                opacity: 0.6;
-                right: -6px;
-                top: -6px;
-                z-index: 101;
-                cursor: pointer;
-                display: none;
-                &:hover {
-                    opacity: 1;
-                }
-                > i {
-                    font-size: 12px;
-                    color: #fff;
-                    transform: scale(0.8);
-                }
-            }
-            &:hover {
-                .close-btn {
-                    display: flex;
-                }
-            }
-        }
-        > span {
-            font-size: 12px;
-            margin-top: 6px;
-            display: inline-block;
-            width: 100%;
-            overflow: hidden;
-            display: -webkit-box; /*彈性伸縮盒子*/
-            -webkit-box-orient: vertical; /*子元素垂直排列*/
-            -webkit-line-clamp: 2; /*可以顯示的行數,超出部分用...表示*/
-            text-overflow: ellipsis; /*(多行文本的情況下,用省略號「…」隱藏溢出範圍的文本)*/
-        }
-    }
-}
-.noEdit {
-    padding: 10px;
-}
-</style>
+<!--  -->
+<template>
+    <div class="metas-waterfall" :class="{ noEdit: !isEdit }">
+        <div class="addcon" v-if="isEdit" @click.stop="store.commit('tag/setShowGoodsList', true)">
+            <div class="add">
+                <ui-icon type="add" class="icon" />
+            </div>
+            <span>添加商品關聯</span>
+        </div>
+        <div class="style-item" v-for="(item, i) in productsList" :key="i">
+            <div :style="`background-image:url(${item.pic});`">
+                <div v-if="isEdit" class="close-btn" @click.stop="delItem(i)">
+                    <ui-icon type="close"></ui-icon>
+                </div>
+            </div>
+            <span>{{ item.name }}</span>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import { reactive, toRefs, onBeforeMount, watch, onMounted, nextTick, ref, computed, defineProps } from 'vue'
+import { useStore } from 'vuex'
+import common from '@/utils/common'
+import { customized } from '../constant.js'
+import { getApp, useApp } from '@/app'
+import { Dialog } from '@kankan/components'
+
+const unique = arr => {
+    for (var i = 0; i < arr.length; i++) {
+        for (var j = i + 1; j < arr.length; j++) {
+            if (arr[i].id === arr[j].id) {
+                arr.splice(j, 1)
+                j--
+            }
+        }
+    }
+    return arr
+}
+
+const store = useStore()
+const type = ref('waterfall')
+const isEdit = computed(() => store.getters['tag/isEdit'])
+
+const hotData = computed(() => store.getters['tag/hotData'])
+const isHongKong = computed(() => store.getters['scene/whichDept'] == 'HK')
+
+const productsList = computed(() => {
+    return hotData.value.products
+})
+const delItem = index => {
+    store.commit('tag/delMetas', { index, type: type.value })
+}
+
+watch(
+    () => store.getters['tag/seleteGoodsItems'],
+    (val, old) => {
+        setProductsList(val)
+    }
+)
+
+const setProductsList = data => {
+    // let LENGTH = isHongKong.value ? 30 : 10
+    //唐發說要統一30個  http://192.168.0.21/index.php?m=bug&f=view&bugID=41973
+    let LENGTH = 30
+    let list = productsList.value.concat(data)
+    if (unique(list).length > LENGTH) {
+        return Dialog.alert({ title: '提示', content: `單個熱點關聯商品不能超過${LENGTH}個`, okText: '確定' })
+    }
+    store.commit('tag/setProductsList', unique(list))
+}
+
+onMounted(async () => {
+    const app = await useApp()
+})
+</script>
+<style lang="scss" scoped>
+.metas-waterfall {
+    display: flex;
+    align-items: flex-start;
+    width: 100%;
+    flex-wrap: wrap;
+    padding-top: 10px;
+    max-height: 50vh;
+    overflow-y: auto;
+    .addcon {
+        color: rgba(255, 255, 255, 0.3);
+        margin-right: 8px;
+        .add {
+            cursor: pointer;
+            width: 80px;
+            height: 80px;
+            border: 1px solid rgba(255, 255, 255, 0.2);
+            background: rgba(255, 255, 255, 0.1);
+            border-radius: 4px;
+            text-align: center;
+            display: flex;
+            flex-direction: column;
+            justify-content: center;
+        }
+        > span {
+            font-size: 12px;
+            margin-top: 6px;
+            text-align: center;
+            width: 100%;
+            display: inline-block;
+        }
+    }
+    .style-item {
+        width: 80px;
+        margin-right: 8px;
+        margin-bottom: 10px;
+        color: rgba(255, 255, 255, 0.3);
+        > div {
+            width: 80px;
+            height: 80px;
+            box-sizing: border-box;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            background-repeat: no-repeat;
+            background-size: cover;
+            position: relative;
+            border-radius: 4px;
+            &.default {
+            }
+            &.active {
+                border: 1px solid var(--editor-main-color);
+            }
+            .close-btn {
+                width: 16px;
+                height: 16px;
+                border-radius: 50%;
+                position: absolute;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                background: rgba(250, 63, 72, 1);
+                opacity: 0.6;
+                right: -6px;
+                top: -6px;
+                z-index: 101;
+                cursor: pointer;
+                display: none;
+                &:hover {
+                    opacity: 1;
+                }
+                > i {
+                    font-size: 12px;
+                    color: #fff;
+                    transform: scale(0.8);
+                }
+            }
+            &:hover {
+                .close-btn {
+                    display: flex;
+                }
+            }
+        }
+        > span {
+            font-size: 12px;
+            margin-top: 6px;
+            display: inline-block;
+            width: 100%;
+            overflow: hidden;
+            display: -webkit-box; /*彈性伸縮盒子*/
+            -webkit-box-orient: vertical; /*子元素垂直排列*/
+            -webkit-line-clamp: 2; /*可以顯示的行數,超出部分用...表示*/
+            text-overflow: ellipsis; /*(多行文本的情況下,用省略號「…」隱藏溢出範圍的文本)*/
+        }
+    }
+}
+.noEdit {
+    padding: 10px;
+}
+</style>

+ 0 - 1
packages/app-cdfg/src/components/Tags/tag-info.vue

@@ -123,7 +123,6 @@ const showBrandList = ref(false)
 if (whichDept.value == 'HK') {
     delete customized['applet_link']
 } else {
-    console.error(2132121)
     // delete customized['exhibits']
     delete customized['point_jump']
 }

+ 324 - 324
packages/app-cdfg/src/store/modules/tour.js

@@ -1,324 +1,324 @@
-import { getApp, getNum } from '@/app'
-import { base64ToBlob, convertBlob2File } from '@/utils/file'
-export default {
-    namespaced: true,
-    state() {
-        return {
-            // showPath: false,
-            // showFrame: false,
-            toursList: [],
-            sourceList: null,
-            frameId: 0,
-            partId: 0,
-            tours: [],
-            fileObj: {},
-            musicList: [],
-            delList: [],
-            isPlay: false,
-            showTours: false,
-            hlIndex: -1,
-            allTime: 0,
-        }
-    },
-    getters: {
-        tours: state => {
-            return state.tours
-        },
-        allTime: state => {
-            return state.allTime
-        },
-
-        partId: state => {
-            return state.partId
-        },
-        frameId: state => {
-            return state.frameId
-        },
-        isPlay: state => {
-            return state.isPlay
-        },
-        showTours: state => {
-            return state.showTours
-        },
-        hlIndex: state => {
-            return state.hlIndex
-        },
-    },
-    mutations: {
-        async setData(state, payload) {
-            if (payload) {
-                for (let key in payload) {
-                    state[key] = payload[key]
-                }
-            }
-        },
-        setBackUp(state) {
-            state.toursList = JSON.parse(JSON.stringify(state.tours))
-        },
-        update(state, tours) {
-            this.commit('enterEdit')
-            //如果删除片段和备份数据一样则退出编辑模式
-            let t = setTimeout(() => {
-                clearTimeout(t)
-                if (state.tours.length == 0 && state.toursList.length == 0) {
-                    this.commit('leaveEdit')
-                }
-            }, 0)
-        },
-        async setFrame(state, payload) {
-            const recordr = await getApp().TourManager.recorder
-            recordr.setFrame(state.frameId, payload)
-            this.commit('tour/update')
-        },
-        async setPart(state, payload) {
-            let data = JSON.parse(JSON.stringify(payload))
-
-            for (let key in payload) {
-                state.tours[state.partId][key] = payload[key]
-            }
-            for (let key in data) {
-                if (key === 'file') {
-                    state.fileObj[state.tours[state.partId].sid] = payload[key]
-                    delete data[key]
-                }
-            }
-            const recordr = await getApp().TourManager.recorder
-            recordr.setPart(state.partId, data)
-            this.commit('tour/update')
-        },
-        getUploadMuscis(state, payload) {
-            let musics = state.tours.filter(item => {
-                console.log(item.file)
-                if (item.file) {
-                    return item
-                }
-            })
-            console.log(musics)
-            return musics
-        },
-        // setTime(state, time) {
-        //     // state.tours[state.partId].list[state.frameId].time = time * 1000
-        //     this.commit('tour/setFrame', { time: time * 1000 })
-        // },
-        deleteList(state, payload) {
-            let frameId = payload.frameId || 0
-            let list = state.tours[state.partId].list
-            let music = state.tours[state.partId].music
-            // let name = state.tours[state.partId].list[frameId].enter.cover
-            switch (payload.type) {
-                case 'part':
-                    // if (music.indexOf('blob:') == -1 && music != '') {
-                    if (music != '') {
-                        let file = state.tours[state.partId].musicUrl ? state.tours[state.partId].musicUrl.split('/').pop().split('?').shift() : music.split('/').pop().split('?').shift()
-                        state.delList.push(file)
-                    }
-                    if (list.length > 0) {
-                        list.forEach((i, index) => {
-                            // if (i.enter.coverUrl || i.enter.cover.indexOf('data:image') == -1) {
-                            //     state.delList.push(i.enter.cover.split('/').pop().split('?').shift())
-                            // }
-                            let cover = i.enter.coverUrl ? i.enter.coverUrl.split('/').pop().split('?').shift() : i.enter.cover.split('/').pop().split('?').shift()
-                            if (state.delList.length > 0) {
-                                let same = false
-                                for (let j = 0; j < state.delList.length; j++) {
-                                    if (cover == state.delList[j]) {
-                                        same = true
-                                    }
-                                }
-                                if (!same) {
-                                    state.delList.push(cover)
-                                }
-                            } else {
-                                state.delList.push(cover)
-                            }
-                        })
-                    }
-                    break
-                case 'frame':
-                    // if (name.indexOf('data:image') == -1) {
-                    //     state.delList.push(name.split('/').pop().split('?').shift())
-                    // }
-                    let enter = state.tours[state.partId].list[frameId].enter
-
-                    // let cover =enter.coverUrl
-                    //     ? enter.coverUrl.split('/').pop().split('?').shift()
-                    //     : enter.cover.split('/').pop().split('?').shift()
-                    let cover = enter.coverUrl ? enter.coverUrl : enter.cover
-                    if (cover.substring(0, 10) != 'data:image') {
-                        state.delList.push(cover)
-                    }
-
-                    //整理删除文件列表
-
-                    if (state.tours[state.partId].list.length == 1) {
-                        this.commit('tour/deleteList', { type: 'part' })
-                    }
-
-                    break
-                case 'music':
-                    // if (music.indexOf('blob:') == -1 && music != '') {
-                    //     state.delList.push(name.split('/').pop().split('?').shift())
-                    // }
-                    if (music != '') {
-                        let file = state.tours[state.partId].musicUrl ? state.tours[state.partId].musicUrl.split('/').pop().split('?').shift() : music.split('/').pop().split('?').shift()
-                        state.delList.push(file)
-                    }
-                    break
-            }
-            console.log(state.delList)
-        },
-        hanldActive(state, payload) {
-            this.commit('tour/deleteList', { type: 'part' })
-            if (state.tours[state.tours.length - 1].list == 0) {
-                state.tours.splice(state.tours.length - 1, 1)
-                if (state.tours.length == 0) {
-                    this.commit('setToolbox', {
-                        show: false,
-                        type: null,
-                    })
-                }
-                let id
-                if (state.partId >= state.tours.length) {
-                    id = 0
-                } else {
-                    id = state.partId
-                }
-                this.commit('tour/setData', { partId: id })
-            }
-        },
-        async cancel(state) {
-            this.commit('leaveEdit')
-            state.hlIndex = -1
-
-            state.tours = JSON.parse(JSON.stringify(state.toursList))
-            getApp().TourManager.load(JSON.parse(JSON.stringify(state.toursList))) //通知回滚
-            if (state.partId >= state.tours.length) {
-                state.partId = 0
-            }
-
-            state.toursList = JSON.parse(JSON.stringify(state.tours))
-            state.delList = []
-            state.fileObj = {}
-        },
-        save(state, newdData) {
-            state.toursList = JSON.parse(JSON.stringify(newdData))
-            getApp().TourManager.load(JSON.parse(JSON.stringify(state.toursList)))
-            // 先删除空的片段
-            state.hlIndex = -1
-            for (let i = 0; i < state.tours.length; i++) {
-                if (state.tours[i].list.length == 0) {
-                    state.tours.splice(i, 1)
-                    //切换片段ID
-                    if (state.partId < state.tours.length - 1) {
-                        state.partId++
-                    } else {
-                        state.partId = 0
-                    }
-                    i--
-                }
-            }
-            for (let i = 0; i < state.tours.length; i++) {
-                state.tours[i].musicUrl = newdData[i].music
-                for (let j = 0; j < newdData[i].list.length; j++) {
-                    state.tours[i].list[j].enter.coverUrl = newdData[i].list[j].enter.cover
-                }
-            }
-            console.log(state.tours)
-            console.log(state.hlIndex)
-            this.commit('leaveEdit')
-        },
-    },
-    actions: {
-        delTours({ commit, state }, payload) {
-            // tour/delete
-            return getApp()
-                .remote_editor.tour_delete({ num: getNum() })
-                .then(res => {
-                    if (res.success) {
-                        state.tours = []
-                        commit('save', [])
-                        getApp().TourManager.load([])
-                    }
-                    return res
-                })
-                .catch(err => {
-                    console.log(err)
-                    return err
-                })
-        },
-        async delFile({ commit, state }, payload) {
-            let params = {
-                num: getNum(),
-                bizType: 'tour',
-                fileNames: state.delList,
-            }
-            let res = await this.dispatch('delFiles', params)
-            console.log(res)
-            if (res.success) {
-                state.delList = []
-            }
-        },
-        async save({ commit, dispatch, state }, payload) {
-            if (state.allTime > 60 * 30) {
-                return Promise.reject({ type: 'toast', tips: 'warn', msg: 'tour.toolbar.timeLimit' })
-            }
-            let recorder = await getApp().TourManager.recorder
-            let data = recorder.exportData()
-            for (let i = 0; i < data.length; i++) {
-                if (data[i].name == '') {
-                    return Promise.reject({ type: 'toast', tips: 'warn', msg: 'tour.toolbox.tourTitleTips' })
-                }
-            }
-            if (state.delList.length > 0) {
-                dispatch('delFile')
-            }
-
-            let exportFiles = recorder.exportFiles()
-            let files = []
-            console.log(exportFiles)
-            exportFiles.map(item => {
-                let obj = {}
-                if (item.type == 'base64') {
-                    obj.file = convertBlob2File(base64ToBlob(item.file), item.name)
-                    obj.filename = item.name
-                } else if (item.type == 'file') {
-                    state.tours.filter(i => {
-                        let fileId = item.name.split('.').shift().split('-').pop()
-                        if (fileId == i.sid) {
-                            // obj.file = i.file
-                            obj.file = state.fileObj[i.sid]
-                            obj.filename = item.name
-                        }
-                    })
-                }
-                files.push(obj)
-            })
-            console.log(files)
-            if (files.length > 0) {
-                let res = await this.dispatch('scene/upload_files', { bizType: 'tour', num: getNum(), type: 0, files: files })
-                if (res.success) {
-                    state.fileObj = {}
-                }
-            }
-
-            console.log('data', data)
-            console.log('tours', state.tours)
-            let params = {
-                num: getNum(),
-                data: JSON.stringify(data),
-            }
-            return getApp()
-                .remote_editor.tour_save(params)
-                .then(res => {
-                    if (res.success) {
-                        commit('save', data)
-                    }
-                    return res
-                })
-                .catch(err => {
-                    console.log(err)
-                    return err
-                })
-        },
-    },
-}
+import { getApp, getNum } from '@/app'
+import { base64ToBlob, convertBlob2File } from '@/utils/file'
+export default {
+    namespaced: true,
+    state() {
+        return {
+            // showPath: false,
+            // showFrame: false,
+            toursList: [],
+            sourceList: null,
+            frameId: 0,
+            partId: 0,
+            tours: [],
+            fileObj: {},
+            musicList: [],
+            delList: [],
+            isPlay: false,
+            showTours: false,
+            hlIndex: -1,
+            allTime: 0,
+        }
+    },
+    getters: {
+        tours: state => {
+            return state.tours
+        },
+        allTime: state => {
+            return state.allTime
+        },
+
+        partId: state => {
+            return state.partId
+        },
+        frameId: state => {
+            return state.frameId
+        },
+        isPlay: state => {
+            return state.isPlay
+        },
+        showTours: state => {
+            return state.showTours
+        },
+        hlIndex: state => {
+            return state.hlIndex
+        },
+    },
+    mutations: {
+        async setData(state, payload) {
+            if (payload) {
+                for (let key in payload) {
+                    state[key] = payload[key]
+                }
+            }
+        },
+        setBackUp(state) {
+            state.toursList = JSON.parse(JSON.stringify(state.tours))
+        },
+        update(state, tours) {
+            this.commit('enterEdit')
+            //如果删除片段和备份数据一样则退出编辑模式
+            // let t = setTimeout(() => {
+            //     clearTimeout(t)
+            //     if (state.tours.length == 0 && state.toursList.length == 0) {
+            //         this.commit('leaveEdit')
+            //     }
+            // }, 0)
+        },
+        async setFrame(state, payload) {
+            const recordr = await getApp().TourManager.recorder
+            recordr.setFrame(state.frameId, payload)
+            this.commit('tour/update')
+        },
+        async setPart(state, payload) {
+            let data = JSON.parse(JSON.stringify(payload))
+
+            for (let key in payload) {
+                state.tours[state.partId][key] = payload[key]
+            }
+            for (let key in data) {
+                if (key === 'file') {
+                    state.fileObj[state.tours[state.partId].sid] = payload[key]
+                    delete data[key]
+                }
+            }
+            const recordr = await getApp().TourManager.recorder
+            recordr.setPart(state.partId, data)
+            this.commit('tour/update')
+        },
+        getUploadMuscis(state, payload) {
+            let musics = state.tours.filter(item => {
+                console.log(item.file)
+                if (item.file) {
+                    return item
+                }
+            })
+            console.log(musics)
+            return musics
+        },
+        // setTime(state, time) {
+        //     // state.tours[state.partId].list[state.frameId].time = time * 1000
+        //     this.commit('tour/setFrame', { time: time * 1000 })
+        // },
+        deleteList(state, payload) {
+            let frameId = payload.frameId || 0
+            let list = state.tours[state.partId].list
+            let music = state.tours[state.partId].music
+            // let name = state.tours[state.partId].list[frameId].enter.cover
+            switch (payload.type) {
+                case 'part':
+                    // if (music.indexOf('blob:') == -1 && music != '') {
+                    if (music != '') {
+                        let file = state.tours[state.partId].musicUrl ? state.tours[state.partId].musicUrl.split('/').pop().split('?').shift() : music.split('/').pop().split('?').shift()
+                        state.delList.push(file)
+                    }
+                    if (list.length > 0) {
+                        list.forEach((i, index) => {
+                            // if (i.enter.coverUrl || i.enter.cover.indexOf('data:image') == -1) {
+                            //     state.delList.push(i.enter.cover.split('/').pop().split('?').shift())
+                            // }
+                            let cover = i.enter.coverUrl ? i.enter.coverUrl.split('/').pop().split('?').shift() : i.enter.cover.split('/').pop().split('?').shift()
+                            if (state.delList.length > 0) {
+                                let same = false
+                                for (let j = 0; j < state.delList.length; j++) {
+                                    if (cover == state.delList[j]) {
+                                        same = true
+                                    }
+                                }
+                                if (!same) {
+                                    state.delList.push(cover)
+                                }
+                            } else {
+                                state.delList.push(cover)
+                            }
+                        })
+                    }
+                    break
+                case 'frame':
+                    // if (name.indexOf('data:image') == -1) {
+                    //     state.delList.push(name.split('/').pop().split('?').shift())
+                    // }
+                    let enter = state.tours[state.partId].list[frameId].enter
+
+                    // let cover =enter.coverUrl
+                    //     ? enter.coverUrl.split('/').pop().split('?').shift()
+                    //     : enter.cover.split('/').pop().split('?').shift()
+                    let cover = enter.coverUrl ? enter.coverUrl : enter.cover
+                    if (cover.substring(0, 10) != 'data:image') {
+                        state.delList.push(cover)
+                    }
+
+                    //整理删除文件列表
+
+                    if (state.tours[state.partId].list.length == 1) {
+                        this.commit('tour/deleteList', { type: 'part' })
+                    }
+
+                    break
+                case 'music':
+                    // if (music.indexOf('blob:') == -1 && music != '') {
+                    //     state.delList.push(name.split('/').pop().split('?').shift())
+                    // }
+                    if (music != '') {
+                        let file = state.tours[state.partId].musicUrl ? state.tours[state.partId].musicUrl.split('/').pop().split('?').shift() : music.split('/').pop().split('?').shift()
+                        state.delList.push(file)
+                    }
+                    break
+            }
+            console.log(state.delList)
+        },
+        hanldActive(state, payload) {
+            this.commit('tour/deleteList', { type: 'part' })
+            if (state.tours[state.tours.length - 1].list == 0) {
+                state.tours.splice(state.tours.length - 1, 1)
+                if (state.tours.length == 0) {
+                    this.commit('setToolbox', {
+                        show: false,
+                        type: null,
+                    })
+                }
+                let id
+                if (state.partId >= state.tours.length) {
+                    id = 0
+                } else {
+                    id = state.partId
+                }
+                this.commit('tour/setData', { partId: id })
+            }
+        },
+        async cancel(state) {
+            this.commit('leaveEdit')
+            state.hlIndex = -1
+
+            state.tours = JSON.parse(JSON.stringify(state.toursList))
+            getApp().TourManager.load(JSON.parse(JSON.stringify(state.toursList))) //通知回滚
+            if (state.partId >= state.tours.length) {
+                state.partId = 0
+            }
+
+            state.toursList = JSON.parse(JSON.stringify(state.tours))
+            state.delList = []
+            state.fileObj = {}
+        },
+        save(state, newdData) {
+            state.toursList = JSON.parse(JSON.stringify(newdData))
+            getApp().TourManager.load(JSON.parse(JSON.stringify(state.toursList)))
+            // 先删除空的片段
+            state.hlIndex = -1
+            for (let i = 0; i < state.tours.length; i++) {
+                if (state.tours[i].list.length == 0) {
+                    state.tours.splice(i, 1)
+                    //切换片段ID
+                    if (state.partId < state.tours.length - 1) {
+                        state.partId++
+                    } else {
+                        state.partId = 0
+                    }
+                    i--
+                }
+            }
+            for (let i = 0; i < state.tours.length; i++) {
+                state.tours[i].musicUrl = newdData[i].music
+                for (let j = 0; j < newdData[i].list.length; j++) {
+                    state.tours[i].list[j].enter.coverUrl = newdData[i].list[j].enter.cover
+                }
+            }
+            console.log(state.tours)
+            console.log(state.hlIndex)
+            this.commit('leaveEdit')
+        },
+    },
+    actions: {
+        delTours({ commit, state }, payload) {
+            // tour/delete
+            return getApp()
+                .remote_editor.tour_delete({ num: getNum() })
+                .then(res => {
+                    if (res.success) {
+                        state.tours = []
+                        commit('save', [])
+                        getApp().TourManager.load([])
+                    }
+                    return res
+                })
+                .catch(err => {
+                    console.log(err)
+                    return err
+                })
+        },
+        async delFile({ commit, state }, payload) {
+            let params = {
+                num: getNum(),
+                bizType: 'tour',
+                fileNames: state.delList,
+            }
+            let res = await this.dispatch('delFiles', params)
+            console.log(res)
+            if (res.success) {
+                state.delList = []
+            }
+        },
+        async save({ commit, dispatch, state }, payload) {
+            if (state.allTime > 60 * 30) {
+                return Promise.reject({ type: 'toast', tips: 'warn', msg: 'tour.toolbar.timeLimit' })
+            }
+            let recorder = await getApp().TourManager.recorder
+            let data = recorder.exportData()
+            for (let i = 0; i < data.length; i++) {
+                if (data[i].name == '') {
+                    return Promise.reject({ type: 'toast', tips: 'warn', msg: 'tour.toolbox.tourTitleTips' })
+                }
+            }
+            if (state.delList.length > 0) {
+                dispatch('delFile')
+            }
+
+            let exportFiles = recorder.exportFiles()
+            let files = []
+            console.log(exportFiles)
+            exportFiles.map(item => {
+                let obj = {}
+                if (item.type == 'base64') {
+                    obj.file = convertBlob2File(base64ToBlob(item.file), item.name)
+                    obj.filename = item.name
+                } else if (item.type == 'file') {
+                    state.tours.filter(i => {
+                        let fileId = item.name.split('.').shift().split('-').pop()
+                        if (fileId == i.sid) {
+                            // obj.file = i.file
+                            obj.file = state.fileObj[i.sid]
+                            obj.filename = item.name
+                        }
+                    })
+                }
+                files.push(obj)
+            })
+            console.log(files)
+            if (files.length > 0) {
+                let res = await this.dispatch('scene/upload_files', { bizType: 'tour', num: getNum(), type: 0, files: files })
+                if (res.success) {
+                    state.fileObj = {}
+                }
+            }
+
+            console.log('data', data)
+            console.log('tours', state.tours)
+            let params = {
+                num: getNum(),
+                data: JSON.stringify(data),
+            }
+            return getApp()
+                .remote_editor.tour_save(params)
+                .then(res => {
+                    if (res.success) {
+                        commit('save', data)
+                    }
+                    return res
+                })
+                .catch(err => {
+                    console.log(err)
+                    return err
+                })
+        },
+    },
+}