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

1

... ... @@ -68,9 +68,6 @@
<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
wx.config(
{$js}
);
// function clacImgZoomParam(maxWidth, maxHeight, width, height) {
// var param = {
// top: 0,
... ... @@ -128,38 +125,39 @@
// }
//
// }
wx.config(
{$js}
);
var serverIds = '';
wx.ready(function () {
$('#imghead').click(function () {
// var id = $(this).attr('id');
wx.ready(function () {
$('#imghead').click(function () {
// if ($(this).find('img').length=="") {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$('#imghead').attr('src',res.localIds)
uploadImages(res.localIds, id)
}
});
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
$('#imghead').attr('src',res.localIds)
uploadImages(res.localIds)
}
});
// }
});
function uploadImages(localIds) {
// var localId = localIds.pop();
wx.uploadImage({
localId: localIds,
isShowProgressTips: 1,
success: function (res) {
serverIds = res.serverId; // 返回图片的服务器端ID
alert(serverIds)
},
fail: function (res) {
alert(res)
$modal.toast(JSON.stringify(res));
});
function uploadImages(localIds) {
var localId = localIds.pop();
wx.uploadImage({
localId: localId,
isShowProgressTips: 1,
success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID
serverIds += id+':'+serverId + ',';
},
fail: function (res) {
$modal.toast(JSON.stringify(res));
}
});
}
});
}
});
//确定上传小票
$(".footer").click(function(){
$.ajax({
... ...