setting.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const fs = require('fs');
  2. const args = process.argv.slice(2)[0];
  3. const filesToModify = ['./src/manifest.json', './src/pages.json'];
  4. filesToModify.forEach((file) => {
  5. fs.readFile(file, 'utf8', function (err, data) {
  6. if (err) throw err;
  7. let cleanedData = data.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, '');// 使用正则表达式去除单行注释
  8. let state = JSON.parse(cleanedData);// 解析JSON数据
  9. if (file == './src/manifest.json') {
  10. if (args === 'zhiHuiYun') {
  11. state.name = '综合智慧云'
  12. state.appid = '__UNI__36DE3A0'
  13. state.description = '综合智慧云APP,是一款助力于企业数字化的应用平台,帮助企业提升办公效率,实现组织数字化和业务数字化。'
  14. state.versionName = "2.2.4"
  15. state.versionCode = 24
  16. state.h5.title = '综合智慧云'
  17. } else if (args === 'xunJian') {
  18. state.name = '智能巡更'
  19. state.appid = '__UNI__BF1A1F0'
  20. state.description = '智能巡更app,是一款用于监督和记录巡逻人员按照预定路线和时间进行巡逻的系统。'
  21. state.versionName = "2.2.0"
  22. state.versionCode = 20
  23. state.h5.title = '智能巡更'
  24. } else if (args === 'huiYi') {
  25. state.name = '智能会议'
  26. state.appid = '__UNI__F3963F8'
  27. state.description = '智能会议APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序,旨在提升会议体验和管理效率。'
  28. state.versionName = "2.0.1"
  29. state.versionCode = 1
  30. state.h5.title = '智能会议'
  31. }
  32. } else if ('./src/pages.json') {
  33. state.pages.forEach((e, index) => {
  34. if (args === 'zhiHuiYun') {
  35. if (e.style.navigationBarTitleText === "工作台") {
  36. if (index != 0) {
  37. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  38. }
  39. }
  40. state.condition.list[0].path = "pages/login"
  41. } else if (args === 'xunJian') {
  42. if (e.style.navigationBarTitleText === "工作台") {
  43. if (index != 0) {
  44. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  45. }
  46. }
  47. state.condition.list[0].path = "pages/login"
  48. } else if (args === 'huiYi') {
  49. if (e.style.navigationBarTitleText === "人脸识别") {
  50. if (index != 0) {
  51. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  52. }
  53. }
  54. state.condition.list[0].path = "pages/face/index"
  55. }
  56. })
  57. }
  58. // 将修改后的对象转换回JSON字符串
  59. const updated = JSON.stringify(state, null, 4);
  60. // 写入新的配置到manifest.json
  61. fs.writeFile(file, updated, 'utf8', function (err) {
  62. if (err) throw err;
  63. console.log(file + ' updated successfully');
  64. });
  65. });
  66. })