优化后台UI
完善表单上传组件
This commit is contained in:
@@ -10,6 +10,7 @@ namespace app\controller;
|
||||
|
||||
use think\facade\Session;
|
||||
use think\facade\Filesystem;
|
||||
use think\facade\Db;
|
||||
|
||||
class Upload extends Base {
|
||||
|
||||
@@ -53,9 +54,22 @@ class Upload extends Base {
|
||||
if (!isset($param['name'])) {
|
||||
return $this->error('非法操作');
|
||||
}
|
||||
$pageConfig = [
|
||||
'list_rows' => $this->request->param('list_rows', 20),
|
||||
'page' => $this->request->param('page', 1),
|
||||
'query' => $this->request->param()
|
||||
];
|
||||
if($param['type'] == 'file'){
|
||||
$list = Db::name('File')->paginate($pageConfig);
|
||||
}else{
|
||||
$list = Db::name('Picture')->paginate($pageConfig);
|
||||
}
|
||||
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
'param' => $param,
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
'require' => [
|
||||
'jsname' => 'upload',
|
||||
'actionname' => 'server'
|
||||
@@ -81,7 +95,7 @@ class Upload extends Base {
|
||||
return json($data);
|
||||
}
|
||||
|
||||
protected function images(){
|
||||
protected function image(){
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class Index extends Base {
|
||||
\think\facade\Log::clear();
|
||||
}
|
||||
}
|
||||
return $this->success("更新成功!", url('/admin/index/index'));
|
||||
return $this->success("更新成功!", url('/admin/index/clear'));
|
||||
} else {
|
||||
$keylist = array(
|
||||
array('name' => 'clear', 'title' => '更新缓存', 'type' => 'checkbox', 'help' => '', 'option' => array(
|
||||
|
||||
@@ -61,7 +61,6 @@ class User extends Base {
|
||||
public function edit(Member $member) {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = $member->editUser($this->request);
|
||||
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!', url('/admin/user/index'));
|
||||
} else {
|
||||
@@ -165,49 +164,7 @@ class User extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改昵称
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function submitNickname() {
|
||||
|
||||
//获取参数
|
||||
$nickname = input('post.nickname');
|
||||
$password = input('post.password');
|
||||
if (empty($nickname)) {
|
||||
return $this->error('请输入昵称');
|
||||
}
|
||||
if (empty($password)) {
|
||||
return $this->error('请输入密码');
|
||||
}
|
||||
|
||||
//密码验证
|
||||
$User = new UserApi();
|
||||
$uid = $User->login(UID, $password, 4);
|
||||
if ($uid == -2) {
|
||||
return $this->error('密码不正确');
|
||||
}
|
||||
|
||||
$Member = model('Member');
|
||||
$data = $Member->create(array('nickname' => $nickname));
|
||||
if (!$data) {
|
||||
return $this->error($Member->getError());
|
||||
}
|
||||
|
||||
$res = $Member->where(array('uid' => $uid))->save($data);
|
||||
|
||||
if ($res) {
|
||||
$user = session('user_auth');
|
||||
$user['username'] = $data['nickname'];
|
||||
session('user_auth', $user);
|
||||
session('user_auth_sign', data_auth_sign($user));
|
||||
return $this->success('修改昵称成功!');
|
||||
} else {
|
||||
return $this->error('修改昵称失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改密码初始化
|
||||
* @title 修改密码
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function editpwd() {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<textarea name="{$name}" id="{$name}" class="form-editor" style="width: 100%">{$value}</textarea>
|
||||
<textarea name="{$name}" id="{$name}" class="form-editor" data-items="{$items|default='full'}" style="width: 100%">{$value}</textarea>
|
||||
@@ -5,22 +5,17 @@
|
||||
{else/}
|
||||
<input type="hidden" name="{$name}" id="field_{$name}" value="">
|
||||
{/if}
|
||||
<div id="fileList_{$name}" class="upload-file-list-info" style="width:280px;">
|
||||
<div id="fileList_{$name}" class="img-list">
|
||||
{if $value}
|
||||
{php}
|
||||
$images = get_cover($value);
|
||||
{/php}
|
||||
<li class="affix-list-item" id="WU_FILE_0">
|
||||
<div class="upload-file-info">
|
||||
<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$value}" data-fileurl="{$images['path']}"><i class="close"></i></span>
|
||||
<span class="fname"></span>
|
||||
<span class="fsize">上传时间:{$images['create_time']}</span>
|
||||
<div class="clearfix"></div>
|
||||
<div class="item" data-id="{$images['id']}">
|
||||
<div class="thumb">
|
||||
<div class="close"><i class="fa fa-close"></i></div>
|
||||
<img src="{$images['path']}" alt="{$images['create_time']}">
|
||||
</div>
|
||||
<div class="filebox image">
|
||||
<img src="{:config('config.base_url')}{$images['path']}" class="img-responsive">
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -218,6 +218,7 @@ class Member extends Model {
|
||||
$data['salt'] = \xin\helper\Str::random(6);
|
||||
return self::update($data, ['uid' => $data]);
|
||||
}else{
|
||||
unset($data['password']);
|
||||
return $this->where('uid', $data['uid'])->save($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
@import url(../../common/css/font-awesome.min.css);
|
||||
@import url(../../common/css/animate.min.css);
|
||||
@import url(../../plugins/bootstrap/css/bootstrap.min.css);
|
||||
/* +----------------------------------------------------------------------
|
||||
// | ThinkAdmin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
107
public/static/admin/js/login.js
Normal file
107
public/static/admin/js/login.js
Normal file
@@ -0,0 +1,107 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 当前资源URL目录
|
||||
var baseRoot = (function () {
|
||||
var scripts = document.scripts, src = scripts[0].src;
|
||||
return src.substring(0, src.lastIndexOf("/") - 9) + '/';
|
||||
})();
|
||||
|
||||
// 配置参数
|
||||
require.config({
|
||||
waitSeconds: 60,
|
||||
packages: [{
|
||||
name: 'moment',
|
||||
location: 'plugins/moment',
|
||||
main: 'moment'
|
||||
}
|
||||
],
|
||||
baseUrl: baseRoot,
|
||||
map: {'*': {css: baseRoot + 'plugins/require/require.css.js'}},
|
||||
paths: {
|
||||
'sent': ['common/js/sent'],
|
||||
'message': ['plugins/messager/messager'],
|
||||
|
||||
'layer': ['plugins/layer/layer'],
|
||||
// jQuery
|
||||
'jquery': ['plugins/jquery/jquery.min'],
|
||||
'json': ['plugins/jquery/json2.min'],
|
||||
// bootstrap
|
||||
'bootstrap': ['plugins/bootstrap/js/bootstrap.min'],
|
||||
},
|
||||
shim: {
|
||||
'message': {deps: ['jquery', 'css!'+'plugins/messager/css/style.css']},
|
||||
// bootstrap
|
||||
'bootstrap':{deps: ['jquery']},
|
||||
'layer': {deps: ['jquery', 'css!'+baseRoot+'plugins/layer/theme/default/layer.css']},
|
||||
},
|
||||
deps: ['json'],
|
||||
// 开启debug模式,不缓存资源
|
||||
urlArgs: "ver=" + (new Date()).getTime()
|
||||
});
|
||||
|
||||
// 注册jquery到require模块
|
||||
require(['jquery', 'bootstrap', 'message', 'sent'], function ($, bootstrap, message, sent) {
|
||||
$('[name="password"]').on('focus', function () {
|
||||
$('#left-hander').removeClass('initial_left_hand').addClass('left_hand');
|
||||
$('#right-hander').removeClass('initial_right_hand').addClass('right_hand')
|
||||
}).on('blur', function () {
|
||||
$('#left-hander').addClass('initial_left_hand').removeClass('left_hand');
|
||||
$('#right-hander').addClass('initial_right_hand').removeClass('right_hand')
|
||||
});
|
||||
|
||||
//表单提交
|
||||
$(document).ajaxStart(function(){
|
||||
$("button:submit").addClass("log-in").attr("disabled", true);
|
||||
}).ajaxStop(function(){
|
||||
$("button:submit").removeClass("log-in").attr("disabled", false);
|
||||
});
|
||||
|
||||
$("form").submit(function(){
|
||||
var self = $(this);
|
||||
$.ajax({
|
||||
data: self.serialize(),
|
||||
type: 'post',
|
||||
success: function(data){
|
||||
if(data.code){
|
||||
sent.msg(data.msg, 'success');
|
||||
setTimeout(function(){
|
||||
window.location.href = data.url;
|
||||
}, 2000);
|
||||
} else {
|
||||
sent.msg(data.msg, 'error');
|
||||
setTimeout(function(){
|
||||
//刷新验证码
|
||||
$(".reloadverify").click();
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
sent.msg(data.message, 'error');
|
||||
setTimeout(function(){
|
||||
//刷新验证码
|
||||
$(".reloadverify").click();
|
||||
}, 2000);
|
||||
},
|
||||
dataType: 'json'
|
||||
})
|
||||
return false;
|
||||
});
|
||||
//初始化选中用户名输入框
|
||||
$("#itemBox").find("input[name=username]").focus();
|
||||
//刷新验证码
|
||||
var verifyimg = $(".verifyimg").attr("src");
|
||||
$(".reloadverify").click(function(){
|
||||
if( verifyimg.indexOf('?')>0){
|
||||
$(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
|
||||
}else{
|
||||
$(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -95,6 +95,7 @@ require.config({
|
||||
'slimscroll': {deps: ['jquery'],exports: '$.fn.extend'},
|
||||
'adminlte': {deps: ['bootstrap', 'slimscroll'],exports: '$.AdminLTE'},
|
||||
|
||||
'form': {deps: ['css!'+baseRoot+'common/css/form.css']},
|
||||
'webupload': {deps: ['jquery', 'css!'+baseRoot+'plugins/webuploader/theme/webuploader.css', 'css!'+baseRoot+'/plugins/webuploader/theme/app.css']},
|
||||
|
||||
'layer': {deps: ['jquery', 'css!'+baseRoot+'plugins/layer/theme/default/layer.css']},
|
||||
|
||||
5
public/static/common/css/form.css
Normal file
5
public/static/common/css/form.css
Normal file
@@ -0,0 +1,5 @@
|
||||
.img-list{padding: 10px 0; display: flex; justify-content: start; flex-wrap: wrap;}
|
||||
.img-list .item{width: 20%;}
|
||||
.img-list .item .thumb{margin: 10px 10px 0 0 ; border: 1px solid #efefef; height: 120px; border-radius: 4px; position: relative; overflow: hidden;}
|
||||
.img-list .item .thumb img{width: 100%;}
|
||||
.img-list .item .close{position: absolute; right: 5px; top: 5px; opacity: 1; width: 20px; height: 20px; font-size: 10px; text-align: center; line-height: 20px; color: #ffffff; border-radius: 50%; background: #333333;}
|
||||
@@ -1,6 +1,17 @@
|
||||
define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator) {
|
||||
var Form = {
|
||||
config: {
|
||||
editor: {
|
||||
"full":['source', 'undo', 'redo', 'code', 'quote', 'cut',
|
||||
'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
|
||||
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
|
||||
'superscript', 'clearhtml', 'quickformat', 'selectall', '/',
|
||||
'formatblock', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold',
|
||||
'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', 'image', 'multiimage', 'media', 'insertfile', 'table', 'hr', 'baidumap',
|
||||
'anchor', 'link', 'unlink','fullscreen'],
|
||||
"base":['undo', 'redo', 'quote', 'formatblock', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold',
|
||||
'italic', 'underline', 'strikethrough', 'lineheight', 'image', 'media', 'table'],
|
||||
},
|
||||
fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
|
||||
},
|
||||
events: {
|
||||
@@ -90,8 +101,10 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
editor: function (form) {
|
||||
//绑定编辑器元素事件
|
||||
if ($(".form-editor", form).size() > 0) {
|
||||
var items = $(".form-editor", form).data('items') || 'full';
|
||||
require(['NKeditor'], function(){
|
||||
KindEditor.create('.form-editor', {
|
||||
items: Form.config.editor[items],
|
||||
uploadJson: "/admin/upload/editor'",
|
||||
fileManagerJson: "/admin/upload/filemanage"
|
||||
})
|
||||
@@ -261,12 +274,45 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
var name = $(this).siblings('input[type=hidden]').attr('name');
|
||||
layer.open({
|
||||
type: 2,
|
||||
shade: false,
|
||||
area: ['60%', '440px'],
|
||||
title: type == 'image' ? '图片' : '文件', //不显示标题
|
||||
area: ['60%', '410px'],
|
||||
title: false,
|
||||
closeBtn: false,
|
||||
shadeClose: true,
|
||||
content: ['/'+Config.module+'/upload/index?name='+name+'&type='+type+'&limit='+limit, 'no'],
|
||||
});
|
||||
})
|
||||
Form.events.imageDel();
|
||||
Form.events.fileDel();
|
||||
}
|
||||
},
|
||||
imageDel: function(){
|
||||
//绑定图片上传删除按钮
|
||||
if($('.picker-box .img-list .close').size() > 0){
|
||||
$('.picker-box .img-list .close').on('click', function(){
|
||||
var value = $('.picker-box input[type=hidden]').val().split(",");
|
||||
value = value.filter(val => val != $(this).parents('.item').data('id'))
|
||||
$(this).parents('.item').remove();
|
||||
if(value.length > 0){
|
||||
$('.picker-box input[type=hidden]').val(value.join(','));
|
||||
}else{
|
||||
$('.picker-box input[type=hidden]').val('');
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fileDel: function(){
|
||||
//绑定文件上传删除按钮
|
||||
if($('.picker-box .file-list .close').size() > 0){
|
||||
$('.picker-box .file-list .close').on('click', function(){
|
||||
var value = $('.picker-box input[type=hidden]').val().split(",");
|
||||
value = value.filter(val => val != $(this).parents('.item').data('id'))
|
||||
$(this).parents('.item').remove();
|
||||
if(value.length > 0){
|
||||
$('.picker-box input[type=hidden]').val(value.join(','));
|
||||
}else{
|
||||
$('.picker-box input[type=hidden]').val('');
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
faselect: function (form) {
|
||||
@@ -538,7 +584,17 @@ define(['jquery', 'bootstrap', 'validator'], function ($, undefined, Validator)
|
||||
},
|
||||
custom: {},
|
||||
setFile: function(fileList, param){
|
||||
// console.log(fileList, param);
|
||||
var file = $('#fileList_'+param.name);
|
||||
var field = $('#field_'+param.name);
|
||||
var html = '<div class="item"><div class="thumb"><div class="close"><i class="fa fa-close"></i></div><img src="#" /></div></div>';
|
||||
for(var i = 0; i < 10; i++){
|
||||
file.append(html);
|
||||
}
|
||||
if(param.type == 'image'){
|
||||
Form.events.imageDel();
|
||||
}else if(param.type == 'file'){
|
||||
Form.events.fileDel();
|
||||
}
|
||||
layer.close(layer.index);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -427,13 +427,21 @@ define(['jquery', 'bootstrap', 'webupload'], function ($, undefined, WebUploader
|
||||
if (res.code == 1) {
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
Upload.config.upList.push(res.info);
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
if(Upload.config.upList.length > 0){
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
}else{
|
||||
sent.msg('未上传数据或上传失败!', 'error')
|
||||
}
|
||||
}
|
||||
},
|
||||
server: function(){
|
||||
$('button.btn-select').click(function(){
|
||||
var query = sent.parseUrl(window.location.href);
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
if(Upload.config.upList.length > 0){
|
||||
parent.Form.api.setFile(Upload.config.upList, query);
|
||||
}else{
|
||||
sent.msg('未选择数据!', 'error')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
define(['jquery', 'layer', 'message'], function ($, layer) {
|
||||
var sent = {
|
||||
config: {
|
||||
keyName: 'sent_'
|
||||
},
|
||||
init: function(){
|
||||
init: function () {
|
||||
if ($("form[role=form]").length > 0) {
|
||||
require(['form'], function(form){
|
||||
require(['form'], function (form) {
|
||||
form.api.bindevent($("form[role=form]"));
|
||||
})
|
||||
}
|
||||
sent.api.bindGet(); //绑定get请求
|
||||
sent.api.bindPost(); //绑定post请求
|
||||
},
|
||||
msg: function(text, type){
|
||||
msg: function (text, type) {
|
||||
text = (type == 'success') ? text + ' 页面即将自动跳转~' : text;
|
||||
if (typeof type != 'undefined') {
|
||||
var message = $.messager.show(text, {
|
||||
@@ -40,8 +42,12 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
return obj;
|
||||
},
|
||||
store: {
|
||||
set: function(params = {}){
|
||||
var { name, content, type} = params;
|
||||
set: function (params = {}) {
|
||||
var {
|
||||
name,
|
||||
content,
|
||||
type
|
||||
} = params;
|
||||
name = sent.config.keyName + name
|
||||
var obj = {
|
||||
dataType: typeof (content),
|
||||
@@ -52,8 +58,11 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
if (type) window.sessionStorage.setItem(name, JSON.stringify(obj));
|
||||
else window.localStorage.setItem(name, JSON.stringify(obj));
|
||||
},
|
||||
get: function(params = {}){
|
||||
var { name, debug } = params;
|
||||
get: function (params = {}) {
|
||||
var {
|
||||
name,
|
||||
debug
|
||||
} = params;
|
||||
name = sent.config.keyName + name
|
||||
var obj = {},
|
||||
content;
|
||||
@@ -79,8 +88,11 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
}
|
||||
return content;
|
||||
},
|
||||
remove: function(params = {}){
|
||||
let { name, type } = params;
|
||||
remove: function (params = {}) {
|
||||
let {
|
||||
name,
|
||||
type
|
||||
} = params;
|
||||
name = sent.config.keyName + name
|
||||
if (type) {
|
||||
window.sessionStorage.removeItem(name);
|
||||
@@ -88,9 +100,11 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
window.localStorage.removeItem(name);
|
||||
}
|
||||
},
|
||||
all: function(params = {}){
|
||||
all: function (params = {}) {
|
||||
let list = [];
|
||||
let { type } = params;
|
||||
let {
|
||||
type
|
||||
} = params;
|
||||
if (type) {
|
||||
for (let i = 0; i <= window.sessionStorage.length; i++) {
|
||||
list.push({
|
||||
@@ -109,13 +123,15 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
name: window.localStorage.key(i),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
},
|
||||
clear: function(params = {}){
|
||||
let { type } = params;
|
||||
clear: function (params = {}) {
|
||||
let {
|
||||
type
|
||||
} = params;
|
||||
if (type) {
|
||||
window.sessionStorage.clear();
|
||||
} else {
|
||||
@@ -124,72 +140,92 @@ define(['jquery', 'layer', 'message'], function($, layer) {
|
||||
}
|
||||
},
|
||||
events: {
|
||||
//请求成功的回调
|
||||
onAjaxSuccess: function (ret, onAjaxSuccess) {
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
|
||||
//请求成功的回调
|
||||
onAjaxSuccess: function (ret, onAjaxSuccess) {
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
|
||||
|
||||
if (typeof onAjaxSuccess === 'function') {
|
||||
var result = onAjaxSuccess.call(this, data, ret);
|
||||
if (result === false)
|
||||
return;
|
||||
}
|
||||
sent.msg(msg, 'success');
|
||||
},
|
||||
//请求错误的回调
|
||||
onAjaxError: function (ret, onAjaxError) {
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
if (typeof onAjaxError === 'function') {
|
||||
var result = onAjaxError.call(this, data, ret);
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
if (typeof onAjaxSuccess === 'function') {
|
||||
var result = onAjaxSuccess.call(this, data, ret);
|
||||
if (result === false)
|
||||
return;
|
||||
}
|
||||
sent.msg(ret.msg, 'error');
|
||||
},
|
||||
//服务器响应数据后
|
||||
onAjaxResponse: function (response) {
|
||||
try {
|
||||
var ret = typeof response === 'object' ? response : JSON.parse(response);
|
||||
if (!ret.hasOwnProperty('code')) {
|
||||
$.extend(ret, {code: -2, msg: response, data: null});
|
||||
}
|
||||
} catch (e) {
|
||||
var ret = {code: -1, msg: e.message, data: null};
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
api:{
|
||||
//发送Ajax请求
|
||||
ajax: function (options, success, error) {
|
||||
options = typeof options === 'string' ? {url: options} : options;
|
||||
var index;
|
||||
if (typeof options.loading === 'undefined' || options.loading) {
|
||||
index = layer.load(options.loading || 0);
|
||||
}
|
||||
options = $.extend({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
index && layer.close(index);
|
||||
ret = sent.events.onAjaxResponse(ret);
|
||||
if (ret.code === 1) {
|
||||
sent.events.onAjaxSuccess(ret, success);
|
||||
} else {
|
||||
sent.events.onAjaxError(ret, error);
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
index && layer.close(index);
|
||||
var ret = {code: xhr.status, msg: xhr.statusText, data: null};
|
||||
sent.events.onAjaxError(ret, error);
|
||||
}
|
||||
}, options);
|
||||
return $.ajax(options);
|
||||
},
|
||||
sent.msg(msg, 'success');
|
||||
},
|
||||
//请求错误的回调
|
||||
onAjaxError: function (ret, onAjaxError) {
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
if (typeof onAjaxError === 'function') {
|
||||
var result = onAjaxError.call(this, data, ret);
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sent.msg(ret.msg, 'error');
|
||||
},
|
||||
//服务器响应数据后
|
||||
onAjaxResponse: function (response) {
|
||||
try {
|
||||
var ret = typeof response === 'object' ? response : JSON.parse(response);
|
||||
if (!ret.hasOwnProperty('code')) {
|
||||
$.extend(ret, {
|
||||
code: -2,
|
||||
msg: response,
|
||||
data: null
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
var ret = {
|
||||
code: -1,
|
||||
msg: e.message,
|
||||
data: null
|
||||
};
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
validatenull: function(val){
|
||||
api: {
|
||||
//发送Ajax请求
|
||||
ajax: function (options, success, error) {
|
||||
options = typeof options === 'string' ? {
|
||||
url: options
|
||||
} : options;
|
||||
var index;
|
||||
if (typeof options.loading === 'undefined' || options.loading) {
|
||||
index = layer.load(options.loading || 0);
|
||||
}
|
||||
options = $.extend({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
index && layer.close(index);
|
||||
ret = sent.events.onAjaxResponse(ret);
|
||||
if (ret.code === 1) {
|
||||
sent.events.onAjaxSuccess(ret, success);
|
||||
} else {
|
||||
sent.events.onAjaxError(ret, error);
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
index && layer.close(index);
|
||||
var ret = {
|
||||
code: xhr.status,
|
||||
msg: xhr.statusText,
|
||||
data: null
|
||||
};
|
||||
sent.events.onAjaxError(ret, error);
|
||||
}
|
||||
}, options);
|
||||
return $.ajax(options);
|
||||
},
|
||||
bindGet: function(){
|
||||
|
||||
},
|
||||
bindPost: function(){
|
||||
|
||||
}
|
||||
},
|
||||
validatenull: function (val) {
|
||||
if (typeof val == 'boolean') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||
<META content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<title>欢迎您登录SentCMS管理平台</title>
|
||||
<link rel="stylesheet" type="text/css" href="__static__/plugins/bootstrap/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__static__/common/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__static__/common/css/animate.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__static__/plugins/layui/css/layui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__css__/login.css"/>
|
||||
<script type="text/javascript" src="__static__/plugins/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="__static__/plugins/layui/layui.all.js"></script>
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<meta charset="UTF-8">
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<title>SentCMS网站管理系统后台</title>
|
||||
<link rel="stylesheet" type="text/css" href="__css__/login.css?time={:time()}">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__static__/common/js/html5shiv.min.js"></script>
|
||||
<script src="__static__/common/js/ie8polyfill.min.js"></script>
|
||||
<script src="__static__/common/js/html5shiv.js"></script>
|
||||
<script src="__static__/common/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body id="login-page-full">
|
||||
@@ -45,7 +38,7 @@
|
||||
|
||||
<!-- 页面表单主体 开始 -->
|
||||
<div class="container">
|
||||
<form onsubmit="return false;" method="post" class="content layui-form animated fadeInDown">
|
||||
<form method="post" class="content animated fadeInDown">
|
||||
<div class="people">
|
||||
<div class="tou"></div>
|
||||
<div id="left-hander" class="initial_left_hand transition"></div>
|
||||
@@ -80,53 +73,11 @@
|
||||
<!-- 底部版本信息 结束 -->
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[name="password"]').on('focus', function () {
|
||||
$('#left-hander').removeClass('initial_left_hand').addClass('left_hand');
|
||||
$('#right-hander').removeClass('initial_right_hand').addClass('right_hand')
|
||||
}).on('blur', function () {
|
||||
$('#left-hander').addClass('initial_left_hand').removeClass('left_hand');
|
||||
$('#right-hander').addClass('initial_right_hand').removeClass('right_hand')
|
||||
});
|
||||
|
||||
//表单提交
|
||||
$(document).ajaxStart(function(){
|
||||
$("button:submit").addClass("log-in").attr("disabled", true);
|
||||
}).ajaxStop(function(){
|
||||
$("button:submit").removeClass("log-in").attr("disabled", false);
|
||||
});
|
||||
|
||||
$("form").submit(function(){
|
||||
var self = $(this);
|
||||
$.post(self.attr("action"), self.serialize(), success, "json");
|
||||
return false;
|
||||
|
||||
function success(data){
|
||||
if(data.code){
|
||||
layer.msg(data.msg, {time:3000, end:function(){
|
||||
window.location.href = data.url;
|
||||
}});
|
||||
} else {
|
||||
layer.msg(data.msg, {time:3000, end:function(){
|
||||
//刷新验证码
|
||||
$(".reloadverify").click();
|
||||
}});
|
||||
}
|
||||
}
|
||||
});
|
||||
//初始化选中用户名输入框
|
||||
$("#itemBox").find("input[name=username]").focus();
|
||||
//刷新验证码
|
||||
var verifyimg = $(".verifyimg").attr("src");
|
||||
$(".reloadverify").click(function(){
|
||||
if( verifyimg.indexOf('?')>0){
|
||||
$(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
|
||||
}else{
|
||||
$(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
|
||||
}
|
||||
});
|
||||
});
|
||||
<script type="text/javascript">
|
||||
var require = {
|
||||
config: {"site": {$config|json_encode|raw}, 'module': 'admin', 'jsname': "{$require['jsname']|default=''}", 'actionname': "{$require['actionname']|default=''}", }
|
||||
}
|
||||
</script>
|
||||
<script src="__plugins__/require/require.js" data-main="__js__/login.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -50,13 +50,13 @@
|
||||
<li class="user-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 text-center">
|
||||
<a href="#">网站首页</a>
|
||||
<a href="{:url('front.Index/index')}">网站首页</a>
|
||||
</div>
|
||||
<div class="col-xs-4 text-center">
|
||||
<a href="#">修改密码</a>
|
||||
<a href="{:url('/admin/user/editpwd')}">修改密码</a>
|
||||
</div>
|
||||
<div class="col-xs-4 text-center">
|
||||
<a href="#">修改资料</a>
|
||||
<a href="{:url('/admin/user/edit')}">修改资料</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
@@ -64,10 +64,10 @@
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<a href="#" class="btn btn-default btn-flat">更新缓存</a>
|
||||
<a href="{:url('/admin/index/clear')}" class="btn btn-default btn-flat">更新缓存</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="#" class="btn btn-default btn-flat">退出</a>
|
||||
<a href="{:url('/admin/index/logout')}" class="btn btn-default btn-flat">退出</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
<input type="hidden" name="{$field['name']}" value="{$info[$field['name']]|default=''}"/>
|
||||
{else/}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-lg-10 col-sm-10">
|
||||
<label class="col-sm-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-sm-10">
|
||||
{:form($field, $info)}
|
||||
<div class="help-block">{$field['help']|default=''}</div>
|
||||
</div>
|
||||
@@ -42,8 +42,8 @@
|
||||
<input type="hidden" name="{$field['name']}" value="{$info[$field['name']]|default=''}"/>
|
||||
{else/}
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-lg-10 col-sm-10">
|
||||
<label class="col-sm-2 control-label">{$field['title']|htmlspecialchars}</label>
|
||||
<div class="col-sm-10">
|
||||
{:form($field, $info)}
|
||||
<div class="help-block">{$field['help']|default=''}</div>
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@
|
||||
{/volist}
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
{if isset($info['id'])}<input type="hidden" name="id" value="{$info['id']|default=''}">{/if}
|
||||
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
|
||||
@@ -1,42 +1,41 @@
|
||||
{extend name="admin/public/base"/}
|
||||
{block name="body"}
|
||||
<div class="main-box no-header clearfix">
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<div class="pull-left">
|
||||
<h2>修改昵称</h2>
|
||||
</div>
|
||||
<h3 class="box-title">{$meta_title}</h3>
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
<div class="box-header with-border">
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<!-- 修改密码表单 -->
|
||||
<form method="post" class="form-horizontal">
|
||||
<form method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">原密码:</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="password" name="oldpassword" class="form-control " autocomplete="off" />
|
||||
<label class="col-sm-2 control-label">原密码:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="oldpassword" class="form-control " data-rule="required" autocomplete="off" />
|
||||
<div class="help-block"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">新密码:</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="password" name="password" class="form-control " autocomplete="off" />
|
||||
<label class="col-sm-2 control-label">新密码:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password" class="form-control " data-rule="required" autocomplete="off" />
|
||||
<div class="help-block"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">确认密码:</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="password" name="repassword" class="form-control " autocomplete="off" />
|
||||
<label class="col-sm-2 control-label">确认密码:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="repassword" class="form-control " data-rule="required" autocomplete="off" />
|
||||
<div class="help-block"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="uid" value="{:session('userInfo.uid')}">
|
||||
<button type="submit" class="btn btn-primary submit-btn ajax-post" target-form="form-horizontal">确 认</button>
|
||||
<button class="btn btn-default btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
|
||||
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
{include file="admin/public/header" /}
|
||||
<style type="text/css">
|
||||
.tab-box{height: 345px; overflow: hidden;}
|
||||
.img-list{padding: 5px; height: 300px; overflow-y: scroll; display: flex; justify-content: start; flex-wrap: wrap; border: 1px dashed #999999;}
|
||||
.img-list .item{width: 20%;}
|
||||
.img-list .item .thumb{margin: 5px; border: 1px solid #efefef; height: 120px; border-radius: 4px; position: relative; cursor: pointer; overflow: hidden;}
|
||||
.img-list .item .thumb img{width: 100%;}
|
||||
.img-list .item .close{position: absolute; right: -10px; top: -10px; width: 20px; height: 20px; font-size: 10px; text-align: center; line-height: 20px; color: #000000; border-radius: 50%; background: #333333;}
|
||||
.page{height: 45px;}
|
||||
.page .pagination{margin: 0;}
|
||||
</style>
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
@@ -9,17 +16,20 @@
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane tab-box active" id="server">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{if empty($list)}
|
||||
<p class="no-data">无{if $param['type'] == 'image'}图片{else/}文件{/if}</p>
|
||||
{else/}
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
{/if}
|
||||
{if empty($list)}
|
||||
<p class="no-data">无{if $param['type'] == 'image'}图片{else/}文件{/if}</p>
|
||||
{else/}
|
||||
<div class="img-list">
|
||||
{volist name="list" id="item"}
|
||||
<div class="item">
|
||||
<div class="thumb"><img src="{$item['url']}" /></div>
|
||||
</div>
|
||||
<div class="col-sm-2 col-sm-offset-10"><button class="btn btn-primary btn-select">确认选择</button></div>
|
||||
{/volist}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="row" style="padding-top: 10px;">
|
||||
<div class="col-xs-10 page">{$page|raw}</div>
|
||||
<div class="col-xs-2"><button class="btn btn-primary btn-block btn-select">确认选择</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user