mali-applet-ui 1.1.50 → 1.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/env/index.js +28 -17
- package/package.json +1 -1
package/env/index.js
CHANGED
|
@@ -9,16 +9,6 @@ const nodemailer = require('nodemailer')
|
|
|
9
9
|
const smtpTransport = require('nodemailer-smtp-transport')
|
|
10
10
|
const pack = require('../package.json')
|
|
11
11
|
|
|
12
|
-
const currTransporter = new Promise((resolve, reject) => {
|
|
13
|
-
axios.get('http://192.168.10.217:3000/emai/getSmtpOptions').then(res => {
|
|
14
|
-
const transporter = nodemailer.createTransport(smtpTransport(res.data))
|
|
15
|
-
resolve(transporter)
|
|
16
|
-
}).catch((e) => {
|
|
17
|
-
console.log('获取邮箱配置失败')
|
|
18
|
-
reject(e)
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
|
|
22
12
|
function getEnvCode (mode) {
|
|
23
13
|
const maps = {
|
|
24
14
|
dev: 'development',
|
|
@@ -113,14 +103,18 @@ function parseEnv (rootPath) {
|
|
|
113
103
|
envConfig.VUE_APP_PLATFORM_NAME = process.env.VUE_APP_PLATFORM_NAME || 'default'
|
|
114
104
|
envConfig.VUE_APP_PUBLISH_DATE = XEUtils.toDateString(new Date(), 'yyyyMMddHHmmss')
|
|
115
105
|
|
|
116
|
-
const
|
|
117
|
-
const
|
|
106
|
+
const cName = `.env.${envConfig.VUE_APP_CUSTOM_MODULE}`
|
|
107
|
+
const csName = `${cName}.${envConfig.VUE_APP_SUB_MODULE}`
|
|
108
|
+
const cspName = `${csName}.${envConfig.VUE_APP_PLATFORM_NAME}`
|
|
109
|
+
const envName = `${cspName}.${getEnvCode(envConfig.VUE_APP_MODE)}`
|
|
118
110
|
const globalDev = parseEnvFile(rootPath, '.env')
|
|
119
|
-
const
|
|
120
|
-
const
|
|
111
|
+
const cEnv = parseEnvFile(rootPath, cName)
|
|
112
|
+
const csEnv = parseEnvFile(rootPath, csName)
|
|
113
|
+
const cspEnv = parseEnvFile(rootPath, cspName)
|
|
114
|
+
const envEnv = parseEnvFile(rootPath, envName)
|
|
121
115
|
const localEnv = parseEnvFile(rootPath, `${envName}.local`)
|
|
122
116
|
|
|
123
|
-
return Object.assign({}, globalDev,
|
|
117
|
+
return Object.assign({}, globalDev, cEnv, csEnv, cspEnv, envEnv, localEnv, envConfig)
|
|
124
118
|
}
|
|
125
119
|
|
|
126
120
|
function initEnv (rootPath) {
|
|
@@ -247,15 +241,32 @@ function uploadWxMiniprogram (rootPath, version) {
|
|
|
247
241
|
})
|
|
248
242
|
}
|
|
249
243
|
|
|
244
|
+
let currTransporter = null
|
|
245
|
+
|
|
246
|
+
function getTransporter () {
|
|
247
|
+
if (!currTransporter) {
|
|
248
|
+
currTransporter = new Promise((resolve, reject) => {
|
|
249
|
+
axios.get('http://192.168.10.217:3000/emai/getSmtpOptions').then(res => {
|
|
250
|
+
const transporter = nodemailer.createTransport(smtpTransport(res.data))
|
|
251
|
+
resolve(transporter)
|
|
252
|
+
}).catch((e) => {
|
|
253
|
+
console.log('获取邮箱配置失败')
|
|
254
|
+
reject(e)
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
return currTransporter
|
|
259
|
+
}
|
|
260
|
+
|
|
250
261
|
function sendMail ({ receivedBy, subject, html }) {
|
|
251
262
|
return new Promise((resolve, reject) => {
|
|
252
|
-
|
|
263
|
+
getTransporter().then((transporter) => {
|
|
253
264
|
transporter.sendMail({
|
|
254
265
|
from: 'xuliangzhan@ddscan.cn',
|
|
255
266
|
to: receivedBy,
|
|
256
267
|
subject,
|
|
257
268
|
html
|
|
258
|
-
}, function (error
|
|
269
|
+
}, function (error) {
|
|
259
270
|
if (error) {
|
|
260
271
|
reject(error)
|
|
261
272
|
} else {
|