release.html
3.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{extend name="layout/default"}
{block name="content"}
<div class="tender_rCon">
<h1 class="tender_rTxt">发布招标</h1>
<div class="tender_rBox">
<form id="form">
<div class="release_Li clearfix">
<label for=""><span>*</span>类 型</label>
<select name="style" id="" class="release_op">
<option value="">请选择类型</option>
{foreach $style as $s}
<option value="{$s.id}">{$s.title}</option>
{/foreach}
</select>
</div>
<div class="release_Li clearfix">
<label for=""><span>*</span>标 题</label>
<input type="text" class="release_input" name="title" placeholder="请输入标题">
</div>
<div class="release_Li clearfix">
<label for=""><span>*</span>内 容</label>
<textarea placeholder="请输入内容" name="content" id="" cols="30" rows="10" class="release_textarea"></textarea>
</div>
<div class="release_Li clearfix">
<label for=""><span>*</span>文 件</label>
<input type="hidden" class="release_input" name="image" id="image">
<div class="release_file">
<div class="release_Imgs"><img src="/statis/image/icon50.png" alt=""></div>
<input type="file" name="file" onchange="sc(this);">
</div>
</div>
</form>
<div class="release_btn">提交</div>
</div>
</div>
<script>
$('.release_op').change(function () {
$(this).css('color','black')
});
function sc(e){
var data = new FormData($('#form')[0]);
$.ajax({
url: "/admin/ajax/upload",
type: 'POST',
data: data,
dataType: 'JSON',
cache: false,
processData: false,
contentType: false
}).done(function(ret){
if(ret['code']==1){
$("#image").val(ret.data.url);
$('.release_Imgs').find('img').attr('src',ret.data.url)
w('上传成功');
}else{
w('上传失败');
}
});
}
$(".release_btn").on("click",function () {
var data=$("#form").serialize();
if($(".release_op option:selected").text() == '请选择类型'){
w('请选择类型');
}else if($('.release_input').val() == ''){
w('请输入标题');
}else if($('.release_textarea').val() ==''){
w('请输入内容');
}else{
ajax("/index/invitation/release",data,"post",function (res) {
w(res.msg);
},"");
}
})
</script>
{/block}