From 6b90e9d02bd1033e9c16fff7bde78f53b5603dae Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期三, 02 八月 2023 11:42:00 +0800
Subject: [PATCH] no message

---
 h5/apph5/main.js                       |    2 
 h5/apph5/package-lock.json             |   96 ++++++++++++++++++++++++
 h5/apph5/package.json                  |    5 +
 h5/apph5/components/items/LineItem.vue |   80 ++++++++++++++------
 h5/apph5/components/setClipboard.js    |    0 
 5 files changed, 159 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);
 				})
diff --git a/h5/apph5/components/setClipboard.js b/h5/apph5/components/setClipboard.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/h5/apph5/components/setClipboard.js
diff --git a/h5/apph5/main.js b/h5/apph5/main.js
index 7ed0fd2..1408550 100644
--- a/h5/apph5/main.js
+++ b/h5/apph5/main.js
@@ -3,6 +3,8 @@
 // #ifndef VUE3
 import Vue from 'vue'
 import './uni.promisify.adaptor'
+import VueClipboard from 'vue-clipboard2'
+Vue.use(VueClipboard)
 Vue.config.productionTip = false
 Vue.prototype.$http=api;
 App.mpType = 'app'
diff --git a/h5/apph5/package-lock.json b/h5/apph5/package-lock.json
new file mode 100644
index 0000000..ae71930
--- /dev/null
+++ b/h5/apph5/package-lock.json
@@ -0,0 +1,96 @@
+{
+  "name": "apph5",
+  "lockfileVersion": 2,
+  "requires": true,
+  "packages": {
+    "": {
+      "dependencies": {
+        "vue-clipboard2": "^0.3.3"
+      }
+    },
+    "node_modules/clipboard": {
+      "version": "2.0.11",
+      "resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
+      "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
+      "dependencies": {
+        "good-listener": "^1.2.2",
+        "select": "^1.1.2",
+        "tiny-emitter": "^2.0.0"
+      }
+    },
+    "node_modules/delegate": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
+      "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+    },
+    "node_modules/good-listener": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
+      "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
+      "dependencies": {
+        "delegate": "^3.1.2"
+      }
+    },
+    "node_modules/select": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
+      "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
+    },
+    "node_modules/tiny-emitter": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+      "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+    },
+    "node_modules/vue-clipboard2": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmmirror.com/vue-clipboard2/-/vue-clipboard2-0.3.3.tgz",
+      "integrity": "sha512-aNWXIL2DKgJyY/1OOeITwAQz1fHaCIGvUFHf9h8UcoQBG5a74MkdhS/xqoYe7DNZdQmZRL+TAdIbtUs9OyVjbw==",
+      "dependencies": {
+        "clipboard": "^2.0.0"
+      }
+    }
+  },
+  "dependencies": {
+    "clipboard": {
+      "version": "2.0.11",
+      "resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
+      "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
+      "requires": {
+        "good-listener": "^1.2.2",
+        "select": "^1.1.2",
+        "tiny-emitter": "^2.0.0"
+      }
+    },
+    "delegate": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
+      "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+    },
+    "good-listener": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
+      "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
+      "requires": {
+        "delegate": "^3.1.2"
+      }
+    },
+    "select": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
+      "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
+    },
+    "tiny-emitter": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+      "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+    },
+    "vue-clipboard2": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmmirror.com/vue-clipboard2/-/vue-clipboard2-0.3.3.tgz",
+      "integrity": "sha512-aNWXIL2DKgJyY/1OOeITwAQz1fHaCIGvUFHf9h8UcoQBG5a74MkdhS/xqoYe7DNZdQmZRL+TAdIbtUs9OyVjbw==",
+      "requires": {
+        "clipboard": "^2.0.0"
+      }
+    }
+  }
+}
diff --git a/h5/apph5/package.json b/h5/apph5/package.json
new file mode 100644
index 0000000..36f2829
--- /dev/null
+++ b/h5/apph5/package.json
@@ -0,0 +1,5 @@
+{
+  "dependencies": {
+    "vue-clipboard2": "^0.3.3"
+  }
+}

--
Gitblit v1.9.3