1.引言
本部分主要说明项目背景和术语定义等。
1.1 编写目的
本部分阐明编写详细设计说明书的目的,指明读者对象。
本文档描述各个模块的细节设计,包括模块的接口、调用关系、处理过程和算法,以及模块测试方案等。本文档的主要读者为软件设计人员、模块开发人员、管理人员、测试人员。
1.2 项目背景
本部分应包括项目的来源和主管部门等。
本项目由华中农业大学计科1601班刘云杰提出,由华中农业大学2016级计算机科学与技术“一个学习小组”学生完成。
1.3 定义
本部分列出本文档中所用到的专门术语的定义和缩写词。
1.4 参考资料
web端:w3school、PHP官方文档
1.5 版本信息
具体版本信息如下表所示。
修改编号
|
修改日期
|
修改后的版本
|
修改位置
|
修改内容概述
|
1
|
2018/6/27
|
2
|
全部
|
完成第一次编写
|
2 总体设计3
本部分简要给出系统的需求和软件结构组成,以便追踪到需求和设计。
2.1 需求概述
校园跳蚤市场系统的需求定义如下:
注册/登录账号:进入软件前,需要登录或者注册账号。
查看/发布/修改/删除/确认交易信息:进入软件系统后,可以根据自己的需求,对自己的交易信息进行发布/修改/删除、或者查看自己或者他人的交易信息,也可以对正在进行的交易进行确认交易成功操作。
个人界面:综合显示个人信息。
交易信息排序:系统对发布的交易信息进行一定的规则排序,保证和确认每个人发布的交易信息能够出现在大多数人的视野中。
2.2 软件结构
3 程序描述
本部分针对每一个模块进行详细设计。
3.1 模块基本信息
web端:
1-1登录:输入,用户名密码
- 功能,后台检测与数据库中匹配后登录到发布内容界面
- 性能,可以跳转到1-2
1-2注册:输入,学号、用户名、性别、班级、学院、密码
- 功能,在数据库中新增用户数据
- 性能,要求学号不能重复,可以跳转到1-1
2-1显示发布页面:输出,
显示所有发布了且没有被拍下的物品的标题、价格
- 功能,跳转到2-2的按钮,点击跳转到2-3的按钮
2-2发布:输入,发布物品标题、内容、价格
- 功能,在数据库中新增一件物品
2-3查看:输出,发物物品的标题、内容、价格
- 功能,跳转到2-3-1按钮、跳转到2-4按钮
2-3-1拍下:功能,改变数据库中值的数据,来改变该物品交易状态
2-4留言:输入,留言内容
2-4-1查看留言:输出,留言内容,留言的用户名称,留言时间
3个人页面:输出,用户名、班级、学院
功能,跳转到3-2、3-3、3-4、3-7的按钮
3-1我发布的:输出,显示该用户所有发布的且没有被拍下的物品
- 功能,每一条发布信息都有跳转到3-1-1、3-1-2、3-1-3的按钮
3-1-1发布内容详情:输出,发布物品的标题、内容、价格
3-1-2修改:输入,该交易物品原本的信息
- 输出,修改后的交易信息
- 功能,更改数据库中物品的信息
3-1-3删除:功能,不实现具体页面,删除数据库中的数据
3-2我买到的:输出,包含3-2-1和3-2-2、3-2-3
- 功能,仅取出数据库中我买到的物品
3-2-1未完成交易:输出,所有发布并拍下但是没有完成交易的物品
3-2-2确认交易:功能,改变数据库中值的数据,来改变该物品交易状态
3-2-3已完成交易:输出,所有完成交易的物品
3-3我卖出的:输出,包含3-2-1和3-2-2、3-2-3
- 功能,仅取出数据库中我卖出的物品
3-4退出登录:功能,清除保存在session中的账户信息,让用户退出登录
物品详情模块 Article(elements):elements;说明如下:
输入:element-主页面物品信息。
显示:element-物品名称信息。
显示:element-物品描述信息。
输出:element-交易界面
功能:从Bmob数据库调用相应物品名称,描述和价格信息,并提供可以跳转到下一个页面的按钮。
性能:要求可以在任意时间执行。
个人界面模块(personalActivity);
显示:默认头像。
显示:用户名。
显示:学号(id)。
功能:点击我发布的、我买到的、我卖出的、设置四个按钮之一,可以进入到相应界面查看。
性能:短时间内执行。
3.2 算法
N-1 显示界面设计:
<?
xml version=
"1.0"
encoding=
"utf-8"
?>
<
android.support.constraint.ConstraintLayout
xmlns:android=
"
http://schemas.android.com/apk/res/android
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
"com.example.sire.flee.MainActivity"
>
<
TextView
android:id=
"
@+id/textView"
android:layout_width=
"168dp"
android:layout_height=
"203dp"
android:drawableTop=
"
@drawable/phone"
app:layout_constraintTop_toTopOf=
"
@+id/guideline8"
app:layout_constraintLeft_toLeftOf=
"
@+id/guideline7"
app:layout_constraintRight_toRightOf=
"
@+id/textView4"
app:layout_constraintBottom_toBottomOf=
"
@+id/textView5"
/>
<
TextView
android:id=
"
@+id/textView2"
android:layout_width=
"145dp"
android:layout_height=
"28dp"
android:layout_marginRight=
"0dp"
android:layout_marginTop=
"0dp"
android:text=
"小米手机"
android:textSize=
"20dp"
app:layout_constraintRight_toRightOf=
"
@+id/textView3"
app:layout_constraintTop_toTopOf=
"
@+id/textView"
tools:layout_editor_absoluteX=
"217dp"
tools:layout_editor_absoluteY=
"130dp"
/>
<
TextView
android:id=
"
@+id/textView3"
android:layout_width=
"145dp"
android:layout_height=
"109dp"
android:layout_marginRight=
"-170dp"
android:text=
"才入的坑,不想要了,求带走"
android:textSize=
"15dp"
app:layout_constraintBottom_toBottomOf=
"
@+id/textView"
app:layout_constraintRight_toRightOf=
"
@+id/textView5"
app:layout_constraintTop_toTopOf=
"
@+id/guideline11"
app:layout_constraintVertical_bias=
"0.0"
/>
<
TextView
android:id=
"
@+id/textView4"
android:layout_width=
"167dp"
android:layout_height=
"47dp"
android:text=
"商品详情"
android:textSize=
"25dp"
android:textStyle=
"bold"
app:layout_constraintLeft_toLeftOf=
"
@+id/guideline7"
app:layout_constraintTop_toTopOf=
"
@+id/guideline2"
/>
<
Button
android:id=
"
@+id/button"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"交易"
app:layout_constraintTop_toTopOf=
"
@+id/guideline13"
app:layout_constraintLeft_toLeftOf=
"
@+id/guideline"
android:layout_marginTop=
"2dp"
android:layout_marginLeft=
"-9dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline2"
app:layout_constraintGuide_begin=
"31dp"
android:orientation=
"horizontal"
tools:layout_editor_absoluteY=
"31dp"
tools:layout_editor_absoluteX=
"0dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline4"
app:layout_constraintGuide_begin=
"217dp"
android:orientation=
"vertical"
tools:layout_editor_absoluteY=
"0dp"
tools:layout_editor_absoluteX=
"217dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline7"
app:layout_constraintGuide_begin=
"24dp"
android:orientation=
"vertical"
tools:layout_editor_absoluteY=
"0dp"
tools:layout_editor_absoluteX=
"24dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline8"
app:layout_constraintGuide_begin=
"130dp"
android:orientation=
"horizontal"
tools:layout_editor_absoluteY=
"130dp"
tools:layout_editor_absoluteX=
"0dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline11"
app:layout_constraintGuide_begin=
"173dp"
android:orientation=
"horizontal"
tools:layout_editor_absoluteY=
"173dp"
tools:layout_editor_absoluteX=
"0dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline13"
app:layout_constraintGuide_begin=
"387dp"
android:orientation=
"horizontal"
/>
<
TextView
android:id=
"
@+id/textView5"
android:layout_width=
"144dp"
android:layout_height=
"36dp"
android:text=
"售价:252"
android:textSize=
"15dp"
app:layout_constraintLeft_toLeftOf=
"
@+id/guideline4"
app:layout_constraintTop_toTopOf=
"
@+id/guideline14"
tools:layout_editor_absoluteX=
"218dp"
tools:layout_editor_absoluteY=
"297dp"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline14"
app:layout_constraintGuide_begin=
"297dp"
android:orientation=
"horizontal"
/>
<
android.support.constraint.Guideline
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"
@+id/guideline"
app:layout_constraintGuide_begin=
"207dp"
android:orientation=
"vertical"
/>
</
android.support.constraint.ConstraintLayout
>
N-2 显示文本功能实现:
package
com.example.sire.flee;
import
android.os.Bundle;
import
android.support.v7.app.AppCompatActivity;
import
android.util.Log;
import
android.view.View;
import
android.widget.Button;
import
android.widget.TextView;
import
cn.bmob.v3.Bmob;
import
cn.bmob.v3.BmobQuery;
import
cn.bmob.v3.exception.BmobException;
import
cn.bmob.v3.listener.QueryListener;
public class
MainActivity
extends
AppCompatActivity {
private
Button
btn1
;
@Override
protected void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
Bmob.
initialize
(
this
,
"a77899ca86a9b4bd0a521f4b6704d7fb"
);
setContentView(R.layout.
activity_main
);
final
TextView textView = (TextView) findViewById(R.id.
textView2
);
BmobQuery<dealMessge> query=
new
BmobQuery<dealMessge>();
query.getObject(
"ZoeuSSSY"
,
new
QueryListener<dealMessge>() {
@Override
public void
done(dealMessge commodity, BmobException e) {
if
(e==
null
){
textView
.setText(commodity.getTitle());
}
else
{
Log.
i
(
"bmob"
,
"失败"
+e.getMessage()+
","
+e.getErrorCode());
}
}
});
final
TextView textView1 = (TextView) findViewById(R.id.
textView3
);
BmobQuery<dealMessge> query1=
new
BmobQuery<dealMessge>();
query1.getObject(
"ZoeuSSSY"
,
new
QueryListener<dealMessge>() {
@Override
public void
done(dealMessge commodity, BmobException e) {
if
(e==
null
){
textView1
.setText(commodity.getText());
}
else
{
Log.
i
(
"bmob"
,
"失败"
+e.getMessage()+
","
+e.getErrorCode());
}
}
});
final
TextView textView2 = (TextView) findViewById(R.id.
textView5
);
BmobQuery<dealMessge> query2=
new
BmobQuery<dealMessge>();
query2.getObject(
"ZoeuSSSY"
,
new
QueryListener<dealMessge>() {
@Override
public void
done(dealMessge commodity, BmobException e) {
if
(e==
null
){
textView2
.setText(commodity.getPrice());
}
else
{
Log.
i
(
"bmob"
,
"失败"
+e.getMessage()+
","
+e.getErrorCode());
}
}
});
super
.onCreate(savedInstanceState);
setContentView(R.layout.
activity_main
);
}
}
N-3 转换界面功能实现:
btn1
.setOnClickListener(
new
View.OnClickListener(){
@Override
public void
onClick(View v){}
});
btn1
.setOnClickListener(
new
View.OnClickListener(){
@Override
public void
onClick(View v){
//Intent i=new Intent(MainActivity.this,page1.class);
//startActivity(i);
}
});
N-4 个人界面设计:
显示模块:
<?
xml version=
"1.0"
encoding=
"utf-8"
?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:id="@+id/image_view_1"
- android:layout_width="160dp"
- android:layout_height="160dp"
- android:layout_centerInParent="true"
- android:layout_alignParentTop="true"
- android:src="@drawable/head"
- />
- <ImageView
- android:id="@+id/image_view_2"
- android:layout_width="40dp"
- android:layout_height="40dp"
- android:layout_above="@+id/edit_text_2"
- android:layout_toRightOf="@+id/edit_text_1" />
- <TextView
- android:id="@+id/edit_text_1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/colorPrimaryDark"
- android:textSize="35sp"
- android:layout_below="@+id/image_view_1"
- android:layout_centerHorizontal="true"
- />
- <TextView
- android:id="@+id/edit_text_2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- android:layout_gravity="center"
- android:layout_below="@+id/edit_text_1"
- android:layout_centerHorizontal="true"/>
- <Button
- android:id="@+id/button_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="我发布的"
- android:textSize="24sp"
- android:layout_below="@id/edit_text_2"
- android:layout_margin="5dp" />
- <Button
- android:id="@+id/button_2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="我买到的"
- android:textSize="24sp"
- android:layout_below="@id/button_1"
- android:layout_margin="5dp" />
- <Button
- android:id="@+id/button_3"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="我卖出的"
- android:textSize="24sp"
- android:layout_below="@id/button_2"
- android:layout_margin="5dp"/>
- <Button
- android:id="@+id/button_4"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="设置"
- android:textSize="24sp"
- android:layout_below="@id/button_3"
- android:layout_margin="5dp"/>
- </RelativeLayout>
N-4-1 我买到的界面设计:
- 显示模块:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/recycler_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- y
- </LinearLayout>
<?
xml version=
"1.0"
encoding=
"utf-8"
?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="200dp">
- <ImageView
- android:id="@+id/bought_image"
- android:layout_width="150dp"
- android:layout_height="150dp" />
- <TextView
- android:id="@+id/bought_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="50dp"
- android:layout_toRightOf="@id/bought_image"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/bought_date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="15dp"
- android:layout_alignParentRight="true"
- android:layout_alignParentBottom="true"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/bought_money"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20dp"
- android:textColor="#FF0000"
- android:layout_alignParentRight="true"
- android:layout_above="@id/bought_date"
- android:layout_marginRight="10dp"/>
- </RelativeLayout>
- N-4-2 我发布的界面设计:
- 显示模块
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/recycler_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="200dp">
- <ImageView
- android:id="@+id/publish_image"
- android:layout_width="150dp"
- android:layout_height="150dp" />
- <TextView
- android:id="@+id/publish_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="50dp"
- android:layout_toRightOf="@id/publish_image"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/publish_date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="15dp"
- android:layout_alignParentRight="true"
- android:layout_alignParentBottom="true"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/publish_money"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20dp"
- android:textColor="#FF0000"
- android:layout_alignParentRight="true"
- android:layout_above="@id/publish_date"
- android:layout_marginRight="10dp"/>
- </RelativeLayout>
- N-4-3 我卖出的界面设计:
- 显示模块:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/recycler_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="200dp">
- <ImageView
- android:id="@+id/sold_image"
- android:layout_width="150dp"
- android:layout_height="150dp" />
- <TextView
- android:id="@+id/sold_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="50dp"
- android:layout_toRightOf="@id/sold_image"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/sold_date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="15dp"
- android:layout_alignParentRight="true"
- android:layout_alignParentBottom="true"
- android:layout_marginLeft="10dp"/>
- <TextView
- android:id="@+id/sold_money"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20dp"
- android:textColor="#FF0000"
- android:layout_alignParentRight="true"
- android:layout_above="@id/sold_date"
- android:layout_marginRight="10dp"/>
- </RelativeLayout>
- N-4-4 设置界面设计:
- 显示模块:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <EditText
- android:id="@+id/edit_text_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="修改用户名"
- android:textColor="@color/colorPrimaryDark"
- android:textSize="35sp"
- android:maxLength="8"
- android:gravity="center"/>
- <Button
- android:id="@+id/button_1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="确认修改"
- android:textSize="24sp"
- android:layout_margin="5dp" />
- <EditText
- android:id="@+id/edit_text_2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="修改密码"
- android:textColor="@color/colorPrimaryDark"
- android:maxLength="8"
- android:textSize="35sp"
- android:gravity="center"/>
- <Button
- android:id="@+id/button_2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="确认修改"
- android:textSize="24sp"
- android:layout_below="@id/button_1"
- android:layout_margin="5dp" />
- </LinearLayout>
3.3 程序逻辑
个人界面模块的程序逻辑如图:
web端:
3.4 接口
web端:无
3.5 测试要点
- 3.5.1除登录注册以外的界面,是否能不登录直接进入
- 3.5.2在各个显示发布内容的界面,是否能显示满足条件的所有内容
- 3.5.3在本地、服务器等各个环境上,前端页面是否正常显示
- 3.5.4一个物品拍下后,卖家和买家的交易信息变化
- 3.5.5卖家不能拍下自己发布的物品