|
@@ -191,9 +191,9 @@ function startSwiper(imageCount) {
|
191
|
191
|
/*copy to clipboard*/
|
192
|
192
|
function toCopy() {
|
193
|
193
|
if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
|
194
|
|
- //区分iPhone设备
|
|
194
|
+ //区分iPhone设备
|
195
|
195
|
window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
|
196
|
|
- var Url2=document.getElementById("biaoios");//要复制文字的节点
|
|
196
|
+ var Url2=document.getElementById("copy_2");//要复制文字的节点
|
197
|
197
|
var range = document.createRange();
|
198
|
198
|
// 选中需要复制的节点
|
199
|
199
|
range.selectNode(Url2);
|
|
@@ -205,7 +205,7 @@ function toCopy() {
|
205
|
205
|
// 移除选中的元素
|
206
|
206
|
window.getSelection().removeAllRanges();
|
207
|
207
|
}else{
|
208
|
|
- var Url2=document.getElementById("biao1");//要复制文字的节点
|
|
208
|
+ var Url2=document.getElementById("copy_1");//要复制文字的节点
|
209
|
209
|
Url2.select(); // 选择对象
|
210
|
210
|
document.execCommand("Copy"); // 执行浏览器复制命令
|
211
|
211
|
}
|
|
@@ -226,8 +226,9 @@ window.onload = function () {
|
226
|
226
|
var res = response.data, data = null, html = '', imgList = [], swiperStr = '', pointStr = '', len = 0;
|
227
|
227
|
var swiper = document.querySelector('.swiper-wrapper .swiper-item'),
|
228
|
228
|
point = document.querySelector('.swiper-wrapper .swiper-point'),
|
229
|
|
- detailsWrapper = document.querySelector('.details-wrapper')
|
230
|
|
-
|
|
229
|
+ detailsWrapper = document.querySelector('.details-wrapper'),
|
|
230
|
+ copy_2 = document.getElementById("copy_2"),
|
|
231
|
+ copy_1 = document.getElementById("copy_1")
|
231
|
232
|
;
|
232
|
233
|
console.log(swiper);
|
233
|
234
|
if (res.errno == 0) {
|
|
@@ -245,8 +246,14 @@ window.onload = function () {
|
245
|
246
|
}
|
246
|
247
|
swiperStr += '<li><a href="javascript: ;"><img src="'+ imgList[0] +'"></a></li>';
|
247
|
248
|
}
|
248
|
|
- html = '<h5 class="price"><span>券后 ¥</span><em>'+ data.discount_price +'</em><span class="icon icon-price">券 '+ data.coupon_price
|
249
|
|
- +'元</span></h5><div class="info"><p class="before-price">价格 <span>'+ data.price +'</span></p><p class="quantity"> 月销 '+ data.volume +'</p></div><p class="elli desc">'+ data.title +'</p>'
|
|
249
|
+ if (is_coupon == 1) {
|
|
250
|
+ html = '<h5 class="price"><span>券后 ¥</span><em>'+ data.discount_price +'</em><span class="icon icon-price">券 '+ data.coupon_price
|
|
251
|
+ +'元</span></h5><div class="info"><p class="before-price">价格 <span>'+ data.price +'</span></p><p class="quantity"> 月销 '+ data.volume +'</p></div><p class="elli desc">'+ data.title +'</p>';
|
|
252
|
+ }else{
|
|
253
|
+ html = '<h5 class="price"><span>折后 ¥</span><em>'+ data.discount_price +'</em></h5><div class="info"><p class="before-price">价格 <span>'+ data.price +'</span></p><p class="quantity"> 月销 '+ data.volume +'</p></div><p class="elli desc">'+ data.title +'</p>';
|
|
254
|
+ }
|
|
255
|
+
|
|
256
|
+
|
250
|
257
|
detailsWrapper.innerHTML = html;
|
251
|
258
|
swiper.innerHTML = swiperStr;
|
252
|
259
|
point.innerHTML = pointStr;
|
|
@@ -257,8 +264,25 @@ window.onload = function () {
|
257
|
264
|
console.log(error);
|
258
|
265
|
});
|
259
|
266
|
|
260
|
|
- btn.addEventListener('click', function () {
|
261
|
|
- console.log('test');
|
262
|
|
- toCopy();
|
263
|
|
- }, false)
|
|
267
|
+ axios.post('/api/v2/adzoneCreate/h5CopyOfTheNaughtyPassword', {
|
|
268
|
+ goods_id: goods_id,
|
|
269
|
+ is_coupon: is_coupon,
|
|
270
|
+ user_id: user_id
|
|
271
|
+ })
|
|
272
|
+ .then(function (response) {
|
|
273
|
+ var res = response.data, data = null;
|
|
274
|
+ if (res.errno == 0) {
|
|
275
|
+ data = res.rst.data;
|
|
276
|
+ copy_2.innerHTML = data;
|
|
277
|
+ console.log(copy_1);
|
|
278
|
+ copy_1.value = data;
|
|
279
|
+ btn.addEventListener('click', function () {
|
|
280
|
+ console.log('test');
|
|
281
|
+ toCopy();
|
|
282
|
+ }, false)
|
|
283
|
+ }
|
|
284
|
+ })
|
|
285
|
+ .catch(function (error) {
|
|
286
|
+ console.log(error);
|
|
287
|
+ });
|
264
|
288
|
}
|