From 3cbd9dc493e8663d9ec1a2816e664f7c9289b8a3 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期四, 21 九月 2023 14:05:16 +0800 Subject: [PATCH] no message --- h5/apph5/components/items/LineItem.vue | 80 ++++++++++++++++++++++++++++------------ 1 files changed, 56 insertions(+), 24 deletions(-) diff --git a/h5/apph5/components/items/LineItem.vue b/h5/apph5/components/items/LineItem.vue index 31d2a1f..79d9d73 100644 --- a/h5/apph5/components/items/LineItem.vue +++ b/h5/apph5/components/items/LineItem.vue @@ -34,33 +34,44 @@ items: Object, isrecord: { type: Boolean, - default: false + default: false, + text: '' }, }, created() {}, methods: { - oncopy(txt) { - let copyObj = { - data: txt, - success: function() { + + copyText() { + // #ifdef H5 + this.$copyText(this.text).then( + res => { uni.showToast({ title: '浼樻儬閾炬帴宸插鍒讹紝鐜板湪鎵撳紑鎵嬫満娣樺疂锛岄鍙栦紭鎯犲埜鍚', icon: 'none', duration: 2500 - }); - }, - fail: function(e) { - console.log(e); + }) } - }; - uni.setClipboardData(copyObj); + ) + // #endif + // #ifndef H5 + uni.setClipboardData({ + data: this.text, + success: () => { + uni.showToast({ + title: '浼樻儬閾炬帴宸插鍒讹紝鐜板湪鎵撳紑鎵嬫満娣樺疂锛岄鍙栦紭鎯犲埜鍚', + icon: 'none', + duration: 2500 + }) + } + }) + // #endif }, getShareLink(items) { - if(this.isrecord) - {//璁板綍鐐瑰嚮 - this.recordClick(items.goodsId,items.sourceType,items.dtitle,items.actualPrice); + + if (this.isrecord) { //璁板綍鐐瑰嚮 + this.recordClick(items.goodsId, items.sourceType, items.dtitle, items.actualPrice); } - var goodsid=items.goodsId; + var goodsid = items.goodsId; var that = this; let postdata = { goodsId: goodsid @@ -76,23 +87,44 @@ if (e.code != 0) { return; } - this.oncopy(e.data.info.longTpwd); + this.text = e.data.info.longTpwd; + uni.getSystemInfo({ + success: function(res) { + if (res.osName == 'ios') { + uni.showModal({ + title: '鎻愮ず', + content: '浼樻儬淇℃伅澶嶅埗鍚庯紝璇锋墦寮�鎵嬫満娣樺疂棰嗗埜', + showCancel: false, + confirmText: '澶嶅埗浼樻儬淇℃伅', + success: function(res) { + if (res.confirm) { + that.copyText(); + } + } + }); + } + else{ + that.copyText(); + } + } + }); + + //this.oncopy(e.data.info.longTpwd); }).catch(function(err) { console.log(err); }) }, - recordClick(goodsid,plat,title,act_price) - { - let postdata={ - goodsid:goodsid, - plat:plat, - title:title, - act_price:act_price + recordClick(goodsid, plat, title, act_price) { + let postdata = { + goodsid: goodsid, + plat: plat, + title: title, + act_price: act_price } this.$http.post('/api/activity/recordItemClick', postdata ).then(e => { - + }).catch(function(err) { console.log(err); }) -- Gitblit v1.9.3