Skip to content

Commit 3b1cae6

Browse files
committed
新增APP交互说明
1 parent 3b9d330 commit 3b1cae6

10 files changed

Lines changed: 286 additions & 3 deletions

File tree

assets/img/favicon.png

69.8 KB
Loading

assets/img/favicon1.png

2.58 KB
Loading

assets/img/seal@2x.png

72.4 KB
Loading

docs/_includes/sidenav.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
<!--
2+
@Project: HaiBian
3+
@Author: 听着情歌流泪 <bobo>
4+
@Create Time: 2016-02-27 02:39:38
5+
@Email: bobo.xiao@nmtree.com
6+
@Last modified time: 2016-07-05 20:14:26
7+
@License: MIT
8+
-->
9+
110
{% assign sorted_pages = site.pages | sort:"order" %}
211
{% assign status = true %}
312
<div class="panel panel-default">
@@ -10,6 +19,23 @@
1019
</div>
1120
</div>
1221

22+
23+
{% assign cate_app_pages = site.pages | sort:"order" %}
24+
<div class="panel panel-default">
25+
<div class="panel-heading">
26+
<h3 class="panel-title">天天练APP&H5交互API</h3>
27+
</div>
28+
<div class="list-group">
29+
{% for p in cate_app_pages %}
30+
{% if p.category == 'APP_H5' && p.published == status %}
31+
<a href="{{ p.url }}" class="list-group-item {% if p.url == page.url %}active{% endif %}">{{ p.title }}</a>
32+
{% endif %}
33+
34+
{% endfor %}
35+
</div>
36+
</div>
37+
38+
1339
{% assign cate_pages = site.pages | sort:"order" %}
1440
<div class="panel panel-default">
1541
<div class="panel-heading">

docs/_layouts/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta name="description" content="{{ site.data.package.description }}">
99
<meta name="author" content="{{ site.data.package.author }}">
1010
<title>{{ page.title }} | {{site.title}}</title>
11-
<link rel="icon" href="{{ site.baseurl }}/assets/images/favicon.png">
11+
<link rel="icon" href="{{ site.baseurl }}/assets/img/favicon.png">
1212
<link rel="stylesheet" href="http://static.haibian.com/seal/0.0.1/css/seal.min.css?t=1464955333">
1313
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/demo.css">
1414
<link rel="stylesheet" href="{{ site.baseurl }}/docs.min.css">
@@ -29,7 +29,7 @@
2929
<header class="gb-page-header">
3030
<div class="container">
3131
<a href="{{ site.baseurl }}/" class="logo">
32-
<img src="{{ site.baseurl }}/assets/img/favicon.png">
32+
<img src="{{ site.baseurl }}/assets/img/seal@2x.png" style="background:transparent">
3333
<h1>{{site.title}}</h1>
3434
</a>
3535

docs/app-answer.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
layout: default
3+
title: 答案
4+
order: 2
5+
published: true
6+
category: APP_H5
7+
---
8+
9+
## 答案
10+
----------
11+
12+
答案采用统一的格式提交客户端,不管是单选、多选还是拍照题,统一格式
13+
14+
### 答案格式
15+
16+
H5向客户端提交答案,统一采用json格式:
17+
18+
{% example html %}
19+
示例
20+
<script>
21+
22+
var answer = {
23+
uid:'10000', // 用户UID(暂定是否需要)
24+
uuid:'abcdefg01abcdefg01', // 题目的UUID,唯一标识
25+
type:1, // 题目类型 1:单选,2:多选 .....(类型暂定,需要后端配合定义)
26+
answers:['A','B','...'], // 多选多答案列表,顺序从上至下
27+
28+
// answers:['你好','我好','大家好'] // 填多空的答案数据,顺序从上至下
29+
// answers:['ABC'] // 多选题答案。由于多选题虽然答案有多个,但是,看作是一个待答区
30+
}
31+
32+
</script>
33+
{% endexample %}

docs/app-api.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
layout: default
3+
title: 交互接口
4+
order: 3
5+
published: true
6+
category: APP_H5
7+
---
8+
9+
## 交互接口
10+
----------
11+
12+
### API名称定义
13+
14+
* <b>native<font color="#dc0000">XXX</font></b>
15+
* <b>web<font color="#dc0000">XXX</font></b>
16+
17+
<b>native</b> 含义:客户端的接口,提供给H5调用。“XXX” 表示具体的方法名
18+
19+
<b>web</b> 含义:H5的接口,提供给客户端调用。“XXX” 表示具体的方法名
20+
21+
22+
23+
### API列表
24+
25+
#### nativeSetAnswer
26+
27+
>p 提交答案(H5提交答案到客户端)
28+
29+
答题操作时,H5调用此接口,向客户端push用户提交的答案,客户端进行答案本地操作
30+
31+
参数:JSON字符串(UID,uuid,type,answers)
32+
33+
{% example html %}
34+
<script>
35+
36+
var answer = {
37+
uid:'10000', // 用户UID(暂定是否需要)
38+
uuid:'abcdefg01abcdefg01', // 题目的UUID,唯一标识
39+
type:1, // 题目类型 1:单选,2:多选 .....(类型暂定,需要后端配合定义)
40+
answers:['A','B','...'], // 多选多答案列表,顺序从上至下
41+
}
42+
43+
</script>
44+
{% endexample %}
45+
46+
#### nativeGetAnswer
47+
48+
> 获取答案(H5主动获取客户端缓存的答案)
49+
50+
返回数据:
51+
52+
{% example html %}
53+
客户端返回答案给H5:
54+
<script>
55+
56+
var answer = {
57+
uid:'10000', // 用户UID(暂定是否需要)
58+
uuid:'abcdefg01abcdefg01', // 题目的UUID,唯一标识
59+
type:1, // 题目类型 1:单选,2:多选 .....(类型暂定,需要后端配合定义)
60+
answers:[{
61+
answer : 'A', // 答案项
62+
url:'', // 音频或图片URL (有则返回,无则为空)
63+
length:'' // 音频时长,单位:S (有则返回,无则为空)
64+
},{
65+
answer : 'A', // 答案项
66+
url:'', // 音频或图片URL (有则返回,无则为空)
67+
length:'' // 音频时长,单位:S (有则返回,无则为空)
68+
},{
69+
// ........
70+
}]
71+
}
72+
73+
</script>
74+
{% endexample %}
75+
76+
界面回退时,H5主动获取答案,用于显示用户之前的答案项
77+
78+
#### webGetImageUrl
79+
> 客户端上传完图片,返回给H5预览
80+
81+
{% example html %}
82+
<script>
83+
84+
var answer = {
85+
uid:'10000', // 用户UID(暂定是否需要)
86+
uuid:'abcdefg01abcdefg01', // 题目的UUID,唯一标识
87+
type:1, // 题目类型 1:单选,2:多选 .....(类型暂定,需要后端配合定义)
88+
answers:[{
89+
answer : 'A', // 答案项
90+
url:'', // 音频或图片URL (有则返回,无则为空)
91+
length:'' // 音频时长,单位:S (有则返回,无则为空)
92+
},{
93+
answer : 'A', // 答案项
94+
url:'', // 音频或图片URL (有则返回,无则为空)
95+
length:'' // 音频时长,单位:S (有则返回,无则为空)
96+
},{
97+
// ........
98+
}]
99+
}
100+
101+
</script>
102+
{% endexample %}
103+
104+
#### nativeOpenVoice
105+
> 打开语音(客户端主动呼出录音功能,录音结束后,客户端自动跳转下一题)
106+
107+
参数: UUID
108+
109+
{% example html %}
110+
<script>
111+
// 提供UUId给客户端
112+
var answer = 'UUID';
113+
114+
</script>
115+
{% endexample %}
116+
117+
118+
#### webGetVoiceUrl
119+
> 获取客户端返回的语言url,返回给H5进行试听
120+
121+
{% example html %}
122+
<script>
123+
124+
var answer = {
125+
uid:'10000', // 用户UID(暂定是否需要)
126+
uuid:'abcdefg01abcdefg01', // 题目的UUID,唯一标识
127+
type:1, // 题目类型 1:单选,2:多选 .....(类型暂定,需要后端配合定义)
128+
answers:[{
129+
answer : 'A', // 答案项
130+
url:'', // 音频或图片URL (有则返回,无则为空)
131+
length:'' // 音频时长,单位:S (有则返回,无则为空)
132+
},{
133+
answer : 'A', // 答案项
134+
url:'', // 音频或图片URL (有则返回,无则为空)
135+
length:'' // 音频时长,单位:S (有则返回,无则为空)
136+
},{
137+
// ........
138+
}]
139+
}
140+
141+
</script>
142+
{% endexample %}

docs/app-h5.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: default
3+
title: 题型
4+
order: 1
5+
published: true
6+
category: APP_H5
7+
---
8+
9+
## 题型
10+
----------
11+
12+
### 题型种类
13+
- 单选 (每题有且仅有一个正确答案。选项以圆形展示)
14+
- 多选 (每题有一个或多个正确答案。选项以方形展示)
15+
- 多选多 (每题有多个待答区域。选项以上拉弹层展示且可切换)
16+
- 填空 (每题有一个待答区域。答案可直接输入)
17+
- 填多空 (每题有多个待答区域。答案可直接输入)
18+
- 上传图片 (简答题。呼出客户端拍照功能)
19+
- 上传语音 (通过语音发送答案)

docs/backend.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: default
3+
title: 后端数据接口
4+
order: 4
5+
published: true
6+
category: APP_H5
7+
---
8+
9+
## 数据字段说明
10+
----------
11+
12+
### 题型配置
13+
14+
| **名称** | **参数** | **** |
15+
| 单选 | DANXUAN | 1 |
16+
| 多选 | DUOXUAN | 2 |
17+
| 多选多 | DUOXUANDUO | 3 |
18+
| 普通型填空 | PUTONGXINGTIANKONG | 4 |
19+
| 判断 | PANDUAN | 5 |
20+
| 配对 | PEIDUI | 6 |
21+
| 排序 | PAIXU | 7 |
22+
| 解答 | JIEDA | 8 |
23+
| 复合 | FUHE | 9 |
24+
| 选择型填空 | XUANZEXINGTIANKONG | 10 |
25+
26+
### 题目数据字段
27+
28+
| **参数** | **含义** |
29+
| queId | 题目ID |
30+
| queTypeId | 类型ID |
31+
| content | 题干 |
32+
| answer | 正确答案 |
33+
| analysis | 解析 |
34+
| difficulty | 难度 |
35+
| answerList | 答案选项 |
36+
| examList | 考点列表 |

less/layout/doc.less

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1+
::-webkit-scrollbar-thumb {
2+
height:32px;
3+
background:#d1d1d1;
4+
outline-offset:-2px;
5+
outline:2px solid #fff;
6+
-webkit-border-radius:6px;
7+
border:3px solid #fff;
8+
}
9+
::-webkit-scrollbar-thumb:hover{
10+
background:#828282;
11+
-webkit-border-radius:6px;
12+
}
13+
::-webkit-scrollbar-thumb:active{
14+
background:#747474;
15+
-webkit-border-radius:6px;
16+
}
17+
18+
::-webkit-scrollbar {
19+
width:13px;
20+
height:13px;
21+
}
22+
/*---滚动框背景样式--*/
23+
::-webkit-scrollbar-track-piece{
24+
background-color:#fff;
25+
-webkit-border-radius:0;
26+
}
127
body{
2-
background: #fff !important
28+
background: #fff !important;
29+
font-family: "Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif !important;
330
}
431
a:hover,
532
a:active,

0 commit comments

Comments
 (0)