diff --git a/src/assets/img/detail/unlock.png b/src/assets/img/detail/unlock.png new file mode 100755 index 0000000..ac2cc9b Binary files /dev/null and b/src/assets/img/detail/unlock.png differ diff --git a/src/main.js b/src/main.js index fd8841b..1aa5434 100755 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import router from './router' import store from './store' import ElementUI, { Message, Pagination } from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; -import { skipUrl, pageStop, pageMove, goTologin } from "@/utils/common.js" +import { skipUrl, pageStop, pageMove, goTologin, copy } from "@/utils/common.js" import http from "@/utils/request" Vue.config.productionTip = false @@ -19,7 +19,8 @@ Vue.prototype.$goTologin = goTologin // 跳转登录页面的方法 Vue.prototype.$pageStop = pageStop // 页面禁止滑动 Vue.prototype.$pageMove = pageMove // 页面可以滑动 -Vue.prototype.$Message = Message // 页面可以滑动 +Vue.prototype.$Message = Message // 消息提示框 +Vue.prototype.$copy = copy // 复制 //svg文件引入 import './icons' diff --git a/src/utils/common.js b/src/utils/common.js index 7c73672..d41c461 100755 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -27,8 +27,24 @@ function goTologin() { } // 点击复制 -function copy(value, ismessage) { +function copy(value, message) { + // 创建一个新的输入元素 + let copyInput = document.createElement('input'); + // 将输入元素添加到文档的主体中 + document.body.appendChild(copyInput); + // 将输入元素的值设置为需要复制的URL + copyInput.setAttribute('value', value); + // 选择输入元素 + copyInput.select(); + // 使用clipboard API将所选文本复制到剪贴板 + navigator.clipboard.writeText(copyInput.value); + // 向用户显示成功消息 + // 从文档中删除动态创建的输入元素 + copyInput.remove(); + if (message) this.$message.success(message); + + } export { skipUrl, pageStop, pageMove, goTologin, copy } \ No newline at end of file diff --git a/src/views/detail/detailIndex.vue b/src/views/detail/detailIndex.vue index e3d1a49..0a74da6 100755 --- a/src/views/detail/detailIndex.vue +++ b/src/views/detail/detailIndex.vue @@ -33,9 +33,9 @@