Commit 04c1abcd by liangjianmin

js

parent dca65964
......@@ -50,7 +50,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wx47674efb6eef06e1",
"appid" : "wx61a41a064fa2fb3c",
"setting" : {
"urlCheck" : false,
"es6" : true,
......
......@@ -71,7 +71,7 @@ export default {
fail: function(res) {
console.log(res);
uni.showToast({
title: '上传失败',
title: '扫码失败',
icon: 'none'
});
}
......
......@@ -59,32 +59,37 @@ export default {
chooseImageChange() {
var self = this;
var time = parseInt(new Date().getTime() / 1000);
uni.chooseImage({
count: 4,
sourceType: ['album', 'camera'],
success: chooseImageRes => {
uni.showLoading({
title: '上传中...'
});
const tempFilePaths = chooseImageRes.tempFilePaths;
let maxNum = tempFilePaths.length * 1 + self.attachAddress.length * 1;
if (maxNum > 4) {
uni.hideLoading();
uni.showToast({
title: '图片不超过4张'
});
return false;
}
for (let i = 0; i < tempFilePaths.length; i++) {
console.log(tempFilePaths[i]);
uni.uploadFile({
url: 'https://api.ichunt.com/oss/upload',
filePath: tempFilePaths[i],
name: 'upload',
formData: {
source: '1',
pf: 20,
k1: time,
k2: w_md5.hex_md5_32(w_md5.hex_md5_32(String(time)) + 'fh6y5t4rr351d2c3bryi')
},
success: uploadFileRes => {
uni.hideLoading();
var data = JSON.parse(uploadFileRes.data);
console.log(data);
if (data.code === 200) {
self.attachAddress.push(data.data[0]);
} else {
......@@ -94,6 +99,7 @@ export default {
}
},
fail: error => {
uni.hideLoading();
console.log(error);
}
});
......@@ -123,7 +129,7 @@ export default {
}, 2000);
} else {
uni.showToast({
title: res.msg,
title: res.err_msg,
icon: 'none'
});
}
......
//const API_BASE = 'https://api.ichunt.com';
const API_BASE = 'http://supplyapi.liexin.com'
const API_BASE = 'https://api.ichunt.com';
//const API_BASE = 'http://supplyapi.liexin.com'
const API = {
/**
* 上传数据
......@@ -16,7 +16,7 @@ const API = {
/**
* 上传文件
* */
upload: API_BASE + '/oss/upload',
upload: API_BASE + '/oss/upload'
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment