Merge branch 'master' of gitee.com:toogee/TaoLer

This commit is contained in:
toogee 2020-05-30 15:26:55 +08:00
commit 1bb9fc4127
7 changed files with 148 additions and 195 deletions

View File

@ -1,192 +0,0 @@
//网站后台综合设置
layui.define(['table', 'form', 'layedit'], function(exports){
var $ = layui.$
,table = layui.table
,form = layui.form
,layedit = layui.layedit;
var index = layedit.build('L_content',{
height: 180 //设置编辑器高度
,tool: [
'strong' //加粗
,'italic' //斜体
,'underline' //下划线
,'del' //删除线
,'|' //分割线
,'left' //左对齐
,'center' //居中对齐
,'right' //右对齐
,'link' //超链接
,'unlink' //清除链接
,'face' //表情
,'image' //插入图片
],
});
//得到编辑器内容异步到表单中
form.verify({
content: function(value){
return layedit.sync(index);
}
});
//通知列表
table.render({
elem: '#notice-list',
url: '/admin/Notice/index',
limit: 5,
cols:[[
{type: 'numbers', fixed: 'left'},
{field: 'type',title: '类型'},
{field: 'title',title: '标题'},
{field: 'user_id',title: '发信ID'},
{field: 'content',title: '内容'},
{field: 'ctime',title: '时间'},
{title: '操作', width: 150, align:'center', fixed: 'right', toolbar: '#notice-tool'}
]]
,page: true
,limit: 10
,height: 'full-220'
,text: '对不起,加载出现异常!'
});
//发站内通知信息
form.on('select(type)', function(data){
var tpl = '<div class="layui-col-md12">\
<label for="L_title" class="layui-form-label">收件人</label>\
<div class="layui-input-block">\
<input type="text" id="receve_id" name="receve_id" required lay-verify="required" autocomplete="off" class="layui-input" >\
</div>\
</div>';
//如果选择是用户追加收件人
if(data.value == 1){
$(this).parents('div .layui-col-md3').next('div').after(tpl);
}else{
$(this).parents('div .layui-col-md3').nextAll('div .layui-col-md12').remove();
}
});
//发布通知
form.on('submit(notice-add)', function(data){
var field = data.field;
$.ajax({
type:"post",
url:"/admin/Notice/add",
data:field,
dataType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('notice-list'); //数据刷新
return false;
});
//监听工具条
table.on('tool(notice-list)', function(obj){
var data = obj.data;
if(obj.event === 'del'){
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('真的删除行么', function(index){
//obj.del();
$.ajax({
type:'post',
url:"/admin/Notice/delete",
data:{id:data.id},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
title:'删除失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
table.reload('notice-list');
layer.close(index);
});
});
} else if(obj.event === 'edit'){
var tr = $(obj.tr);
layer.open({
type: 2
,title: '编辑签到'
,content: '/admin/Notice/edit?id='+ data.id
,maxmin: true
,area: ['500px', '450px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'notice-edit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"/admin/Notice/edit",
data:{id:field.id,title:field.title,content:field.content,type:field.type},
daType:"json",
success:function (res){
if (res.code == 0) {
layer.msg(res.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'修改失败',
content:res.msg,
icon:5,
anim:6
});
}
}
});
table.reload('notice-list'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
,success: function(layero, index){
}
});
}
});
exports('appset', {})
});

View File

@ -859,6 +859,22 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util'], function(
if(type === 'bar1'){ if(type === 'bar1'){
//slayer.msg('打开 index.js开启发表新帖的路径'); //slayer.msg('打开 index.js开启发表新帖的路径');
location.href = articleAdd; location.href = articleAdd;
}
//分享
if(type === 'bar2'){
if(navigator.userAgent.indexOf("Html5Plus") > -1) {
//5+ 原生分享
window.plusShare({
title: "my-app-name",//应用名字
content: "分享具体内容",
href: location.href,//分享出去后,点击跳转地址
thumbs: ["/static/share/icon/wx.png"] //分享缩略图
}, function(result) {
//分享回调
});
} else {
//原有wap分享实现
}
} }
} }
}); });

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -0,0 +1,117 @@
(function() {
var plusReady = function(callback) {
if(window.plus) {
callback();
} else {
document.addEventListener('plusready', callback);
}
}
var shareServices = {};
var init = function() {
plus.share.getServices(function(services) {
for(var i = 0, len = services.length; i < len; i++) {
shareServices[services[i].id] = services[i];
}
});
};
var isWechatInstalled = function() {
return plus.runtime.isApplicationExist && plus.runtime.isApplicationExist({
pname: 'com.tencent.mm',
action: 'weixin://'
});
};
function share(id, msg, callback) {
var service = shareServices[id];
if(!service) {
callback && callback(false);
return;
}
var _share = function() {
service.send(msg, function() {
plus.nativeUI.toast("分享到\"" + service.description + "\"成功!");
callback && callback(true);
}, function(e) {
plus.nativeUI.toast("分享到\"" + service.description + "\"失败!");
callback && callback(false);
})
};
if(service.authenticated) {
_share(service, msg, callback);
} else {
service.authorize(function() {
_share(service, msg, callback);
}, function(e) {
console.log("认证授权失败");
callback && callback(false);
})
}
};
function openSystem(msg, callback) {
if(plus.share.sendWithSystem) {
plus.share.sendWithSystem(msg, function() {
//TODO 系统分享暂不支持回调
//callback && callback(true);
}, function() {
//TODO 系统分享暂不支持回调
//callback && callback(false);
});
} else {
callback && callback(false);
}
}
var open = function(msg, callback) {
/**
*如下情况直接打开系统分享
* 1未配置微信分享通道
* 2用户手机未安装威胁你
* 3360浏览器下
*/
if(shareServices.weixin && isWechatInstalled() && !/360\sAphone/.test(navigator.userAgent)) {
plus.nativeUI.actionSheet({
title: '分享到',
cancel: "取消",
buttons: [{
title: "微信消息"
}, {
title: "微信朋友圈"
}, {
title: "更多分享"
}]
}, function(e) {
var index = e.index;
switch(index) {
case 1: //分享到微信好友
msg.extra = {
scene: 'WXSceneSession'
};
share('weixin', msg, callback);
break;
case 2: //分享到微信朋友圈
msg.title = msg.content;
msg.extra = {
scene: 'WXSceneTimeline'
};
share('weixin', msg, callback);
break;
case 3: //更多分享
var url = msg.href ? ('( ' + msg.href + ' )') : '';
msg.title = msg.title + url;
msg.content = msg.content + url;
openSystem(msg, callback);
break;
}
})
} else {
//系统分享
var url = msg.href ? ('( ' + msg.href + ' )') : '';
msg.title = msg.title + url;
msg.content = msg.content + url;
openSystem(msg, callback);
}
};
plusReady(init);
window.plusShare = open;
})();

View File

@ -6,10 +6,22 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="{block name="keywords"}关键词{/block}"> <meta name="keywords" content="{block name="keywords"}关键词{/block}">
<meta name="description" content="{block name="description"}描述{/block}"> <meta name="description" content="{block name="description"}描述{/block}">
<link rel="stylesheet" href="/static/layui/css/layui.css"> <link rel="stylesheet" href="/static/layui/css/layui.css" charset="utf-8">
<link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8"> <link rel="stylesheet" href="/static/res/css/global.css" charset="utf-8">
<style>
/*5+ 引擎环境下自动隐藏无关元素*/
.html5plus .html5plus-hide {
display: none
}
</style>
<script src="/static/share/plusShare.js" type="text/javascript" charset="utf-8"></script>
</head> </head>
<body > <body >
<script>
if(navigator.userAgent.indexOf("Html5Plus") > -1) {
document.body.classList.add("html5plus");
}
</script>
{include file="public/header" /} {include file="public/header" /}
{block name="column"}导航{/block} {block name="column"}导航{/block}
{block name="content"}内容{/block} {block name="content"}内容{/block}

View File

@ -1,4 +1,4 @@
<div class="fly-panel fly-link"> <div class="fly-panel fly-link html5plus-hide">
<h3 class="fly-panel-title">友情链接</h3> <h3 class="fly-panel-title">友情链接</h3>
<dl class="fly-panel-main"> <dl class="fly-panel-main">
{volist name="flinks" id="vo"} {volist name="flinks" id="vo"}

View File

@ -1,4 +1,4 @@
<div class="fly-footer"> <div class="fly-footer html5plus-hide">
<p> Copyright &copy; {:date('Y')}{$sysInfo.copyright|raw}</p> <p> Copyright &copy; {:date('Y')}{$sysInfo.copyright|raw}</p>
<p> <p>
<a href="#" target="_blank">站务反馈</a> <a href="#" target="_blank">站务反馈</a>