<%@ Page Title="" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="basics.aspx.cs" Inherits="zhongchou.AddProject.basics" %>

<asp:Content ID="Content1" ContentPlaceHolderID="titleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <script src="../Scripts/My97Date/WdatePicker.js" type="text/javascript"></script>
    <script src="../Scripts/area.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../kindeditor-4.1.7/themes/default/default.css" />
    <link rel="stylesheet" href="../kindeditor-4.1.7/plugins/code/prettify.css" />
    <script charset="utf-8" src="../kindeditor-4.1.7/kindeditor.js"></script>
    <script charset="utf-8" src="../kindeditor-4.1.7/lang/zh_CN.js"></script>
    <script charset="utf-8" src="../kindeditor-4.1.7/plugins/code/prettify.js"></script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link href="../Images/82f8b8a65f382c57ae8ef8aeee541802.css" rel="stylesheet" type="text/css" />
    <div class="process">
        <!--flow step static-->
        <div class="project-edit-nav">
            <h3 class="steps-1">
                项目信息</h3>
        </div>
        <!--flow step end-->
    </div>
    <div class="main clearfix">
        <div class="process-wrap clearfix">
            <div class="tit-wrap">
                <h3>
                    项目信息</h3>
            </div>
            <!--project start-->
            <div class="project-box">
                <div class="project-con fl w835">
                    <div class="project-edit">
                        <div class="form-item clearfix">
                            <label>
                                项目名称：</label>
                            <input type="text" name="title" class="w655" placeholder="项目名称不能超过40个字" value="<%=Project.LengName %>" maxlength="40" />
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                筹资金额：</label>
                            <input type="text" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" maxlength="9" name="limit_price" class="w408" placeholder="请填写项目资金目标" value="<%=Project.target %>" />
                            <em>元</em> <span class="error-text" id="wx-validator-limit_price-error" style="display: none;">请填写项目资金目标</span>
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                开始时间：</label>
                            <input type="text" name="start_time" onclick="WdatePicker()" readonly class="w655" placeholder="项目名称不能超过40个字" value="<%=Project.startTime %>" maxlength="40" />
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                募集天数：</label>
                            <input type="text" name="deal_days" placeholder="可填写10-60天，30天效果最佳" class="w408" value="<%=Project.Duration %>" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" maxlength="3" />
                            <em>天</em> <span class="error-text" id="wx-validator-deal_days-error" style="display: none;">天数为10-90天</span>
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                类别：</label>
                            <div id="Js-select-cate" class="option-sort">
                                <asp:Repeater ID="typeList" runat="server">
                                    <ItemTemplate>
                                        <span data-id="<%#Eval("id") %>" class="<%#check() %>">
                                            <%#Eval("name") %></span>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                            <input id="Js-cate" class="hidden" name="cate_id" value="" />
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                项目地点：</label>
                            <div class="option-box">
                                <select id="s_province" name="s_province">
                                </select>
                                <select id="s_city" name="s_city">
                                </select>
                                <select id="s_county" name="s_county">
                                </select>
                                <span id="Span1" class="error-text">
                                    <%=string.IsNullOrEmpty(Request.QueryString["id"]) ? "" : "不改则不动"%></span>
                            </div>
                            <script type="text/javascript">                                _init_area();</script>
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                项目封面：</label>
                            <div class="up-btn fs14">
                                <div class="ipt-file">
                                    <input type="file" id="inputfile" />
                                    <a class="">上传封面</a>
                                </div>
                                <span class="gray">支持jpg、jpeg、png，大小不超过5M。建议尺寸：640 x 480px</span>
                            </div>
                            <script type="text/javascript">
                                $(document).ready(function () {
                                    $("#inputfile").change(function () {
                                        //创建FormData对象
                                        var data = new FormData();
                                        //为FormData对象添加数据
                                        $.each($('#inputfile')[0].files, function (i, file) {
                                            data.append('imgFile', file);
                                        });
                                        $.ajax({
                                            url: '../kindeditor-4.1.7/asp.net/upload_json.ashx',
                                            type: 'POST',
                                            data: data,
                                            cache: false,
                                            contentType: false,    //不可缺
                                            processData: false,    //不可缺
                                            success: function (data) {
                                                var imgurl = data.split(':')[1].split(',')[0].replace("\"", "").replace("\"", "");
                                                $("#image").attr("src", imgurl);
                                                $("input[name='image']").attr("value", imgurl);
                                            },
                                            error: function (date) {
                                                alert(date);
                                            }
                                        });
                                    });
                                });
                            </script>
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                视频：</label>
                            <input type="text" name="vedio" class="inp-w310" placeholder="请输入优酷视频的播放页地址" wx-validator-placeholder="请输入优酷视频的播放页地址" maxlength='200' value="<%=Project.MovieURL%>" />
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                项目简介：</label>
                            <input type="text" name="short_title" placeholder="不超过20个字" maxlength="20" value="<%=Project.seoName %>" />
                            <span id="wx-validator-brief-maxLength" class="error-text hidden">不超过20个字</span>
                        </div>
                        <div class="form-item clearfix">
                            <label>
                                项目详情：</label>
                            <textarea id="Js-description" name="description"><%=Project.jianjie%></textarea>
                        </div>
                        <div class="form-item clearfix fs14">
                            <label>
                            </label>
                            我已经查看了相关的<a href="/about.aspx?id=3" class="green" target="_blank">《服务协议》</a>，同意协议内容并继续发布众筹项目
                        </div>
                        <input type="hidden" name="image" value="" />
                        <div class="action">
                            <asp:Button ID="Button1" class="btn-effect-blue btn-sub w170" runat="server" Text="同意协议并下一步" OnClick="Button1_Click" />
                        </div>
                    </div>
                </div>
                <!--project end-->
                <!--side static-->
                <div class="sidebar w383 fr">
                    <p class="view-area fs18 fb">
                        预览区域</p>
                    <!--list item static-->
                    <div class="list-item">
                        <a class="item-figure" href="javascript:void(0);">
                            <%if (string.IsNullOrEmpty(Project.smallImg)) { %>
                            <img id="image" src="/images/default.jpg" />
                            <%} else { %>
                            <img id="image" src="<%=Project.smallImg %>" />
                            <%} %>
                        </a>
                        <h3 class="project-name">
                            <a id="Js-name" href="javascript:;"></a>
                        </h3>
                        <div class="item-caption">
                            <span class="caption-title">目标：<span id="Js-days"></span>&nbsp;&nbsp;&nbsp; <span id="Js-price"></span></span>
                        </div>
                        <!--list item end-->
                    </div>
                    <!--side end-->
                </div>
            </div>
        </div>
        <script>
            $("input[name='name']").blur(function () {
                $("#Js-name").text($(this).val());
            });
            $("input[name='limit_price']").blur(function () {
                $("#Js-price").text("￥" + $(this).val());
            });
            $("input[name='deal_days']").blur(function () {
                $("#Js-days").text($(this).val() + "天");
            });

            $("#Js-select-cate").delegate('span', 'click', function (event) {
                $(this).addClass('select').siblings().removeClass('select');
                $("#Js-cate").val($(this).attr("data-id"));
            });

            var kindeditorOption = {
                resizeType: 1,
                allowPreviewEmoticons: false,

                allowMediaUpload: false,
                allowFileUpload: false,
                allowFlashUpload: false,

                allowFileManager: false,
                allowImageRemote: false,
                filePostName: "imgFile",
                minWidth: "567",
                minHeight: "500",
                uploadJson: "../kindeditor-4.1.7/asp.net/upload_json.ashx",
                items: ['formatblock', '|', 'image', 'link', 'removeformat']
            }
            var editor = KindEditor.create("#Js-description", kindeditorOption)
            window['HwForm_before'] = function () {
                $("#Js-description").val(editor.html());
                return true;
            }
            $('.w655').change(function () {
                var that = $(this);
                $('#Js-name').val($(this).val());
            });
            $('[name="deal_days"]').change(function () {
                $('#Js-days').val($(this).val());
            });
            $('[neme="linit_price"]').change(function () {
                $('#Js-price').val("￥" + $(this).val());
            });        
        </script>
</asp:Content>
