Commit d4b5bd1a by 周添尉

..

parent 77e0c173
...@@ -175,7 +175,7 @@ a{ ...@@ -175,7 +175,7 @@ a{
line-height: 28px; line-height: 28px;
text-align: center; text-align: center;
color: white; color: white;
margin-top: 3px; margin-top: 5px;
cursor: pointer; cursor: pointer;
} }
.index_application_show_tabs_content_img:hover{ .index_application_show_tabs_content_img:hover{
...@@ -220,7 +220,7 @@ a{ ...@@ -220,7 +220,7 @@ a{
<div class="index_application_show_tabs_container"> <div class="index_application_show_tabs_container">
<div class="index_application_show_tabs_content"> <div class="index_application_show_tabs_content">
<div> <%-- <div>
<div class="index_application_show_tabs_content_div"> <div class="index_application_show_tabs_content_div">
<div><img SRC="${ctx}/custom/images/index_application_img.png" width="40" height="40"/></div> <div><img SRC="${ctx}/custom/images/index_application_img.png" width="40" height="40"/></div>
<div class="index_application_show_tabs_content_text">组织结构组织结构</div> <div class="index_application_show_tabs_content_text">组织结构组织结构</div>
...@@ -283,7 +283,7 @@ a{ ...@@ -283,7 +283,7 @@ a{
<div class="index_application_show_tabs_content_text">(用户安装)</div> <div class="index_application_show_tabs_content_text">(用户安装)</div>
<div class="index_application_show_tabs_content_img" style="background:#1887f6;" onclick="index_application_isLoad(this)"><img src="${ctx}/custom/images/index_application_load.png" width="16" height="16"/><span>安装</span></div> <div class="index_application_show_tabs_content_img" style="background:#1887f6;" onclick="index_application_isLoad(this)"><img src="${ctx}/custom/images/index_application_load.png" width="16" height="16"/><span>安装</span></div>
</div> </div>
</div> </div> --%>
</div> </div>
</div> </div>
...@@ -303,44 +303,22 @@ $(function(){ ...@@ -303,44 +303,22 @@ $(function(){
init_index_categorys(); init_index_categorys();
//初始化apps //初始化apps
//init_index_apps(); init_index_apps();
//左边导航的切换 //左边导航的切换
$('.index_application_left>div').bind('click',function(){ $('.index_application_left>div').bind('click',function(){
$('.index_application_left_click').toggleClass('index_application_left_click'); $('.index_application_left_click').toggleClass('index_application_left_click');
$(this).addClass('index_application_left_click'); $(this).addClass('index_application_left_click');
switch ($(this).find('span').eq(0).text()) { //apps的切换
case '全部应用': index_application_toggle();
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
})
break;
case '未安装':
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
if($(element).find('.index_application_show_tabs_content_img').find('span').text()!='安装'){
$(element).hide();
}
})
break;
case '已安装':
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
if($(element).find('.index_application_show_tabs_content_img').find('span').text()!='卸载'){
$(element).hide();
}
})
break;
default:
break;
}
}) })
//右边导航的切换 //右边导航的切换
$('.index_application_show_tabs>span').bind('click',function(){ $('.index_application_show_tabs>span').bind('click',function(){
$('.index_application_show_tabs_click').toggleClass('index_application_show_tabs_click'); $('.index_application_show_tabs_click').toggleClass('index_application_show_tabs_click');
$(this).addClass('index_application_show_tabs_click'); $(this).addClass('index_application_show_tabs_click');
//apps的切换
index_application_toggle();
}) })
}) })
...@@ -361,6 +339,10 @@ function index_application_isLoad(handler){ ...@@ -361,6 +339,10 @@ function index_application_isLoad(handler){
$(handler).parent().parent().hide(); $(handler).parent().parent().hide();
} }
//保存到数据库
jwAppAppsModel.jwAppsAppsActAction.insert_unInstallApp_byResourceId({
RESOURCE_ID:$(handler).parent().parent().data('app').RESOURCE_ID
});
$('.fancybox-iframe',window.parent.document).parent().parent().parent().find('.fancybox-close').unbind().bind('click',function(event){ $('.fancybox-iframe',window.parent.document).parent().parent().parent().find('.fancybox-close').unbind().bind('click',function(event){
event.stopPropagation(); event.stopPropagation();
...@@ -411,7 +393,97 @@ function index_application_close(){ ...@@ -411,7 +393,97 @@ function index_application_close(){
//初始化类别 //初始化类别
function init_index_categorys(){ function init_index_categorys(){
console.log(list_allApps) var list_category = list_allApps.types;
var index_application_show_tabs = $('.index_application_show_tabs');
index_application_show_tabs.append('<span class="index_application_show_tabs_click">全部应用</span>');
for(var i = 0 ; i<list_category.length;i++){
var span = $('<span></span>').data('type',list_category[i]).text(list_category[i].NAME);
index_application_show_tabs.append(span);
}
} }
//初始化apps
function init_index_apps(){
var apps = list_allApps.apps.rowSet;
var appsContainer = $('.index_application_show_tabs_content');
//获得默认应用的id
var default_appId;
$('.index_application_show_tabs>span').each(function(index,element){
if($(element).text()=='默认应用'){
default_appId =$(element).data('type').CATEGORY_ID;
}
})
for(var i=0;i<apps.length;i++){
var createContainer = $('<div></div>').data('app',apps[i]);
appsContainer.append(createContainer);
var index_application_show_tabs_content_div= $('<div class="index_application_show_tabs_content_div"></div>');
createContainer.append(index_application_show_tabs_content_div);
var app_img = $('<div><img src="'+ctx+'/custom/images/index_application_img.png" width="40" height="40"/></div>');
var app_text1=$('<div class="index_application_show_tabs_content_text"></div>').text(apps[i].NAME);
var app_text2=$('<div class="index_application_show_tabs_content_text" style="margin-top:2px;"></div>');
//判断是用户安装的还是系统自带的
if(apps[i].CATEGORY==default_appId){
app_text2.text('(默认安装) ');
}
else{
app_text2.text('(用户安装 )');
}
var app_isInstall = $('<div class="index_application_show_tabs_content_img" onclick="index_application_isLoad(this)"><img src="'+ ctx +'/custom/images/index_application_unLoad.png" width="16" height="16"/><span>卸载</span></div>');
//判断是否卸载
if(!apps[i].USERID){
app_isInstall.css('background','#1887f6');
app_isInstall.find('img').attr('src',ctx+'/custom/images/index_application_load.png');
app_isInstall.find('span').text('安装');
}
index_application_show_tabs_content_div.append(app_img).append(app_text1).append(app_text2).append(app_isInstall);
}
}
//apps的切换
function index_application_toggle(){
var type = $('.index_application_show_tabs_click').data('type');
switch ($('.index_application_left_click>span:first-child').text()) {
case '全部应用':
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
if(type&&type.CATEGORY_ID!=$(element).data('app').CATEGORY){
$(element).hide();
}
})
break;
case '未安装':
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
//隐藏已经安装的
if($(element).data('app').USERID){
$(element).hide();
}
//再隐藏不符合tabs的
else{
if(type&&type.CATEGORY_ID!=$(element).data('app').CATEGORY){
$(element).hide();
}
}
})
break;
case '已安装':
$('.index_application_show_tabs_content>div').each(function(index,element){
$(element).show();
//隐藏未安装的
if(!$(element).data('app').USERID){
$(element).hide();
}
//再隐藏不符合tabs的
else{
if(type&&type.CATEGORY_ID!=$(element).data('app').CATEGORY){
$(element).hide();
}
}
})
break;
default:
break;
}
}
</script> </script>
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<title>首页</title> <title>首页</title>
<jsp:include page="header.jsp"></jsp:include> <jsp:include page="header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/apps/js/jwAppAppsModule.js" charset="utf-8"></script>
<script src="${ctx}/jfcas04/js/index.js"></script> <script src="${ctx}/jfcas04/js/index.js"></script>
</head> </head>
<body> <body>
...@@ -223,7 +224,7 @@ ...@@ -223,7 +224,7 @@
</div> </div>
<div class="index_module_noMoveContainer"> <div class="index_module_noMoveContainer">
<div class="index_container_application_text"> <div class="index_container_application_text">
<div><img src="${ctx}/custom/images/index4_yonghu.png" width="58" height="46" /><span>同一用户管理系统</span></div> <%-- <div><img src="${ctx}/custom/images/index4_yonghu.png" width="58" height="46" /><span>同一用户管理系统</span></div>
<div><img src="${ctx}/custom/images/index4_ziyuan.png" width="46" height="46" /><span>资源综合管理系统</span></div> <div><img src="${ctx}/custom/images/index4_ziyuan.png" width="46" height="46" /><span>资源综合管理系统</span></div>
<div><img src="${ctx}/custom/images/index4_wangz.png" width="49" height="46" /><span>网站建站系统</span></div> <div><img src="${ctx}/custom/images/index4_wangz.png" width="49" height="46" /><span>网站建站系统</span></div>
<div><img src="${ctx}/custom/images/index4_kec.png" width="46" height="46" /><span>课程教学系统</span></div> <div><img src="${ctx}/custom/images/index4_kec.png" width="46" height="46" /><span>课程教学系统</span></div>
...@@ -232,7 +233,7 @@ ...@@ -232,7 +233,7 @@
<div><img src="${ctx}/custom/images/index4_ziyuan1.png" width="46" height="46" /><span>资源综合管理系统</span></div> <div><img src="${ctx}/custom/images/index4_ziyuan1.png" width="46" height="46" /><span>资源综合管理系统</span></div>
<div><img src="${ctx}/custom/images/index4_wangz1.png" width="49" height="46" /><span>网站建站系统</span></div> <div><img src="${ctx}/custom/images/index4_wangz1.png" width="49" height="46" /><span>网站建站系统</span></div>
<div><img src="${ctx}/custom/images/index4_kec1.png" width="46" height="46" /><span>课程教学系统</span></div> <div><img src="${ctx}/custom/images/index4_kec1.png" width="46" height="46" /><span>课程教学系统</span></div>
<div style="margin-right:0"><img src="${ctx}/custom/images/index4_wend.png " width="40" height="46" /><span>文档管理系统</span></div> <div style="margin-right:0"><img src="${ctx}/custom/images/index4_wend.png " width="40" height="46" /><span>文档管理系统</span></div> --%>
</div> </div>
</div> </div>
</div> </div>
......
//全局存放下拉框的数据 //全局存放下拉框的数据
var index_module_selectData ; var index_module_selectData ;
$(function(){ $(function(){
//页面加载时给全局变量赋值 //页面加载时给全局变量赋值
index_module_selectData=jwAppPortletModel.jwAppsPortletDataAction.listAllPTemplate({FIELD_COLUMN_ID:$('.layout_center_navClick').data('uuid')}).rowSet; index_module_selectData=jwAppPortletModel.jwAppsPortletDataAction.listAllPTemplate({FIELD_COLUMN_ID:$('.layout_center_navClick').data('uuid')}).rowSet;
...@@ -39,6 +40,10 @@ $(function(){ ...@@ -39,6 +40,10 @@ $(function(){
//动态添加新增模块的宽度 //动态添加新增模块的宽度
$('.index_insert_module').css('width',$('.index_footer').width()); $('.index_insert_module').css('width',$('.index_footer').width());
//初始化应用
init_index_application();
}) })
//初始化模块 //初始化模块
...@@ -885,4 +890,26 @@ function index_application(handler){ ...@@ -885,4 +890,26 @@ function index_application(handler){
$.fancybox.open({href:'application.jsp',type: 'iframe',width:$('.index_container').width()}); $.fancybox.open({href:'application.jsp',type: 'iframe',width:$('.index_container').width()});
} }
//初始化应用
function init_index_application(){
var list_allApps = jwAppAppsModel.jwAppsAppsDataAction.list_allApps_by_user({FIELD_COLUMN_ID:$('.layout_center_navClick').data('uuid')}).apps.rowSet;
//把未安装的app过滤掉
var list_insert = [];
for(var j=0;j<list_allApps.length;j++){
if(list_allApps[j].USERID){
list_insert.push(list_allApps[j]);
}
}
for(var i = 0;i<list_insert.length;i++){
var app_container = $('.index_container_application_text');
var app_div = $('<div></div>');
//每隔5个加个样式
if((i+1)%5==0){
app_div.css('marginRight','0');
}
var app_img=$('<img width="46" height="46" />').attr('src',list_insert[i].IMG_ID_S);
var app_span=$('<span></span>').text(list_insert[i].NAME);
app_div.append(app_img).append(app_span);
app_container.append(app_div);
}
}
...@@ -10,9 +10,10 @@ jwAppAppsModel.prototype = BusinessObject; ...@@ -10,9 +10,10 @@ jwAppAppsModel.prototype = BusinessObject;
//获取当前登陆人的所有应用 //获取当前登陆人的所有应用
jwAppAppsModel.prototype.list_allApps_by_user = function(){}; jwAppAppsModel.prototype.list_allApps_by_user = function(){};
/*//获取所有应用的类别 //安装应用
jwAppAppsModel.prototype.list_allCategory = function(){};*/ jwAppAppsModel.prototype.insert_installApp_byResourceId=function(){};
//下载应用
jwAppAppsModel.prototype.insert_unInstallApp_byResourceId=function(){};
//创建一个数据操作对象,然后再后续使用 //创建一个数据操作对象,然后再后续使用
jwAppAppsModel.jwAppsAppsActAction = new jwAppAppsModel("json").delegate("jwAppsAppstoreAct"); jwAppAppsModel.jwAppsAppsActAction = new jwAppAppsModel("json").delegate("jwAppsAppstoreAct");
......
package com.jw.app.apps.action; package com.jw.app.apps.action;
import net.sf.json.JSONObject; import java.util.Map;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.AppsBusiness;
import net.sf.json.JSONObject;
public class actAction extends BasicAction{ public class actAction extends BasicAction{
...@@ -21,4 +27,36 @@ public class actAction extends BasicAction{ ...@@ -21,4 +27,36 @@ public class actAction extends BasicAction{
this.jsonObject = jsonObject; this.jsonObject = jsonObject;
} }
/**
* 根据用户人id和appId来安装应用
* @return
* @throws BusinessException
*/
public String insert_installApp_byResourceId() throws BusinessException{
jsonObject=new JSONObject();
AppsBusiness business = BusinessManager
.getBusiness(AppsBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
query.put("APP_ID", RequestUtils.getString(request, "RESOURCE_ID"));
/*business.insert_installApp_byResourceId();*/
return "json";
}
/**
* 根据用户人id和appId来卸载应用
* @return
* @throws BusinessException
*/
public String insert_unInstallApp_byResourceId() throws BusinessException{
jsonObject=new JSONObject();
AppsBusiness business = BusinessManager
.getBusiness(AppsBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
query.put("RESOURCE_ID", RequestUtils.getString(request, "RESOURCE_ID"));
/*business.insert_unInstallApp_byResourceId();*/
return "json";
}
} }
...@@ -13,4 +13,45 @@ ...@@ -13,4 +13,45 @@
resultType="upperCaseKeyMap"> resultType="upperCaseKeyMap">
SELECT * FROM apps_category SELECT * FROM apps_category
</select> </select>
<delete id="delete_installApp_byResourceId" parameterType="map">
delete from app_install where RESOURCE_ID=#{RESOURCE_ID}
</delete>
<insert id="insert_installApp_byResourceId" parameterType="java.util.List">
insert into app_install(
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
${field.key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
#{field.value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<delete id="delete_unInstallApp_byResourceId" parameterType="map">
delete from apps_uninstall where RESOURCE_ID=#{RESOURCE_ID}
</delete>
<insert id="insert_unInstallApp_byResourceId" parameterType="java.util.List">
insert into apps_uninstall(
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
${field.key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
#{field.value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
</mapper> </mapper>
\ No newline at end of file
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