Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dcc6280

Browse files
committed
文档描述和增加permissions表的seeder文件
1 parent e9836d7 commit dcc6280

File tree

9 files changed

+269
-3
lines changed

9 files changed

+269
-3
lines changed

‎back.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ PASSPORT_Client_Secret=
2626

2727
用户名和密码在database\seeds\UsersTableSeeder.php文件中明文标记
2828

29+
## 7、配置域名(back.test 或者其他名称)指向后端目录下的public目录(backend/public/),并在本地hosts文件中添加记录
30+
`127.0.0.1 back.test`
31+
32+
**此步骤是OAuth认证所必须,请务必设置,否则无法登录**
33+
2934
## 查看API文档地址
30-
假设后端的域名为http://localhost则文档地址为http://localhost/apidoc/
35+
假设后端的域名为back.test 则文档地址为http://back.test/apidoc/
3136

3237
## 编译API文档
3338
由于文档使用了apidoc 请使用前预先安装apidoc
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Models\Teacher;
6+
use Illuminate\Http\Request;
7+
8+
class TeacherController extends Controller
9+
{
10+
/**
11+
* Display a listing of the resource.
12+
*
13+
* @return \Illuminate\Http\Response
14+
*/
15+
public function index()
16+
{
17+
//
18+
}
19+
20+
/**
21+
* Show the form for creating a new resource.
22+
*
23+
* @return \Illuminate\Http\Response
24+
*/
25+
public function create()
26+
{
27+
//
28+
}
29+
30+
/**
31+
* Store a newly created resource in storage.
32+
*
33+
* @param \Illuminate\Http\Request $request
34+
* @return \Illuminate\Http\Response
35+
*/
36+
public function store(Request $request)
37+
{
38+
//
39+
}
40+
41+
/**
42+
* Display the specified resource.
43+
*
44+
* @param \App\Models\Teacher $teacher
45+
* @return \Illuminate\Http\Response
46+
*/
47+
public function show(Teacher $teacher)
48+
{
49+
//
50+
}
51+
52+
/**
53+
* Show the form for editing the specified resource.
54+
*
55+
* @param \App\Models\Teacher $teacher
56+
* @return \Illuminate\Http\Response
57+
*/
58+
public function edit(Teacher $teacher)
59+
{
60+
//
61+
}
62+
63+
/**
64+
* Update the specified resource in storage.
65+
*
66+
* @param \Illuminate\Http\Request $request
67+
* @param \App\Models\Teacher $teacher
68+
* @return \Illuminate\Http\Response
69+
*/
70+
public function update(Request $request, Teacher $teacher)
71+
{
72+
//
73+
}
74+
75+
/**
76+
* Remove the specified resource from storage.
77+
*
78+
* @param \App\Models\Teacher $teacher
79+
* @return \Illuminate\Http\Response
80+
*/
81+
public function destroy(Teacher $teacher)
82+
{
83+
//
84+
}
85+
}

‎backend/app/Models/Teacher.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class Teacher extends Model
8+
{
9+
//
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
use Faker\Generator as Faker;
4+
5+
$factory->define(App\Models\Teacher::class, function (Faker $faker) {
6+
return [
7+
//
8+
];
9+
});
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateTeachersTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('yz_teacher', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('name')->comment('姓名');
19+
$table->char('sex', 1)->comment('性别');
20+
$table->unsignedTinyInteger('nation_id')->comment('民族ID');
21+
$table->date('birthday')->comment('生日');
22+
$table->date('work_time')->comment('工作日期');
23+
$table->string('political')->comment('政治面貌')->default('群众');
24+
$table->date('join_date')->comment('入党、团时间')->nullable();
25+
$table->string('card_id')->comment('身份证');
26+
$table->char('phone', 13)->comment('联系号码1');
27+
$table->char('phone2', 13)->comment('联系号码2')->nullable();
28+
$table->unsignedTinyInteger('type')->comment('类型(1->教师 0->职工)')->default(1);
29+
$table->string('open_id')->comment('微信绑定OpenId')->nullable();
30+
$table->unsignedTinyInteger('state')->comment('人员状态(1->正常 2->调出 3->退出 4->停薪留职)')->default(1);
31+
$table->unsignedTinyInteger('teaching_id')->comment('教学科目Id')->nullable;
32+
$table->timestamps();
33+
$table->comment('教职工信息表');
34+
$table->unique('card_id');
35+
$table->unique('phone');
36+
$table->unique('phone2');
37+
$table->foreign('teaching_id')->reference('id')->on('yz_teaching');
38+
$table->foreign('nation_id')->reference('id')->on('yz_nation');
39+
});
40+
}
41+
42+
/**
43+
* Reverse the migrations.
44+
*
45+
* @return void
46+
*/
47+
public function down()
48+
{
49+
Schema::dropIfExists('yz_teacher');
50+
}
51+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
3+
use Illuminate\Database\Seeder;
4+
use Illuminate\Support\Facades\DB;
5+
use Illuminate\Support\Carbon;
6+
7+
class PermissionsTableSeeder extends Seeder
8+
{
9+
/**
10+
* Run the database seeds.
11+
*
12+
* @return void
13+
*/
14+
public function run()
15+
{
16+
//
17+
$id = DB::table('permissions') ->insertGetId([
18+
'name' => '学期管理',
19+
'pid' => 0,
20+
'type' => 1,
21+
'method' => '',
22+
'route_name' => '',
23+
'route_match' => '',
24+
'remark' => '管理学期信息',
25+
'created_at' => Carbon::now(),
26+
'updated_at' => Carbon::now()
27+
]);
28+
DB::table('permissions') ->insert([
29+
'name' => '获取学期列表',
30+
'pid' => $id,
31+
'type' => 2,
32+
'method' => 'GET',
33+
'route_name' => 'session.index',
34+
'route_match' => '/^\/api\/session$/',
35+
'remark' => '获取学期列表信息',
36+
'created_at' => Carbon::now(),
37+
'updated_at' => Carbon::now()
38+
]);
39+
40+
DB::table('permissions') ->insert([
41+
'name' => '获取指定的学期信息',
42+
'pid' => $id,
43+
'type' => 2,
44+
'method' => 'GET',
45+
'route_name' => 'session.show',
46+
'route_match' => '/^\/api\/session\/\d+$/',
47+
'remark' => '获取指定的学期信息',
48+
'created_at' => Carbon::now(),
49+
'updated_at' => Carbon::now()
50+
]);
51+
52+
DB::table('permissions') ->insert([
53+
'name' => '创建新的学期信息',
54+
'pid' => $id,
55+
'type' => 2,
56+
'method' => 'POST',
57+
'route_name' => 'session.store',
58+
'route_match' => '/^\/api\/session$/',
59+
'remark' => '创建新的学期信息',
60+
'created_at' => Carbon::now(),
61+
'updated_at' => Carbon::now()
62+
]);
63+
64+
DB::table('permissions') ->insert([
65+
'name' => '更新指定的学期信息',
66+
'pid' => $id,
67+
'type' => 2,
68+
'method' => 'PATCH',
69+
'route_name' => 'session.update',
70+
'route_match' => '/^\/api\/session\/\d+$/',
71+
'remark' => '更新指定的学期信息',
72+
'created_at' => Carbon::now(),
73+
'updated_at' => Carbon::now()
74+
]);
75+
76+
DB::table('permissions') ->insert([
77+
'name' => '删除指定的学期信息',
78+
'pid' => $id,
79+
'type' => 2,
80+
'method' => 'DELETE',
81+
'route_name' => 'session.destroy',
82+
'route_match' => '/^\/api\/session\/\d+$/',
83+
'remark' => '删除指定的学期信息',
84+
'created_at' => Carbon::now(),
85+
'updated_at' => Carbon::now()
86+
]);
87+
88+
$id2 = DB::table('permissions') ->insertGetId([
89+
'name' => '行政管理',
90+
'pid' => 0,
91+
'type' => 1,
92+
'method' => '',
93+
'route_name' => '',
94+
'route_match' => '',
95+
'remark' => '管理行政信息',
96+
'created_at' => Carbon::now(),
97+
'updated_at' => Carbon::now()
98+
]);
99+
100+
}
101+
}

‎developer.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## 后端开发
2+
3+
### 1、建立模型
4+
~php artisan make:model Models\teacher -all ~

‎frontend/config/dev.env.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ const prodEnv = require('./prod.env')
44

55
module.exports = merge(prodEnv, {
66
NODE_ENV: '"development"',
7-
BASE_API: '"http://back.test"',
7+
// BASE_API: '"http://back.test"',
8+
BASE_API: '"https://www.easy-mock.com/mock/5a901b3baad80a47eaa237e8"',
89
})

‎frontend/src/permission.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ router.beforeEach((to, from, next) => {
99
NProgress.start()
1010
if (getToken()) {
1111
if (to.path === '/login') {
12-
next({ path: '/' })
12+
next({ path: '/' })// 如果已经登录了 就无需再输入密码
1313
} else {
1414
if (store.getters.roles.length === 0) {
1515
store.dispatch('GetInfo').then(res => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /