Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOOD
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
10 years ago
Commit
0c46416625626af8a2f6aae9a50b2e64cff849f0
1 parent
652c9cae
上传图片插件
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
383 additions
and
382 deletions
res/js/admin/news.js
res/js/admin/news.js
View file @
0c46416
/**
* @fileOverview 反馈模块
* @author:Hbomb(zhouqq@yoho.cn)
* @date:2013-05-27
*/
define
(
'admin/news'
,
function
(
require
,
exports
)
{
var
box
=
require
(
'admin/box'
);
// 提示框
var
$
=
require
(
"jquery"
);
var
common
=
require
(
"common"
);
var
upload
=
require
(
'admin/upload'
);
var
json
=
require
(
"lib/util/json"
);
require
(
'lib/ui/jquery.form'
);
$
(
"#choose_tag"
).
bind
(
"change"
,
function
()
{
var
tag
=
$
(
this
).
val
();
window
.
location
.
href
=
"/admin/news/index/tag/"
+
tag
;
});
//绑定统一的AJAX页面操作
$
(
'button[model="ajax"]'
).
click
(
function
()
{
var
href
=
$
(
this
).
attr
(
'href'
);
if
(
href
)
{
box
.
confirm
(
'加载中...'
,
''
,{
title
:
'编辑信息'
,
'showFooter'
:
false
,
width
:
"700px"
});
$
.
ajax
({
dataType
:
'html'
,
url
:
href
,
data
:{
rand
:
Math
.
random
()},
success
:
function
(
html
)
{
$
(
'#confirm_message'
).
html
(
html
);
initPicUp
();
}
});
}
});
$
(
'.del'
).
click
(
function
(){
var
href
=
$
(
this
).
attr
(
'href'
);
box
.
confirm
(
'确定删除?'
,
function
()
{
$
.
post
(
href
,
function
(
html
)
{
location
.
reload
();
})
});
});
function
init_upload
(
id
,
callback
,
setting
)
{
var
defaultSetting
=
{
button_placeholder_id
:
id
,
button_width
:
"58"
,
button_height
:
"30"
,
post_params
:
{
'key'
:
$
(
'#'
+
id
).
attr
(
'key'
),
'format'
:
'json'
},
custom_settings
:
{
saveCallback
:
callback
}
};
if
(
setting
)
{
$
.
extend
(
defaultSetting
,
setting
);
}
//绑定上传背景按钮
upload
.
init
(
defaultSetting
);
}
function
initPicUp
()
{
init_upload
(
'upload_pic_list'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0100x0100"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#pic_list"
).
append
(
"<img class='pic_list_thumb img-polaroid' style='margin-left:10px;' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"' width='100' height='100'/>"
+
"<i class='icon-remove remove_pic_list' style='margin-top:-50px;margin-left:-10px;cursor:pointer;'></i>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
},
{
button_width
:
"100"
,
button_height
:
"30"
});
init_upload
(
'upload_pic'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0140x0060"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#thumb"
).
val
(
realPath
);
$
(
"#picdiv"
).
html
(
"<img class='thumb_but' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"'>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
}
);
init_upload
(
'client_upload_pic'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0140x0060"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#client_thumb"
).
val
(
realPath
);
$
(
"#clientpicdiv"
).
html
(
"<img class='thumb_but' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"'>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
}
);
}
//创建/更新初始化
exports
.
create
=
function
()
{
var
form_html
=
$
(
"#form_pan"
).
html
();
var
drag_img
=
""
;
var
drag_offset
=
0
;
var
drag_end
=
0
;
$
(
"#form_pan"
).
remove
();
initPicUp
();
//初始化上传
$
(
'.typeahead'
).
typeahead
();
//开始拖动
$
(
".pic_list_thumb"
).
live
(
"dragstart"
,
function
(
event
)
{
event
.
stopPropagation
();
drag_offset
=
$
(
this
).
offset
().
left
;
});
//拖动结束
$
(
".pic_list_thumb"
).
live
(
"dragleave"
,
function
(
event
)
{
event
.
preventDefault
();
event
.
stopPropagation
();
drag_end
=
$
(
this
).
offset
().
left
;
var
pic_start
=
$
(
".pic_list_thumb:eq(0)"
).
offset
().
left
;
var
size
=
$
(
".pic_list_thumb"
).
size
();
var
pic_end
=
$
(
".pic_list_thumb"
).
eq
(
size
-
1
).
offset
().
left
;
var
drag_pic_pos
=
(
drag_offset
-
pic_start
)
/
110
;
var
drag_pic_end_pos
=
(
drag_end
-
pic_start
)
/
110
;
if
(
size
>
1
&&
drag_pic_end_pos
!=
drag_pic_pos
)
{
var
prev_val
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
(
"val"
);
var
prev_src
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
(
"src"
);
var
last_val
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
(
"val"
);
var
last_src
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
(
"src"
);
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
({
"val"
:
last_val
,
"src"
:
last_src
});
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
({
"val"
:
prev_val
,
"src"
:
prev_src
});
}
});
//删除图片
$
(
".remove_pic_list"
).
live
(
"click"
,
function
()
{
$
(
this
).
prev
().
remove
();
$
(
this
).
remove
();
});
//保存内容
$
(
'#saveinfo'
).
submit
(
function
()
{
var
pics
=
''
,
brands
=
''
;
$
(
'.pic_list_thumb'
).
each
(
function
(
k
,
v
)
{
pics
+=
$
(
v
).
attr
(
"val"
)
+
"|"
;
});
$
(
"input[name=pics]"
).
val
(
pics
);
$
.
each
(
$
(
"#brand_list"
).
children
(),
function
(
k
,
v
)
{
brands
+=
$
(
v
).
attr
(
"val"
)
+
"|"
;
});
$
(
"input[name=brands]"
).
val
(
brands
);
$
(
this
).
ajaxSubmit
({
beforeSend
:
function
()
{
var
title
=
$
(
'#title'
).
val
()
;
var
content
=
$
(
'#content'
).
val
()
;
var
pic_list_thumb
=
$
(
'.pic_list_thumb'
);
var
main_title
=
$
(
'#main_title'
).
val
();
var
thumb
=
$
(
"#thumb"
).
val
();
var
tag
=
$
(
"#tag"
).
val
();
if
(
title
==
''
)
{
box
.
alert
(
'填写标题哎!'
);
return
false
;
}
if
(
main_title
==
''
)
{
box
.
alert
(
"填写主标题哎!"
)
}
if
(
content
==
''
)
{
box
.
alert
(
'填写内容哦!'
);
return
false
;
}
if
(
thumb
==
''
)
{
box
.
alert
(
'给张缩略图吧!'
);
return
false
;
}
content
=
'<div id="temp">'
+
content
+
'</div>'
;
if
((
tag
==
"视频"
||
tag
==
"手机视频"
)
&&
$
(
content
).
find
(
"embed"
).
size
()
<=
0
)
{
box
.
alert
(
'天啊,视频呢!'
);
return
false
;
}
/*if($(content).find("img").size()<=0 && $(content).find("embed").size()<=0)
{
box.alert('天啊,内容没图,求图啊!');
return false ;
}*/
},
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
location
.
href
=
data
.
data
.
url
;
}
else
{
box
.
alert
(
data
.
message
);
}
}
});
return
false
;
});
/**
* 添加品牌
*
* @method addBrand
* @param [object] obj
*/
function
addBrand
(
obj
)
{
var
flag
=
1
;
//是否重复添加
$
.
each
(
$
(
"#add_brand_list"
).
find
(
".btn"
),
function
(
i
,
v
)
{
if
(
$
(
v
).
attr
(
"val"
)
==
obj
.
attr
(
"val"
))
{
flag
=
0
;
return
true
;
}
});
if
(
flag
)
{
$
(
"#add_brand_list"
).
append
(
'<a class="btn" href="#" val="'
+
obj
.
attr
(
"val"
)
+
'">'
+
obj
.
text
()
+
'<i class="icon-remove remove_brand"></i></a>'
);
}
}
//删除品牌
$
(
".remove_brand"
).
live
(
"click"
,
function
()
{
$
(
this
).
parent
().
remove
();
});
/*
* 添加品牌对话框
* 功能:包含相关操作
*/
$
(
"#add_brand_dialog"
).
bind
(
"click"
,
function
()
{
box
.
confirm
(
form_html
,
function
()
{
//添加列表给显示列表
$
(
"#brand_list"
).
html
(
$
(
"#add_brand_list"
).
html
());
$
(
"#box_confirm"
).
modal
(
"hide"
);
},
{
title
:
'添加品牌'
,
width
:
'800px'
,
autoClose
:
false
}
);
//显示列表给添加列表
$
(
"#add_brand_list"
).
html
(
$
(
"#brand_list"
).
html
());
$
.
ajax
({
url
:
"/admin/brand/getallbrand"
,
type
:
"get"
,
success
:
function
(
data
)
{
var
html
=
'{table}'
;
var
table
=
''
;
$
.
each
(
data
.
data
,
function
(
k
,
val
)
{
table
+=
'<tr><td style="width:100px;">'
+
k
+
'</td><td>'
;
$
.
each
(
val
,
function
(
k2
,
v
)
{
table
+=
'<a class="btn btn_brand" href="#" val="'
+
v
.
id
+
'">'
+
v
.
name
+
'</a>'
;
});
table
+=
"</td></tr>"
;
});
$
(
"#brand_select"
).
append
(
html
.
replace
(
"{table}"
,
table
));
}
});
//添加品牌
$
(
".btn_brand"
).
live
(
"click"
,
function
()
{
addBrand
(
$
(
this
));
});
//输入框添加品牌
$
(
"#add_brand"
).
bind
(
"click"
,
function
()
{
var
brand_name
=
$
.
trim
(
$
(
"input[name=brand_name]"
).
val
());
var
flag
=
1
;
if
(
brand_name
!=
""
)
{
$
(
".btn_brand"
).
each
(
function
(
k
,
v
)
{
v
=
$
(
v
);
if
(
v
.
text
().
toLowerCase
()
==
brand_name
.
toLowerCase
())
{
addBrand
(
v
);
flag
=
0
;
$
(
"input[name=brand_name]"
).
val
(
""
);
return
true
;
}
});
if
(
flag
)
{
box
.
alert
(
"品牌不存在"
);
}
}
});
});
}
//手机模块设置
exports
.
mobile
=
function
()
{
$
(
".open_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
1
);
});
$
(
".close_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
0
);
});
$
(
".wait_open_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
2
);
});
function
setModuleStatus
(
id
,
status
)
{
$
.
ajax
({
url
:
"/admin/mobile/setmodulestatus"
,
type
:
"post"
,
data
:{
id
:
id
,
status
:
status
},
success
:
function
(
data
)
{
if
(
data
.
status
)
{
window
.
location
.
reload
();
}
else
{
alert
(
"设置失败"
);
}
}
});
}
}
});
/**
* @fileOverview 反馈模块
* @author:Hbomb(zhouqq@yoho.cn)
* @date:2013-05-27
*/
define
(
'admin/news'
,
function
(
require
,
exports
)
{
var
box
=
require
(
'admin/box'
);
// 提示框
var
$
=
require
(
"jquery"
);
var
common
=
require
(
"common"
);
var
upload
=
require
(
'admin/upload'
);
var
json
=
require
(
"lib/util/json"
);
require
(
'lib/ui/jquery.form'
);
$
(
"#choose_tag"
).
bind
(
"change"
,
function
()
{
var
tag
=
$
(
this
).
val
();
window
.
location
.
href
=
"/admin/news/index/tag/"
+
tag
;
});
//绑定统一的AJAX页面操作
$
(
'button[model="ajax"]'
).
click
(
function
()
{
var
href
=
$
(
this
).
attr
(
'href'
);
if
(
href
)
{
box
.
confirm
(
'加载中...'
,
''
,{
title
:
'编辑信息'
,
'showFooter'
:
false
,
width
:
"700px"
});
$
.
ajax
({
dataType
:
'html'
,
url
:
href
,
data
:{
rand
:
Math
.
random
()},
success
:
function
(
html
)
{
$
(
'#confirm_message'
).
html
(
html
);
initPicUp
();
}
});
}
});
$
(
'.del'
).
click
(
function
(){
var
href
=
$
(
this
).
attr
(
'href'
);
box
.
confirm
(
'确定删除?'
,
function
()
{
$
.
post
(
href
,
function
(
html
)
{
location
.
reload
();
})
});
});
function
init_upload
(
id
,
callback
,
setting
)
{
var
defaultSetting
=
{
button_placeholder_id
:
id
,
button_width
:
"58"
,
button_height
:
"30"
,
post_params
:
{
'key'
:
$
(
'#'
+
id
).
attr
(
'key'
),
'format'
:
'json'
},
file_queue_limit
:
50
,
custom_settings
:
{
saveCallback
:
callback
}
};
if
(
setting
)
{
$
.
extend
(
defaultSetting
,
setting
);
}
//绑定上传背景按钮
upload
.
init
(
defaultSetting
);
}
function
initPicUp
()
{
init_upload
(
'upload_pic_list'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0100x0100"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#pic_list"
).
append
(
"<img class='pic_list_thumb img-polaroid' style='margin-left:10px;' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"' width='100' height='100'/>"
+
"<i class='icon-remove remove_pic_list' style='margin-top:-50px;margin-left:-10px;cursor:pointer;'></i>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
},
{
button_width
:
"100"
,
button_height
:
"30"
});
init_upload
(
'upload_pic'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0140x0060"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#thumb"
).
val
(
realPath
);
$
(
"#picdiv"
).
html
(
"<img class='thumb_but' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"'>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
}
);
init_upload
(
'client_upload_pic'
,
function
(
response
,
swf
)
{
if
(
response
.
code
==
12
)
{
var
thumbPath
=
common
.
getImages
(
response
.
data
.
file
.
relaPath
,
"0140x0060"
,
"blogimg"
,
"primary"
);
var
realPath
=
response
.
data
.
file
.
relaPath
;
$
(
"#client_thumb"
).
val
(
realPath
);
$
(
"#clientpicdiv"
).
html
(
"<img class='thumb_but' val='"
+
realPath
+
"' src='"
+
thumbPath
+
"'>"
);
}
else
{
box
.
alert
(
response
.
message
);
}
}
);
}
//创建/更新初始化
exports
.
create
=
function
()
{
var
form_html
=
$
(
"#form_pan"
).
html
();
var
drag_img
=
""
;
var
drag_offset
=
0
;
var
drag_end
=
0
;
$
(
"#form_pan"
).
remove
();
initPicUp
();
//初始化上传
$
(
'.typeahead'
).
typeahead
();
//开始拖动
$
(
".pic_list_thumb"
).
live
(
"dragstart"
,
function
(
event
)
{
event
.
stopPropagation
();
drag_offset
=
$
(
this
).
offset
().
left
;
});
//拖动结束
$
(
".pic_list_thumb"
).
live
(
"dragleave"
,
function
(
event
)
{
event
.
preventDefault
();
event
.
stopPropagation
();
drag_end
=
$
(
this
).
offset
().
left
;
var
pic_start
=
$
(
".pic_list_thumb:eq(0)"
).
offset
().
left
;
var
size
=
$
(
".pic_list_thumb"
).
size
();
var
pic_end
=
$
(
".pic_list_thumb"
).
eq
(
size
-
1
).
offset
().
left
;
var
drag_pic_pos
=
(
drag_offset
-
pic_start
)
/
110
;
var
drag_pic_end_pos
=
(
drag_end
-
pic_start
)
/
110
;
if
(
size
>
1
&&
drag_pic_end_pos
!=
drag_pic_pos
)
{
var
prev_val
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
(
"val"
);
var
prev_src
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
(
"src"
);
var
last_val
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
(
"val"
);
var
last_src
=
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
(
"src"
);
$
(
".pic_list_thumb"
).
eq
(
drag_pic_pos
).
attr
({
"val"
:
last_val
,
"src"
:
last_src
});
$
(
".pic_list_thumb"
).
eq
(
drag_pic_end_pos
).
attr
({
"val"
:
prev_val
,
"src"
:
prev_src
});
}
});
//删除图片
$
(
".remove_pic_list"
).
live
(
"click"
,
function
()
{
$
(
this
).
prev
().
remove
();
$
(
this
).
remove
();
});
//保存内容
$
(
'#saveinfo'
).
submit
(
function
()
{
var
pics
=
''
,
brands
=
''
;
$
(
'.pic_list_thumb'
).
each
(
function
(
k
,
v
)
{
pics
+=
$
(
v
).
attr
(
"val"
)
+
"|"
;
});
$
(
"input[name=pics]"
).
val
(
pics
);
$
.
each
(
$
(
"#brand_list"
).
children
(),
function
(
k
,
v
)
{
brands
+=
$
(
v
).
attr
(
"val"
)
+
"|"
;
});
$
(
"input[name=brands]"
).
val
(
brands
);
$
(
this
).
ajaxSubmit
({
beforeSend
:
function
()
{
var
title
=
$
(
'#title'
).
val
()
;
var
content
=
$
(
'#content'
).
val
()
;
var
pic_list_thumb
=
$
(
'.pic_list_thumb'
);
var
main_title
=
$
(
'#main_title'
).
val
();
var
thumb
=
$
(
"#thumb"
).
val
();
var
tag
=
$
(
"#tag"
).
val
();
if
(
title
==
''
)
{
box
.
alert
(
'填写标题哎!'
);
return
false
;
}
if
(
main_title
==
''
)
{
box
.
alert
(
"填写主标题哎!"
)
}
if
(
content
==
''
)
{
box
.
alert
(
'填写内容哦!'
);
return
false
;
}
if
(
thumb
==
''
)
{
box
.
alert
(
'给张缩略图吧!'
);
return
false
;
}
content
=
'<div id="temp">'
+
content
+
'</div>'
;
if
((
tag
==
"视频"
||
tag
==
"手机视频"
)
&&
$
(
content
).
find
(
"embed"
).
size
()
<=
0
)
{
box
.
alert
(
'天啊,视频呢!'
);
return
false
;
}
/*if($(content).find("img").size()<=0 && $(content).find("embed").size()<=0)
{
box.alert('天啊,内容没图,求图啊!');
return false ;
}*/
},
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
location
.
href
=
data
.
data
.
url
;
}
else
{
box
.
alert
(
data
.
message
);
}
}
});
return
false
;
});
/**
* 添加品牌
*
* @method addBrand
* @param [object] obj
*/
function
addBrand
(
obj
)
{
var
flag
=
1
;
//是否重复添加
$
.
each
(
$
(
"#add_brand_list"
).
find
(
".btn"
),
function
(
i
,
v
)
{
if
(
$
(
v
).
attr
(
"val"
)
==
obj
.
attr
(
"val"
))
{
flag
=
0
;
return
true
;
}
});
if
(
flag
)
{
$
(
"#add_brand_list"
).
append
(
'<a class="btn" href="#" val="'
+
obj
.
attr
(
"val"
)
+
'">'
+
obj
.
text
()
+
'<i class="icon-remove remove_brand"></i></a>'
);
}
}
//删除品牌
$
(
".remove_brand"
).
live
(
"click"
,
function
()
{
$
(
this
).
parent
().
remove
();
});
/*
* 添加品牌对话框
* 功能:包含相关操作
*/
$
(
"#add_brand_dialog"
).
bind
(
"click"
,
function
()
{
box
.
confirm
(
form_html
,
function
()
{
//添加列表给显示列表
$
(
"#brand_list"
).
html
(
$
(
"#add_brand_list"
).
html
());
$
(
"#box_confirm"
).
modal
(
"hide"
);
},
{
title
:
'添加品牌'
,
width
:
'800px'
,
autoClose
:
false
}
);
//显示列表给添加列表
$
(
"#add_brand_list"
).
html
(
$
(
"#brand_list"
).
html
());
$
.
ajax
({
url
:
"/admin/brand/getallbrand"
,
type
:
"get"
,
success
:
function
(
data
)
{
var
html
=
'{table}'
;
var
table
=
''
;
$
.
each
(
data
.
data
,
function
(
k
,
val
)
{
table
+=
'<tr><td style="width:100px;">'
+
k
+
'</td><td>'
;
$
.
each
(
val
,
function
(
k2
,
v
)
{
table
+=
'<a class="btn btn_brand" href="#" val="'
+
v
.
id
+
'">'
+
v
.
name
+
'</a>'
;
});
table
+=
"</td></tr>"
;
});
$
(
"#brand_select"
).
append
(
html
.
replace
(
"{table}"
,
table
));
}
});
//添加品牌
$
(
".btn_brand"
).
live
(
"click"
,
function
()
{
addBrand
(
$
(
this
));
});
//输入框添加品牌
$
(
"#add_brand"
).
bind
(
"click"
,
function
()
{
var
brand_name
=
$
.
trim
(
$
(
"input[name=brand_name]"
).
val
());
var
flag
=
1
;
if
(
brand_name
!=
""
)
{
$
(
".btn_brand"
).
each
(
function
(
k
,
v
)
{
v
=
$
(
v
);
if
(
v
.
text
().
toLowerCase
()
==
brand_name
.
toLowerCase
())
{
addBrand
(
v
);
flag
=
0
;
$
(
"input[name=brand_name]"
).
val
(
""
);
return
true
;
}
});
if
(
flag
)
{
box
.
alert
(
"品牌不存在"
);
}
}
});
});
}
//手机模块设置
exports
.
mobile
=
function
()
{
$
(
".open_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
1
);
});
$
(
".close_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
0
);
});
$
(
".wait_open_status"
).
bind
(
"click"
,
function
()
{
var
module_id
=
$
(
this
).
attr
(
"module_id"
);
setModuleStatus
(
module_id
,
2
);
});
function
setModuleStatus
(
id
,
status
)
{
$
.
ajax
({
url
:
"/admin/mobile/setmodulestatus"
,
type
:
"post"
,
data
:{
id
:
id
,
status
:
status
},
success
:
function
(
data
)
{
if
(
data
.
status
)
{
window
.
location
.
reload
();
}
else
{
alert
(
"设置失败"
);
}
}
});
}
}
});
...
...
Please
register
or
login
to post a comment