接口层兼容

pull/26/head
落日晚风 2023-12-12 16:13:27 +08:00
parent ef26268c8e
commit cf2c782c0e
13 changed files with 212 additions and 207 deletions

View File

@ -1,12 +1,6 @@
<template>
<s-layout
title="我的"
tabbar="/pages/index/user"
navbar="custom"
:bgStyle="template.page"
:navbarStyle="template.style?.navbar"
onShareAppMessage
>
<s-layout title="我的" tabbar="/pages/index/user" navbar="custom" :bgStyle="template.page"
:navbarStyle="template.style?.navbar" onShareAppMessage>
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
@ -14,8 +8,14 @@
</template>
<script setup>
import { computed } from 'vue';
import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import {
computed
} from 'vue';
import {
onShow,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
// tabBar

View File

@ -1,10 +1,9 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
list: (data) =>
request2({
url: 'trade/cart/list',
request({
url: '/app-api/trade/cart/list',
method: 'GET',
custom: {
showLoading: false,
@ -12,7 +11,7 @@ export default {
},
}),
append: (data) =>
request2({
request({
url: '/app-api/trade/cart/add',
method: 'POST',
custom: {
@ -39,13 +38,13 @@ export default {
// }),
// 删除购物车
delete: (ids) =>
request2({
url: 'trade/cart/delete?ids=' + ids,
request({
url: '/app-api/trade/cart/delete?ids=' + ids,
method: 'DELETE',
}),
update: (data) =>
request2({
url: 'trade/cart/update-count',
request({
url: '/app-api/trade/cart/update-count',
method: 'PUT',
data: {
...data,

View File

@ -1,9 +1,7 @@
import request2 from '@/sheep/request2';
export default {
list: (params) =>
request2({
url: 'product/category/list',
request({
url: '/app-api/product/category/list',
method: 'GET',
params,
}),

View File

@ -1,5 +1,4 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 我的拼团
@ -13,8 +12,8 @@ export default {
},
}),
userCoupon: (params) =>
request2({
url: 'promotion/coupon/page',
request({
url: '/app-api/promotion/coupon/page',
method: 'GET',
params,
}),
@ -33,8 +32,8 @@ export default {
},
}),
get: (id) =>
request2({
url: 'promotion/coupon/take',
request({
url: '/app-api/promotion/coupon/take',
method: 'POST',
data: {
templateId: id

View File

@ -1,10 +1,9 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
area: () =>
request2({
url: 'system/area/tree',
request({
url: '/app-api/system/area/tree',
method: 'GET',
}),
// area: () =>

View File

@ -1,5 +1,4 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 商品详情

View File

@ -1,14 +1,14 @@
import request2 from '@/sheep/request2';
import request from '@/sheep/request';
export default {
decorate: () =>
request2({
url: 'promotion/decorate/list?page=1',
request({
url: '/app-api/promotion/decorate/list?page=1',
method: 'GET',
}),
spids: () =>
request2({
url: 'product/spu/page?recommendType=best&pageNo=1&pageSize=10',
request({
url: '/app-api/product/spu/page?recommendType=best&pageNo=1&pageSize=10',
method: 'GET',
}),
};

View File

@ -1,11 +1,10 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 订单详情
detail: (id, params) =>
request2({
url: 'trade/order/get-detail?id=' + id,
request({
url: '/app-api/trade/order/get-detail?id=' + id,
method: 'GET',
params,
}),
@ -40,8 +39,8 @@ export default {
}),
// 订单列表
list: (params) =>
request2({
url: 'trade/order/page',
request({
url: '/app-api/trade/order/page',
method: 'GET',
params,
custom: {
@ -66,9 +65,9 @@ export default {
delete data2.items
for (let i = 0; i < data.items.length; i++) {
// 此处转码问题,待解决方案
// data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
// data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
// data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + '';
data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + '';
data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + '';
// data2['items' + `[${i}]` + '.skuId'] = data.items[i].skuId + '';
// data2['items' + `[${i}]` + '.count'] = data.items[i].count + '';
@ -79,8 +78,8 @@ export default {
// data2['items' + `%5B${i}%5D` + '.cartId'] = data.items[i].cartId + '';
}
console.log(data2, '手动转码的参数')
return request2({
url: 'trade/order/settlement',
return request({
url: '/app-api/trade/order/settlement',
method: 'GET',
// data: data2,
params: data2
@ -114,8 +113,8 @@ export default {
}),
// 评价订单
comment: (data) =>
request2({
url: 'trade/order/item/create-comment',
request({
url: '/app-api/trade/order/item/create-comment',
method: 'POST',
data,
}),
@ -153,8 +152,8 @@ export default {
data,
}),
list: (params) =>
request2({
url: 'trade/after-sale/page',
request({
url: '/app-api/trade/after-sale/page',
method: 'GET',
params,
custom: {
@ -184,8 +183,8 @@ export default {
}),
// 售后详情
detail: (id) =>
request2({
url: 'trade/after-sale/get?id=' + id,
request({
url: '/app-api/trade/after-sale/get?id=' + id,
method: 'GET',
}),
},

View File

@ -1,9 +1,9 @@
import request2 from '@/sheep/request2';
import request from '@/sheep/request';
const ActivityApi = {
// 获得单个商品,近期参与的每个活动
getActivityListBySpuId: (spuId) => {
return request2({
return request({
url: '/app-api/promotion/activity/list-by-spu-id',
method: 'GET',
params: {

View File

@ -1,20 +1,22 @@
import request2 from "@/sheep/request2";
import request from "@/sheep/request";
// 拼团 API
const CombinationApi = {
// 获得拼团活动列表
getCombinationActivityList: (count) => {
return request2({
url: "promotion/combination-activity/list",
return request({
url: "/app-api/promotion/combination-activity/list",
method: 'GET',
params: {count}
params: {
count
}
});
},
// 获得拼团活动分页
getCombinationActivityPage: (params) => {
return request2({
url: "promotion/combination-activity/page",
return request({
url: "/app-api/promotion/combination-activity/page",
method: 'GET',
params
});
@ -22,8 +24,8 @@ const CombinationApi = {
// 获得拼团活动明细
getCombinationActivity: (id) => {
return request2({
url: "promotion/combination-activity/get-detail",
return request({
url: "/app-api/promotion/combination-activity/get-detail",
method: 'GET',
params: {
id
@ -33,8 +35,8 @@ const CombinationApi = {
// 获得最近 n 条拼团记录(团长发起的)
getHeadCombinationRecordList: (activityId, status, count) => {
return request2({
url: "promotion/combination-record/get-head-list",
return request({
url: "/app-api/promotion/combination-record/get-head-list",
method: 'GET',
params: {
activityId,
@ -46,8 +48,8 @@ const CombinationApi = {
// 获得拼团记录明细
getCombinationRecordDetail: (id) => {
return request2({
url: "promotion/combination-record/get-detail",
return request({
url: "/app-api/promotion/combination-record/get-detail",
method: 'GET',
params: {
id
@ -57,8 +59,8 @@ const CombinationApi = {
// 获得拼团记录的概要信息
getCombinationRecordSummary: () => {
return request2({
url: "promotion/combination-record/get-summary",
return request({
url: "/app-api/promotion/combination-record/get-summary",
method: 'GET',
});
}

View File

@ -1,5 +1,4 @@
import request from '@/sheep/request';
import request2 from '@/sheep/request2';
export default {
// 获得优惠劵模板列表
@ -14,8 +13,8 @@ export default {
},
// 获得优惠劵模版列表
getCouponTemplateList: (params) => {
return request2({
url: `promotion/coupon/match-list?price=${params.price}&spuIds=${params.spuIds}&skuIds=${params.skuIds}&categoryIds=${params.categoryIds}`,
return request({
url: `/app-api/promotion/coupon/match-list?price=${params.price}&spuIds=${params.spuIds}&skuIds=${params.skuIds}&categoryIds=${params.categoryIds}`,
method: 'GET',
// params,
});

View File

@ -1,19 +1,28 @@
import request2 from "@/sheep/request2";
import request from "@/sheep/request";
const SeckillApi = {
// 获得秒杀时间段列表
getSeckillConfigList: () => {
return request2({ url: 'promotion/seckill-config/list', method: 'GET' });
return request({
url: '/app-api/promotion/seckill-config/list',
method: 'GET'
});
},
// 获得当前秒杀活动
getNowSeckillActivity: () => {
return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
return request({
url: '/app-api/promotion/seckill-activity/get-now',
method: 'GET'
});
},
// 获得秒杀活动分页
getSeckillActivityPage: () => {
return request2({ url: 'promotion/seckill-activity/page', method: 'GET' });
return request({
url: '/app-api/promotion/seckill-activity/page',
method: 'GET'
});
},
/**
@ -22,10 +31,12 @@ const SeckillApi = {
* @return {*}
*/
getSeckillActivity: (id) => {
return request2({
url: 'promotion/seckill-activity/get-detail',
return request({
url: '/app-api/promotion/seckill-activity/get-detail',
method: 'GET',
params: { id }
params: {
id
}
});
}
}

View File

@ -364,7 +364,7 @@ Parser.prototype.onAttrName = function(name) {
* @private
*/
Parser.prototype.onAttrVal = function(val) {
console.log(val, '解码转码')
// console.log(val, '解码转码')
const name = this.attrName || ''
if (name === 'style' || name === 'href') {
// 部分属性进行实体解码