Pārlūkot izejas kodu

添加复制到鼠标

wen 3 gadi atpakaļ
vecāks
revīzija
e2234c1e98
8 mainītis faili ar 29593 papildinājumiem un 10082 dzēšanām
  1. 2 1
      .env.development
  2. 19370 24
      package-lock.json
  3. 1 0
      package.json
  4. 6 6
      src/api/modules/sys.user.api.js
  5. 6 0
      src/main.js
  6. 1 1
      src/store/modules/d2admin/modules/account.js
  7. 31 17
      src/views/index/page.vue
  8. 10176 10033
      yarn.lock

+ 2 - 1
.env.development

@@ -4,4 +4,5 @@
 VUE_APP_TITLE=YYB-游戏打包
 
 # API-URL
-VUE_APP_API=http://www.yyb.com/api/
+#VUE_APP_API=http://www.yyb.com/api/
+VUE_APP_API=http://api.myycwl.com/api/

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 19370 - 24
package-lock.json


+ 1 - 0
package.json

@@ -30,6 +30,7 @@
     "sortablejs": "^1.10.1",
     "ua-parser-js": "^0.7.20",
     "vue": "^2.6.11",
+    "vue-clipboard2": "^0.3.3",
     "vue-i18n": "^8.15.1",
     "vue-router": "^3.1.3",
     "vuex": "^3.1.2"

+ 6 - 6
src/api/modules/sys.user.api.js

@@ -1,10 +1,10 @@
-import { find, assign } from 'lodash'
+// import { find, assign } from 'lodash'
 
-const users = [
-  { username: 'admin', password: 'admin', uuid: 'admin-uuid', name: 'Admin' },
-  { username: 'editor', password: 'editor', uuid: 'editor-uuid', name: 'Editor' },
-  { username: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
-]
+// const users = [
+//   { username: 'admin', password: 'admin', uuid: 'admin-uuid', name: 'Admin' },
+//   { username: 'editor', password: 'editor', uuid: 'editor-uuid', name: 'Editor' },
+//   { username: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
+// ]
 
 export default ({ service, request, serviceForMock, requestForMock, mock, faker, tools }) => ({
   /**

+ 6 - 0
src/main.js

@@ -16,8 +16,14 @@ import { frameInRoutes } from '@/router/routes'
 import ElementUI from 'element-ui'
 import 'element-ui/lib/theme-chalk/index.css'
 import D2Crud from '@d2-projects/d2-crud'
+
+// 复制粘贴
+import VueClipBoard from 'vue-clipboard2'
+
+
 Vue.use(ElementUI)
 Vue.use(D2Crud)
+Vue.use(VueClipBoard)
 
 // 核心插件
 Vue.use(d2Admin)

+ 1 - 1
src/store/modules/d2admin/modules/account.js

@@ -24,7 +24,7 @@ export default {
       // token 代表用户当前登录状态 建议在网络请求中携带 token
       // 如有必要 token 需要定时更新,默认保存一天
       util.cookies.set('uuid', res.user_info.id)
-      util.cookies.set('token', res.token_type +' '+ res.access_token)
+      util.cookies.set('token', res.token_type + ' ' + res.access_token)
       // 设置 vuex 用户信息
       await dispatch('d2admin/user/set', { name: res.user_info.username }, { root: true })
       // 用户登录后从持久化数据加载一系列的设置

+ 31 - 17
src/views/index/page.vue

@@ -67,7 +67,7 @@
               <span class="tag-group__title" v-show="!scope.row.url"> - </span>
             </el-col>
             <el-col :span="10" >
-              <el-button size="mini" type="success" @click="handleDelete(scope.$index, scope.row)">复制</el-button>
+              <el-button size="mini" type="success" v-clipboard:copy="scope.row.url" v-clipboard:success="onCopy" v-clipboard:error="onError">复制</el-button>
             </el-col>
           </el-row>
         </template>
@@ -116,11 +116,11 @@ export default {
       },
       rules: {
         name: [
-          { required: true, message: '请输入游戏名', trigger: 'blur' },
+          { required: true, message: '请输入游戏名', trigger: 'blur' }
         ],
         app_id: [
-          { required: true, message: '请输入 app_id', trigger: 'blur' },
-        ],
+          { required: true, message: '请输入 app_id', trigger: 'blur' }
+        ]
       },
       formInline: {
         name: '',
@@ -147,12 +147,12 @@ export default {
     },
     // 重置
     onReset () {
-      this.fetchData();
+      this.fetchData()
     },
-    onAdd(){
+    onAdd () {
       this.dialogVisible = true
     },
-    onAddSubmit(formName) {
+    onAddSubmit (formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           api.GAME_ADD(this.form).then(res => {
@@ -160,7 +160,7 @@ export default {
               showClose: true,
               message: '添加成功!',
               type: 'success'
-            });
+            })
             this.fetchData()
             this.dialogVisible = false
           }).catch(err => {
@@ -172,10 +172,10 @@ export default {
             })
           })
         }
-      });
+      })
     },
-    resetAddForm(formName) {
-      this.$refs[formName].resetFields();
+    resetAddForm (formName) {
+      this.$refs[formName].resetFields()
     },
 
     // 列表
@@ -203,17 +203,31 @@ export default {
     handleDelete (index, row) {
       console.log(index, row)
     },
+    onCopy () {
+      this.$message({
+        showClose: true,
+        message: '复制成功!',
+        type: 'success'
+      })
+    },
+    onError () {
+      this.$message({
+        showClose: true,
+        message: '复制失败!',
+        type: 'error'
+      })
+    },
 
     // 分页
-    handleSizeChange(val) {
+    handleSizeChange (val) {
       // this.pagination.limit = val
-      this.fetchData({'limit': val})
-      console.log(`每页 ${val} 条`);
+      this.fetchData({ limit: val })
+      console.log(`每页 ${val} 条`)
     },
-    handleCurrentChange(val) {
+    handleCurrentChange (val) {
       this.pagination.page = val
-      this.fetchData({'page': val})
-      console.log(`当前页: ${val}`);
+      this.fetchData({ page: val })
+      console.log(`当前页: ${val}`)
     }
   }
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 10176 - 10033
yarn.lock