|
@@ -43,7 +43,7 @@ Page({ |
|
|
|
|
|
|
|
|
chooseImage(e) { |
|
|
chooseImage(e) { |
|
|
const that = this |
|
|
const that = this |
|
|
const action = e.currentTarget.dataset.action |
|
|
|
|
|
|
|
|
const action = e ? e.currentTarget.dataset.action : false |
|
|
|
|
|
|
|
|
if (action && that.data.tempFilePath) { |
|
|
if (action && that.data.tempFilePath) { |
|
|
that.setData({ |
|
|
that.setData({ |
|
@@ -77,6 +77,10 @@ Page({ |
|
|
const filePath = that.data.tempFilePath |
|
|
const filePath = that.data.tempFilePath |
|
|
const BaseUrl = request.baseUrl |
|
|
const BaseUrl = request.baseUrl |
|
|
|
|
|
|
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '检测中 1/3', |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
wx.uploadFile({ |
|
|
wx.uploadFile({ |
|
|
filePath, |
|
|
filePath, |
|
|
url: BaseUrl + "/api/userDigital/checkPhoto", |
|
|
url: BaseUrl + "/api/userDigital/checkPhoto", |
|
@@ -89,6 +93,7 @@ Page({ |
|
|
if (code == 200) { |
|
|
if (code == 200) { |
|
|
that.imgCheckByBaidu() |
|
|
that.imgCheckByBaidu() |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
wx.hideLoading() |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
showScanLine: false |
|
|
showScanLine: false |
|
|
}) |
|
|
}) |
|
@@ -99,6 +104,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: err => { |
|
|
fail: err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '上传失败,请稍后再试', |
|
|
title: '上传失败,请稍后再试', |
|
|
icon: "none" |
|
|
icon: "none" |
|
@@ -113,6 +119,10 @@ Page({ |
|
|
const filePath = that.data.tempFilePath |
|
|
const filePath = that.data.tempFilePath |
|
|
const BaseUrl = request.baseUrl |
|
|
const BaseUrl = request.baseUrl |
|
|
|
|
|
|
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '验证中 2/3', |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
wx.uploadFile({ |
|
|
wx.uploadFile({ |
|
|
filePath, |
|
|
filePath, |
|
|
url: BaseUrl + "/api/baidu/checkPhoto", |
|
|
url: BaseUrl + "/api/baidu/checkPhoto", |
|
@@ -125,6 +135,7 @@ Page({ |
|
|
if (code == 200) { |
|
|
if (code == 200) { |
|
|
that.doUploadImg() |
|
|
that.doUploadImg() |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
wx.hideLoading() |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
showScanLine: false |
|
|
showScanLine: false |
|
|
}) |
|
|
}) |
|
@@ -135,6 +146,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: err => { |
|
|
fail: err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '上传失败,请稍后再试', |
|
|
title: '上传失败,请稍后再试', |
|
|
icon: "none" |
|
|
icon: "none" |
|
@@ -149,6 +161,10 @@ Page({ |
|
|
const filePath = that.data.tempFilePath |
|
|
const filePath = that.data.tempFilePath |
|
|
const BaseUrl = request.baseUrl |
|
|
const BaseUrl = request.baseUrl |
|
|
|
|
|
|
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '上传中 3/3', |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
wx.uploadFile({ |
|
|
wx.uploadFile({ |
|
|
filePath, |
|
|
filePath, |
|
|
url: BaseUrl + "/api/upload/awsImgUpload", |
|
|
url: BaseUrl + "/api/upload/awsImgUpload", |
|
@@ -163,26 +179,41 @@ Page({ |
|
|
console.log(res, 'res'); |
|
|
console.log(res, 'res'); |
|
|
const data = JSON.parse(res.data) |
|
|
const data = JSON.parse(res.data) |
|
|
if (data.code == 200) { |
|
|
if (data.code == 200) { |
|
|
|
|
|
wx.hideLoading() |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
showScanLine: false, |
|
|
showScanLine: false, |
|
|
isSuccess: true, |
|
|
isSuccess: true, |
|
|
onlineFilePath: data.data.url |
|
|
onlineFilePath: data.data.url |
|
|
}) |
|
|
}) |
|
|
wx.showToast({ |
|
|
|
|
|
title: '上传成功!', |
|
|
|
|
|
icon: "success" |
|
|
|
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '照片验证成功!', |
|
|
|
|
|
content: '是否要使用这张照片?', |
|
|
|
|
|
confirmText: "使用", |
|
|
|
|
|
confirmColor: "#ff4f00", |
|
|
|
|
|
cancelText: "换一张", |
|
|
|
|
|
complete: (res) => { |
|
|
|
|
|
if (res.cancel) { |
|
|
|
|
|
that.chooseImage(false) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
that.confirmImage() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '服务器繁忙,请稍后再试', |
|
|
title: '服务器繁忙,请稍后再试', |
|
|
icon: "none" |
|
|
icon: "none" |
|
|
}) |
|
|
}) |
|
|
|
|
|
wx.hideLoading() |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
showScanLine: false |
|
|
showScanLine: false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: err => { |
|
|
fail: err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '上传失败,请稍后再试', |
|
|
title: '上传失败,请稍后再试', |
|
|
icon: "none" |
|
|
icon: "none" |
|
@@ -212,12 +243,78 @@ Page({ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
topTitle: "上传成功!" |
|
|
topTitle: "上传成功!" |
|
|
}) |
|
|
}) |
|
|
|
|
|
that.startSub() |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err, 'err'); |
|
|
console.log(err, 'err'); |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
startSub() { |
|
|
|
|
|
const that = this |
|
|
|
|
|
request.get({ |
|
|
|
|
|
url: `/api/templateMsg/list?projectType=6&plat=1` |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
console.log(res, 'res'); |
|
|
|
|
|
const id = res.data[0].templateId |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '订阅消息', |
|
|
|
|
|
content: '作品生成完毕后将会通知您', |
|
|
|
|
|
confirmColor: "", |
|
|
|
|
|
confirmText: "好的", |
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
complete: (res) => { |
|
|
|
|
|
if (res.cancel) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
that.subscribe(id) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err, 'err'); |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
subscribe(templateId) { |
|
|
|
|
|
const arr = [templateId] |
|
|
|
|
|
wx.requestSubscribeMessage({ |
|
|
|
|
|
//此处填写刚才申请模板的模板ID |
|
|
|
|
|
tmplIds: arr, |
|
|
|
|
|
success(res) { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
let failFlag = true; |
|
|
|
|
|
arr.forEach((item) => { |
|
|
|
|
|
if (res[item] == "accept") { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: "订阅成功", |
|
|
|
|
|
icon: "success", |
|
|
|
|
|
}); |
|
|
|
|
|
failFlag = false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (failFlag) { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: "提示", |
|
|
|
|
|
content: |
|
|
|
|
|
"订阅失败 ,您可以在 \n 小程序设置->通知管理 \n 中重新启用订阅功能", |
|
|
|
|
|
confirmText: "确定", |
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
fail(err) { |
|
|
|
|
|
console.log("订阅消息失败", err); |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: "订阅失败", |
|
|
|
|
|
icon: "none", |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
*/ |
|
|
*/ |
|
|