diff --git a/apis/index.js b/apis/index.js index b8c1474..bbbec18 100644 --- a/apis/index.js +++ b/apis/index.js @@ -9,8 +9,8 @@ import store from '@/store' // 基础配置 const config = { - apiUrl : 'https://oapi.lianshang.vip/api/', - apiUrls : 'https://oapi.lianshang.vip/', + apiUrl : 'http://api.ahxh.shangkelian.cn/api/', + apiUrls : 'http://api.ahxh.shangkelian.cn/', // apiUrl : 'http://api.ahxh.shangkelian.cn/api/', // apiUrls : 'http://api.ahxh.shangkelian.cn/', timeout : 60000 diff --git a/js_sdk/junyi-h5-copy/junyi-h5-copy/junyi-h5-copy.js b/js_sdk/junyi-h5-copy/junyi-h5-copy/junyi-h5-copy.js new file mode 100644 index 0000000..91fff37 --- /dev/null +++ b/js_sdk/junyi-h5-copy/junyi-h5-copy/junyi-h5-copy.js @@ -0,0 +1,18 @@ +export default function h5Copy(content) { + + if (!document.queryCommandSupported('copy')) { + // 不支持 + return false + } + + let textarea = document.createElement("textarea") + textarea.value = content + textarea.readOnly = "readOnly" + document.body.appendChild(textarea) + textarea.select() // 选择对象 + textarea.setSelectionRange(0, content.length) //核心 + let result = document.execCommand("copy") // 执行浏览器复制命令 + textarea.remove() + return result + +} \ No newline at end of file diff --git a/pages/user/code.vue b/pages/user/code.vue index 6169d5e..a8aba88 100644 --- a/pages/user/code.vue +++ b/pages/user/code.vue @@ -60,6 +60,7 @@ import { userInvite } from '@/apis/interfaces/user' import { saveImageToPhotosAlbum, showToast, downloadFile } from '@/uni_modules/sakura-canvas/js_sdk/util' import Draw from '@/uni_modules/sakura-canvas/js_sdk/draw' + import h5Copy from '@/js_sdk/junyi-h5-copy/junyi-h5-copy/junyi-h5-copy' let draw = null export default { data() { @@ -270,20 +271,17 @@ // 复制邀请码 copyCenter(e) { let copyNo = e - uni.vibrateShort({ - success: () => { - uni.setClipboardData({ - data : copyNo, - success : res=> { - uni.showToast({ - title : '复制成功', - icon :'none', - duration: 3000 - }); - } - }) - } - }) + const result = h5Copy(copyNo) + if (result === false) { + uni.showToast({ + title:'不支持', + }) + } else { + uni.showToast({ + title:'复制成功', + icon:'none' + }) + } }, // 切换海报背景index diff --git a/pages/user/index.vue b/pages/user/index.vue index 73d57c1..7a07cd2 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -28,7 +28,7 @@ - + @@ -252,6 +252,7 @@