Ext 里面增加一个click function

productsPic.js

Ext.namespace("ast.ast1949.admin.productsPic");

ast.ast1949.admin.productsPic.imageView = Ext.extend(Ext.Panel,{
constructor:function(config){
config = config||{};
Ext.apply(this,config);

    var _imgStore = this.imageStore;
    var _xtpl = this.xtpl;

// var _imgRecord = this.imageRecord;
var c={
id:'images-view',
autoScroll:true,
items:new Ext.DataView({
store:_imgStore,
tpl:_xtpl,
multiSelect:true,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText:"没有图片"
})
,
tbar:[
" 注意: Ctrl+左键 可以复选哟! ",{
iconCls:"item-true",
text:"通过选中图片",
scope:this,
handler:function(btn){
var imgview = Ext.getCmp("images-view").getComponent(0);
var selectedrecords = imgview.getSelectedRecords()
if(selectedrecords.length==0){
return ;
}
var _ids = new Array();
for (var i=0,len = selectedrecords.length;i<len;i++){
var _id=selectedrecords[i].get("id");
_ids.push(_id);
}
Ext.Ajax.request({
url:Context.ROOT + Context.PATH + "/admin/good/passPic.htm",
params:{"idArrayStr":_ids.join(","),"unpassReason":Ext.get("batchReason").dom.value,"status":1},
success:function(response,opt){
var obj = Ext.decode(response.responseText);
if(obj.success){
imgview.getStore().reload();
}else{
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
},
failure:function(response,opt){
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
});
}
},{
iconCls:"item-false",
text:"退回选中图片",
scope:this,
handler:function(btn){
var imgview = Ext.getCmp("images-view").getComponent(0);
var selectedrecords = imgview.getSelectedRecords()
if(selectedrecords.length==0){
return ;
}
var _ids = new Array();
for (var i=0,len = selectedrecords.length;i<len;i++){
var _id=selectedrecords[i].get("id");
_ids.push(_id);
}
var unpassReason = Ext.get("batchReason").dom.value;
Ext.Ajax.request({
url:Context.ROOT + Context.PATH + "/admin/good/passPic.htm",
params:{"idArrayStr":_ids.join(","),"unpassReason":unpassReason,"productId":Ext.getCmp("id").value,"status":2},
success:function(response,opt){
var obj = Ext.decode(response.responseText);
if(obj.success){
imgview.getStore().reload();
}else{
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
},
failure:function(response,opt){
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
});
}
},{
iconCls:"item-edit",
text:"添加水印",
scope:this,
handler:function(btn){
var imgview = Ext.getCmp("images-view").getComponent(0);
var selectedrecords = imgview.getSelectedRecords()
if(selectedrecords.length==0){
return ;
}
Ext.MessageBox.confirm(Context.MSG_TITLE,"确定要给图片添加水印吗?",function(btn){
if(btn!="yes"){
return ;
}
var _ids = new Array();
for (var i=0,len = selectedrecords.length;i<len;i++){
var _id=selectedrecords[i].get("id");
_ids.push(_id);
}
Ext.Ajax.request({
url:Context.ROOT + Context.PATH + "/admin/good/markPic.htm",
params:{"picId":_ids.join(",")},
success:function(response,opt){
var obj = Ext.decode(response.responseText);
if(obj.success){
newwin=window.open("http://apps2.zz91.com/task/job/definition/doTask.htm?jobName=pic_mark_tzs&start="+new Date().add(Date.DAY, 1).format("Y-m-d")+" 00:00:00")
setTimeout(function(){
newwin.close();
},100);
imgview.getStore().reload();

// Ext.Ajax.request({
// url:"http://apps1.zz91.com/task/job/definition/doTask.htm",
// params:{
// "jobName":"pic_mark_tzs",
// "start":new Date().add(Date.DAY, 1).format("Y-m-d")+" 00:00:00"
// },
// success:function(response,opt){
// Ext.MessageBox.show({
// title : Context.MSG_TITLE,
// msg : "成功!",
// buttons : Ext.MessageBox.OK,
// icon : Ext.MessageBox.INFO
// });
// }
// });
}else{
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
},
failure:function(response,opt){
Ext.MessageBox.show({
title : Context.MSG_TITLE,
msg : "发生错误,没有读取图片信息",
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
});

                });
            }
        },"->",
        {   
            xtype:"combo",
            width : 600,
            emptyText: '审核不过原因',
            triggerAction : "all",
            forceSelection : true,
            displayField : "label",
            valueField : "code",
            id : "batchReason",
            name:"reason",
            store:new Ext.data.JsonStore( {
                root : "records",
                fields : [ "label", "code" ],
                autoLoad:true,
                url : Context.ROOT + Context.PATH + "/admin/category/getChildListByMem.htm?parentCode=1012"
            })
        }
        ]
    };

    ast.ast1949.admin.productsPic.imageView.superclass.constructor.call(this,c);

// this.get(0).on("dblclick",function(view,index,node,e){
//// var viewstore=view.getStore();
//// alert(Ext.get(node).child(".thumb img").dom.src)
// window.open(Ext.get(node).child(".thumb img").dom.src)
// });
},
// porductId:0,
//xtemplate,图片展现模板
xtpl:new Ext.XTemplate('',
'

',
'
',
'未审核',
'通过',
'退回',
'
',
'',
'

'
),
imageStore:new Ext.data.JsonStore({
url: Context.ROOT+Context.PATH+'/admin/good/listGoodsPic.htm',
// scope:this,
// params:{"productId":this.productId},
root: 'records',
fields: [
'id','productId','picAddress','name','status','unpassReason'
]
})
// ,
// imageRecord:Ext.data.Record.create(['id','productId','picAddress','name'])
});
我想给productsPic.js里的img增加一个click事件或者function 怎么做?

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!