mali-applet-ui 1.1.44 → 1.1.46

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.d.ts CHANGED
@@ -5,6 +5,7 @@ export function getPlatformName(platform: string): string
5
5
  export function getSubModuleName(module: string): string
6
6
  export function parseEnv(dirPath: string): Record<string, string>
7
7
  export function initEnv(dirPath: string, defaultEnv: Record<string, string>): Record<string, string>
8
+ export function initManifestConfig(dirPath: string, manifestJson: any): void
8
9
  export function initManifestEnv(dirPath: string, manifestJson: any): Record<string, string>
9
10
  export function uploadWxMiniprogram(version: string): void
10
11
  export function getSCSSAdditionalData(): string
package/env/index.js CHANGED
@@ -130,6 +130,12 @@ function initEnv (rootPath) {
130
130
  return conf
131
131
  }
132
132
 
133
+ function initManifestConfig (rootPath, manifestJson) {
134
+ if (!fs.existsSync(path.resolve(rootPath, 'src/manifest.json'))) {
135
+ fs.writeFileSync(path.resolve(rootPath, 'src/manifest.json'), JSON.stringify(manifestJson, null, 2))
136
+ }
137
+ }
138
+
133
139
  function initManifestEnv (rootPath, manifestJson) {
134
140
  const envConfig = initEnv(rootPath)
135
141
  if (process.env.VUE_APP_MP_APPID) {
@@ -174,8 +180,6 @@ function uploadWxMiniprogram (rootPath, version) {
174
180
  return new Promise((resolve, reject) => {
175
181
  if (['mp-weixin', 'mp-qiwei'].includes(process.env.VUE_APP_PLATFORM_NAME)) {
176
182
  const projectConfig = parseJSONFile(rootPath, `${process.env.UNI_OUTPUT_DIR}/project.config.json`)
177
- console.log('projectConfig', projectConfig)
178
- console.log('projectPath=', path.resolve(rootPath, process.env.UNI_OUTPUT_DIR))
179
183
  const options = {
180
184
  appid: projectConfig.appid,
181
185
  type: 'miniProgram',
@@ -190,8 +194,6 @@ function uploadWxMiniprogram (rootPath, version) {
190
194
  robot,
191
195
  sourceMapSavePath: path.resolve(rootPath, 'sm.zip')
192
196
  }).then((res) => {
193
- console.log('sm==', path.resolve(rootPath, 'sm.zip'))
194
- console.log('get success', res)
195
197
  compressing.zip.uncompress(path.resolve(rootPath, 'sm.zip'), 'temp').then(() => {
196
198
  const rest = JSON.parse(fs.readFileSync(path.resolve(rootPath, 'temp/__FULL__/app-service.js.map')))
197
199
  const vArr = rest.wx.userVersion.match(/(\d+).(\d+).(\d+)/)
@@ -203,21 +205,19 @@ function uploadWxMiniprogram (rootPath, version) {
203
205
  desc: fixDesc,
204
206
  robot
205
207
  }).then((res) => {
206
- console.log('ci.upload success', res)
207
208
  resolve()
208
209
  }).catch((e) => {
209
- console.log('ci.upload err', e)
210
210
  reject(e)
211
211
  })
212
212
  } else {
213
213
  const e = {}
214
- console.error('version error')
214
+ console.log(e)
215
215
  reject(e)
216
216
  }
217
217
  deleteFolder(path.resolve(rootPath, 'temp'))
218
218
  fs.unlinkSync(path.resolve(rootPath, 'sm.zip'))
219
219
  }).catch((e) => {
220
- console.log('compressing err', res)
220
+ console.log(e)
221
221
  reject(e)
222
222
  })
223
223
  }).catch(e => {
@@ -228,19 +228,19 @@ function uploadWxMiniprogram (rootPath, version) {
228
228
  desc: '修复bug',
229
229
  robot: 1
230
230
  }).then((res) => {
231
- console.log('ci.upload success', res)
232
231
  resolve()
233
232
  }).catch((e) => {
234
- console.log('ci.upload err', e)
233
+ console.log(e)
235
234
  reject(e)
236
235
  })
237
236
  } else {
238
- console.log(e.message)
237
+ console.log(e)
239
238
  reject(e)
240
239
  }
241
240
  })
242
241
  } else {
243
242
  const e = {}
243
+ console.log(e)
244
244
  reject(e)
245
245
  }
246
246
  })
@@ -267,18 +267,38 @@ function sendMail ({ receivedBy, subject, html }) {
267
267
  })
268
268
  }
269
269
 
270
- function sendQyWechatMsg (webhook, params) {
270
+ function sendQyWechatMsg (webhook, opts) {
271
271
  if (!webhook) {
272
272
  throw new Error('企微机器人 webhook 地址不能为空')
273
273
  }
274
- return axios.post(webhook, {
275
- msgtype: params.msgtype || 'markdown',
276
- [params.msgtype || 'markdown']: {
277
- content: params.content || '',
278
- mentioned_list: params.mentionedList || [],
279
- mentioned_mobile_list: params.mentionedMobileList || []
274
+ let params = {
275
+ msgtype: 'markdown',
276
+ markdown: {
277
+ content: opts.content || ''
280
278
  }
281
- }).then(res => {
279
+ }
280
+ switch (opts.msgType) {
281
+ case 'text':
282
+ params = {
283
+ msgtype: 'text',
284
+ image: {
285
+ content: opts.content || '',
286
+ mentioned_list: opts.mentionedList || [],
287
+ mentioned_mobile_list: opts.mentionedMobileList || []
288
+ }
289
+ }
290
+ break
291
+ case 'image':
292
+ params = {
293
+ msgtype: 'image',
294
+ image: {
295
+ base64: opts.base64 || '',
296
+ md5: opts.md5 || ''
297
+ }
298
+ }
299
+ break
300
+ }
301
+ return axios.post(webhook, params).then(res => {
282
302
  return res.data
283
303
  })
284
304
  }
@@ -297,6 +317,7 @@ exports.getPlatformName = getPlatformName
297
317
  exports.getSubModuleName = getSubModuleName
298
318
  exports.parseEnv = parseEnv
299
319
  exports.initEnv = initEnv
320
+ exports.initManifestConfig = initManifestConfig
300
321
  exports.initManifestEnv = initManifestEnv
301
322
  exports.uploadWxMiniprogram = uploadWxMiniprogram
302
323
  exports.getSCSSAdditionalData = getSCSSAdditionalData
@@ -312,6 +333,7 @@ module.exports = {
312
333
  getSubModuleName,
313
334
  parseEnv,
314
335
  initEnv,
336
+ initManifestConfig,
315
337
  initManifestEnv,
316
338
  uploadWxMiniprogram,
317
339
  getSCSSAdditionalData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.44",
3
+ "version": "1.1.46",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",