Skip to content

Commit dad0ea0

Browse files
authored
Merge pull request #1421 from haoxiuwen/callkit
Add CallKit Docs
2 parents 173cecb + cd5545b commit dad0ea0

File tree

223 files changed

+7041
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+7041
-8
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<script lang="ts" setup>
2+
import { ref, watch, computed } from "vue";
3+
import { useRoute, useRouter } from "vue-router";
4+
5+
const PLATFORM_ICON_MAP = {
6+
android: {
7+
icon: "/icon-Android.svg",
8+
activeIcon: "/icon-Android-hover.svg"
9+
},
10+
ios: {
11+
icon: "/icon-iOS.svg",
12+
activeIcon: "/icon-iOS-hover.svg"
13+
},
14+
web: {
15+
icon: "/icon-web.svg",
16+
activeIcon: "/icon-web-hover.png"
17+
},
18+
harmonyos: {
19+
icon: "/icon-harmonyos.svg",
20+
activeIcon: "/icon-harmonyos-hover.svg"
21+
},
22+
windows: {
23+
icon: "/icon-windows.svg",
24+
activeIcon: "/icon-windows-hover.svg"
25+
},
26+
["react-native"]: {
27+
icon: "/icon-ReactNative.svg",
28+
activeIcon: "/icon-ReactNative-hover.svg"
29+
},
30+
flutter: {
31+
icon: "/icon-flutter.svg",
32+
activeIcon: "/icon-flutter-hover.png"
33+
},
34+
unity: {
35+
icon: "/icon-unity.svg",
36+
activeIcon: "/icon-unity-hover.svg"
37+
},
38+
uniapp: {
39+
icon: "/icon-uni-app.svg",
40+
activeIcon: "/icon-uni-app.svg"
41+
},
42+
applet: {
43+
icon: "/icon-mini-program.svg",
44+
activeIcon: "/icon-mini-program-hover.svg"
45+
},
46+
["server-side"]: {
47+
icon: "/icon-platform.svg",
48+
activeIcon: "/icon-platform-hover.svg"
49+
}
50+
};
51+
52+
const options = [
53+
{
54+
label: "平台",
55+
options: [
56+
{
57+
value: "android",
58+
label: "Android"
59+
},
60+
{
61+
value: "ios",
62+
label: "iOS"
63+
},
64+
{
65+
value: "web",
66+
label: "Web"
67+
}
68+
]
69+
}
70+
];
71+
72+
const platform = ref("android");
73+
const platformIcon = computed(
74+
() => PLATFORM_ICON_MAP[platform.value]?.activeIcon
75+
);
76+
const route = useRoute();
77+
const router = useRouter();
78+
watch(
79+
() => route.path,
80+
() => {
81+
if (route.path.indexOf("/callkit") == 0) {
82+
const splitRoute = route.path.split("/");
83+
platform.value = splitRoute[2];
84+
}
85+
},
86+
{ immediate: true }
87+
);
88+
89+
// 切换平台,如果有相同路径的route就直接跳转
90+
const onChange = (platform) => {
91+
const nextPlatformDocRouters = router.options.routes
92+
.filter(
93+
(item) =>
94+
item.hasOwnProperty("name") &&
95+
item?.path.indexOf(`/callkit/${platform}`) == 0
96+
)
97+
.map((item) => item.path);
98+
99+
let newPath = route.path.split("/");
100+
newPath[2] = platform;
101+
const nextPathPath = newPath.join("/");
102+
103+
if (nextPlatformDocRouters.indexOf(nextPathPath) > -1) {
104+
router.push(nextPathPath);
105+
} else {
106+
router.push(`/callkit/${platform}/product_overview.html`);
107+
}
108+
};
109+
</script>
110+
111+
<template>
112+
<el-select v-model="platform" @change="onChange" placeholder="请选择">
113+
<template #prefix>
114+
<img width="20" height="20" :src="platformIcon" />
115+
</template>
116+
<el-option-group
117+
v-for="group in options"
118+
:key="group.label"
119+
:label="group.label"
120+
>
121+
<el-option
122+
v-for="item in group.options"
123+
:key="item.value"
124+
:label="item.label"
125+
:value="item.value"
126+
class="option-content"
127+
>
128+
<span class="label-icon">
129+
<img
130+
class="default"
131+
width="20"
132+
height="20"
133+
:src="PLATFORM_ICON_MAP[item.value]?.icon"
134+
/>
135+
<img
136+
class="active"
137+
width="20"
138+
height="20"
139+
:src="PLATFORM_ICON_MAP[item.value]?.activeIcon"
140+
/>
141+
</span>
142+
<span>{{ item.label }}</span>
143+
</el-option>
144+
</el-option-group>
145+
</el-select>
146+
</template>
147+
148+
<style lang="scss" scope>
149+
.option-content:hover .default {
150+
display: none;
151+
}
152+
153+
.option-content .active {
154+
display: none;
155+
}
156+
157+
.option-content:hover .active {
158+
display: inline-block;
159+
}
160+
161+
.label-icon {
162+
vertical-align: sub;
163+
padding-right: 5px;
164+
}
165+
</style>

docs/.vuepress/components/Sidebar.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
import PlatformSwitch from './PlatformSwitch.vue'
44
import PrivateSwitch from './PrivateSwitch.vue'
55
import UIKitSwitch from './UIKitSwitch.vue'
6+
import CallKitSwitch from './CallKitSwitch.vue'
67
import { usePageData } from '@vuepress/client'
78
import { ref, watch } from 'vue'
89
910
const pageData = usePageData()
1011
const showPlatformSwitch = ref(false)
1112
const showPrivateSwitch = ref(false)
1213
const showUIKitSwitch = ref(false)
14+
const showCallKitSwitch = ref(false)
1315
watch(pageData, ()=> {
1416
const pagePath = pageData.value.path
1517
showPrivateSwitch.value = pagePath.indexOf('/private/') == 0
1618
showPlatformSwitch.value = pagePath.indexOf('/document/') == 0
1719
showUIKitSwitch.value = pagePath.indexOf('/uikit/') == 0
20+
showCallKitSwitch.value = pagePath.indexOf('/callkit/') == 0
1821
}, {immediate:true})
1922
2023
@@ -37,6 +40,11 @@
3740
<UIKitSwitch />
3841
</ClientOnly>
3942
</div>
43+
<div v-show="showCallKitSwitch" class="platform-switch">
44+
<ClientOnly>
45+
<CallKitSwitch />
46+
</ClientOnly>
47+
</div>
4048
</template>
4149
</Sidebar>
4250
</template>

docs/.vuepress/navbar/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,26 @@ export const zhNavbar = navbar([
7777
}
7878
]
7979
},
80+
{
81+
text: 'CallKit',
82+
children: [
83+
{
84+
text: 'Android',
85+
icon: '/icon-Android.svg',
86+
link: '/callkit/android/product_overview.html'
87+
},
88+
{
89+
text: 'iOS',
90+
icon: '/icon-iOS.svg',
91+
link: '/callkit/ios/product_overview.html'
92+
},
93+
{
94+
text: 'Web',
95+
icon: '/icon-web.svg',
96+
link: '/callkit/web/product_overview.html'
97+
},
98+
]
99+
},
80100
{
81101
text: 'SDK/REST 集成',
82102
children: [
-1.07 KB
Binary file not shown.
900 KB
780 KB
168 KB
224 KB
819 KB
434 KB

0 commit comments

Comments
 (0)