|
@@ -73,6 +73,15 @@
|
|
|
<el-button link type="primary" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-popconfirm>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status !== 0"
|
|
|
+ @click="() => copyCode(scope.row.catalogId)"
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ 复制代码
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -95,7 +104,7 @@
|
|
|
import type { SiteList } from '@/types/Site'
|
|
|
import type { CatalogTreeOri } from '@/types/Catalog'
|
|
|
import { reactive, ref } from 'vue'
|
|
|
-import { ElMessage } from 'element-plus'
|
|
|
+import { ElMessage, ElNotification } from 'element-plus'
|
|
|
import {
|
|
|
getSiteList,
|
|
|
deleteAsTree,
|
|
@@ -205,6 +214,27 @@ const publishAsTreeFunc = (id: number) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const copyCode = (id: number) => {
|
|
|
+ try {
|
|
|
+ navigator.clipboard.writeText(`<script src="http://cxzx.smcic.net/ad/catalog/${id}.js" />`)
|
|
|
+ ElMessage({
|
|
|
+ message: '复制成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ ElNotification({
|
|
|
+ title: '代码(如复制失败可直接复制下文)',
|
|
|
+ message: `<script src="http://cxzx.smcic.net/ad/catalog/${id}.js" />`,
|
|
|
+ duration: 0,
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ ElMessage({
|
|
|
+ message: '复制失败',
|
|
|
+ type: 'info',
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const Add = (row: CatalogTreeOri, list: CatalogTreeOri[]) => {
|
|
|
const sonItem: CatalogTreeOri = { isEdit: true, parentId: row.catalogId, mediaId: row.mediaId }
|
|
|
for (let i = 0; i < list.length; i++) {
|