1.cmswing遷移服務(wù)端需更改其端口號,端口號位置:src--config--config.js
默認端口為8360,更改端口號需要重新定義
// default config
module.exports = {
http_: 1, // 1:http,2:https
host:"0.0.0.0",//新增添加
port:8362,//新增添加
document_model_type: {2: '主題', 1: '目錄', 3: '段落'}, // 文檔模型配置 (文檔模型核心配置,請勿更改)
user_administrator: [1] // 數(shù)組格式,可以配置多個[1,2,3]
};
2.查看端口號是否被占用
netstat -aon|findstr "端口號"
tasklist|findstr "端口號" //查看端口號被誰占用
3.node.js發(fā)送郵件需要配置路由,否則ajax異步請求不到數(shù)據(jù)
路由位置:src--config--router.js,配置路由時如果請求是post,路由接收參數(shù)也必須是post
4.node.js 配置郵件
注意:配置郵件功能屬于那個模型,相應(yīng)的郵件配置參數(shù)需對應(yīng)其模型,配置在控制器中對應(yīng)的模型。
async messageAction() {
var nodemailer = require('nodemailer');
let transporter = nodemailer.createTransport({
host: 'smtp.qq.com',
secureConnection: true, // use SSL
port: 465,
secure: true, // secure:true for port 465, secure:false for port 587
auth: {
user: '601657393@qq.com',
pass: 'ilotxvoxdcdfbcdg' // QQ郵箱需要使用授權(quán)碼
}
});
// 設(shè)置郵件內(nèi)容(誰發(fā)送什么給誰)
const data = this.post();
const text = "留言人公司名稱:\n"+data.gcName+"\n留言人姓名:\n"+data.yourName+"\n留言人電話:\n"+data.phone;
let mailOptions = {
from: '601657393@qq.com', // 發(fā)件人
to: '495583090@qq.com', // 收件人
subject: '有新的網(wǎng)站留言', // 主題
text: text, // plain text body
html: '<b> '+text+'</b>', // html body
}; m
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log(error);
}
console.log('Message: ${info.messageId}');
console.log('sent: ${info.response}');
});
return this.success("OK");
}
5.cmswing配置后臺參數(shù)模型時需注意
(1)、刪除字段時需先把選擇字段中的字段解除占用,然后再去刪除字段,否則出現(xiàn)數(shù)據(jù)匹配不到,后臺配置詳情崩潰,原因:空字段占用數(shù)據(jù)匹配,解決方法查找數(shù)據(jù)庫當前數(shù)據(jù)中的值與字段匹配,多出的空數(shù)據(jù)刪除即可。
6.解決上傳圖片不壓縮uplodaFile,因為圖片在上傳時就已經(jīng)壓縮過,而不是前臺渲染時才壓縮
cmswing采用WebUploader組件,cmswing上傳組件的位置src--controller--ext--attachment--view--pc--hooks_adminUpPic.html
var uploader = WebUploader.Uploader({
compress:false//圖片不壓縮,默認沒有這個參數(shù),默認壓縮
})