Skip to content

Commit 9e8d92b

Browse files
committed
添加项目main
1 parent d879af2 commit 9e8d92b

File tree

10 files changed

+138
-38
lines changed

10 files changed

+138
-38
lines changed

application/index/controller/Dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Dashboard extends Auth
1616
public function index()
1717
{
1818
$this->assign('title',lang('Dashboard'));
19-
19+
$this->assign('menu_nav','dashboard');
2020
return view('dashboard/index');
2121
}
2222
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: zhangcheng
5+
* Date: 2017/12/18 0018
6+
* Time: 19:43
7+
*/
8+
9+
namespace app\index\controller;
10+
11+
12+
class Profile extends Auth
13+
{
14+
public function index()
15+
{
16+
17+
if($this->request->isGet())
18+
{
19+
return view('profile/index');
20+
}else{
21+
22+
23+
}
24+
}
25+
26+
27+
}

application/index/controller/Project.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function index()
2222
$this->assign('list', $list);
2323
$this->assign('page', $page);
2424
$this->assign('title',lang('Project List'));
25+
$this->assign('menu_nav','project/index');
2526

2627
return view('project/index');
2728
}
@@ -42,6 +43,7 @@ public function edit()
4243
{
4344
$this->assign('project',ProjectModel::get($this->request->param('id')));
4445
$this->assign('title',lang('Edit Project'));
46+
$this->assign('menu_nav','project/index');
4547
return view('project/edit');
4648
}else{
4749
return ProjectService::edit($this->request->param('project_name'),$this->user_id,$this->request->param('id'));
@@ -54,4 +56,17 @@ public function delete()
5456
{
5557
return ProjectService::delete($this->request->param('id'),$this->user_id);
5658
}
59+
60+
61+
/**
62+
* 项目详情
63+
*/
64+
public function main()
65+
{
66+
//todo BUG列表 BUG统计 项目版本 模块
67+
68+
69+
$this->assign('menu_nav','project/index');
70+
return view('project/main');
71+
}
5772
}

application/index/service/Auth.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ public static function updatePassword($username,$oldPassword,$newPassword)
4444
public static function updatePasswordV2($username,$newPassword)
4545
{
4646
$user = UserModel::get(['username'=>$username]);
47+
48+
$validate = new UserValidate();
49+
50+
if(!$validate->scene('edit_password')->check([
51+
52+
'password'=>$newPassword,
53+
54+
]))
55+
{
56+
return ServiceResult::Error($validate->getError());
57+
}
58+
4759
$user->password = $newPassword;
4860

4961
if($user->save() !== false)
@@ -90,7 +102,7 @@ public static function register($username,$password,$email)
90102
//$model->validate('User.add');
91103
$validate = new UserValidate();
92104

93-
if(!$validate->check([
105+
if(!$validate->scene('add')->check([
94106
'username'=>$username,
95107
'password'=>$password,
96108
'email'=>$email,

application/index/service/Profile.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: zhangcheng
5+
* Date: 2017/12/18 0018
6+
* Time: 19:48
7+
*/
8+
9+
namespace app\index\service;
10+
11+
12+
class Profile
13+
{
14+
public static function updateProfile($nickname,$user_id)
15+
{
16+
17+
}
18+
}

application/index/service/Project.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function create($project_name,$user_id)
2323

2424
$validate = new ProjectValidate();
2525

26-
if(!$validate->check([
26+
if(!$validate->scene('add')->check([
2727
'project_name'=>$project_name,
2828
]))
2929
{
@@ -78,7 +78,7 @@ public static function edit($project_name,$user_id,$id)
7878

7979
$validate = new ProjectValidate();
8080

81-
if(!$validate->check([
81+
if(!$validate->scene('edit')->check([
8282
'project_name'=>$project_name,
8383
]))
8484
{

application/index/view/extend/main.html

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<ul class="nav">
5656

5757
<li>
58-
<a href="dashboard.html#">
58+
<a href="">
5959
<span class="sidebar-mini"> SET </span>
6060
<span class="sidebar-normal"> {:lang('Settings')} </span>
6161
</a>
@@ -65,23 +65,23 @@
6565
</div>
6666
</div>
6767
<ul class="nav">
68-
<li class="active">
68+
<li {eq name="menu_nav" value="dashboard"}class="active"{/eq}>
6969
<a href="/dashboard.html">
7070
<i class="material-icons">dashboard</i>
7171
<p>{:lang('Dashboard')}</p>
7272
</a>
7373
</li>
7474

75-
<li>
75+
<li {eq name="menu_nav" value="project/index"}class="active"{/eq} >
7676
<a data-toggle="collapse" href="dashboard.html#componentsExamples">
7777
<i class="material-icons">apps</i>
7878
<p> 我的项目
7979
<b class="caret"></b>
8080
</p>
8181
</a>
82-
<div class="collapse" id="componentsExamples">
82+
<div class="collapse {eq name="menu_nav" value="project/index"}in{/eq}" id="componentsExamples">
8383
<ul class="nav">
84-
<li>
84+
<li {eq name="menu_nav" value="project/index"}class="active"{/eq} >
8585
<a href="/project/index">
8686
<span class="sidebar-mini"> 项目 </span>
8787
<span class="sidebar-normal"> 项目列表 </span>
@@ -148,13 +148,13 @@
148148
<span class="icon-bar"></span>
149149
<span class="icon-bar"></span>
150150
</button>
151-
<a class="navbar-brand" href="dashboard.html#"> {$title|default=''} </a>
151+
<a class="navbar-brand" href="javascript:void(0);"> {$title|default=''} </a>
152152
</div>
153153
<div class="collapse navbar-collapse">
154154
<ul class="nav navbar-nav navbar-right">
155155

156156
<li class="dropdown">
157-
<a href="dashboard.html#" class="dropdown-toggle" data-toggle="dropdown">
157+
<a href="" class="dropdown-toggle" data-toggle="dropdown">
158158
<i class="material-icons">notifications</i>
159159
<span class="notification">5</span>
160160
<p class="hidden-lg hidden-md">
@@ -164,27 +164,16 @@
164164
</a>
165165
<ul class="dropdown-menu">
166166
<li>
167-
<a href="dashboard.html#">Mike John responded to your email</a>
168-
</li>
169-
<li>
170-
<a href="dashboard.html#">You have 5 new tasks</a>
171-
</li>
172-
<li>
173-
<a href="dashboard.html#">You're now friend with Andrew</a>
174-
</li>
175-
<li>
176-
<a href="dashboard.html#">Another Notification</a>
177-
</li>
178-
<li>
179-
<a href="dashboard.html#">Another One</a>
167+
<a href="#">Mike John responded to your email</a>
180168
</li>
169+
181170
</ul>
182171
</li>
183172

184173
<li class="separator hidden-lg hidden-md"></li>
185174

186175
<li>
187-
<a href="dashboard.html#pablo" class="dropdown-toggle" data-toggle="dropdown">
176+
<a href="" class="dropdown-toggle" data-toggle="dropdown">
188177
<i class="material-icons">person</i>
189178
<p class="hidden-lg hidden-md">Profile</p>
190179
</a>

application/index/view/project/index.html

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ <h4 class="card-title">{:lang('Project List')}</h4>
2929
<td class="text-right">{$project.create_time}</td>
3030
<td class="td-actions text-right">
3131

32-
<button type="button" rel="tooltip" class="btn btn-success edit-project" data-id="{$project.id}">
32+
<button type="button" rel="tooltip" class="btn btn-success main-project" data-id="{$project.id}" title="进入项目">
33+
<i class="material-icons">people</i>
34+
</button>
35+
36+
<button type="button" rel="tooltip" class="btn btn-success edit-project" data-id="{$project.id}" title="修改">
3337
<i class="material-icons">edit</i>
3438
</button>
3539
&nbsp;
36-
<button type="button" rel="tooltip" class="btn btn-danger delete-project" data-id="{$project.id}">
40+
<button type="button" rel="tooltip" class="btn btn-danger delete-project" data-id="{$project.id}" title="删除">
3741
<i class="material-icons">close</i>
3842
</button>
3943
</td>
@@ -119,7 +123,7 @@ <h4 class="card-title">{:lang('Create Project')}</h4>
119123
});
120124

121125
$('.delete-project').click(function () {
122-
126+
var that = $(this);
123127
swal({
124128
title: 'Are you sure?',
125129
text: '删除这个项目!',
@@ -131,27 +135,57 @@ <h4 class="card-title">{:lang('Create Project')}</h4>
131135
cancelButtonClass: "btn btn-danger",
132136
buttonsStyling: false
133137
}).then(function() {
134-
swal({
135-
title: 'Deleted!',
136-
text: 'Your imaginary file has been deleted.',
137-
type: 'success',
138-
confirmButtonClass: "btn btn-success",
139-
buttonsStyling: false
140-
}).catch(swal.noop)
138+
139+
140+
axios.post('/index/project/delete', {
141+
id:that.data('id'),
142+
}).then(function (response) {
143+
144+
if(response.data.status == 1){
145+
swal({
146+
title: 'Deleted!',
147+
text: response.data.message,
148+
type: 'success',
149+
confirmButtonClass: "btn btn-success",
150+
buttonsStyling: false
151+
}).catch(swal.noop)
152+
153+
setTimeout(function () {
154+
location.href = '/project/index';
155+
},1500);
156+
}else{
157+
swal({
158+
title: 'Cancelled',
159+
text: '操作已取消.'+response.data.message,
160+
type: 'error',
161+
confirmButtonClass: "btn btn-info",
162+
buttonsStyling: false
163+
}).catch(swal.noop)
164+
}
165+
166+
167+
}).catch(function (error) {
168+
console.log(error);
169+
});
170+
171+
141172
}, function(dismiss) {
142173
// dismiss can be 'overlay', 'cancel', 'close', 'esc', 'timer'
143174
if (dismiss === 'cancel') {
144175
swal({
145176
title: 'Cancelled',
146-
text: 'Your imaginary file is safe :)',
177+
text: '操作已取消.)',
147178
type: 'error',
148179
confirmButtonClass: "btn btn-info",
149180
buttonsStyling: false
150181
}).catch(swal.noop)
151182
}
152183
})
153184

154-
window.location.href='/index/project/delete?id='+$(this).data('id');
185+
});
186+
187+
$('.main-project').click(function () {
188+
location.href = '/project/main?id='+$(this).data('id');
155189
});
156190
});
157191
</script>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{extend name="extend/main" /}
2+
{block name="content"}
3+
4+
{/block}

route/route.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
Route::rule('base/register','index/base/register');
2121
Route::rule('base/login','index/base/login');
2222
Route::rule('dashboard','index/dashboard/index');
23-
Route::rule('project/index','project/index');
23+
Route::rule('project/index','index/project/index');
24+
Route::rule('project/main','index/project/main');
2425
return [
2526

2627
];

0 commit comments

Comments
 (0)