1 line
14 KiB
HTML
1 line
14 KiB
HTML
<div class="row-content am-cf">
|
|
|
|
<div class="row">
|
|
|
|
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
|
|
|
|
<div class="widget am-cf">
|
|
|
|
<div class="widget-head am-cf">
|
|
|
|
<div class="widget-title am-cf fl">插件列表 </div>
|
|
|
|
<div class="fr">
|
|
|
|
<a href="javascript:void(0);" class="hema-login am-btn am-btn-secondary am-radius am-btn-sm">
|
|
|
|
<i class="am-icon-user"></i> 用户信息
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="widget-body am-fr">
|
|
|
|
<div class="am-scrollable-horizontal am-u-sm-12">
|
|
|
|
<table width="100%" class="am-table am-table-hover tpl-table-black">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>图标</th>
|
|
|
|
<th>名称</th>
|
|
|
|
<th>标识</th>
|
|
|
|
<th>介绍</th>
|
|
|
|
<th>作者</th>
|
|
|
|
<th>价格</th>
|
|
|
|
<th>下载</th>
|
|
|
|
<th>版本</th>
|
|
|
|
<th>状态</th>
|
|
|
|
<th>操作</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{if sizeof($list['data'])}
|
|
|
|
{foreach $list['data'] as $item}
|
|
|
|
<tr>
|
|
|
|
<td class="am-text-middle">
|
|
|
|
<a href="https://www.hemaphp.com/index/addon/detail?id={$item['addon_id']}" target="_blank">
|
|
|
|
<img src="{$item['logo']['url']}" width="75" height="50" />
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td class="am-text-middle">{$item['title']}</td>
|
|
|
|
<td class="am-text-middle">{$item['name']}</td>
|
|
|
|
<td class="am-text-middle">
|
|
|
|
<p class="item-title">{$item['description']}</p>
|
|
|
|
</td>
|
|
|
|
<td class="am-text-middle">{$item['author']}</td>
|
|
|
|
<td class="am-text-middle">
|
|
|
|
<span class="{$item['price']['value'] == 10 ? 'x-color-green' : 'x-color-red'}">
|
|
|
|
{$item['price']['text']}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td class="am-text-middle">{$item['download']}</td>
|
|
|
|
<td class="am-text-middle">V{$item['version'][0]['version']}</td>
|
|
|
|
<td class="am-text-middle">
|
|
|
|
{if isset($item['addon']['status'])}
|
|
|
|
<span class="item-status am-badge x-cur-p {$item['addon']['status'] ? ' am-badge-success' : ' am-badge-warning'}"
|
|
|
|
data-status="{$item['addon']['status']}"
|
|
|
|
data-name="{$item['name']}">
|
|
|
|
{$item['addon']['status'] == 1 ? '启用' : '禁用'}
|
|
|
|
</span>
|
|
|
|
{/if}
|
|
|
|
</td>
|
|
|
|
<td class="am-text-middle">
|
|
|
|
<div class="tpl-table-black-operation">
|
|
|
|
{if !isset($item['addon'])}
|
|
|
|
<a class="item-install tpl-table-black-operation-green"
|
|
|
|
href="javascript:void(0);"
|
|
|
|
data-name="{$item['name']}">
|
|
|
|
<i class="am-icon-cloud-download"></i> 安装
|
|
|
|
</a>
|
|
|
|
{else /}
|
|
|
|
{if isset($item['addon']['config']) AND $item['addon']['config'] == 1}
|
|
|
|
<a class="item-config tpl-table-black-operation-default"
|
|
|
|
href="javascript:void(0);"
|
|
|
|
data-name="{$item['name']}"
|
|
|
|
data-title="{$item['title']}">
|
|
|
|
<i class="am-icon-pencil"></i> 配置
|
|
|
|
</a>
|
|
|
|
{/if}
|
|
|
|
<a class="item-uninstall tpl-table-black-operation-del"
|
|
|
|
href="javascript:void(0);"
|
|
|
|
data-name="{$item['name']}">
|
|
|
|
<i class="am-icon-trash"></i> 卸载
|
|
|
|
</a>
|
|
|
|
{if $item['addon']['version'] != $item['version'][0]['version']}
|
|
|
|
<a class="item-upgrade tpl-table-black-operation-primary"
|
|
|
|
href="javascript:void(0);"
|
|
|
|
data-name="{$item['name']}">
|
|
|
|
<i class="am-icon-cloud-upload"></i> 升级
|
|
|
|
</a>
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{/foreach}
|
|
|
|
{else /}
|
|
|
|
<tr>
|
|
|
|
<td colspan="10" class="am-text-center">暂无记录</td>
|
|
|
|
</tr>
|
|
|
|
{/if}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="am-u-lg-12 am-cf">
|
|
|
|
<div class="am-fr">{:$page}</div>
|
|
|
|
<div class="am-fr pagination-total am-margin-right">
|
|
|
|
<div class="am-vertical-align-middle">总记录:{$list['total']}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{include file="addon/tpl/config" /}
|
|
|
|
{include file="addon/tpl/login" /}
|
|
|
|
{include file="addon/tpl/user" /}
|
|
|
|
<script>
|
|
|
|
$(function () {
|
|
|
|
var user = <?= json_encode($addonuser)?>;
|
|
|
|
//插件配置
|
|
|
|
$('.item-config').on('click', function () {
|
|
|
|
var data = $(this).data();
|
|
|
|
$.get("{:url('addon/config')}?name=" + data.name, function (result) {
|
|
|
|
if(result.code == 0){
|
|
|
|
$.show_error(result.msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$.showAction({
|
|
|
|
title: '插件配置 《' + data.title + '》',
|
|
|
|
area: '750px',
|
|
|
|
content: template('tpl-config', {config:result.data}),
|
|
|
|
uCheck: true,
|
|
|
|
success: function ($content) {
|
|
|
|
$('#my-form').formPost({
|
|
|
|
url: "{:url('addon/config')}?name=" + data.name
|
|
|
|
});
|
|
|
|
},
|
|
|
|
btn2: function ($content) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 安装操作
|
|
|
|
$('.item-install').click(function () {
|
|
|
|
var data = $(this).data();
|
|
|
|
layer.confirm('您确定要安装该插件?', {
|
|
|
|
title: '友情提示',
|
|
|
|
icon: 0,
|
|
|
|
btn:['取消','确定'],
|
|
|
|
skin: 'layui-layer-hema',
|
|
|
|
cancel : function(){
|
|
|
|
// 你点击右上角 X 回调
|
|
|
|
},
|
|
|
|
btn1:function(index,layero){
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
btn2:function(index){
|
|
$("#addons-loading").html('<div class="am-modal-dialog"><div class="am-modal-hd">插件安装中,请等待...</div><div class="am-modal-bd"><span class="am-icon-spinner am-icon-spin"></span></div></div>');
|
|
$("#addons-loading").modal('open');
|
|
$.post("{:url('addon/install')}", data, function (result) {
|
|
$("#addons-loading").modal('close');
|
|
if(typeof(result) == 'string'){
|
|
result = JSON.parse(result);
|
|
}
|
|
if(result.code == 1){
|
|
|
|
$.show_success(result.msg, result.url);
|
|
|
|
}
|
|
|
|
if(result.code == 0){
|
|
|
|
$.show_error(result.msg);
|
|
|
|
}
|
|
|
|
if(result.code == -1){
|
|
|
|
userLogin();
|
|
|
|
}
|
|
|
|
if(result.code == -10){
|
|
|
|
layer.open({
|
|
|
|
type: 2,
|
|
|
|
title: '立即支付',
|
|
|
|
shadeClose: true,
|
|
|
|
shade: false,
|
|
|
|
maxmin: true, //开启最大化最小化按钮
|
|
|
|
area: ['450px', '620px'],
|
|
|
|
content: "{:url('addon/pay')}?addon_id=" + result.data.addon_id
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
end:function() {
|
|
|
|
//所有操作都会执行
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//升级操作
|
|
|
|
$('.item-upgrade').click(function () {
|
|
|
|
var data = $(this).data();
|
|
|
|
layer.confirm('您确定要进行升级操作?', {
|
|
|
|
title: '友情提示',
|
|
|
|
icon: 0,
|
|
|
|
btn:['取消','确定'],
|
|
|
|
skin: 'layui-layer-hema',
|
|
|
|
cancel : function(){
|
|
|
|
// 你点击右上角 X 回调
|
|
|
|
},
|
|
|
|
btn1:function(index,layero){
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
btn2:function(index){
|
|
$("#addons-loading").html('<div class="am-modal-dialog"><div class="am-modal-hd">插件升级中,请等待...</div><div class="am-modal-bd"><span class="am-icon-spinner am-icon-spin"></span></div></div>');
|
|
$("#addons-loading").modal('open');
|
|
$.post("{:url('addon/upgrade')}", data, function (result) {
|
|
$("#addons-loading").modal('close');
|
|
if(typeof(result) == 'string'){
|
|
result = JSON.parse(result);
|
|
}
|
|
result.code === 1 ? $.show_success(result.msg, result.url) : $.show_error(result.msg);
|
|
|
|
});
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
end:function() {
|
|
|
|
//所有操作都会执行
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 卸载操作
|
|
|
|
$('.item-uninstall').click(function () {
|
|
|
|
var data = $(this).data();
|
|
|
|
layer.confirm('您确定要卸载该插件?卸载后将清楚与该插件相关的所有数据!', {
|
|
|
|
title: '友情提示',
|
|
|
|
icon: 0,
|
|
|
|
btn:['取消','确定'],
|
|
|
|
skin: 'layui-layer-hema',
|
|
|
|
cancel : function(){
|
|
|
|
// 你点击右上角 X 回调
|
|
|
|
},
|
|
|
|
btn1:function(index,layero){
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
btn2:function(index){
|
|
$("#addons-loading").html('<div class="am-modal-dialog"><div class="am-modal-hd">插件卸载中,请等待...</div><div class="am-modal-bd"><span class="am-icon-spinner am-icon-spin"></span></div></div>');
|
|
$("#addons-loading").modal('open');
|
|
$.post("{:url('addon/uninstall')}", data, function (result) {
|
|
$("#addons-loading").modal('close');
|
|
if(typeof(result) == 'string'){
|
|
result = JSON.parse(result);
|
|
}
|
|
result.code === 1 ? $.show_success(result.msg, result.url) : $.show_error(result.msg);
|
|
|
|
});
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
end:function() {
|
|
|
|
//所有操作都会执行
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// 状态操作
|
|
|
|
$('.item-status').click(function () {
|
|
|
|
var data = $(this).data();
|
|
|
|
var msg = '禁用';
|
|
|
|
if(parseInt(data.status) === 0){
|
|
|
|
msg = '启用';
|
|
|
|
}
|
|
|
|
layer.confirm('您确定要' + msg + '该插件?', {
|
|
|
|
title: '友情提示',
|
|
|
|
icon: 0,
|
|
|
|
btn:['取消','确定'],
|
|
|
|
skin: 'layui-layer-hema',
|
|
|
|
cancel : function(){
|
|
|
|
// 你点击右上角 X 回调
|
|
|
|
},
|
|
|
|
btn1:function(index,layero){
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
btn2:function(index){
|
|
|
|
$.post("{:url('addon/status')}", data, function (result) {
|
|
if(typeof(result) == 'string'){
|
|
result = JSON.parse(result);
|
|
}
|
|
result.code === 1 ? $.show_success(result.msg, result.url) : $.show_error(result.msg);
|
|
|
|
});
|
|
|
|
layer.close(index);
|
|
|
|
},
|
|
|
|
end:function() {
|
|
|
|
//所有操作都会执行
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// 检测是否登录
|
|
|
|
$('.hema-login').click(function () {
|
|
|
|
$.post("{:url('addon/checkLogin')}", {}, function (result) {
|
|
|
|
if(result.code === 1){
|
|
|
|
userDetail();
|
|
|
|
}else{
|
|
|
|
userLogin();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
function userDetail(){
|
|
|
|
$.showAction({
|
|
|
|
title: '会员信息',
|
|
|
|
area: '460px',
|
|
|
|
content: template('tpl-user', {user: user}),
|
|
|
|
btn: ['关闭', '退出'],
|
|
|
|
uCheck: true,
|
|
|
|
success: function ($content) {
|
|
|
|
$('#my-form').formPost({
|
|
|
|
url: "{:url('addon/logout')}"
|
|
|
|
});
|
|
|
|
},
|
|
|
|
btn2: function ($content) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function userLogin(){
|
|
|
|
$.showAction({
|
|
|
|
title: '用户登录',
|
|
|
|
area: '460px',
|
|
|
|
content: template('tpl-login', {}),
|
|
|
|
btn: ['关闭', '登录'],
|
|
|
|
uCheck: true,
|
|
|
|
success: function ($content) {
|
|
|
|
$('#my-form').formPost({
|
|
|
|
url: "{:url('addon/login')}"
|
|
|
|
});
|
|
|
|
},
|
|
|
|
btn2: function ($content) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|