作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

1

@@ -68,9 +68,6 @@ @@ -68,9 +68,6 @@
68 <script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script> 68 <script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
69 <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> 69 <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
70 <script> 70 <script>
71 - wx.config(  
72 - {$js}  
73 - );  
74 // function clacImgZoomParam(maxWidth, maxHeight, width, height) { 71 // function clacImgZoomParam(maxWidth, maxHeight, width, height) {
75 // var param = { 72 // var param = {
76 // top: 0, 73 // top: 0,
@@ -128,10 +125,12 @@ @@ -128,10 +125,12 @@
128 // } 125 // }
129 // 126 //
130 // } 127 // }
  128 + wx.config(
  129 + {$js}
  130 + );
131 var serverIds = ''; 131 var serverIds = '';
132 -wx.ready(function () { 132 + wx.ready(function () {
133 $('#imghead').click(function () { 133 $('#imghead').click(function () {
134 -// var id = $(this).attr('id');  
135 // if ($(this).find('img').length=="") { 134 // if ($(this).find('img').length=="") {
136 wx.chooseImage({ 135 wx.chooseImage({
137 count: 1, // 默认9 136 count: 1, // 默认9
@@ -139,27 +138,26 @@ wx.ready(function () { @@ -139,27 +138,26 @@ wx.ready(function () {
139 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 138 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
140 success: function (res) { 139 success: function (res) {
141 $('#imghead').attr('src',res.localIds) 140 $('#imghead').attr('src',res.localIds)
142 - uploadImages(res.localIds, id) 141 + uploadImages(res.localIds)
143 } 142 }
144 }); 143 });
145 // } 144 // }
146 }); 145 });
147 function uploadImages(localIds) { 146 function uploadImages(localIds) {
148 -// var localId = localIds.pop(); 147 + var localId = localIds.pop();
149 wx.uploadImage({ 148 wx.uploadImage({
150 - localId: localIds, 149 + localId: localId,
151 isShowProgressTips: 1, 150 isShowProgressTips: 1,
152 success: function (res) { 151 success: function (res) {
153 - serverIds = res.serverId; // 返回图片的服务器端ID  
154 - alert(serverIds) 152 + var serverId = res.serverId; // 返回图片的服务器端ID
  153 + serverIds += id+':'+serverId + ',';
155 }, 154 },
156 fail: function (res) { 155 fail: function (res) {
157 - alert(res)  
158 $modal.toast(JSON.stringify(res)); 156 $modal.toast(JSON.stringify(res));
159 } 157 }
160 }); 158 });
161 } 159 }
162 -}); 160 + });
163 //确定上传小票 161 //确定上传小票
164 $(".footer").click(function(){ 162 $(".footer").click(function(){
165 $.ajax({ 163 $.ajax({