同步业务系统代码

This commit is contained in:
邹景立 2021-08-04 13:44:36 +08:00
parent 16feb95ed9
commit 15b6202ee9
9 changed files with 48 additions and 50 deletions

View File

@ -66,6 +66,7 @@ class Upload extends Controller
$data = ['uptype' => $this->getType(), 'safe' => intval($safe), 'key' => input('key')];
if ($info = Storage::instance($data['uptype'])->info($data['key'], $safe, $name)) {
$data['url'] = $info['url'];
$data['key'] = $info['key'];
$this->success('文件已经上传', $data, 200);
} elseif ('local' === $data['uptype']) {
$data['url'] = LocalStorage::instance()->url($data['key'], $safe, $name);

View File

@ -29,11 +29,11 @@ define(['md5'], function (SparkMD5, allowMime) {
opt.load = opt.hide || $.msg.loading('上传进度 <span data-upload-progress>0%</span>');
opt.count.total++, file.index = index, opt.cache[index] = file, delete opt.files[index];
md5file(file).then(function (file) {
opt.elem.triggerHandler('upload.hash', file);
jQuery.ajax("{:url('admin/api.upload/state')}", {
opt.elem.triggerHandler('upload.hash', file), jQuery.ajax("{:sysuri('admin/api.upload/state')}", {
data: {key: file.xkey, uptype: opt.type, safe: opt.safe, name: file.name}, method: 'post', success: function (ret) {
file.xurl = ret.data.url, file.xsafe = ret.data.safe;
file.xpath = ret.data.key, file.xtype = ret.data.uptype;
if (parseInt(ret.code) === 404) {
file.xurl = ret.data.url;
opt.uploader.config.url = ret.data.server;
opt.uploader.config.data.key = ret.data.key;
opt.uploader.config.data.safe = ret.data.safe;
@ -48,7 +48,7 @@ define(['md5'], function (SparkMD5, allowMime) {
opt.uploader.config.data['Content-Disposition'] = 'inline;filename=' + encodeURIComponent(file.name);
} else if (ret.data.uptype === 'txcos') {
opt.uploader.config.data['q-ak'] = ret.data['q-ak'];
opt.uploader.config.data['policy'] = ret.data.policy;
opt.uploader.config.data['policy'] = ret.data['policy'];
opt.uploader.config.data['q-key-time'] = ret.data['q-key-time'];
opt.uploader.config.data['q-signature'] = ret.data['q-signature'];
opt.uploader.config.data['q-sign-algorithm'] = ret.data['q-sign-algorithm'];
@ -67,8 +67,11 @@ define(['md5'], function (SparkMD5, allowMime) {
});
});
}, progress: function (number) {
/*! 文件上传进度处理 */
$('[data-upload-progress]').html(number + '%');
opt.elem.triggerHandler('upload.progress', {number: number, event: arguments[2], file: arguments[3]});
}, done: function (ret, idx) {
/*! 检查单个文件上传返回的结果 */
@ -79,7 +82,7 @@ define(['md5'], function (SparkMD5, allowMime) {
if (typeof callable === 'function') {
callable.call(opt.elem, opt.cache[idx].xurl, opt.cache['id']);
} else if (opt.mult < 1 && opt.elem.data('input')) {
$(opt.elem.data('input')).val(opt.cache[idx].xurl).trigger('change');
$(opt.elem.data('input')).val(opt.cache[idx].xurl).trigger('change', opt.cache[idx]);
}
(opt.hide || $.msg.close(opt.load)), opt.elem.html(opt.elem.data('html'));
@ -91,7 +94,7 @@ define(['md5'], function (SparkMD5, allowMime) {
var urls = opt.elem.data('input').value || [];
if (typeof urls === 'string') urls = urls.split('|');
for (var i in opt.cache) urls.push(opt.cache[i].xurl);
$(opt.elem.data('input')).val(urls.join('|')).trigger('change');
$(opt.elem.data('input')).val(urls.join('|')).trigger('change', opt.cache);
}
opt.elem.triggerHandler('upload.complete', {file: opt.cache});
(opt.cache = [], opt.files = []), opt.uploader.reload();

View File

@ -61,7 +61,7 @@
<i style="font-size:1.2em;margin:0;float:none" class='{$vo.icon|default=""}'></i>
</span>
<button data-icon='icon' type='button' class='layui-btn layui-btn-primary'>选择图标</button>
<p class="help-block">可选,设置菜单选项前置图标,目前只支持 Font Awesome 5.2.0 字体图标</p>
<p class="help-block">可选,设置菜单选项前置图标,目前支持 layui 字体图标及 iconfont 定制字体图标。</p>
</div>
</div>

View File

@ -55,7 +55,7 @@
<span class="color-desc margin-left-5">User Permission</span>
<div class="layui-textarea" style="min-height:42px;line-height:28px">
{if isset($vo.username) and $vo.username eq $superName}
<span class="color-desc">超级用户不需要配置权限</span>
<span class="color-desc">超级用户拥所有访问权限,不需要配置权限</span>
{else}{foreach $authorizes as $authorize}
<label class="think-checkbox layui-unselect margin-top-5">
{if in_array($authorize.id, $vo.authorize)}

View File

@ -41,16 +41,16 @@
cols: [[
{checkbox: true, fixed: true},
{field: 'sort', title: '排序权重', width: 100, align: 'center', sort: true, templet: '#SortInputTpl'},
{field: 'nickname', title: '用户名称', minWidth: 100, align: 'center', sort: false, templet: '<div>{{d.nickname||"-"}}</div>'},
{field: 'username', title: '登录账号', minWidth: 100, align: 'center', sort: true, templet: '<div>{{d.username||"-"}}</div>'},
{field: 'username', title: '登录账号', minWidth: 100, templet: '<div>{{d.username||"-"}}</div>'},
{field: 'nickname', title: '用户名称', minWidth: 100, templet: '<div>{{d.nickname||"-"}}</div>'},
{
field: 'usertype', title: '角色身份', minWidth: 120, align: 'center', sort: true, templet: function (d) {
field: 'usertype', title: '角色身份', minWidth: 140, sort: true, templet: function (d) {
d.userinfo = d.userinfo || {};
return d.userinfo.code ? (d.userinfo.name + ' ( ' + d.userinfo.code + ' ) ') : '';
}
},
{field: 'contact_mail', title: '联系邮箱', align: 'center', sort: false, templet: '<div>{{d.contact_mail||"-"}}</div>'},
{field: 'contact_phone', title: '联系电话', align: 'center', sort: false, templet: '<div>{{d.contact_phone||"-"}}</div>'},
{field: 'contact_mail', title: '联系邮箱', templet: '<div>{{d.contact_mail||"-"}}</div>'},
{field: 'contact_phone', title: '联系电话', templet: '<div>{{d.contact_phone||"-"}}</div>'},
{field: 'login_num', title: '登录次数', align: 'center', minWidth: 80, sort: false},
{field: 'login_at', title: '最后登录', sort: true, align: 'center', minWidth: 170},
{field: 'create_at', title: '创建时间', align: 'center', minWidth: 170, sort: true},

View File

@ -414,10 +414,11 @@ $(function () {
/*! 注册对象到Jq */
$.vali = function (form, callable, options) {
return (new function (that) {
/*! 表单元素 */
that = this, this.tags = 'input,select,textarea';
/*! 检测元素事件 */
this.checkEvent = {change: true, blur: true, keyup: false};
that = this;
/*! 绑定元素事件 */
this.evts = 'blur change';
/*! 筛选表单元素 */
this.tags = 'input,select,textarea';
/*! 去除字符串的空格 */
this.trim = function (str) {
return str.replace(/(^\s*)|(\s*$)/g, '');
@ -426,17 +427,11 @@ $(function () {
this.hasProp = function (ele, prop) {
if (typeof prop !== "string") return false;
var attrProp = ele.getAttribute(prop);
return (typeof attrProp !== 'undefined' && attrProp !== null && attrProp !== false);
};
/*! 判断表单元素是否为空 */
this.isEmpty = function (ele, value) {
var trim = this.trim(ele.value);
value = value || ele.getAttribute('placeholder');
return (trim === "" || trim === value);
return typeof attrProp !== 'undefined' && attrProp !== null && attrProp !== false;
};
/*! 正则验证表单元素 */
this.isRegex = function (ele, regex, params) {
var input = $(ele).val(), real = this.trim(input);
var real = this.trim($(ele).val());
regex = regex || ele.getAttribute('pattern');
if (real === "" || !regex) return true;
return new RegExp(regex, params || 'i').test(real);
@ -451,13 +446,11 @@ $(function () {
};
/*! 检测表单单元 */
this.checkInput = function (input) {
var tag = input.tagName.toLowerCase(), need = this.hasProp(input, "required");
var type = (input.getAttribute("type") || '').replace(/\W+/, "").toLowerCase();
if (this.hasProp(input, 'data-auto-none')) return true;
var ingoreTags = ['select'], ingoreType = ['radio', 'checkbox', 'submit', 'reset', 'image', 'file', 'hidden'];
for (var i in ingoreTags) if (tag === ingoreTags[i]) return true;
for (var i in ingoreType) if (type === ingoreType[i]) return true;
if (need && this.isEmpty(input)) return this.remind(input);
var type = (input.getAttribute("type") || '').replace(/\W+/, "").toLowerCase();
var ingoreTypes = ['file', 'reset', 'image', 'radio', 'checkbox', 'submit', 'hidden'];
if (ingoreTypes.length > 0) for (var i in ingoreTypes) if (type === ingoreTypes[i]) return true;
if (this.hasProp(input, "required") && this.trim($(input).val()) === '') return this.remind(input);
return this.isRegex(input) ? (this.hideError(input), true) : this.remind(input);
};
/*! 显示验证标志 */
@ -485,14 +478,9 @@ $(function () {
};
/*! 表单验证入口 */
this.check = function (form, callable) {
$(form).attr('novalidate', 'novalidate').find(that.tags).map(function (idx, input) {
(function (evt) {
for (var e in that.checkEvent) if (that.checkEvent[e]) $(input).off(e, evt).on(e, evt);
})(function () {
that.checkInput(input);
});
});
$(form).bind("submit", function (event) {
$(form).off(that.evts, that.tags).on(that.evts, that.tags, function () {
that.checkInput(this);
}).attr('novalidate', 'novalidate').bind("submit", function (event) {
if (that.checkAllInput() && typeof callable === 'function') {
if (typeof CKEDITOR === 'object' && typeof CKEDITOR.instances === 'object') {
for (var i in CKEDITOR.instances) CKEDITOR.instances[i].updateElement();
@ -534,7 +522,7 @@ $(function () {
/*! 表单转JSON */
$.fn.formToJson = function () {
var self = this, data = {}, push = {};
var patterns = {"key": /[a-zA-Z0-9_]+|(?=\[])/g, "push": /^$/, "fixed": /^\d+$/, "named": /^[a-zA-Z0-9_]+$/};
var patterns = {key: /[a-zA-Z0-9_]+|(?=\[])/g, push: /^$/, fixed: /^\d+$/, named: /^[a-zA-Z0-9_]+$/};
this.build = function (base, key, value) {
return (base[key] = value), base;
};
@ -575,7 +563,7 @@ $(function () {
return this.each(function ($in, $bt) {
$in = $(this), $bt = $('<a data-file="one" class="uploadimage transition"><span class="layui-icon">&#x1006;</span></a>');
$bt.attr('data-size', $in.data('size') || 0).attr('data-file', 'one').attr('data-type', $in.data('type') || 'png,jpg,gif');
$bt.attr('input', $in.get(0)).data('input', this).find('span').on('click', function (event) {
$bt.data('input', this).find('span').on('click', function (event) {
event.stopPropagation(), $bt.attr('style', ''), $in.val('');
});
$in.attr('name', $bt.attr('data-field')).after($bt).on('change', function () {
@ -615,10 +603,10 @@ $(function () {
/*! 标签输入插件 */
$.fn.initTagInput = function () {
return this.each(function () {
var $box = $('<div class="layui-tags"></div>');
var $this = $(this), tags = this.value ? this.value.split(',') : [];
var $text = $('<textarea class="layui-input layui-input-inline layui-tag-input"></textarea>');
$this.parent().append($box.append($text)), $text.off('keydown blur'), (tags.length > 0 && showTags(tags));
var $tags = $('<div class="layui-tags"></div>').append($text);
$this.parent().append($tags), $text.off('keydown blur'), (tags.length > 0 && showTags(tags));
$text.on('keydown blur', function (event, value) {
if (event.keyCode === 13 || event.type === 'blur') {
event.preventDefault(), (value = $text.val().replace(/^\s*|\s*$/g, ''));
@ -633,7 +621,7 @@ $(function () {
element.on('click', 'i', function (tagText, tagIndex) {
tagText = $(this).parent().text(), tagIndex = tags.indexOf(tagText);
tags.splice(tagIndex, 1), $(this).parent().remove(), $this.val(tags.join(','));
}), $box.append(element, $text);
}), $tags.append(element, $text);
});
}
});
@ -747,7 +735,11 @@ $(function () {
/*! 注册 data-reload 事件行为 */
onEvent('click', '[data-reload]', function () {
if (this.dataset.tableId) {
$('#' + this.dataset.tableId).trigger('reload');
} else {
$.form.reload();
}
});
/*! 注册 data-dbclick 事件行为 */
@ -876,9 +868,11 @@ $(function () {
$(that).attr('index', layer.tips(img.outerHTML, that, {time: 0, skin: 'layui-layer-image', scrollbar: false, anim: 5, isOutAnim: false}));
}
$(this).off('mouseleave').on('mouseleave', function () {
layer.close($(this).attr('index'));
setTimeout(function () {
layer.close($(that).attr('index'));
}, 100)
});
});
})
$.previewImage = function (src, area) {
var img = new Image(), defer = $.Deferred(), load = $.msg.loading();

View File

@ -31,7 +31,7 @@
// 导航条颜色配置
@TopHeaderTextColor: #333;
@TopHeaderBackColor: #FFF;
@TopHeaderBottomLine: 1px solid #098;
@TopHeaderBottomLine: 1px solid #E5E5E5;
@TopHeaderNavNormalTextColor: @TopHeaderTextColor;
@TopHeaderNavNormalBackColor: @TopHeaderBackColor;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long