当前位置:网站首页>Smart business card applet creates business card page function and realizes key code
Smart business card applet creates business card page function and realizes key code
2022-04-22 11:53:00 【mon_ star°】
Smart business card applet creates business card page function and realizes key code
When creating a business card page , The whole operation process is like this , Form filling 、 Head picture upload 、 Address selection 、 Form verification 、 Submit data to database .
The form layout is mainly form、input、textarea For page elements , It's simple , Mainly talk about the key code implementation of relevant function points .
Image upload
call wx.cloud.uploadFile Method , Upload the picture to the cloud storage server .
wx.cloud.uploadFile({
cloudPath: cloudPath, // Path to the cloud
filePath: this.data.tempFilePath, // Applet temporary file path
success: res => {
// Return file ID
const fileID = res.fileID;
},
fail: console.error
})
Address selection
Add a click event listener to the page , And then in js In the corresponding function body in , Add this code , You can adjust the map function , Make address selection .
wx.chooseLocation({
success: function (res) {
// success
that.setData({
address: res.address,
latitude: res.latitude,
longitude: res.longitude
})
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})
Form verification
Use common regular expressions , call .test() check .
MOBILE_TEST.test(formData.mobile)
Submit data to database
Submit the electronic business card data to the cloud database for saving .
wx.cloud.database().collection('card').add({})

版权声明
本文为[mon_ star°]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221139444824.html
边栏推荐
- 无刷直流电机矢量控制(一):概念和流程梳理
- 关于Pycharm的常用实用技巧分享
- 2. flddler响应显示乱码问题解决方案
- Cloud native Virtualization: building edge computing instances based on kubevirt
- [Tang Laoshi] subcontracting and sticking in unity network communication
- Flutter 应用程序创建一个扩展面板列表
- 哇哦,好丰富呀。
- Kernel pwn 基础教程之 Heap Overflow
- 2. flddler响应显示乱码问题解决方案
- uniApp 学习笔记总结(一)
猜你喜欢

《假如你身处被“科技制裁”的俄罗斯》之GBase篇

活动预告 | 4月23日,多场OpenMLDB精彩分享来袭,不负周末好时光!

In depth analysis of the drawing source code process of view

从怎么阅读AWR报告说起

POSTGRESQL 15 的新功能,值得期待,其中两个被吐槽很久

12. (map data) cesium city building map

分支和循环语句例题

Add page transition animation in fluent

Open new space for development with digital key

Summary of important knowledge points of discrete structure and its application
随机推荐
POSTGRESQL 15 的新功能,值得期待,其中两个被吐槽很久
C language small project ---- > push box
Redis clears the data of all databases and the currently selected database
Cloud native Virtualization: building edge computing instances based on kubevirt
2021-09-17
“开源之夏”活动火热报名中,丰厚奖金等你来拿!
Golang development: suggestions for go concurrency
解决Command line is too long. Shorten command line for........错误
分支和循环语句
leetcode:508. 出现次数最多的子树元素和【dfs记录和】
游戏+NFT,脱虚向实外的另一可行场景
【唐老狮】Unity网络通信中的分包、黏包
[Tang Laoshi] subcontracting and sticking in unity network communication
北汽福田与中国石化、轻程物联网组建中石化销售氢能源(北京)
活动预告 | 4月23日,多场OpenMLDB精彩分享来袭,不负周末好时光!
360数科等入选信通院首批数据安全管理能力认证公司
leetcode:508. Subtree elements with the most occurrences and [DFS records]
Open new space for development with digital key
怎么得到tuphub.today热榜和热度呢?
Eight misunderstandings in writing