|
@@ -68,19 +68,51 @@ |
|
@@ -68,19 +68,51 @@ |
68
|
</div>
|
68
|
</div>
|
69
|
{include file="public/js" /}
|
69
|
{include file="public/js" /}
|
70
|
<script>
|
70
|
<script>
|
71
|
- // 营业执照
|
|
|
72
|
- function fileImg() {
|
|
|
73
|
- var reads = new FileReader();
|
|
|
74
|
- var img = document.getElementById("imgFile").files[0];
|
|
|
75
|
- reads.readAsDataURL(img);
|
|
|
76
|
- reads.onload = function(e) {
|
|
|
77
|
- document.getElementById('img1').src = this.result;
|
|
|
78
|
- console.log($("#img1"))
|
|
|
79
|
- console.log(e)
|
|
|
80
|
- };
|
|
|
81
|
- };
|
|
|
82
|
- $(".btn_box").click(function() {
|
|
|
83
|
- window.location.href = "examine.html"
|
71
|
+ $(function(){
|
|
|
72
|
+ wx.config(
|
|
|
73
|
+ {$jssdk}
|
|
|
74
|
+ );
|
|
|
75
|
+ wx.ready(function () {
|
|
|
76
|
+ $('.upload').click(function () {
|
|
|
77
|
+ wx.chooseImage({
|
|
|
78
|
+ count: 1, // 默认9
|
|
|
79
|
+ sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
80
|
+ sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
81
|
+ success: function (res) {
|
|
|
82
|
+ $(res.localIds).each(function (key, localId) {
|
|
|
83
|
+ uploadImages(localId);
|
|
|
84
|
+ });
|
|
|
85
|
+ }
|
|
|
86
|
+ });
|
|
|
87
|
+ });
|
|
|
88
|
+ function uploadImages(localId) {
|
|
|
89
|
+ wx.uploadImage({
|
|
|
90
|
+ localId: localId,
|
|
|
91
|
+ isShowProgressTips: 1,
|
|
|
92
|
+ success: function (res) {
|
|
|
93
|
+ var serverId = res.serverId; // 返回图片的服务器端ID
|
|
|
94
|
+ $.ajax({
|
|
|
95
|
+ url:"{:url('home/upload/fetImage')}",
|
|
|
96
|
+ type:"GET",
|
|
|
97
|
+ data:{'media':serverId},
|
|
|
98
|
+ success:function(res){
|
|
|
99
|
+ console.log(res);
|
|
|
100
|
+ if(res.code == 1){
|
|
|
101
|
+ $('.upload').find('img').attr('src',res.data);
|
|
|
102
|
+ $('#avatar').val(res.data);
|
|
|
103
|
+ }
|
|
|
104
|
+ },
|
|
|
105
|
+ error:function(res){
|
|
|
106
|
+ toast('与服务器断开连接');
|
|
|
107
|
+ }
|
|
|
108
|
+ })
|
|
|
109
|
+ },
|
|
|
110
|
+ fail: function (res) {
|
|
|
111
|
+ toast(JSON.stringify(res));
|
|
|
112
|
+ }
|
|
|
113
|
+ });
|
|
|
114
|
+ }
|
|
|
115
|
+ });
|
84
|
})
|
116
|
})
|
85
|
</script>
|
117
|
</script>
|
86
|
</body>
|
118
|
</body>
|