Skip to content

Commit f6faefb

Browse files
committed
增加 “添加联系人” 示例
1 parent 0a6633e commit f6faefb

3 files changed

Lines changed: 101 additions & 22 deletions

File tree

‎pages.json‎

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@
332332
"navigationBarTitleText" : "获取手机系统信息"
333333
}
334334
},
335+
{
336+
"path" : "pages/API/add-phone-contact/add-phone-contact",
337+
"style" : {
338+
"navigationBarTitleText" : "添加手机联系人"
339+
}
340+
},
335341
{
336342
"path" : "pages/API/on-accelerometer-change/on-accelerometer-change",
337343
"style" : {
@@ -637,28 +643,28 @@
637643
}
638644
}
639645
},
640-
{
641-
"path" : "nav-dot/nav-dot",
642-
"style" : {
643-
"navigationBarTitleText" : "导航栏带红点和角标",
644-
"app-plus": {
645-
"titleNView": {
646-
"buttons": [
647-
{
648-
"text": "消息",
649-
"fontSize": "14",
650-
"redDot": true
651-
},
652-
{
653-
"text": "关注",
654-
"fontSize": "14",
655-
"badgeText": "12"
656-
}
657-
]
658-
}
659-
}
660-
}
661-
},
646+
{
647+
"path" : "nav-dot/nav-dot",
648+
"style" : {
649+
"navigationBarTitleText" : "导航栏带红点和角标",
650+
"app-plus" : {
651+
"titleNView" : {
652+
"buttons" : [
653+
{
654+
"text" : "消息",
655+
"fontSize" : "14",
656+
"redDot" : true
657+
},
658+
{
659+
"text" : "关注",
660+
"fontSize" : "14",
661+
"badgeText" : "12"
662+
}
663+
]
664+
}
665+
}
666+
}
667+
},
662668
// #endif
663669
{
664670
"path" : "mpvue-picker/mpvue-picker",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<view>
3+
<page-head :title="title"></page-head>
4+
<view class="uni-common-mt">
5+
<view class="uni-list">
6+
<view class="uni-list-cell">
7+
<view class="uni-list-cell-left">
8+
<view class="uni-label">名称</view>
9+
</view>
10+
<view class="uni-list-cell-db">
11+
<input class="uni-input" type="text" placeholder="请输入联系人名称" name="name" :value="name" @input="nameChange"></input>
12+
</view>
13+
</view>
14+
<view class="uni-list-cell">
15+
<view class="uni-list-cell-left">
16+
<view class="uni-label">手机号</view>
17+
</view>
18+
<view class="uni-list-cell-db">
19+
<input class="uni-input" type="text" placeholder="请输入联系人手机号" name="phone" :value="phone" @input="phoneChange"></input>
20+
</view>
21+
</view>
22+
</view>
23+
<view class="uni-padding-wrap">
24+
<view class="uni-btn-v">
25+
<button type="primary" class="btn-setstorage" @tap="add">添加联系人</button>
26+
</view>
27+
</view>
28+
</view>
29+
</view>
30+
</template>
31+
<script>
32+
export default {
33+
data() {
34+
return {
35+
title: 'addPhoneContact',
36+
name: '',
37+
phone: ''
38+
}
39+
},
40+
methods: {
41+
nameChange: function(e) {
42+
this.name = e.detail.value
43+
},
44+
phoneChange: function(e) {
45+
this.phone = e.detail.value
46+
},
47+
add() {
48+
uni.addPhoneContact({
49+
firstName: this.name,
50+
mobilePhoneNumber: this.phone,
51+
success: function() {
52+
uni.showModal({
53+
content:'已成功添加联系人!',
54+
showCancel:false
55+
})
56+
},
57+
fail: function() {
58+
uni.showModal({
59+
content:'添加联系人失败!',
60+
showCancel:false
61+
})
62+
}
63+
});
64+
}
65+
}
66+
}
67+
</script>
68+
69+
<style>
70+
</style>

‎pages/tabBar/API/API.vue‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
},
110110
//#ifndef H5
111111
{
112+
name: '添加手机联系人',
113+
url: 'add-phone-contact'
114+
}, {
112115
name: '扫码',
113116
url: 'scan-code'
114117
}, {

0 commit comments

Comments
 (0)