Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
82c9fc8b
Commit
82c9fc8b
authored
Oct 14, 2019
by
agping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf上传多张
parent
145ef6a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
9 deletions
+45
-9
shop_edit.js
public/resource/js/shop_edit.js
+45
-9
No files found.
public/resource/js/shop_edit.js
View file @
82c9fc8b
...
@@ -3,6 +3,8 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -3,6 +3,8 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
var
user
=
{
var
user
=
{
del_value_panfang
:
''
,
del_value_panfang
:
''
,
del_value_anchang
:
''
,
del_value_anchang
:
''
,
file_id_str
:
''
,
file_id_arr
:[],
initShopRong
:
false
,
//判断是否是需要加载商圈
initShopRong
:
false
,
//判断是否是需要加载商圈
init
:
function
()
{
init
:
function
()
{
//初始化dot
//初始化dot
...
@@ -41,6 +43,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -41,6 +43,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
_doc
=
$
(
document
),
_doc
=
$
(
document
),
_tpl_landlord_phone1
=
$
(
'#my_tpl_landlord_phone1'
).
html
(),
//手机号码添加的位置模板
_tpl_landlord_phone1
=
$
(
'#my_tpl_landlord_phone1'
).
html
(),
//手机号码添加的位置模板
_urlCut
=
ServerHostImageLiu
+
'/resource/lib/Attachments/images/'
,
//要截取的部分url
_urlCut
=
ServerHostImageLiu
+
'/resource/lib/Attachments/images/'
,
//要截取的部分url
_urlCutPdf
=
ServerHostImageLiu
,
//要截取的部分url
_loadMainItem
=
$
(
'#main_loading_pic'
),
//整个页面的加载图标
_loadMainItem
=
$
(
'#main_loading_pic'
),
//整个页面的加载图标
_shangpuTypeObj
=
$
(
'#shangpuType'
),
//商铺类型
_shangpuTypeObj
=
$
(
'#shangpuType'
),
//商铺类型
_showCdObj
=
$
(
'#showCd'
),
//显示给C端用户看
_showCdObj
=
$
(
'#showCd'
),
//显示给C端用户看
...
@@ -418,10 +421,23 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -418,10 +421,23 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
};
};
//附件
//附件
_data
[
'file_path'
]
&&
_pdfUploadFujian
.
html
(
'<li class="pdf-pre-li"><a class="pdf-pre-a" href="{0}" target="_blank" title="点击查看">{1}</a><a href="javascript:;" class="delet-pic-btn">删除</a></li>'
.
stringFormatObj
({
// _data['file_path'] && _pdfUploadFujian.html('<li class="pdf-pre-li"><a class="pdf-pre-a" href="{0}" target="_blank" title="点击查看">{1}</a><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
'0'
:
_urlCut
+
_data
[
'file_path'
],
// '0': _urlCut + _data['file_path'],
'1'
:
dealFileName
(
decodeURI
(
_data
[
'file_path'
].
slice
(
_data
[
'file_path'
].
lastIndexOf
(
'/'
)
+
1
)))
// '1': dealFileName(decodeURI(_data['file_path'].slice(_data['file_path'].lastIndexOf('/') + 1)))
// }));
//附件 多个
for
(
var
i
in
_data
[
'exclusive_file'
])
{
_pdfUploadFujian
.
append
(
'<li class="pdf-pre-li"><a class="pdf-pre-a" href="{0}" target="_blank" title="点击查看">{1}</a><a href="javascript:;" class="delet-pic-btn" data-id="{2}">删除</a></li>'
.
stringFormatObj
({
'0'
:
ServerHostImageLiu
+
_data
[
'exclusive_file'
][
i
][
'file_name'
],
'1'
:
dealFileName
(
decodeURI
(
_data
[
'exclusive_file'
][
i
][
'file_name'
].
slice
(
_data
[
'exclusive_file'
][
i
][
'file_name'
].
lastIndexOf
(
'/'
)
+
1
))),
'2'
:
_data
[
'exclusive_file'
][
i
][
'id'
],
}));
}));
};
}
else
{
}
else
{
alert
(
data
[
'msg'
]);
alert
(
data
[
'msg'
]);
};
};
...
@@ -490,7 +506,19 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -490,7 +506,19 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
user
.
initShopRong
=
false
;
user
.
initShopRong
=
false
;
}
}
});
});
//删除pdf文件
_doc
.
on
(
'click'
,
'.pdf-pre-li .delet-pic-btn'
,
function
(
e
)
{
var
_this
=
$
(
this
);
e
.
preventDefault
();
e
.
stopPropagation
();
console
.
log
(
666
)
var
file_id
=
$
(
this
).
attr
(
'data-id'
)
*
1
;
if
(
file_id
){
user
.
file_id_arr
.
push
(
file_id
);
user
.
file_id_str
=
user
.
file_id_arr
.
join
(
','
);
}
});
//图片上传,附件上传处理事件
//图片上传,附件上传处理事件
$
(
".upload-image-btn"
).
change
(
function
(
e
)
{
$
(
".upload-image-btn"
).
change
(
function
(
e
)
{
var
_this
=
$
(
this
),
var
_this
=
$
(
this
),
...
@@ -502,7 +530,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -502,7 +530,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
//区分图片 轮播图 平面图 pdf 独家合同
//区分图片 轮播图 平面图 pdf 独家合同
if
(
_spFile
==
'pdf'
){
//pdf单个文件上传
if
(
_spFile
==
'pdf'
){
//pdf单个文件上传
var
formData
=
new
FormData
();
var
formData
=
new
FormData
();
formData
.
append
(
'type'
,
'
house_img
'
);
formData
.
append
(
'type'
,
'
exclusive_file
'
);
formData
.
append
(
'image'
,
_this
[
0
].
files
[
0
]);
formData
.
append
(
'image'
,
_this
[
0
].
files
[
0
]);
}
else
{
//图片可以多个上传
}
else
{
//图片可以多个上传
var
formData
=
new
FormData
();
var
formData
=
new
FormData
();
...
@@ -528,7 +556,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -528,7 +556,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
if
(
_data
.
code
==
200
)
{
if
(
_data
.
code
==
200
)
{
if
(
_spFile
==
'pdf'
){
if
(
_spFile
==
'pdf'
){
_this
.
parent
().
next
().
prepend
(
'<li class="pdf-pre-li"><a class="pdf-pre-a" href="{0}" target="_blank" title="点击查看">{1}</a><a href="javascript:;" class="delet-pic-btn">删除</a></li>'
.
stringFormatObj
({
_this
.
parent
().
next
().
prepend
(
'<li class="pdf-pre-li"><a class="pdf-pre-a" href="{0}" target="_blank" title="点击查看">{1}</a><a href="javascript:;" class="delet-pic-btn">删除</a></li>'
.
stringFormatObj
({
'0'
:
ServerHostImageLiu
+
'/
resource/lib/Attachments/images/
'
+
_data
.
data
.
internet_img_name
,
'0'
:
ServerHostImageLiu
+
'/'
+
_data
.
data
.
internet_img_name
,
'1'
:
_data
.
data
.
imgformer_name
'1'
:
_data
.
data
.
imgformer_name
}));
}));
}
else
{
//可以上传多张图片
}
else
{
//可以上传多张图片
...
@@ -1416,10 +1444,17 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -1416,10 +1444,17 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
$
.
each
(
_loucengPicObj
,
function
(
i
,
item
)
{
$
.
each
(
_loucengPicObj
,
function
(
i
,
item
)
{
_data
[
'plan['
+
i
+
']'
]
=
item
.
src
.
replace
(
_urlCut
,
''
);
_data
[
'plan['
+
i
+
']'
]
=
item
.
src
.
replace
(
_urlCut
,
''
);
});
});
if
(
_fujianObj
.
length
===
1
)
{
// if(_fujianObj.length === 1) {
_data
[
'file_path'
]
=
_fujianObj
[
0
].
href
.
replace
(
_urlCut
,
''
);
//附件取得是herf值
// _data['file_path'] = _fujianObj[0].href.replace(_urlCut, ''); //附件取得是herf值
};
// };
//上传多个 pdf文件
var
dataPdf
=
[];
$
.
each
(
_fujianObj
,
function
(
i
,
item
)
{
dataPdf
[
i
]
=
item
.
href
.
replace
((
ServerHostImageLiu
+
'/static/exclusive_file/'
),
''
);
});
_data
[
'exclusive_file'
]
=
dataPdf
.
join
(
','
);
// 删除pdf id
_data
[
'del_file_id'
]
=
user
.
file_id_str
;
//当为编辑时,要传入id
//当为编辑时,要传入id
if
(
_id
!=
null
)
{
if
(
_id
!=
null
)
{
_data
[
'id'
]
=
_id
;
_data
[
'id'
]
=
_id
;
...
@@ -1452,6 +1487,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
...
@@ -1452,6 +1487,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
return
;
return
;
window
.
location
.
href
=
'/admin.php/index/getHouseList.html'
;
window
.
location
.
href
=
'/admin.php/index/getHouseList.html'
;
};
};
user
.
file_id_arr
=
[];
//置空pdf id
}
else
{
}
else
{
alert
(
'数据错误'
);
alert
(
'数据错误'
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment