mitao
2024-07-08 022a7ff7abf82cd2546e18071ade5228b4e2339f
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@/*
头像参数的说明:
name : 名称
id : 头像的id
@*/
<div class="form-group" id="${id}_container">
    <style type="text/css">.avatar-btn-hide { opacity: 0 }</style>
    <label class="col-sm-3 control-label head-scu-label">
        @if(isNotEmpty(required)){
        <span style="color: red;">*</span>
        @}
        ${name}</label>
    <div class="col-sm-9">
        <div class="col-sm-12">
            <div class="col-sm-4">
                <div id="${id}PreId">
                    <img width="100px" height="100px" src="${ctxPath}/static/img/NoPIC.png" />
                </div>
            </div>
            <div class="col-sm-2">
                <div class="head-scu-btn upload-btn" id="${id}BtnId">
                    <i class="fa fa-upload"></i>&nbsp;<span>上传</span>
                </div>
            </div>
            @if( isNotEmpty( placeholder)) {
            <div class="col-sm-8 col-sm-offset-4" style="color: red;">
                ${placeholder!}
            </div>
            @}
        </div>
        <div class="col-sm-12">
            <div class="progress progress-striped" style="margin-top: 20px;">
                <div id="${id}progressBar" style="width: 0%" aria-valuemax="100"
                     aria-valuemin="0" aria-valuenow="0" role="progressbar"
                     class="progress-bar progress-bar-info"></div>
            </div>
            <input style="opacity:0"  id="${id}" value="${value!}" name="${id}"/>
        </div>
        <script>$(function () {
            // 初始化图片上传
            var imageUp = new $WebUploadImage("${id}");
            imageUp.setUploadBarId("${id}progressBar");
            imageUp.init();
 
            if ( "${value!}") {
                var $image = $("#${id}PreId").find("img");
                $image.attr( "src", "${value!}");
                $("#${id}BtnId").find( "span").text("更改");
 
                $( "#${id}_container").find("img").on( "click", function() {
                    Feng.openImageLayerMax( this);
                });
            }
 
            $("#${id}").on( "valueChange", function (){
                $("#${id}BtnId").find( "span").text("更改");
 
                $( "#${id}_container").find("img").on( "click", function() {
                    Feng.openImageLayerMax( this);
                });
            });
 
            $.fn.extend({
                avatar_disabled: function ( flag) {
                    var $this = $(this);
                    var $id = "#" + $this.attr( "id");
                    if ( flag) {
                        $this.val("");
                        $($id + "PreId").find( "img")
                            .attr( "src", "${ctxPath}/static/img/NoPIC.png");
                        $($id + "progressBar").css({width: "0%"});
                    }
                    $($id + "BtnId")[ flag ? "addClass":"removeClass"]( "avatar-btn-hide");
                },
                avatar_disable_btn: function( flag) {
                    var $id = "#" + $(this).attr( "id");
                    $($id + "BtnId")[ flag ? "hide":"show"]();
                },
                hide_container: function ( flag) {
                    var id = $( this).attr( "id");
                    $( "#" + id + "_container")[ (!flag) ? "show": "hide"]();
                }
            });
        })</script>
    </div>
</div>
@if(isNotEmpty(underline) && underline == 'true'){
<div class="hr-line-dashed"></div>
@}