There are two paths for editing business cards, which are divided into the process of adding a business card and the process of modifying the business card. The process for users to manually fill in a new business card is as follows:
##First jump to our new business card page 1. You need to pass the user’s current userId, wx.navigateTo jumps with value. Manual is true to set the user to take the new route.
Vertical Adding it means sliding vertically, removing it means sliding left and right. The overall structure is as follows:
In addition proptText is the content that needs to be prompted.
Even many input boxes support dynamic changes in data, which is very convenient.
The setting is directly the background image.
Submit the form and jump. To submit the form, you use the built-in bindsubmit event component. Just add formType="submit" to the button component. Another thing to note is that when using the form submission function, the input needs to add the name attribute. This The delivery method is in the form of key-value pairs.
loop, the radio button may need to be beautified in the future.
data binding and verification effects.
Modify the business card process renderings and requirements. Modifying the business card is to render all the previously filled in personal information at once for the user to change:
This card image module has some problems uploading images for the time being. Here it is imitating a jump component. It is recommended that the page that needs to be jumped is controlled by wx.navigateTo. One point, wx.navigateTo provides us with 3 different jumps routes, all of which are well encapsulated, and many jump pages involve passing values and the like, which can be achieved Unified management can also avoid some invisible bugs. In short, it should be determined according to business needs:
Name mobile phone required module:
Personal information module, directly loop (block) out:
//请求名片对应的公司的中文信息的属性组数据,分为必填和选填//选题项变量以 no 开头requester.getOfflineCardInfoGroupFields(userId, cardId,function (res) {//debuggervar userName = res.card.userName;var mobile = res.card.mobile;var requiredGroup = res.requiredGroupCh;var notRequiredGroup = res.notRequiredGroupCh;var requiredGroupEn = res.requiredGroupEn;var notRequiredGroupEn = res.notRequiredGroupEn;var reqLen = requiredGroup.fields.length;var nreqLen = notRequiredGroup.fields.length;var reqLenEn = requiredGroupEn.fields.length;var nreqLenEn = notRequiredGroupEn.fields.length;self.setData({userName: userName,mobile: mobile,requireFields: requiredGroup.fields,notRequireFields: notRequiredGroup.fields,requireFieldsEn: requiredGroupEn.fields,notRequireFieldsEn: notRequiredGroupEn.fields,l1: reqLen,l2: nreqLen + reqLen,l3: reqLenEn + nreqLen + reqLen});self.forceUpdate();}, function (code, msg) {console.info("code=" + code + "&msg=" + msg);});
The first is the small index layout on the right and data binding. The data binding is the same as the letter on the business card list. Below the letter If there is a business card, it will be rendered. If there is no business card, there is no need to render. The id is also the current letter and the content displayed on the right:
#If there is a menu bar at the top here , you have to pay attention to the layout, otherwise the height of the menu bar will be offset downwards. In fact, you can avoid this problem as long as it is at the same level as the alphabetical index (the top menu here is separated by a template, and the separated template It should be noted that some data that needs to be bound to the template here will be invalid, and the details will not be further studied).
The jump function is basically implemented (ohter is # at the bottom).
【related suggestion】
1. Complete source code download of WeChat Mini Program
2. Click the tabbar to change icon
3. WeChat Mini Program demo :Lezhu
The above is the detailed content of WeChat Mini Program Development (6) 'Edit Business Card' Page Development. For more information, please follow other related articles on the PHP Chinese website!