diff --git a/api/goods/index.js b/api/goods/index.js index 904f6a0..aef9bc3 100644 --- a/api/goods/index.js +++ b/api/goods/index.js @@ -14,6 +14,10 @@ const api = { presale:'goods/presale' } +// 短连接 +export const goodsShortUrl = (param, option) => { + return request.post('goods/shortUrl', param, option) +} // 商品价格修改 export const editGoodsPrice = (param, option) => { return request.post('StoreKeeper/editGoodsPrice', param, option) diff --git a/config.js b/config.js index d0154b4..cef42d9 100644 --- a/config.js +++ b/config.js @@ -15,7 +15,7 @@ export default { * 可在超管后台-商城列表中查看10025 */ - storeId: wx.getExtConfigSync().store_id? wx.getExtConfigSync().store_id : 10048, + storeId: wx.getExtConfigSync().store_id? wx.getExtConfigSync().store_id : 10045, // storeId: 10037, diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 1185db7..f9b79ea 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -465,6 +465,7 @@ }, data() { return { + options: {}, timestamp: new Date().getTime(), goods_sku_no: "", isTodo: false, @@ -529,6 +530,7 @@ }, onLoad(options) { const that = this; + that.options = options; let result = uni.getStorageSync("addressResult") this.addressResult = result ? result.address_component : this.addressResult this.isPre = options.isPre ? options.isPre : null @@ -1100,10 +1102,18 @@ this.isTodo = true; this.openDialog = false; }, - toHaibao(index) { - this.shareCancel(); - if (index == 2) { - let str = `型号:${this.goods.goods_name}\n前台价:¥${this.goods.goods_price_max}元\n推广价:¥${this.goods.goods_price_min}元\nSKU:${this.goods.goods_no}\n京东链接:https://item.jd.com/${this.goods.goods_no}.html` + //获取短连接 + async toQueryShortUrl() { + // 获取推荐商品列表 + const that = this; + // 构建页面参数 + const params = that.$getShareUrlParams(this.options) + const res = await GoodsApi.goodsShortUrl({ + page_url: `pages/goods/detail?${params}`, + page_title: that.goods.goods_name + }) + if(res.data.url){ + let str = `型号:${that.goods.goods_name}\n前台价:¥${that.goods.goods_price_max}元\n推广价:¥${that.goods.goods_price_min}元\nSKU:${that.goods.goods_no}\n小程序链接:${res.data.url}` uni.setClipboardData({ data: str, // 这里是个坑接受字符串类型 value转化为字符串 success: function() { @@ -1115,6 +1125,20 @@ }) } }) + }else{ + uni.showToast({ + title: '复制失败', + icon: 'none', + duration: 2000 + }) + } + + }, + toHaibao(index) { + this.shareCancel(); + if (index == 2) { + this.toQueryShortUrl(); + } else { this.openDialog = false this.showGoodsPosterPopup = true; @@ -1127,9 +1151,7 @@ onShareAppMessage() { const app = this // 构建页面参数 - const params = app.$getShareUrlParams({ - goodsId: app.goodsId, - }) + const params = app.$getShareUrlParams(this.options) return { title: app.goods.goods_name, imageUrl: app.goods.goods_image, @@ -1144,10 +1166,11 @@ */ onShareTimeline() { const app = this + const params = app.$getShareUrlParams(this.options) return { title: app.goods.goods_name, imageUrl: app.goods.goods_image, - path: `/pages/goods/detail?goodsId=${app.goodsId}` + path: `/pages/goods/detail?${params}` } } } diff --git a/pages/goods/list.vue b/pages/goods/list.vue index ee13290..93ec47d 100644 --- a/pages/goods/list.vue +++ b/pages/goods/list.vue @@ -114,6 +114,7 @@ + @@ -169,6 +170,7 @@ + @@ -236,7 +238,7 @@ } from '@/core/app' import Search from '@/components/search' - const pageSize = 15 + const pageSize = 10 const showViewKey = 'GoodsList-ShowView'; import * as cstegory from '@/api/category' export default { @@ -443,7 +445,8 @@ const newList = result.data.list console.log(newList) let arr = getMoreListData(newList, app.list, pageNo); - app.list.data = app.arrayUnique(arr, 'goods_id') + // app.list.data = app.arrayUnique(arr, 'goods_id') + app.list.data = arr; app.total = result.data.list.total; console.log(newList) resolve(newList) diff --git a/pages/news/rules/index.vue b/pages/news/rules/index.vue index 6416c93..d705751 100644 --- a/pages/news/rules/index.vue +++ b/pages/news/rules/index.vue @@ -20,7 +20,7 @@ onLoad(options){ this.itemInfo = JSON.parse(decodeURIComponent(options.itemInfo)) this.title = this.itemInfo.title; - this.strings = this.itemInfo.content.replace(/style=\"text-wrap: nowrap;\"/g,'style=\"text-wrap: inherit;\"');; + this.strings = this.itemInfo.content.replace(/style=\"text-wrap: nowrap;\"/g,'style=\"text-wrap: inherit;\"'); }, methods:{ diff --git a/uni_modules/vk-uview-ui/components/u-waterfall/u-waterfall.vue b/uni_modules/vk-uview-ui/components/u-waterfall/u-waterfall.vue index e56bdaf..51850de 100644 --- a/uni_modules/vk-uview-ui/components/u-waterfall/u-waterfall.vue +++ b/uni_modules/vk-uview-ui/components/u-waterfall/u-waterfall.vue @@ -38,13 +38,13 @@ export default { // 单位ms addTime: { type: [Number, String], - default: 200 + default: 300 }, // id值,用于清除某一条数据时,根据此idKey名称找到并移除,如数据为{idx: 22, name: 'lisa'} // 那么该把idKey设置为idx idKey: { type: String, - default: "id" + default: "goods_id" } }, data() { @@ -105,7 +105,9 @@ export default { } else { this.rightList.push(item); } - } + } + // console.log("this.leftList",this.leftList) + // console.log("this.rightList",this.rightList) // 移除临时列表的第一项 this.tempList.splice(0, 1); // 如果临时数组还有数据,继续循环