瀏覽代碼

Merge branch 'Nov16thResetMusic' into online

wolyshaw 4 年之前
父節點
當前提交
844ead2916

+ 44 - 0
src/components/copy-text/index.vue

@@ -0,0 +1,44 @@
+<template>
+  <span class="copy" v-if="$slots.default || text">
+    <slot/>{{text}}
+    <i @click="copyText" title="复制" class="el-icon-document-copy"></i>
+  </span>
+</template>
+
+<script>
+import copy from 'copy-to-clipboard'
+
+export default {
+  name: 'copy-text',
+  props: {
+    text: {
+      type: String,
+      default: ''
+    },
+    hint: {
+      type: Boolean,
+      default: true
+    }
+  },
+  methods: {
+    copyText() {
+      const slot = this.$slots.default || []
+      const text = slot[0]?.text || this.text
+      if (text) {
+        copy(text)
+        if (this.hint) {
+          this.$message.success('复制成功')
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.copy{
+  .el-icon-document-copy{
+    cursor: pointer;
+  }
+}
+</style>

+ 2 - 0
src/components/install.js

@@ -6,11 +6,13 @@
 import saveform from '@/components/save-form'
 import overflowtext from '@/components/overflow-text'
 import selectall from '@/components/select-all'
+import copytext from '@/components/copy-text'
 
 export default {
   install(Vue) {
     Vue.component(saveform.name, saveform)
     Vue.component(overflowtext.name, overflowtext)
     Vue.component(selectall.name, selectall)
+    Vue.component(copytext.name, copytext)
   }
 }

+ 5 - 1
src/views/save-form-test/index.vue

@@ -66,7 +66,11 @@
       <el-table-column
         prop="title"
         label="标题"
-      ></el-table-column>
+      >
+        <template slot-scope="scope">
+          <copy-text>{{scope.row.title}}</copy-text>
+        </template>
+      </el-table-column>
       <el-table-column
         prop="remark"
         width="220px"

+ 9 - 3
src/views/teamDetail/teamList.vue

@@ -80,11 +80,17 @@
                            width="100"
                            align='center'
                            label="乐团编号">
+                           <template slot-scope="scope">
+                             <copy-text>{{scope.row.id}}</copy-text>
+                           </template>
           </el-table-column>
           <el-table-column prop="name"
                            width="200px"
                            align='center'
                            label="乐团名称">
+                           <template slot-scope="scope">
+                             <copy-text>{{scope.row.name}}</copy-text>
+                           </template>
           </el-table-column>
           <el-table-column align='center'
                            width="200px"
@@ -385,7 +391,7 @@ export default {
       this.$router.push({ path: '/business/resetTeaming', query: { type: 'resetTeam', id: row.id, search, rules } })
     },
     setSearchList (obj) {
-      // 
+      //
       // 没有相同的key=>添加这个对象
       // 有相同的key => 替换这个对象
       if (obj.type == 1) {
@@ -437,7 +443,7 @@ export default {
           if (this.searchLsit[some].value == item.value && this.searchLsit[some].id == item.id) {
             this.searchLsit.splice(some, 1);
           }
-          // id: 'school', key: this.schools[item].text, value: val, type: 1 
+          // id: 'school', key: this.schools[item].text, value: val, type: 1
         }
 
 
@@ -560,7 +566,7 @@ export default {
       let rules = JSON.stringify(this.rules)
       this.$router.push({ path: '/business/teamDetailedList', query: { id: row.id, search, rules } })
     },
-    //  
+    //
     lookTeamInfo (row) {
       let search = JSON.stringify(this.topForm)
       let rules = JSON.stringify(this.rules)