<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>精准导购系统企业号应用</title>
    <link rel="stylesheet" href="/static/css/wechat/weui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/wechat/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="/static/css/wechat/style.css">
</head>

<body ontouchstart class="bg-white">
<header>
    <div class="header">
        <a href="javascript:history.go(-1);" class="btn-a-back"><i class="iconfont">&#xe61f;</i></a>
        <h2>我的驻场项目</h2>
    </div>
</header>
<!--我的驻场项目-->
<div id="projects"></div>
<!--我的驻场项目 end-->

</body>
<script type="text/html" id="projectTemplate">
    {{each projects as project index}}
    <div class="my-client">
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <p class="tu-text">{{index+count}}</p>
            </div>
            <div class="weui-cell__bd">
                <p class="my-client__tel">
                    {{project.projectName}}
                </p>
                <p class="my-client__tag">
                    <span><i class="iconfont">&#xe603;</i>{{project.startTime.time | dateFormat:"yyyy.MM.dd"}}</span>
                </p>
            </div>
        </div>
        <div class="weui-flex my-client__bd">
            <a href="/project/getprojectdetail?projectId={{project.id}}" class="weui-flex__item"><i class="iconfont">
                &#xe740;</i>楼盘详情</a>
            <a href="/project/projectcustomers?projectId={{project.id}}" class="weui-flex__item"><i class="iconfont">
                &#xe68f;</i>客户列表</a>
        </div>
    </div>
    {{/each}}
</script>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/statistics.js"></script>
<script type="text/javascript" src="/static/js/template.js"></script>
<script type="text/javascript" src="/static/js/utils.js"></script>
<script>
    var count = 1;
    $(function () {
        loadData();
    });

    function loadData() {
        $.ajax({
            url: "/project/getmyprojects",
            data: {
                userId: "63"
            },
            type: "post",
            success: function (data) {
                var html = template('projectTemplate', {projects: data.data.list, count: count});
                $("#projects").append(html);
            }
        });
    }
</script>
</html>
