瀏覽代碼

接口层兼容

落日晚风 1 年之前
父節點
當前提交
cf2c782c0e

+ 30 - 30
pages/index/user.vue

@@ -1,41 +1,41 @@
 <template>
-  <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>
-  </s-layout>
+	<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>
+	</s-layout>
 </template>
 
 <script setup>
-  import { computed } from 'vue';
-  import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
-  import sheep from '@/sheep';
+	import {
+		computed
+	} from 'vue';
+	import {
+		onShow,
+		onPageScroll,
+		onPullDownRefresh
+	} from '@dcloudio/uni-app';
+	import sheep from '@/sheep';
 
-  // 隐藏原生tabBar
-  uni.hideTabBar();
+	// 隐藏原生tabBar
+	uni.hideTabBar();
 
-  const template = computed(() => sheep.$store('app').template.user);
-  const isLogin = computed(() => sheep.$store('user').isLogin);
+	const template = computed(() => sheep.$store('app').template.user);
+	const isLogin = computed(() => sheep.$store('user').isLogin);
 
-  onShow(() => {
-    sheep.$store('user').updateUserData();
-  });
+	onShow(() => {
+		sheep.$store('user').updateUserData();
+	});
 
-  onPullDownRefresh(() => {
-    sheep.$store('user').updateUserData();
-    setTimeout(function () {
-      uni.stopPullDownRefresh();
-    }, 800);
-  });
+	onPullDownRefresh(() => {
+		sheep.$store('user').updateUserData();
+		setTimeout(function() {
+			uni.stopPullDownRefresh();
+		}, 800);
+	});
 
-  onPageScroll(() => {});
+	onPageScroll(() => {});
 </script>
 
-<style></style>
+<style></style>

+ 7 - 8
sheep/api/cart.js

@@ -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,

+ 7 - 9
sheep/api/category.js

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

+ 4 - 5
sheep/api/coupon.js

@@ -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

+ 21 - 22
sheep/api/data.js

@@ -1,25 +1,24 @@
 import request from '@/sheep/request';
-import request2 from '@/sheep/request2';
 
 export default {
-  area: () =>
-    request2({
-      url: 'system/area/tree',
-      method: 'GET',
-    }),
-  // area: () =>
-  //   request({
-  //     url: 'data/area',
-  //     method: 'GET',
-  //   }),
-  faq: () =>
-    request({
-      url: 'data/faq',
-      method: 'GET',
-    }),
-  richtext: (id) =>
-    request({
-      url: 'data/richtext/' + id,
-      method: 'GET',
-    }),
-};
+	area: () =>
+		request({
+			url: '/app-api/system/area/tree',
+			method: 'GET',
+		}),
+	// area: () =>
+	//   request({
+	//     url: 'data/area',
+	//     method: 'GET',
+	//   }),
+	faq: () =>
+		request({
+			url: 'data/faq',
+			method: 'GET',
+		}),
+	richtext: (id) =>
+		request({
+			url: 'data/richtext/' + id,
+			method: 'GET',
+		}),
+};

+ 0 - 1
sheep/api/goods.js

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

+ 12 - 12
sheep/api/index2.js

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

+ 15 - 16
sheep/api/order.js

@@ -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',
 			}),
 	},

+ 12 - 12
sheep/api/promotion/activity.js

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

+ 59 - 57
sheep/api/promotion/combination.js

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

+ 2 - 3
sheep/api/promotion/coupon.js

@@ -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,
 		});

+ 37 - 26
sheep/api/promotion/seckill.js

@@ -1,33 +1,44 @@
-import request2 from "@/sheep/request2";
+import request from "@/sheep/request";
 
 const SeckillApi = {
-  // 获得秒杀时间段列表
-  getSeckillConfigList: () => {
-    return request2({ url: 'promotion/seckill-config/list', method: 'GET' });
-  },
+	// 获得秒杀时间段列表
+	getSeckillConfigList: () => {
+		return request({
+			url: '/app-api/promotion/seckill-config/list',
+			method: 'GET'
+		});
+	},
 
-  // 获得当前秒杀活动
-  getNowSeckillActivity: () => {
-    return request2({ url: 'promotion/seckill-activity/get-now', method: 'GET' });
-  },
+	// 获得当前秒杀活动
+	getNowSeckillActivity: () => {
+		return request({
+			url: '/app-api/promotion/seckill-activity/get-now',
+			method: 'GET'
+		});
+	},
 
-  // 获得秒杀活动分页
-  getSeckillActivityPage: () => {
-    return request2({ url: 'promotion/seckill-activity/page', method: 'GET' });
-  },
+	// 获得秒杀活动分页
+	getSeckillActivityPage: () => {
+		return request({
+			url: '/app-api/promotion/seckill-activity/page',
+			method: 'GET'
+		});
+	},
 
-  /**
-   * 获得秒杀活动明细
-   * @param {number} id 秒杀活动编号
-   * @return {*}
-   */
-  getSeckillActivity: (id) => {
-    return request2({
-      url: 'promotion/seckill-activity/get-detail',
-      method: 'GET',
-      params: { id }
-    });
-  }
+	/**
+	 * 获得秒杀活动明细
+	 * @param {number} id 秒杀活动编号
+	 * @return {*}
+	 */
+	getSeckillActivity: (id) => {
+		return request({
+			url: '/app-api/promotion/seckill-activity/get-detail',
+			method: 'GET',
+			params: {
+				id
+			}
+		});
+	}
 }
 
-export default SeckillApi;
+export default SeckillApi;

+ 6 - 6
uni_modules/mp-html/components/mp-html/parser.js

@@ -7,7 +7,7 @@ const config = {
 	// 信任的标签(保持标签名不变)
 	trustTags: makeMap(
 		'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
-		),
+	),
 
 	// 块级标签(转为 div,其他的非信任标签转为 span)
 	blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
@@ -20,12 +20,12 @@ const config = {
 	// 要移除的标签
 	ignoreTags: makeMap(
 		'area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'
-		),
+	),
 
 	// 自闭合的标签
 	voidTags: makeMap(
 		'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
-		),
+	),
 
 	// html 实体
 	entities: {
@@ -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') {
 		// 部分属性进行实体解码
@@ -502,7 +502,7 @@ Parser.prototype.onOpenTag = function(selfClose) {
 							for (let j = i + 1; j < this.stack.length; j++) {
 								const style = this.stack[j].attrs.style || ''
 								if (!style.includes(';width') && !style.includes(' width') && style.indexOf(
-									'width') !== 0) {
+										'width') !== 0) {
 									styleObj.width = ''
 									break
 								}
@@ -1151,7 +1151,7 @@ Parser.prototype.onText = function(text) {
 	if (this.hook(node)) {
 		// #ifdef MP-WEIXIN
 		if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse(
-			'rich-text.user-select')) {
+				'rich-text.user-select')) {
 			this.expose()
 		}
 		// #endif