Commit 11ae17c8 by jscat

nyx weapp: 功能更新

1. 为edit和submit页面分别添加checkText 合规校验
parent ec9d9347
//app.js
//app.js
......@@ -351,6 +351,7 @@ App({
onCheckPic(file) {
var _this = this;
var strUrl = config.check_pic_url
console.log("===onCheckPic_" + strUrl)
let promise = Promise.all(file.map((pic, index) => {
return new Promise(function (resolve, reject) {
_this.checkPic(strUrl, pic, index, resolve, reject)
......@@ -362,6 +363,7 @@ App({
//小程序文本检测主函数
checkText(strUrl, strText, resolve, reject) {
console.log("===onCheckText_" + strUrl)
wx.request({
url: strUrl,
method: 'GET',
......
// pages/member/activity-post/activity-edit/activity-edit.js
// pages/member/activity-post/activity-edit/activity-edit.js
......@@ -106,7 +106,20 @@ Page({
if(checkField())
{
let promise = app.onCheckText(app.globalData.postData.photoTag)
var srcCheck = app.globalData.postData.photoTag + app.globalData.postData.photoTitle
var cbs = app.globalData.postData.photoCbs
for(var i=1; i<cbs.length; i++)
{
srcCheck += cbs[i].name
}
var products = app.globalData.postData.photoProduct
for(var i=0; i<products.length; i++)
{
srcCheck += products[i].productDesc
}
let promise = app.onCheckText(srcCheck)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
......
// pages/member/activity-post/activity-submit/activity-submit.js
// pages/member/activity-post/activity-submit/activity-submit.js
......@@ -226,7 +226,23 @@ Page({
var _this = this;
if(_this.checkField())
{
//step2, 判断文本是否合规
var strCheck = app.globalData.member.member_name + app.globalData.member.member_address + app.globalData.postData.photoContent + app.globalData.member.member_city + app.globalData.member.member_slogan
let promise = app.onCheckText(strCheck)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise.then(function (value) {
console.log("===enter promise then_pass_" + value)
console.log("字段合规校验成功")
_this.submitPost()
},
function (value) {
console.log("===enter promise then_failed_" + value)
console.log("字段合规校验失败")
});
}
},
......@@ -283,37 +299,15 @@ Page({
{
console.log("===直接提交aliyun oss")
// todo jscat 20200815 测试版本不需要限定文本content是否为 ""
//if (content != undefined && content != "") {
if(1) {
//step1, 上传至oss-获取token,在onReady()提前准备
//_this.oss();
//step2, 判断文本是否合规
let promise = app.onCheckText(title+content)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise.then(function (value) {
console.log("===enter promise then_pass_" + value)
//step3, 上传至oss-上传图片
//step1, 上传至oss-上传图片
_this.releaseOss(title, content);
_this.switchTab()
},
function (value) {
console.log("===enter promise then_failed_" + value)
});
//step4, 上传信息到数据库
//step2, 上传信息到数据库
//上传数据库在oss sdk的callback函数里设置
//需要java后台支持
}
}
},
// 获得oss配置信息
......@@ -471,7 +465,6 @@ Page({
console.log("=== index_"+index)
console.log(res)
console.log("success to upload file")
//_this.switchTab()
},
fail: function (err) {
console.log("fail to upload file")
......@@ -594,7 +587,23 @@ Page({
var _this = this;
if(_this.checkField())
{
//step2, 判断文本是否合规
var strCheck = app.globalData.member.member_name + app.globalData.member.member_address + app.globalData.postData.photoContent + app.globalData.member.member_city + app.globalData.member.member_slogan
let promise = app.onCheckText(strCheck)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise.then(function (value) {
console.log("===enter promise then_pass_" + value)
console.log("字段合规校验成功")
_this.getUserInfo()
},
function (value) {
console.log("===enter promise then_failed_" + value)
console.log("字段合规校验失败")
});
}
},
......@@ -918,6 +927,7 @@ Page({
var _this = this;
var info = ""
//step1: 判断字段是否合规
if(app.globalData.postData.photoContent.length == 0)
{
info = "请输入活动内容"
......@@ -962,9 +972,9 @@ Page({
return false;
}
console.log("字段校验成功")
console.log("字段非空校验成功")
return true;
},
// 更换商家
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论