chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{yun:}include file="$wapstyle/member/lheader.htm"{/yun}
<link rel="stylesheet" type="text/css" href="{yun:}$wap_style{/yun}/js/webapppic/cropper.css?v={yun:}$config.cachecode{/yun}" />
<script src="{yun:}$wap_style{/yun}/js/alloy/transform.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$wap_style{/yun}/js/alloy/alloy-finger.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$wap_style{/yun}/js/alloy-crop.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$wap_style{/yun}/js/compress.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$wap_style{/yun}/js/exif.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script>
    $(function() {
 
        $('#image').on('change', function() {
            cutImg();
        });
        
        var $inputImage = $('#image'),
            URL = window.URL || window.webkitURL;
        if(URL) {
            $inputImage.change(function() {
                var files = this.files,
                    file;
                previewImage(this,'preview');
                if(files && files.length) {
                    file = files[0];
 
                    if(/^image\/\w+$/.test(file.type)) {
                        setTimeout(function(){
 
                            toAlloyCrop($('#preview').val());
                        },1000);
                        $inputImage.val('');
                    } else {
                        showMessage('请上传图片');
                    }
                }
            });
        } else {
            $inputImage.parent().remove();
        }
    });
    function cutImg() {
        $('#showResult').fadeOut();
    }
    function toAlloyCrop(pic){
        var mAlloyCrop;
        
        mAlloyCrop = new AlloyCrop({
            image_src: pic,
            width: 200,
            height: 200,
            output: 1,
            ok: function(base64, canvas) {
                $("#changeAvatar > img").attr("src", base64);
                document.getElementById('uimage').value = base64;
                $('#showResult').fadeIn();
            },
            cancel: function() {
                $('#showResult').fadeIn();
            },
            ok_text: '确定',
            cancel_text: '取消'
        });
    }
    function photo() {
        var uimage = $("#uimage").val();
        var regS = new RegExp("\\+", "gi");
        if(uimage == '') {
            showToast('头像未改变,无需修改');
            return false;
        }else{
            uimage = uimage.replace(regS, "#");
            showLoading();
            $.ajax({
                type: 'POST',
                url: "index.php?c=uppic",
                cache: false,
                dataType: 'json',
                data: {
                    uimage: uimage,
                    submit: 1
                },
                success: function(res) {
                    hideLoading();
                    if(res){
                        showToast(res.msg, 2, function() {
                            window.location.reload();
                        });
                        return false;
                    }
                }
            });
        }
        
    }
</script>
<section class="resume_mangage">
    <div class="clear"></div>
    <div class="verify">
        <div class="photo_i_box_v" style="background:#fff">
            <div id="showResult">
                <div id="changeAvatar" class="photo_i_box">
                    <img src="{yun:}$row.photo_big{/yun}" width="120" height="120">
                </div>
                <div class="clear"></div>
                <div class="photo_xz">
                    <input id="image" type="file" accept="image/*" />选择上传头像
                </div>
                <div class="clear"></div>
 
                <div class="yunset_identity_msg"><i class="yunset_identity_msg_icon"></i>选择上传头像点击提交按钮即可上传{yun:}if $row.photo_n{/yun}({yun:}if $row.photo_status=='1'{/yun}<font color="red">审核中</font>{yun:}else if $row.photo_status=='2'{/yun}<font color="red">未通过</font>{yun:}else{/yun}<font color="red">已审核</font>{yun:}/if{/yun}){yun:}/if{/yun}</div>
            </div>
            
            <input type="hidden" value=""  id="preview">
            <div class="photo_tj">
                <input type='hidden' name="txt" id="uimage" value="">
                <input name="submit" type="button" onclick="photo()" value="保存/修改" class="yunset_bth" />
            </div>
        </div>
    </div>
</section>
</div>
<div class="clear"></div>
</body></html>