Commit 1979c813 by jscat

nyx weapp: 功能优化

1. 为图片和logo上传分别提供图片合规验证功能
parent d6b7145b
//app.js //app.js
...@@ -325,7 +325,7 @@ App({ ...@@ -325,7 +325,7 @@ App({
if (checkResult.data.errcode == '87014') { if (checkResult.data.errcode == '87014') {
wx.hideLoading(); wx.hideLoading();
wx.showModal({ wx.showModal({
content: '第' + i + '张图存在敏感内容,请更换图片', content: '第' + i + '张图存在敏感内容, 请更换',
showCancel: false, showCancel: false,
confirmText: '明白了' confirmText: '明白了'
}) })
......
// pages/member/activity-post/activity-post.js // pages/member/activity-post/activity-post.js
...@@ -129,16 +129,13 @@ Page({ ...@@ -129,16 +129,13 @@ Page({
navigateToEdit() { navigateToEdit() {
var _this = this; var _this = this;
var newFilePaths = _this.data.photoArray var newFilePaths = _this.data.photoArray
// let promise = app.onCheckPic(newFilePaths) let promise_checkPic = app.onCheckPic(newFilePaths)
// //在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的 //在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
// //then后的括号里应该是参数param //then后的括号里应该是参数param
// //https://www.cnblogs.com/qlongbg/p/11603328.html //https://www.cnblogs.com/qlongbg/p/11603328.html
// promise.then(function (value) { promise_checkPic.then(function (value) {
// console.log("===checkPic_enter promise then_" + value) console.log("===checkPic_enter promise passed_" + value)
// //同步更新全局变量 console.log("图片合规校验成功")
// app.globalData.postData.photoArray = newFilePaths
// wx.navigateTo({ url: './edit/edit' })
// });
//先设置支付按钮为可点击 //先设置支付按钮为可点击
var canClick = true; var canClick = true;
...@@ -147,6 +144,11 @@ Page({ ...@@ -147,6 +144,11 @@ Page({
//离开的时候再赋值全局变量 //离开的时候再赋值全局变量
app.globalData.postData.photoArray = newFilePaths app.globalData.postData.photoArray = newFilePaths
wx.navigateTo({ url: './activity-edit/activity-edit' }) wx.navigateTo({ url: './activity-edit/activity-edit' })
},
function (value) {
console.log("===checkPic_enter promise failed_" + value)
console.log("图片合规校验失败")
});
}, },
......
// pages/member/activity-post/activity-submit/activity-submit.js // pages/member/activity-post/activity-submit/activity-submit.js
...@@ -717,9 +717,29 @@ Page({ ...@@ -717,9 +717,29 @@ Page({
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) { success: function (res) {
console.log("===addLogo_上传图片参数", res) console.log("===addLogo_上传图片参数", res)
//新增图片合规审核功能 jscat 20201013
var newFilePaths = res.tempFilePaths
let promise_checkPic = app.onCheckPic(newFilePaths)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise_checkPic.then(function (value) {
console.log("===checkPic_enter promise passed_" + value)
console.log("图片合规校验成功")
_this.setData({ _this.setData({
logoArray: res.tempFilePaths logoArray: res.tempFilePaths
}) })
},
function (value) {
console.log("===checkPic_enter promise failed_" + value)
console.log("图片合规校验失败")
_this.setData({
logoArray: []
})
});
} }
}) })
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论