123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- $(function()
- {
- /* 搜索切换 */
- var $more_where = $('.more-where');
- $more_submit = $('.more-submit');
- $more_submit.find('input[name="is_more"]').change(function()
- {
- if($more_submit.find('i').hasClass('am-icon-angle-down'))
- {
- $more_submit.find('i').removeClass('am-icon-angle-down');
- $more_submit.find('i').addClass('am-icon-angle-up');
- } else {
- $more_submit.find('i').addClass('am-icon-angle-down');
- $more_submit.find('i').removeClass('am-icon-angle-up');
- }
-
- if($more_submit.find('input[name="is_more"]:checked').val() == undefined)
- {
- $more_where.addClass('none');
- } else {
- $more_where.removeClass('none');
- }
- });
- // 日期选择
- var $time_start = $('#time_start');
- var $time_end = $('#time_end');
- var nowTemp = new Date();
- var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
- var checkin = $time_start.datepicker({}).on('changeDate.datepicker.amui', function(ev) {
- var newDate = new Date(ev.date)
- newDate = (ev.date.valueOf() > checkout.date.valueOf() || ev.date.valueOf() == checkout.date.valueOf()) ? newDate.setDate(newDate.getDate() + 1) : checkout.date.valueOf();
- checkout.setValue(newDate);
-
- checkin.close();
- $time_end[0].blur();
- }).data('amui.datepicker');
- var checkout = $time_end.datepicker({
- onRender:function(date) {
- return date.valueOf() <= checkin.date.valueOf() ? 'am-disabled' : '';
- }
- }).on('changeDate.datepicker.amui', function(ev) {
- checkout.close();
- }).data('amui.datepicker');
- //文件上传
- var uploader = WebUploader.create({
- // 选完文件后,是否自动上传。
- auto: true,
- // 表单文件名称
- fileVal: 'upfile',
- // 文件接收服务端。
- server: '/admin.php?m=Admin&c=Ueditor&a=Index&action=uploadimage',
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#uploader',
- // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
- resize: false,
- });
- //上传成功
- uploader.on( 'uploadSuccess', function( file , response) {
- if(response.state != 'SUCCESS'){
- Prompt(response.state);
- return false;
- }
- var $li = $(
- '<img src="' + response.url + '" alt="" class="am-img-thumbnail">'
- ),
- $img = $li.find('img');
- var $list = $("#fileList");
- // $list为容器jQuery实例
- $list.html( $li );
- $("#thumb").val(response.url);
- });
- // 文件上传失败,显示上传出错。
- uploader.on('uploadError', function( file, response ) {
- Prompt(response.state);
- });
- $('#decorate_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important'
- });
- //专属联动
- $('#decorate_target_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important'
- });
- //有选项初始化
- if($("#decorate_target_id option").length > 1){
- $('#decorate_target_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important'
- });
- }
- if($("#decorate_target_property_id option").length > 1){
- $('#decorate_target_property_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important'
- });
- }
- $('#decorate_target_type_id').on('change', function(){
- var decorate_target_type_id = $(this).val();
- //销毁插件 、 删除选项
- if($("#decorate_target_property_id_chosen").length != 0){
- $("#decorate_target_property_id option:gt(0)").remove();
- $('#decorate_target_property_id').chosen('destroy');
- }
- if($("#decorate_target_id_chosen").length != 0){
- $("#decorate_target_id option:gt(0)").remove();
- $('#decorate_target_id').chosen("destroy");
- }
- //获取数据
- $.get('/admin.php?m=Admin&c=CultureDecorate&a=getDecorateTarget', {decorate_target_type_id : decorate_target_type_id}, function(responsedata){
- if(responsedata.code != 0){
- return false;
- }
- //设置option
- for(x in responsedata.data){
- $("#decorate_target_id").append("<option value='" + responsedata.data[x].id + "'>" + responsedata.data[x].name + "</option>");
- }
- //初始化插件
- $('#decorate_target_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important',
- });
- },'JSON');
- //获取装饰类型数据
- $.get('/admin.php?m=Admin&c=CultureDecorate&a=getDecorateType', {decorate_target_type_id : decorate_target_type_id}, function(responsedata){
- if($("#decorate_type_id_chosen").length != 0){
- $("#decorate_type_id option:gt(0)").remove();
- $('#decorate_type_id').chosen("destroy");
- }
- if(responsedata.code != 0){
- $('#decorate_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important',
- })
- return false;
- }
- //设置option
- for(x in responsedata.data){
- $("#decorate_type_id").append("<option value='" + responsedata.data[x].id + "'>" + responsedata.data[x].name + "</option>");
- }
- //初始化插件
- $('#decorate_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important',
- })
- },'JSON');
- });
- $('#decorate_target_id').on('change', function(){
- var decorate_target_type_id = $("#decorate_target_type_id").val();
- var decorate_target_id = $(this).val();
- //销毁插件 、 删除选项
- if($("#decorate_target_property_id_chosen").length != 0){
- $("#decorate_target_property_id option:gt(0)").remove();
- $('#decorate_target_property_id').chosen('destroy');
- }
- //获取数据
- $.get('/admin.php?m=Admin&c=CultureDecorate&a=getDecorateTargetProperty', {
- decorate_target_type_id : decorate_target_type_id,
- decorate_target_id : decorate_target_id
- }, function(responsedata){
- if(responsedata.code != 0){
- return false;
- }
- //设置option
- for(x in responsedata.data){
- $("#decorate_target_property_id").append("<option value='" + responsedata.data[x].id + "'>" + responsedata.data[x].name + "</option>");
- }
- //初始化插件
- $('#decorate_target_property_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important'
- });
- },'JSON');
- //获取装饰类型数据
- $.get('/admin.php?m=Admin&c=CultureDecorate&a=getDecorateType', {
- decorate_target_type_id : decorate_target_type_id,
- decorate_target_id : decorate_target_id
- }, function(responsedata){
- if($("#decorate_type_id_chosen").length != 0){
- $("#decorate_type_id option:gt(0)").remove();
- $('#decorate_type_id').chosen("destroy");
- }
- if(responsedata.code != 0){
- return false;
- }
- //设置option
- for(x in responsedata.data){
- $("#decorate_type_id").append("<option value='" + responsedata.data[x].id + "'>" + responsedata.data[x].name + "</option>");
- }
- //初始化插件
- $('#decorate_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important',
- })
- },'JSON');
- });
- $('#decorate_target_property_id').on('change', function(){
- var decorate_target_type_id = $("#decorate_target_type_id").val();
- var decorate_target_id = $("#decorate_target_id").val();
- var decorate_target_property_id = $(this).val();
- //获取装饰类型数据
- $.get('/admin.php?m=Admin&c=CultureDecorate&a=getDecorateType', {
- decorate_target_type_id : decorate_target_type_id,
- decorate_target_id : decorate_target_id,
- decorate_target_property_id : decorate_target_property_id
- }, function(responsedata){
- if($("#decorate_type_id_chosen").length != 0){
- $("#decorate_type_id option:gt(0)").remove();
- $('#decorate_type_id').chosen("destroy");
- }
- if(responsedata.code != 0){
- return false;
- }
- //设置option
- for(x in responsedata.data){
- $("#decorate_type_id").append("<option value='" + responsedata.data[x].id + "'>" + responsedata.data[x].name + "</option>");
- }
- //初始化插件
- $('#decorate_type_id').chosen({
- disable_search_threshold: 10,
- no_results_text: '没有选项',
- width: '200px !important',
- })
- },'JSON');
- });
- });
|