Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-study-front-share
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
yifu-study
front
yifu-study-front-share
Commits
ba6eeeaf
Commit
ba6eeeaf
authored
Sep 26, 2022
by
liyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
9月分享:由前端接入第三方实名认证引发的知识探索
parent
b3c2bda4
Pipeline
#16839
canceled with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
4 deletions
+5
-4
由前端接入第三方实名认证引发的知识探索.md
source/_posts/由前端接入第三方实名认证引发的知识探索.md
+5
-4
1.jpg
source/images/realNameCertify/1.jpg
+0
-0
2.png
source/images/realNameCertify/2.png
+0
-0
3.jpg
source/images/realNameCertify/3.jpg
+0
-0
4.jpg
source/images/realNameCertify/4.jpg
+0
-0
No files found.
source/_posts/由前端接入第三方实名认证引发的知识探索.md
View file @
ba6eeeaf
...
...
@@ -145,14 +145,15 @@ realNameCertify() {
然后执行代码,结果报错如下:
![
1.jpg
](
https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e666dc7694f74511a3781e099cbc694b~tplv-k3u1fbpfcp-watermark.image?
)
![
1.jpg
](
/yifu-study-front-share/images/realNameCertify/1.jpg
)
再一查,才知道,微信本身没有
`FormData`
对象,无法使用
`new FormData`
。
无耐用普通对象试了一下,结果第三方接口不接收。
![
2.png
](
https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/934a8f0b43fe489a8f4311db832bfe6d~tplv-k3u1fbpfcp-watermark.image?
)
![
2.png
](
/yifu-study-front-share/images/realNameCertify/2.png
)
从上面的错误信息们可以看到,大概就是说multipart少了对参数boundary的初始化,其实就是boundary这个参数没有给值。遂将Context-type的值调整为multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bd1,其中boundary里的值可以随便改。
再一执行代码,还是报上述同样的错。
...
...
@@ -240,7 +241,7 @@ const FormData = require('../../../../utils/formData/formData')
实名认证功能开发完成后,开始了自测,在自测过程中,忽然发现一个页面的数据不能正常渲染了,控制台报错如下:
![
3.jpg
](
https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4ae25bdbe8e349b59ab7d850baf088a3~tplv-k3u1fbpfcp-watermark.image?
)
![
3.jpg
](
/yifu-study-front-share/images/realNameCertify/3.jpg
)
本想着这个问题是页面历史遗留问题,遂找写此代码的小伙伴一起看一下。结果,小伙伴查看后告诉我,他那边可以正常显示。
...
...
@@ -276,7 +277,7 @@ String.prototype.utf8CodeAt = function(i) {
我们来看一下inputValue和val值的打印:
![
4.jpg
](
https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/0acf23f4b3c04d0fb68f0d2618188fd4~tplv-k3u1fbpfcp-watermark.image?
)
![
4.jpg
](
/yifu-study-front-share/images/realNameCertify/4.jpg
)
发现val值多了一个方法,而这个方法再调用字符串的toUpperCase()方法时当然会造成报错。
...
...
source/images/realNameCertify/1.jpg
0 → 100644
View file @
ba6eeeaf
28.9 KB
source/images/realNameCertify/2.png
0 → 100644
View file @
ba6eeeaf
19.4 KB
source/images/realNameCertify/3.jpg
0 → 100644
View file @
ba6eeeaf
20.1 KB
source/images/realNameCertify/4.jpg
0 → 100644
View file @
ba6eeeaf
12.9 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment