|
@@ -17,17 +17,79 @@ Page({
|
|
|
fcontent: "", //通告内容
|
|
|
ftype: "", //通告类型
|
|
|
popups: false,
|
|
|
+ coverFiles: [], //封面
|
|
|
+ defaultFiles: [], //附件
|
|
|
errTips: {
|
|
|
ftitle: false,
|
|
|
fsummary: false,
|
|
|
- fcontent: false
|
|
|
+ fcontent: false,
|
|
|
+ ftype: false
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
-
|
|
|
+ //修改
|
|
|
+ if (options.id) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.noticemag.noticemag",
|
|
|
+ "method": "query_noticeMain",
|
|
|
+ "content": {
|
|
|
+ "tnoticeid": options.id
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let data = res.data[0],
|
|
|
+ attinfos = res.data[0].attinfos,
|
|
|
+ coverFiles = [],
|
|
|
+ defaultFiles = [],
|
|
|
+ ftype = (data.ftype == '商户') ? '商户公告' : '团队公告';
|
|
|
+ for (let i = 0; i < attinfos.length; i++) {
|
|
|
+ let img = {
|
|
|
+ name: attinfos[i].serialnumber,
|
|
|
+ url: attinfos[i].fobsurl,
|
|
|
+ ownerid: attinfos[i].ownerid,
|
|
|
+ tattachmentid: attinfos[i].tattachmentid,
|
|
|
+ ftype: attinfos[i].ftype,
|
|
|
+ ownertable: attinfos[i].ownertable
|
|
|
+ };
|
|
|
+ (img.ftype == "default") ? defaultFiles.push(img): coverFiles.push(img)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ tnoticeid: data.tnoticeid,
|
|
|
+ ftitle: data.ftitle,
|
|
|
+ fsummary: data.fsummary,
|
|
|
+ fcontent: data.fcontent,
|
|
|
+ ftype: ftype,
|
|
|
+ coverFiles,
|
|
|
+ defaultFiles
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 修改图片回调 */
|
|
|
+ imageChange(e) {
|
|
|
+ const {
|
|
|
+ fileList
|
|
|
+ } = e.detail;
|
|
|
+ this.setData({
|
|
|
+ coverFiles: fileList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 修改附加回调 */
|
|
|
+ filesChange(e) {
|
|
|
+ const {
|
|
|
+ fileList
|
|
|
+ } = e.detail;
|
|
|
+ this.setData({
|
|
|
+ defaultFiles: fileList
|
|
|
+ })
|
|
|
},
|
|
|
/* 提交代码 */
|
|
|
submit() {
|
|
@@ -35,13 +97,14 @@ Page({
|
|
|
title: '请检查表单内容',
|
|
|
icon: "error"
|
|
|
});
|
|
|
+ let ftype = (this.data.ftype == '团队公告') ? '团队' : '商户';
|
|
|
_Http.basic({
|
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
|
"classname": "customer.noticemag.noticemag",
|
|
|
"method": "insertOrModify",
|
|
|
"content": {
|
|
|
"tnoticeid": this.data.tnoticeid,
|
|
|
- "ftype": this.data.ftype,
|
|
|
+ "ftype": ftype,
|
|
|
"ftitle": this.data.ftitle,
|
|
|
"fsummary": this.data.fsummary,
|
|
|
"fcontent": this.data.fcontent,
|
|
@@ -72,6 +135,7 @@ Page({
|
|
|
let errTips = this.data.errTips,
|
|
|
verify = true;
|
|
|
/* 验证标题 */
|
|
|
+
|
|
|
if (!_Verify.required(this.data.ftitle)) {
|
|
|
errTips.ftitle = true;
|
|
|
verify = false;
|
|
@@ -86,6 +150,11 @@ Page({
|
|
|
errTips.fcontent = true;
|
|
|
verify = false;
|
|
|
}
|
|
|
+ /* 发布范围 */
|
|
|
+ if (!_Verify.required(this.data.ftype)) {
|
|
|
+ errTips.ftype = true;
|
|
|
+ verify = false;
|
|
|
+ }
|
|
|
this.setData({
|
|
|
errTips
|
|
|
})
|
|
@@ -133,7 +202,8 @@ Page({
|
|
|
}) {
|
|
|
this.setData({
|
|
|
ftype: detail,
|
|
|
- popups: false
|
|
|
+ popups: false,
|
|
|
+ 'errTips.ftype': false
|
|
|
})
|
|
|
},
|
|
|
/* 打开类目选择 */
|