ソースを参照

添加复制代码中的divid提示

liyongli 4 ヶ月 前
コミット
3ef7a885f3
2 ファイル変更9 行追加5 行削除
  1. 3 1
      src/types/Catalog.d.ts
  2. 6 4
      src/views/SitePage.vue

+ 3 - 1
src/types/Catalog.d.ts

@@ -1,3 +1,5 @@
+import type { AsSpaceItem } from '@/types/AsSpace'
+
 export interface CatalogTreeOri {
   catalogId?: number
   catalogName?: string
@@ -6,7 +8,7 @@ export interface CatalogTreeOri {
   media?: string
   mediaId?: number
   parentId?: number
-  slots?: null
+  slots?: AsSpaceItem[]
   status?: number
   isEdit?: boolean
 }

+ 6 - 4
src/views/SitePage.vue

@@ -66,7 +66,8 @@
               </template>
             </el-popconfirm>
             <el-button
-              @click="() => copyCode(scope.row.catalogId)"
+              v-if="scope.row.slots && scope.row.slots.length"
+              @click="() => copyCode(scope.row)"
               link
               type="primary"
               size="small"
@@ -182,15 +183,16 @@ const saveEdit = (row: CatalogTreeOri) => {
   })
 }
 
-const copyCode = (id: number) => {
+const copyCode = (row: CatalogTreeOri) => {
+  const slots = row.slots || []
   ElNotification({
     title: '请复制下文',
-    message: `<script src="http://cxzx.smcic.net/ad/catalog/${id}.js" />  `,
+    message: `<script src="http://cxzx.smcic.net/ad/catalog/${row.catalogId}.js" />  `,
     duration: 0,
   })
   ElNotification({
     title: 'divID',
-    message: ``,
+    message: '当前id为:' + slots.map((v) => '#sxtv-ad-' + v.slotId).join(','),
     duration: 0,
     offset: 200,
   })