小程序
小游戏
企业微信
微信支付
扫描小程序码分享
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
看一下 你 wx.request 怎么写的
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
测试了很久发现不走mock,导出mock数据发现正则匹配的url最后一个空格 - -
麻烦发下mock的配置内容
{"useApiMock":true,"apiMockConfig":{"globalOpen":true,"rules":[{"ruleId":"47268ce6-1b3f-4a77-b9b7-dfed65d7a1d3","ruleName":"未命名规则1","apiName":"request","enable":false,"verifyFail":false,"filterList":[{"propName":"","propRegString":"","filterId":"56201ef4-2a11-4115-8c00-006e6cd5240a"}],"returnConfig":{"returnType":"succ","generateType":"manual","manual":{"succ":{"resStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}},{"ruleId":"a1699ec2-a332-4ee3-b5f6-bb093da41ea0","ruleName":"未命名规则","apiName":"request","enable":false,"verifyFail":false,"filterList":[{"propName":"","propRegString":"","filterId":"ab56feec-a035-4fcd-a986-1c8b8e8bfc2b"}],"returnConfig":{"returnType":"succ","generateType":"manual","manual":{"succ":{"resStr":"{\r\n \"statusCode\": 200,\r\n \"header\": {},\r\n \"data\": {\r\n \"code\": 0,\r\n \"codeMsg\": \"\",\r\n \"body\": {}\r\n }\r\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}},{"ruleId":"ad52b1ba-043c-46df-93e0-f3fd3820d725","ruleName":"未使用券列表","apiName":"request","enable":true,"verifyFail":false,"filterList":[{"propName":"url","propRegString":"https://api-ddyz.egou.com/rest?method=xxxxxx?coupounStatus=0","filterId":"d8ba52f0-7078-453e-bb75-1cd027d4bbe2"},{"propName":"dataType","propRegString":"json","filterId":"77fd367c-9665-4776-932f-27410a2141ed"}],"returnConfig":{"returnType":"succ","generateType":"template","manual":{"succ":{"resStr":"{\n \"code\": 0,\n \"data\": [\n {\n \"coupounType\": 1,\n \"coupounStatus\": 0,\n \"money\": 15,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"isValid\": true\n },\n {\n \"coupounType\": 2,\n \"coupounStatus\": 1,\n \"money\": 10,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"isExpired\": true\n },\n {\n \"coupounType\": 3,\n \"coupounStatus\": 2,\n \"money\": 10,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"2.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"hasUsed\": true\n }\n ]\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": {\n \"list|10\": [\n {\"id|+1\": 1, \"name\": \"@FIRST\"}\n ]\n },\n \"statusCode\": 200,\n \"header\": {\n \"content-type\": \"application/json; charset=utf-8\"\n }\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}}]}}
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
看一下 你 wx.request 怎么写的
测试了很久发现不走mock,导出mock数据发现正则匹配的url最后一个空格 - -
麻烦发下mock的配置内容
{"useApiMock":true,"apiMockConfig":{"globalOpen":true,"rules":[{"ruleId":"47268ce6-1b3f-4a77-b9b7-dfed65d7a1d3","ruleName":"未命名规则1","apiName":"request","enable":false,"verifyFail":false,"filterList":[{"propName":"","propRegString":"","filterId":"56201ef4-2a11-4115-8c00-006e6cd5240a"}],"returnConfig":{"returnType":"succ","generateType":"manual","manual":{"succ":{"resStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}},{"ruleId":"a1699ec2-a332-4ee3-b5f6-bb093da41ea0","ruleName":"未命名规则","apiName":"request","enable":false,"verifyFail":false,"filterList":[{"propName":"","propRegString":"","filterId":"ab56feec-a035-4fcd-a986-1c8b8e8bfc2b"}],"returnConfig":{"returnType":"succ","generateType":"manual","manual":{"succ":{"resStr":"{\r\n \"statusCode\": 200,\r\n \"header\": {},\r\n \"data\": {\r\n \"code\": 0,\r\n \"codeMsg\": \"\",\r\n \"body\": {}\r\n }\r\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": \"\",\n \"statusCode\": \"\",\n \"header\": \"\"\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}},{"ruleId":"ad52b1ba-043c-46df-93e0-f3fd3820d725","ruleName":"未使用券列表","apiName":"request","enable":true,"verifyFail":false,"filterList":[{"propName":"url","propRegString":"https://api-ddyz.egou.com/rest?method=xxxxxx?coupounStatus=0","filterId":"d8ba52f0-7078-453e-bb75-1cd027d4bbe2"},{"propName":"dataType","propRegString":"json","filterId":"77fd367c-9665-4776-932f-27410a2141ed"}],"returnConfig":{"returnType":"succ","generateType":"template","manual":{"succ":{"resStr":"{\n \"code\": 0,\n \"data\": [\n {\n \"coupounType\": 1,\n \"coupounStatus\": 0,\n \"money\": 15,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"isValid\": true\n },\n {\n \"coupounType\": 2,\n \"coupounStatus\": 1,\n \"money\": 10,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"isExpired\": true\n },\n {\n \"coupounType\": 3,\n \"coupounStatus\": 2,\n \"money\": 10,\n \"img\": \"https://img0.gouwubang.com/brand/202004/16/2d74d2e2b486946498dd67a1dc2b72f6.jpg\",\n \"proName\": \"张小琴车厘子非常好吃0317\",\n \"validTime\": \"10小时候即将过期\",\n \"useCondition\": [\n \"1.使用限制:只限泰国进口牛奶椰皇商品可用\",\n \"2.使用限制:只限泰国进口牛奶椰皇商品可用\"\n ],\n \"expanded\": false,\n \"hasUsed\": true\n }\n ]\n}"},"fail":{"resStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}},"template":{"succ":{"templateStr":"{\n \"data\": {\n \"list|10\": [\n {\"id|+1\": 1, \"name\": \"@FIRST\"}\n ]\n },\n \"statusCode\": 200,\n \"header\": {\n \"content-type\": \"application/json; charset=utf-8\"\n }\n}"},"fail":{"templateStr":"{\n \"errMsg\": \"request:fail 填写错误信息\"\n}"}}}}]}}
改成如下值即可: