接口层兼容

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> <template>
<s-layout <s-layout title="我的" tabbar="/pages/index/user" navbar="custom" :bgStyle="template.page"
title="我的" :navbarStyle="template.style?.navbar" onShareAppMessage>
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 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-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block> </s-block>
@ -14,8 +8,14 @@
</template> </template>
<script setup> <script setup>
import { computed } from 'vue'; import {
import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app'; computed
} from 'vue';
import {
onShow,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
// tabBar // tabBar
@ -30,7 +30,7 @@
onPullDownRefresh(() => { onPullDownRefresh(() => {
sheep.$store('user').updateUserData(); sheep.$store('user').updateUserData();
setTimeout(function () { setTimeout(function() {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 800); }, 800);
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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