Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Oct 23, 2016
1 parent b51dafa commit fa96ca6
Show file tree
Hide file tree
Showing 59 changed files with 250 additions and 470 deletions.
1 change: 0 additions & 1 deletion backend/assets/AppAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class AppAsset extends AssetBundle
];
public $js = [
'js/app.min.js',
'js/notify.js',
'plugins/slimScroll/jquery.slimscroll.min.js',
'js/site.js'
];
Expand Down
Empty file modified backend/components/gii/crud/default/search.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/_form.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/_search.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/create.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/index.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/update.php
100644 → 100755
Empty file.
Empty file modified backend/components/gii/crud/default/views/view.php
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions backend/controllers/SpiderController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function actionCreate()
$model = new Spider();

if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
Expand All @@ -85,7 +85,7 @@ public function actionUpdate($id)
$model = $this->findModel($id);

if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
return $this->redirect(['index']);
} else {
return $this->render('update', [
'model' => $model,
Expand Down
5 changes: 3 additions & 2 deletions backend/modules/backup/views/import/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
'data-method' => 'post',
'data-ajax' => 1,
'data-params' => ['time' => $model['time']],
'data-confirm' => '删除后不能恢复,确定要删除吗?'
'data-confirm' => '删除后不能恢复,确定要删除吗?',
'data-refresh' => '1'
]
);
}
Expand Down Expand Up @@ -89,7 +90,7 @@ function success(data){
window.onbeforeunload = function(){ return null; }
}
} else {
updateAlert(data.info,'alert-error');
$.modal.error(data.info);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion backend/static/js/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(document).ready(
{
return;
}
notify.msg(msg.status, msg.msg);
$.modal.msg(msg.status, msg.msg);
});
}

Expand Down
84 changes: 0 additions & 84 deletions backend/static/js/notify.js

This file was deleted.

60 changes: 1 addition & 59 deletions backend/static/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,14 @@
* Created by yidashi on 16/7/28.
*/
$(document).ajaxError(function(event,xhr,options,exc){
var message = xhr.responseJSON.message || '操作失败';
var message = xhr.responseJSON ? xhr.responseJSON.message : '操作失败';
$.modal.error(message);
});
$.extend(yii, {
confirm: function (message, ok, cancel) {
$.modal.confirm(message, ok, cancel);
}
});
$.extend({
modal: {
alert: function (message, type, callback) {
if (type == undefined) {
type = 0;
}
layer.alert(message, {icon: type, title:"提示"}, function (index) {
layer.close(index)
if (callback) {
callback();
}
});
},
info: function (message) {
this.alert(message, 0);
},
success: function (message) {
this.alert(message, 1);
},
error: function (message) {
this.alert(message, 2);
},
confirm: function (message, ok, cancel) {
layer.confirm(message, {icon: 3, title:'提示'}, function(index){
ok();
layer.close(index);
});
},
loading:function () {
return layer.load();
},
load: function (url, message, data) {
var loading = this.loading();
$.ajax({
url: url,
data:data,
type: data ? 'post' : 'get',
success: function (str) {
layer.close(loading);
index = layer.open({
type: 1,
title:message,
area:['900px'],
content: str,
});
}
});
},
close: function (index) {
if (index != undefined) {
layer.close(index);
} else {
layer.closeAll();
}
}
}
});
window.alert = $.modal.alert;
$(function () {
$(document).off('click', "[data-remote-modal]").on('click', "[data-remote-modal]", function() {
var url = $(this).data('remote-modal-url') || $(this).attr('href');
Expand Down
5 changes: 4 additions & 1 deletion backend/views/article/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
<div class="box-body"><?php echo $this->render('_search', ['model' => $searchModel]); ?></div>
</div>
<div class="box box-primary">
<div class="box-header"><h2 class="box-title">文章列表</h2></div>
<div class="box-header with-border">
<h2 class="box-title">文章列表</h2>
<div class="box-tools"><?= Html::a('置顶', ['top'], ['class' => 'btn btn-box-tool']) ?></div>
</div>
<div class="box-body">
<?= GridView::widget([
'dataProvider' => $dataProvider,
Expand Down
Empty file modified common/assets/LayerAsset.php
100644 → 100755
Empty file.
Empty file modified common/assets/ModalAsset.php
100644 → 100755
Empty file.
Empty file modified common/behaviors/SoftDeleteBehavior.php
100644 → 100755
Empty file.
Empty file modified common/models/Album.php
100644 → 100755
Empty file.
Empty file modified common/models/AlbumAttachment.php
100644 → 100755
Empty file.
Empty file modified common/models/WxUser.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/Module.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/controllers/AdminController.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/controllers/DefaultController.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/models/Message.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/models/MessageData.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/models/MessageForm.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/views/admin/create.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/views/default/create.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/views/default/index.php
100644 → 100755
Empty file.
Empty file modified common/modules/message/views/default/view.php
100644 → 100755
Empty file.
2 changes: 0 additions & 2 deletions common/modules/user/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public function rules()
['username', 'required', 'on' => 'create'],
['email', 'required', 'on' => 'create'],
['password', 'required', 'on' => ['register']],
['status', 'default', 'value' => self::STATUS_ACTIVE],
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]],
];
}

Expand Down
2 changes: 1 addition & 1 deletion common/modules/user/traits/AjaxValidationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait AjaxValidationTrait
*/
protected function performAjaxValidation(Model $model)
{
if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) {
if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post()) && \Yii::$app->request->get('validate', '0') == '1') {
\Yii::$app->response->format = Response::FORMAT_JSON;
\Yii::$app->response->data = ActiveForm::validate($model);
\Yii::$app->response->send();
Expand Down
4 changes: 1 addition & 3 deletions common/modules/user/views/registration/signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-signup">
<h1><?= Html::encode($this->title) ?></h1>


<div class="row">
<div class="col-lg-5">
Expand All @@ -27,7 +25,7 @@
<div class="form-group">
<?= Html::submitButton('注册', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>

<?= Html::a('去登录', ['/user/security/login'], ['class' => 'btn btn-warning']) ?>
&nbsp;&nbsp;已有帐号? <?= Html::a('马上登录', ['/user/security/login']) ?>
</div>

<?php ActiveForm::end(); ?>
Expand Down
4 changes: 1 addition & 3 deletions common/modules/user/views/security/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-login">
<h1><?= Html::encode($this->title) ?></h1>


<div class="row">
<div class="col-lg-5">
Expand Down Expand Up @@ -41,7 +39,7 @@
?>
<?= Html::submitButton('登录', $loginOptions) ?>

<?= Html::a('去注册', ['/user/registration/signup'], ['class' => 'btn btn-warning']) ?>
&nbsp;&nbsp;还没有帐号? <?= Html::a('马上注册', ['/user/registration/signup']) ?>
</div>
<?php ActiveForm::end(); ?>
<?php $this->trigger('afterLogin'); ?>
Expand Down
Empty file modified common/static/layer/layer.js
100644 → 100755
Empty file.
Empty file modified common/static/layer/skin/default/icon-ext.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified common/static/layer/skin/default/icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified common/static/layer/skin/default/loading-0.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified common/static/layer/skin/default/loading-1.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified common/static/layer/skin/default/loading-2.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified common/static/layer/skin/layer.css
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions common/static/modal.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ $.extend({
this.alert(message, 0);
},
success: function (message) {
this.alert(message, 1);
this.msg(message, 1);
},
error: function (message) {
this.alert(message, 2);
this.msg(message, 0);
},
confirm: function (message, ok, cancel) {
layer.confirm(message, {icon: 3, title:'提示'}, function(index){
ok();
layer.close(index);
});
},
tips: function (message) {
layer.msg(message);
msg: function (message, success) {
layer.msg(message, {icon: success ? 1 : 2});
},
loading:function () {
return layer.load();
Expand All @@ -46,7 +46,7 @@ $.extend({
index = layer.open({
type: 1,
title:message,
area:['900px'],
area:['700px'],
content: '<div class="container-fluid">' + str + '</div>',
});
}
Expand Down
72 changes: 41 additions & 31 deletions common/static/yii.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,39 +254,49 @@ yii = (function ($) {
})
}
if (ajax !== undefined) {
$form.on('submit', function (e) {
e.preventDefault();
});
var loading = $.modal.loading();
$.ajax({
url: $form.attr('action'),
method: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
success: function (res) {
if (res.status != undefined && res.status == 0) {
$.modal.error(res.message || '操作失败');
return;
}
if (!res.message) {
res.message = '操作成功';
}
layer.msg(res.message, {time: 1000, icon:1}, function () {
if (refreshPjaxContainer) {
$.pjax.reload({container:'#' + refreshPjaxContainer});
}
if (refresh) {
location.reload();
if (activeFormData) {
$form.off('beforeSubmit').on('beforeSubmit', function () {
handlerAjax();
return false;
})
} else {
$form.off('submit').on('submit', function (e) {
handlerAjax();
return false;
});
}
function handlerAjax() {
var loading = $.modal.loading();
$.ajax({
url: $form.attr('action'),
method: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
success: function (res) {
if (res.status != undefined && res.status == 0) {
$.modal.error(res.message || '操作失败');
return;
}
if (callback) {
eval(callback);
if (!res.message) {
res.message = '操作成功';
}
});
},
complete: function () {
$.modal.close(loading);
}
});
layer.msg(res.message, {time: 1000, icon:1}, function () {
if (refreshPjaxContainer) {
$.pjax.reload({container:'#' + refreshPjaxContainer});
}
if (refresh) {
location.reload();
}
if (callback) {
eval(callback);
}
});
},
complete: function () {
$.modal.close(loading);
}
});
}
}
$form.trigger('submit');
$.when($form.data('yiiSubmitFinalizePromise')).then(
Expand Down
Loading

0 comments on commit fa96ca6

Please sign in to comment.