|
@@ -1,6 +1,7 @@
|
|
|
+const app=getApp();
|
|
|
Page({
|
|
|
data: {
|
|
|
- address: '安平镇安坪村安平小区12栋305室',
|
|
|
+ address: app.globalData.currentAccountInfo.address,
|
|
|
contact: '',
|
|
|
phone: '',
|
|
|
repairType: '',
|
|
@@ -100,11 +101,11 @@ Page({
|
|
|
success: function(res) {
|
|
|
let tempFiles = res.tempFiles;
|
|
|
let validFiles = [];
|
|
|
-
|
|
|
+ debugger;
|
|
|
for (let i = 0; i < tempFiles.length; i++) {
|
|
|
const file = tempFiles[i];
|
|
|
if (file.size <= 5 * 1024 * 1024) {
|
|
|
- validFiles.push(file.tempFilePath);
|
|
|
+ validFiles.push(file);
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '图片大小不能超过5M',
|
|
@@ -182,7 +183,13 @@ Page({
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ const fileManager = wx.getFileSystemManager();
|
|
|
+ this.data.imageList.map(imgInfo=>{
|
|
|
+ const base64 = fileManager.readFileSync(imgInfo.tempFilePath, 'base64');
|
|
|
+ imgInfo.base64=base64;
|
|
|
+ return imgInfo;
|
|
|
+ })
|
|
|
+
|
|
|
const submitData = {
|
|
|
address: this.data.address,
|
|
|
contact: this.data.contact,
|
|
@@ -197,20 +204,28 @@ Page({
|
|
|
wx.showLoading({
|
|
|
title: '提交中...',
|
|
|
});
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
- wx.hideLoading();
|
|
|
- wx.showToast({
|
|
|
- icon: 'success',
|
|
|
- duration: 2000,
|
|
|
- success: function() {
|
|
|
- setTimeout(() => {
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.interfaceUrls.repairRegistration,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json', // 默认值
|
|
|
+ 'token': app.globalData.userWxInfo.token,
|
|
|
+ 'source': "wc",
|
|
|
+ '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
|
|
|
+ },
|
|
|
+ data:submitData,
|
|
|
+ success(res) {
|
|
|
+ wx.hideLoading();
|
|
|
+ if(res.data.code=='200'){
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/baoxiuSuccess/baoxiuSuccess',
|
|
|
});
|
|
|
- }, 2000);
|
|
|
}
|
|
|
- });
|
|
|
- }, 1500);
|
|
|
+ },
|
|
|
+ fail(error) {
|
|
|
+ wx.hideLoading()
|
|
|
+ utils.simleInfo('登记失败,请稍后再试')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
});
|