From 78c1e13726153e6aab2b3e4fdc496d6cc9d576df Mon Sep 17 00:00:00 2001 From: "Adam.Gong" Date: Wed, 14 Sep 2022 16:12:11 +0800 Subject: [PATCH] auto commit the code by alias command --- package-lock.json | 50 ++++++++------------------ package.json | 2 +- src/components/CommodityCard/CommodityCard.vue | 40 +++++++++++---------- src/components/UniDrawer/UniDrawer.vue | 3 +- src/pages/details/details.vue | 27 +++++++------- src/pages/index/index.vue | 8 ++--- src/store/modules/details.js | 50 +++++++++++++++++--------- src/store/modules/index.js | 6 ++-- src/store/modules/read.js | 12 +++---- src/store/request.js | 8 +++-- src/store/url.js | 15 ++++---- 11 files changed, 115 insertions(+), 106 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e3b81c..4d8def7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3491,9 +3491,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001048", - "resolved": "https://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30001048.tgz?cache=0&sync_timestamp=1587836069414&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcaniuse-lite%2Fdownload%2Fcaniuse-lite-1.0.30001048.tgz", - "integrity": "sha1-S7TxvC6zBOXhFU2oC5Pe4/HPRH4=" + "version": "1.0.30001393", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001393.tgz", + "integrity": "sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA==" }, "case-sensitive-paths-webpack-plugin": { "version": "2.3.0", @@ -6639,8 +6639,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -6658,13 +6657,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6677,18 +6674,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6791,8 +6785,7 @@ }, "inherits": { "version": "2.0.4", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6802,7 +6795,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6815,20 +6807,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "1.2.5", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.9.0", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6845,7 +6834,6 @@ "mkdirp": { "version": "0.5.3", "bundled": true, - "optional": true, "requires": { "minimist": "^1.2.5" } @@ -6901,8 +6889,7 @@ }, "npm-normalize-package-bin": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "npm-packlist": { "version": "1.4.8", @@ -6927,8 +6914,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -6938,7 +6924,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7007,8 +6992,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -7038,7 +7022,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7056,7 +7039,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7095,13 +7077,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.1.1", - "bundled": true, - "optional": true + "bundled": true } } }, diff --git a/package.json b/package.json index 75b3b0d..6a2e9dd 100644 --- a/package.json +++ b/package.json @@ -91,4 +91,4 @@ "uni-app": { "scripts": {} } -} \ No newline at end of file +} diff --git a/src/components/CommodityCard/CommodityCard.vue b/src/components/CommodityCard/CommodityCard.vue index 3ade7d2..a525ce4 100644 --- a/src/components/CommodityCard/CommodityCard.vue +++ b/src/components/CommodityCard/CommodityCard.vue @@ -1,28 +1,28 @@ @@ -37,14 +37,16 @@ export default { * 商品数据 */ goods: { - id: Number, - imgurl: String, - name: String, - rsSon: Object, - originCost: String, - price: String, - trade_num: String, - goodType: String, + shop_wood_id: Number, + url0: String, + url45: String, + shop_wood_name: String, + // rsSon: Object, + // originCost: String, + sales_price: String, + sales_num: String, + // goodType: String, + eyegArr:Object }, scrollTop: Number, viewHeight: Number, @@ -58,10 +60,10 @@ export default { }, methods: { - toGoods (id, skId) { - console.log('---', '../details/details?pid=' + id + '&sk_id=' + skId) + toGoods (shop_wood_id, skuId) { + console.log('---', '../details/details?shop_wood_id=' + shop_wood_id + '&sk_id=' + skuId) uni.navigateTo({ - url: '../details/details?pid=' + id + '&sk_id=' + skId, + url: '../details/details?shop_wood_id=' + shop_wood_id + '&sk_id=' + skuId, success: res => {}, fail: () => {}, complete: () => {}, diff --git a/src/components/UniDrawer/UniDrawer.vue b/src/components/UniDrawer/UniDrawer.vue index c930a49..022da80 100644 --- a/src/components/UniDrawer/UniDrawer.vue +++ b/src/components/UniDrawer/UniDrawer.vue @@ -57,7 +57,8 @@ visibleSync: false, showDrawer: false, rightMode: false, - watchTimer: null, + watchTimer: null, + mask:false, drawerWidth: 220 } }, diff --git a/src/pages/details/details.vue b/src/pages/details/details.vue index 6279469..790ff1c 100644 --- a/src/pages/details/details.vue +++ b/src/pages/details/details.vue @@ -120,9 +120,9 @@ {{item.name}} + >{{item}} @@ -217,8 +217,8 @@ export default { }, data () { return { - pid: 7, // 产品ID - skId: undefined, // skuId + shop_wood_id: 751, // 产品ID + skId: 2723, // skuId // 详细信息菜单 item_current: 0, screenItems: [ @@ -226,18 +226,19 @@ export default { '规格参数', '售后保障', ], + current:0, showPostImg: false, // 是否展示分享海报 isShowBottom: false, // 是否展示参数选择 isCart: 1, // 参数选择 按钮判断 } }, - onLoad({ pid = this.pid, sk_id: skId }) { + onLoad({ shop_wood_id = this.shop_wood_id, sk_id: skId }) { // 根据页面传参请求页面数据 - this.pid = pid + this.shop_wood_id = shop_wood_id this.skId = skId // 获取产品详情 - this.getDetails({ pid, skId }) + this.getDetails({ shop_wood_id, skId }) // 获取购物车数据 this.getCartNum() }, @@ -285,13 +286,13 @@ export default { }, methods: { // 获取产品详情 - getDetails({ pid, skId }) { + getDetails({ shop_wood_id, skId }) { store.dispatch('details/details', { - pid, + shop_wood_id:shop_wood_id, sk_id: skId, }) store.dispatch('read/fetch', { - pid, + shop_wood_id:shop_wood_id, sk_id: skId, }) }, @@ -301,9 +302,11 @@ export default { }, // 切换详细信息菜单 tabChange (e) { - if (this.current !== e) { + console.error('eeeeeee', e); + // if (this.current !== e) { + this.current = e this.item_current = e - } + // } }, // 打开分享界面 confirmShare() { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 2c2443c..9549ae4 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -15,7 +15,7 @@ @@ -61,7 +61,7 @@ --> - 关闭 - + --> @@ -99,7 +99,7 @@ { state.cartNumber = number @@ -74,19 +75,24 @@ const mutations = { const actions = { // 获取详情 details({ commit, rootState }, param) { + // console.log('paramparamparamparamparam', param); return new Promise((resolve, reject) => request({ url: read, data: param, success: ({ data: { data } }) => { - console.log('data.tag', data.tag) + // console.log('details.details.details.details.details.data.tag', data) + console.log('this.statethis.statethis.statethis.state', this.state) + // return; // 规格参数设置 - const specification = rootState.details.specification + const specification=[]; + // specification[0].slength=1; const parameter = { + frame_weight: data.frame_weight, frame_width: data.frame_width, - glass_width: data.glass_width, glass_height: data.glass_height, - nose_width: data.nose_width, - leg_long: data.leg_long, + nose_width: data.nose_bridge, + lens_width:data.lens_width, + leg_long: data.leg_temple, weight: data.weight, } for (let index = 0; index < specification.length; index++) { @@ -99,23 +105,33 @@ const actions = { commit('INIT', { goodInfo: data, - skuList: data.skuList, - carousel: data.pics, + skuList: data.sku, + carousel: data.sku[0].sku_pic_arr_http, goodsInfo: { - name: data.p_name, - price: data.priceArea.Min_Price, - discountPrice: data.priceArea.Min_Price - Number(data.priceArea.discount), - tradeNumber: data.trade_num, + name: data.shop_wood_name, + price: data.sales_price, + discountPrice: data.sales_price - Number(0), + tradeNumber: data.sales_num, }, - tag: data.tag, - specification, + tag: data.tag_defined, + specification:[ + { key: 'frame_width', img: '/static/img/detail/d2.png', standard: '框架宽', slength: '139mm' }, + { key: 'glass_width', img: '/static/img/detail/d3.png', standard: '镜片宽', slength: '51mm' }, + { key: 'glass_height', img: '/static/img/detail/d4.png', standard: '镜片高', slength: '45mm' }, + { key: 'nose_width', img: '/static/img/detail/d5.png', standard: '鼻架宽', slength: '19mm' }, + { key: 'leg_long', img: '/static/img/detail/d6.png', standard: '框架耳长', slength: '138mm' }, + { key: 'weight', img: '/static/img/detail/d7.png', standard: '框架重', slength: '19克(grams)' }, + ], evaluate: { - rate: data.judgeInfo.good, - tag: data.judge_tag, - star: parseInt(5 * Number(data.judgeInfo.good.slice(0, -1)) / 100), + rate: 5, + tag: data.judge.list, + // star: parseInt(5 * Number(data.judgeInfo.good.slice(0, -1)) / 100), + star: 5, }, // eslint-disable-next-line - more: data.prodIntro1.replace(/\ request({ url: category, success: (res) => { - let data = res.data.data; + //分类的镜架 + let data = res.data.data.list; for (let i = 0; i <= data.length; i++) { if (data[i] && data[i].type !== 'filter') { data[i].type = 'hierarchy'; @@ -409,7 +410,8 @@ let categoryList = [ return new Promise((resolve) => request({ url: shopList, success: (res) => { - commit('LIST', res.data.data) + console.log('shopListshopListshopListshopListshopListshopListshopListshopListshopListshopListshopListshopList',res.data.data.list); + commit('LIST', res.data.data.list) resolve(res.data) }, fail: (res) => { diff --git a/src/store/modules/read.js b/src/store/modules/read.js index 4bc916c..6bbf99c 100644 --- a/src/store/modules/read.js +++ b/src/store/modules/read.js @@ -24,15 +24,15 @@ const actions = { url: read, data: param, success: (res) => { - console.log('readParm====>', arg) - console.log('read====>', res.data.data) + // console.log('readParm====>', arg) + // console.log('read====>', res.data.data) // 用一个新的对象来接收sk_id找的值 const Res = Object.assign({}, res.data.data) if (arg.sk_id !== undefined) { - for (let i = 0; i < res.data.data.skuList.length; i++) { - if (res.data.data.skuList[i].sk_id === arg.sk_id) { - Res.p_sale_price = res.data.data.skuList[i].real_price - console.log('陈工了') + for (let i = 0; i < res.data.data.sku.length; i++) { + if (res.data.data.sku[i].sk_id === arg.sk_id) { + Res.p_sale_price = res.data.data.sku[i].real_price + console.log('.......购物车和用户推荐的价格.........') } } } diff --git a/src/store/request.js b/src/store/request.js index 205d77c..f29eaf4 100644 --- a/src/store/request.js +++ b/src/store/request.js @@ -1,11 +1,15 @@ const DOMAIN = 'https://api.glass.xiuyetang.com' - +// const DOMAIN = 'http://localhost:8062' export default async function request({ url, method = 'post', - data = {}, + data = { + wood_cate: 818, + shop_id:12 + }, header = { 'Content-Type': 'application/x-www-form-urlencoded', + // 'Appid': 6 }, timeout = 3000, withCredentials = false, // 跨域请求时是否携带凭证(cookies) diff --git a/src/store/url.js b/src/store/url.js index bb52b32..0b486b3 100644 --- a/src/store/url.js +++ b/src/store/url.js @@ -1,10 +1,11 @@ const urlAlias = { // 详情 - read: '/app/prod/read', // 获取商品信息 + read: '/api/frontend/wood/detail', // 获取商品信息 // 首页 - shopList: '/app/prod/list', // 获取首页商品列表 - category: '/app/prod/category2', // 获取首页商品分类 + shopList: '/api/frontend/wood/list', // 获取首页商品列表 + // category: '/app/prod/category2', + category: '/api/frontend/wood/category',// 获取首页商品分类 search: '/app/prod/search', // 首页搜索商品 // 登陆 @@ -23,10 +24,10 @@ const urlAlias = { pay: '/app/pay/log', // 支付接口 // 购物车 - cartList: '/app/cart/list', // 获取购物车列表 - cartModi: '/app/cart/modi', // 修改购物车 - cartDel: '/app/cart/del', // 删除购物车 - cartAdd: '/app/cart/add', // 添加购物车 + cartList: '/api/frontend/cart/list', // 获取购物车列表 + cartModi: '/api/frontend/cart/modi', // 修改购物车 + cartDel: '/api/frontend/cart/del', // 删除购物车 + cartAdd: '/api/frontend/cart/add', // 添加购物车 // 我的 recommandList: '/app/prod/recommand', // 获取用户个性化推荐商品 -- 2.0.0