Commit e512eac5 authored by hujun's avatar hujun

参数设置

parent 8e8958eb
......@@ -9,10 +9,35 @@
namespace app\index\controller;
class Setting
use app\index\extend\Basic;
use think\Cache;
class Setting extends Basic
{
/**
* 页面视图
*
* @return \think\response\View
*/
public function index() {
return view('setting/index');
}
/**
* 修改和新增
*
* @return \think\Response
*/
public function getSetting() {
$data = [];
if ($this->request->isGet()) {
$data = Cache::get('Setting');
} else {
$data['is_privacy'] = $this->params['is_privacy'];
$data['day_num'] = $this->params['day_num'];
Cache::set('Setting',$data);
}
return $this->response(200, '', $data);
}
}
\ No newline at end of file
......@@ -76,6 +76,12 @@
<!--<li role="presentation">-->
<!--<a href="/admin.php/index/bindPhoneListIndex.html">号码绑定列表</a>-->
<!--</li>-->
<li role="presentation">
<a href="/admin.php/index/setting_index.html">参数设置</a>
</li>
<li role="presentation">
<a href="/admin.php/index/uLabelIndex.html">客户标签</a>
</li>
</ul>
</nav>
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="version"/>
<input type="hidden" class="page-load" id="setting"/>
<!--导航star-->
......@@ -13,37 +13,13 @@
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">参数管理</a></li>
<li><a href="javascript:;">参数管理</a></li>
</div>
<div class="panel-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: right">是否使用隐号系统:</label>
<div class="col-sm-9">
<div class="radio" style="display: inline-block">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="0"
checked>关闭
<div id="info">
</label>
</div>
<div class="radio" style="display: inline-block">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2"
value="1">开启
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: right">隐号绑定天数
</label>
<div class="col-sm-9">
<input type="text" class="form-control btn5" name="title" id="version_no" placeholder="隐号绑定天数">
</div>
</div>
<div class="form-group">
......@@ -51,10 +27,8 @@
<div class="col-sm-9" style="text-align: left;">
<button type="button" class="btn btn-primary" id="save">保存修改</button>
</div>
</div>
</form>
</div>
</div>
</div>
......
......@@ -161,9 +161,8 @@ Route::group('index', [
'useraction_search' => ['index/remark/useraction_search', [ 'method' => 'get|post' ] ], //后台客户详情
'select_by_phone' => ['index/remark/select_by_phone', [ 'method' => 'get|post' ] ], //后台客户详情--客方搜索
'setting_index' => ['index/Setting/index', [ 'method' => 'get|post' ] ], //全局参数设置
'setting_index' => ['index/Setting/index', [ 'method' => 'get' ] ], //全局参数设置页面
'getSetting' => ['index/Setting/getSetting', [ 'method' => 'get|post' ] ], //新增和修改全局参数设置
]);
......
/**
* Created by zw on 2017/12/15.
*/
define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], function (doT, template) {
var Setting = {
init: function () {
//初始化dot
$ ("body").append (template);
Setting.event ();
Setting.getInfo();
},
event: function () {
$("#save").click(function () {
Setting.saveSetting();
});
},
getInfo: function () {
var param = {};
$.ajax ({
url: '/admin.php/index/getSetting',
type: 'GET',
async: true,
data: param,
dataType: 'json',
success: function (data) {
console.log (data.data);
var temp = document.getElementById ('setting_list_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("#info").html (doTtmpl (data.data));
}
});
},
saveSetting : function () {
var param = {};
param.is_privacy= $("input[type='radio']:checked").val();
param.day_num= $("input[name='day_num']").val();
$.ajax ({
url: '/admin.php/index/getSetting',
type: 'POST',
async: true,
data: param,
dataType: 'json',
success: function (data) {
if (data.code == 200) {
Setting.getInfo();
alert('添加成功');
} else {
alert('操作失败');
}
}
});
}
};
return Setting;
});
<script id="setting_list_tpl" type="text/template">
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: right">是否使用隐号系统:</label>
<div class="col-sm-9">
<div class="radio" style="display: inline-block">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="0"
[% if(it.is_privacy == 0) { %] checked [% } %]>关闭
</label>
</div>
<div class="radio" style="display: inline-block">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2" value="1" [% if(it.is_privacy == 1) { %] checked [% } %]>开启
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: right">隐号绑定有效期(天数):</label>
<div class="col-sm-9">
<input type="text" class="form-control btn5" name="day_num" placeholder="隐号绑定天数" value="[%= it['day_num'] %]">
</div>
</div>
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment