setting.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. var maps = state["app-plus"].distribute.sdkConfigs.maps
  11. var geolocation = state["app-plus"].distribute.sdkConfigs.geolocation
  12. var icons = state["app-plus"].distribute.icons
  13. var push = state["app-plus"].distribute.sdkConfigs.push
  14. if (args === 'zhiHuiYun') {
  15. state.name = '综合智慧云'
  16. state.appid = '__UNI__36DE3A0'
  17. state.description = '综合智慧云APP,是一款助力于企业数字化的应用平台,帮助企业提升办公效率,实现组织数字化和业务数字化。'
  18. state.versionName = "2.2.4"
  19. state.versionCode = 24
  20. state.h5.title = '综合智慧云'
  21. maps.amap.name = "amapBOujshtbA"
  22. maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  23. maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  24. geolocation.amap.name = "amapBOujshtbA"
  25. geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  26. geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  27. geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  28. geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  29. icons.android = {
  30. "hdpi" : "unpackage/res/icons/72x72.png",
  31. "xhdpi" : "unpackage/res/icons/96x96.png",
  32. "xxhdpi" : "unpackage/res/icons/144x144.png",
  33. "xxxhdpi" : "unpackage/res/icons/192x192.png"
  34. }
  35. icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
  36. icons.ios.ipad = {
  37. "app": "unpackage/res/icons/76x76.png",
  38. "app@2x": "unpackage/res/icons/152x152.png",
  39. "notification": "unpackage/res/icons/20x20.png",
  40. "notification@2x": "unpackage/res/icons/40x40.png",
  41. "proapp@2x": "unpackage/res/icons/167x167.png",
  42. "settings": "unpackage/res/icons/29x29.png",
  43. "settings@2x": "unpackage/res/icons/58x58.png",
  44. "spotlight": "unpackage/res/icons/40x40.png",
  45. "spotlight@2x": "unpackage/res/icons/80x80.png"
  46. }
  47. icons.ios.iphone = {
  48. "app@2x": "unpackage/res/icons/120x120.png",
  49. "app@3x": "unpackage/res/icons/180x180.png",
  50. "notification@2x": "unpackage/res/icons/40x40.png",
  51. "notification@3x": "unpackage/res/icons/60x60.png",
  52. "settings@2x": "unpackage/res/icons/58x58.png",
  53. "settings@3x": "unpackage/res/icons/87x87.png",
  54. "spotlight@2x": "unpackage/res/icons/80x80.png",
  55. "spotlight@3x": "unpackage/res/icons/120x120.png"
  56. }
  57. push.unipush.icons.small = {
  58. "hdpi" : "unpackage/res/push/36x36.png",
  59. "ldpi" : "unpackage/res/push/18x18.png",
  60. "mdpi" : "unpackage/res/push/24x24.png",
  61. "xhdpi" : "unpackage/res/push/48x48.png",
  62. "xxhdpi" : "unpackage/res/push/72x72.png"
  63. }
  64. } else if (args === 'xunJian') {
  65. state.name = '智能巡更'
  66. state.appid = '__UNI__BF1A1F0'
  67. state.description = '智能巡更app,是一款用于监督和记录巡逻人员按照预定路线和时间进行巡逻的系统。'
  68. state.versionName = "2.2.7"
  69. state.versionCode = 27
  70. state.h5.title = '智能巡更'
  71. maps.amap.name = "amap_15575941817CWPEQVCyc"
  72. maps.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
  73. maps.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
  74. geolocation.amap.name = "amap_15575941817CWPEQVCyc"
  75. geolocation.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
  76. geolocation.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
  77. geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  78. geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  79. icons.android = {
  80. "hdpi" : "unpackage/res/icons-xunJian/72x72.png",
  81. "xhdpi" : "unpackage/res/icons-xunJian/96x96.png",
  82. "xxhdpi" : "unpackage/res/icons-xunJian/144x144.png",
  83. "xxxhdpi" : "unpackage/res/icons-xunJian/192x192.png"
  84. }
  85. icons.ios.appstore = "unpackage/res/icons-xunJian/1024x1024.png"
  86. icons.ios.ipad = {
  87. "app": "unpackage/res/icons-xunJian/76x76.png",
  88. "app@2x": "unpackage/res/icons-xunJian/152x152.png",
  89. "notification": "unpackage/res/icons-xunJian/20x20.png",
  90. "notification@2x": "unpackage/res/icons-xunJian/40x40.png",
  91. "proapp@2x": "unpackage/res/icons-xunJian/167x167.png",
  92. "settings": "unpackage/res/icons-xunJian/29x29.png",
  93. "settings@2x": "unpackage/res/icons-xunJian/58x58.png",
  94. "spotlight": "unpackage/res/icons-xunJian/40x40.png",
  95. "spotlight@2x": "unpackage/res/icons-xunJian/80x80.png"
  96. }
  97. icons.ios.iphone = {
  98. "app@2x": "unpackage/res/icons-xunJian/120x120.png",
  99. "app@3x": "unpackage/res/icons-xunJian/180x180.png",
  100. "notification@2x": "unpackage/res/icons-xunJian/40x40.png",
  101. "notification@3x": "unpackage/res/icons-xunJian/60x60.png",
  102. "settings@2x": "unpackage/res/icons-xunJian/58x58.png",
  103. "settings@3x": "unpackage/res/icons-xunJian/87x87.png",
  104. "spotlight@2x": "unpackage/res/icons-xunJian/80x80.png",
  105. "spotlight@3x": "unpackage/res/icons-xunJian/120x120.png"
  106. }
  107. push.unipush.icons.small = {
  108. "hdpi" : "unpackage/res/push-xunJian/36x36.png",
  109. "ldpi" : "unpackage/res/push-xunJian/18x18.png",
  110. "mdpi" : "unpackage/res/push-xunJian/24x24.png",
  111. "xhdpi" : "unpackage/res/push-xunJian/48x48.png",
  112. "xxhdpi" : "unpackage/res/push-xunJian/72x72.png"
  113. }
  114. } else if (args === 'huiYi') {
  115. state.name = '智能会议'
  116. state.appid = '__UNI__F3963F8'
  117. state.description = '智能会议APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序,旨在提升会议体验和管理效率。'
  118. state.versionName = "2.0.5"
  119. state.versionCode = 1
  120. state.h5.title = '智能会议'
  121. maps.amap.name = "amapBOujshtbA"
  122. maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  123. maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  124. geolocation.amap.name = "amapBOujshtbA"
  125. geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  126. geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  127. geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  128. geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  129. icons.android = {
  130. "hdpi" : "unpackage/res/icons/72x72.png",
  131. "xhdpi" : "unpackage/res/icons/96x96.png",
  132. "xxhdpi" : "unpackage/res/icons/144x144.png",
  133. "xxxhdpi" : "unpackage/res/icons/192x192.png"
  134. }
  135. icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
  136. icons.ios.ipad = {
  137. "app": "unpackage/res/icons/76x76.png",
  138. "app@2x": "unpackage/res/icons/152x152.png",
  139. "notification": "unpackage/res/icons/20x20.png",
  140. "notification@2x": "unpackage/res/icons/40x40.png",
  141. "proapp@2x": "unpackage/res/icons/167x167.png",
  142. "settings": "unpackage/res/icons/29x29.png",
  143. "settings@2x": "unpackage/res/icons/58x58.png",
  144. "spotlight": "unpackage/res/icons/40x40.png",
  145. "spotlight@2x": "unpackage/res/icons/80x80.png"
  146. }
  147. icons.ios.iphone = {
  148. "app@2x": "unpackage/res/icons/120x120.png",
  149. "app@3x": "unpackage/res/icons/180x180.png",
  150. "notification@2x": "unpackage/res/icons/40x40.png",
  151. "notification@3x": "unpackage/res/icons/60x60.png",
  152. "settings@2x": "unpackage/res/icons/58x58.png",
  153. "settings@3x": "unpackage/res/icons/87x87.png",
  154. "spotlight@2x": "unpackage/res/icons/80x80.png",
  155. "spotlight@3x": "unpackage/res/icons/120x120.png"
  156. }
  157. push.unipush.icons.small = {
  158. "hdpi" : "unpackage/res/push/36x36.png",
  159. "ldpi" : "unpackage/res/push/18x18.png",
  160. "mdpi" : "unpackage/res/push/24x24.png",
  161. "xhdpi" : "unpackage/res/push/48x48.png",
  162. "xxhdpi" : "unpackage/res/push/72x72.png"
  163. }
  164. } else if (args === 'menJin') {
  165. state.name = '智能门禁'
  166. state.appid = '__UNI__8D6E9FD'
  167. state.description = '智能门禁APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序。'
  168. state.versionName = "1.0.0"
  169. state.versionCode = 1
  170. state.h5.title = '智能门禁'
  171. maps.amap.name = "amapBOujshtbA"
  172. maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  173. maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  174. geolocation.amap.name = "amapBOujshtbA"
  175. geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
  176. geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
  177. geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  178. geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
  179. icons.android = {
  180. "hdpi" : "unpackage/res/icons/72x72.png",
  181. "xhdpi" : "unpackage/res/icons/96x96.png",
  182. "xxhdpi" : "unpackage/res/icons/144x144.png",
  183. "xxxhdpi" : "unpackage/res/icons/192x192.png"
  184. }
  185. icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
  186. icons.ios.ipad = {
  187. "app": "unpackage/res/icons/76x76.png",
  188. "app@2x": "unpackage/res/icons/152x152.png",
  189. "notification": "unpackage/res/icons/20x20.png",
  190. "notification@2x": "unpackage/res/icons/40x40.png",
  191. "proapp@2x": "unpackage/res/icons/167x167.png",
  192. "settings": "unpackage/res/icons/29x29.png",
  193. "settings@2x": "unpackage/res/icons/58x58.png",
  194. "spotlight": "unpackage/res/icons/40x40.png",
  195. "spotlight@2x": "unpackage/res/icons/80x80.png"
  196. }
  197. icons.ios.iphone = {
  198. "app@2x": "unpackage/res/icons/120x120.png",
  199. "app@3x": "unpackage/res/icons/180x180.png",
  200. "notification@2x": "unpackage/res/icons/40x40.png",
  201. "notification@3x": "unpackage/res/icons/60x60.png",
  202. "settings@2x": "unpackage/res/icons/58x58.png",
  203. "settings@3x": "unpackage/res/icons/87x87.png",
  204. "spotlight@2x": "unpackage/res/icons/80x80.png",
  205. "spotlight@3x": "unpackage/res/icons/120x120.png"
  206. }
  207. push.unipush.icons.small = {
  208. "hdpi" : "unpackage/res/push/36x36.png",
  209. "ldpi" : "unpackage/res/push/18x18.png",
  210. "mdpi" : "unpackage/res/push/24x24.png",
  211. "xhdpi" : "unpackage/res/push/48x48.png",
  212. "xxhdpi" : "unpackage/res/push/72x72.png"
  213. }
  214. }
  215. } else if ('./src/pages.json') {
  216. state.pages.forEach((e, index) => {
  217. if (args === 'zhiHuiYun') {
  218. if (e.style.navigationBarTitleText === "工作台") {
  219. if (index != 0) {
  220. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  221. }
  222. }
  223. state.condition.list[0].path = "pages/login"
  224. } else if (args === 'xunJian') {
  225. if (e.style.navigationBarTitleText === "工作台") {
  226. if (index != 0) {
  227. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  228. }
  229. }
  230. state.condition.list[0].path = "pages/login"
  231. } else if (args === 'huiYi') {
  232. if (e.style.navigationBarTitleText === "人脸识别") {
  233. if (index != 0) {
  234. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  235. }
  236. }
  237. state.condition.list[0].path = "pages/face/index"
  238. } else if (args === 'menJin') {
  239. if (e.style.navigationBarTitleText === "门禁识别") {
  240. if (index != 0) {
  241. state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
  242. }
  243. }
  244. state.condition.list[0].path = "pages/door/index"
  245. }
  246. })
  247. }
  248. // 将修改后的对象转换回JSON字符串
  249. const updated = JSON.stringify(state, null, 4);
  250. // 写入新的配置到manifest.json
  251. fs.writeFile(file, updated, 'utf8', function (err) {
  252. if (err) throw err;
  253. console.log(file + ' updated successfully');
  254. });
  255. });
  256. })