123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- const fs = require('fs');
- const args = process.argv.slice(2)[0];
- const filesToModify = ['./src/manifest.json', './src/pages.json'];
- filesToModify.forEach((file) => {
- fs.readFile(file, 'utf8', function (err, data) {
- if (err) throw err;
- let cleanedData = data.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, '');// 使用正则表达式去除单行注释
- let state = JSON.parse(cleanedData);// 解析JSON数据
- if (file == './src/manifest.json') {
- var maps = state["app-plus"].distribute.sdkConfigs.maps
- var geolocation = state["app-plus"].distribute.sdkConfigs.geolocation
- var icons = state["app-plus"].distribute.icons
- var push = state["app-plus"].distribute.sdkConfigs.push
- if (args === 'zhiHuiYun') {
- state.name = '综合智慧云'
- state.appid = '__UNI__36DE3A0'
- state.description = '综合智慧云APP,是一款助力于企业数字化的应用平台,帮助企业提升办公效率,实现组织数字化和业务数字化。'
- state.versionName = "2.2.4"
- state.versionCode = 24
- state.h5.title = '综合智慧云'
- maps.amap.name = "amapBOujshtbA"
- maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.amap.name = "amapBOujshtbA"
- geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- icons.android = {
- "hdpi" : "unpackage/res/icons/72x72.png",
- "xhdpi" : "unpackage/res/icons/96x96.png",
- "xxhdpi" : "unpackage/res/icons/144x144.png",
- "xxxhdpi" : "unpackage/res/icons/192x192.png"
- }
- icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
- icons.ios.ipad = {
- "app": "unpackage/res/icons/76x76.png",
- "app@2x": "unpackage/res/icons/152x152.png",
- "notification": "unpackage/res/icons/20x20.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "proapp@2x": "unpackage/res/icons/167x167.png",
- "settings": "unpackage/res/icons/29x29.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "spotlight": "unpackage/res/icons/40x40.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png"
- }
- icons.ios.iphone = {
- "app@2x": "unpackage/res/icons/120x120.png",
- "app@3x": "unpackage/res/icons/180x180.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "notification@3x": "unpackage/res/icons/60x60.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "settings@3x": "unpackage/res/icons/87x87.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png",
- "spotlight@3x": "unpackage/res/icons/120x120.png"
- }
- push.unipush.icons.small = {
- "hdpi" : "unpackage/res/push/36x36.png",
- "ldpi" : "unpackage/res/push/18x18.png",
- "mdpi" : "unpackage/res/push/24x24.png",
- "xhdpi" : "unpackage/res/push/48x48.png",
- "xxhdpi" : "unpackage/res/push/72x72.png"
- }
- } else if (args === 'xunJian') {
- state.name = '智能巡更'
- state.appid = '__UNI__BF1A1F0'
- state.description = '智能巡更app,是一款用于监督和记录巡逻人员按照预定路线和时间进行巡逻的系统。'
- state.versionName = "2.2.7"
- state.versionCode = 27
- state.h5.title = '智能巡更'
- maps.amap.name = "amap_15575941817CWPEQVCyc"
- maps.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
- maps.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
- geolocation.amap.name = "amap_15575941817CWPEQVCyc"
- geolocation.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
- geolocation.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
- geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- icons.android = {
- "hdpi" : "unpackage/res/icons-xunJian/72x72.png",
- "xhdpi" : "unpackage/res/icons-xunJian/96x96.png",
- "xxhdpi" : "unpackage/res/icons-xunJian/144x144.png",
- "xxxhdpi" : "unpackage/res/icons-xunJian/192x192.png"
- }
- icons.ios.appstore = "unpackage/res/icons-xunJian/1024x1024.png"
- icons.ios.ipad = {
- "app": "unpackage/res/icons-xunJian/76x76.png",
- "app@2x": "unpackage/res/icons-xunJian/152x152.png",
- "notification": "unpackage/res/icons-xunJian/20x20.png",
- "notification@2x": "unpackage/res/icons-xunJian/40x40.png",
- "proapp@2x": "unpackage/res/icons-xunJian/167x167.png",
- "settings": "unpackage/res/icons-xunJian/29x29.png",
- "settings@2x": "unpackage/res/icons-xunJian/58x58.png",
- "spotlight": "unpackage/res/icons-xunJian/40x40.png",
- "spotlight@2x": "unpackage/res/icons-xunJian/80x80.png"
- }
- icons.ios.iphone = {
- "app@2x": "unpackage/res/icons-xunJian/120x120.png",
- "app@3x": "unpackage/res/icons-xunJian/180x180.png",
- "notification@2x": "unpackage/res/icons-xunJian/40x40.png",
- "notification@3x": "unpackage/res/icons-xunJian/60x60.png",
- "settings@2x": "unpackage/res/icons-xunJian/58x58.png",
- "settings@3x": "unpackage/res/icons-xunJian/87x87.png",
- "spotlight@2x": "unpackage/res/icons-xunJian/80x80.png",
- "spotlight@3x": "unpackage/res/icons-xunJian/120x120.png"
- }
- push.unipush.icons.small = {
- "hdpi" : "unpackage/res/push-xunJian/36x36.png",
- "ldpi" : "unpackage/res/push-xunJian/18x18.png",
- "mdpi" : "unpackage/res/push-xunJian/24x24.png",
- "xhdpi" : "unpackage/res/push-xunJian/48x48.png",
- "xxhdpi" : "unpackage/res/push-xunJian/72x72.png"
- }
- } else if (args === 'huiYi') {
- state.name = '智能会议'
- state.appid = '__UNI__F3963F8'
- state.description = '智能会议APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序,旨在提升会议体验和管理效率。'
- state.versionName = "2.0.5"
- state.versionCode = 1
- state.h5.title = '智能会议'
- maps.amap.name = "amapBOujshtbA"
- maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.amap.name = "amapBOujshtbA"
- geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- icons.android = {
- "hdpi" : "unpackage/res/icons/72x72.png",
- "xhdpi" : "unpackage/res/icons/96x96.png",
- "xxhdpi" : "unpackage/res/icons/144x144.png",
- "xxxhdpi" : "unpackage/res/icons/192x192.png"
- }
- icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
- icons.ios.ipad = {
- "app": "unpackage/res/icons/76x76.png",
- "app@2x": "unpackage/res/icons/152x152.png",
- "notification": "unpackage/res/icons/20x20.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "proapp@2x": "unpackage/res/icons/167x167.png",
- "settings": "unpackage/res/icons/29x29.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "spotlight": "unpackage/res/icons/40x40.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png"
- }
- icons.ios.iphone = {
- "app@2x": "unpackage/res/icons/120x120.png",
- "app@3x": "unpackage/res/icons/180x180.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "notification@3x": "unpackage/res/icons/60x60.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "settings@3x": "unpackage/res/icons/87x87.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png",
- "spotlight@3x": "unpackage/res/icons/120x120.png"
- }
- push.unipush.icons.small = {
- "hdpi" : "unpackage/res/push/36x36.png",
- "ldpi" : "unpackage/res/push/18x18.png",
- "mdpi" : "unpackage/res/push/24x24.png",
- "xhdpi" : "unpackage/res/push/48x48.png",
- "xxhdpi" : "unpackage/res/push/72x72.png"
- }
- } else if (args === 'menJin') {
- state.name = '智能门禁'
- state.appid = '__UNI__8D6E9FD'
- state.description = '智能门禁APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序。'
- state.versionName = "1.0.0"
- state.versionCode = 1
- state.h5.title = '智能门禁'
- maps.amap.name = "amapBOujshtbA"
- maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.amap.name = "amapBOujshtbA"
- geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
- geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
- geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
- icons.android = {
- "hdpi" : "unpackage/res/icons/72x72.png",
- "xhdpi" : "unpackage/res/icons/96x96.png",
- "xxhdpi" : "unpackage/res/icons/144x144.png",
- "xxxhdpi" : "unpackage/res/icons/192x192.png"
- }
- icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
- icons.ios.ipad = {
- "app": "unpackage/res/icons/76x76.png",
- "app@2x": "unpackage/res/icons/152x152.png",
- "notification": "unpackage/res/icons/20x20.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "proapp@2x": "unpackage/res/icons/167x167.png",
- "settings": "unpackage/res/icons/29x29.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "spotlight": "unpackage/res/icons/40x40.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png"
- }
- icons.ios.iphone = {
- "app@2x": "unpackage/res/icons/120x120.png",
- "app@3x": "unpackage/res/icons/180x180.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "notification@3x": "unpackage/res/icons/60x60.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "settings@3x": "unpackage/res/icons/87x87.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png",
- "spotlight@3x": "unpackage/res/icons/120x120.png"
- }
- push.unipush.icons.small = {
- "hdpi" : "unpackage/res/push/36x36.png",
- "ldpi" : "unpackage/res/push/18x18.png",
- "mdpi" : "unpackage/res/push/24x24.png",
- "xhdpi" : "unpackage/res/push/48x48.png",
- "xxhdpi" : "unpackage/res/push/72x72.png"
- }
- }
- } else if ('./src/pages.json') {
- state.pages.forEach((e, index) => {
- if (args === 'zhiHuiYun') {
- if (e.style.navigationBarTitleText === "工作台") {
- if (index != 0) {
- state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
- }
- }
- state.condition.list[0].path = "pages/login"
- } else if (args === 'xunJian') {
- if (e.style.navigationBarTitleText === "工作台") {
- if (index != 0) {
- state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
- }
- }
- state.condition.list[0].path = "pages/login"
- } else if (args === 'huiYi') {
- if (e.style.navigationBarTitleText === "人脸识别") {
- if (index != 0) {
- state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
- }
- }
- state.condition.list[0].path = "pages/face/index"
- } else if (args === 'menJin') {
- if (e.style.navigationBarTitleText === "门禁识别") {
- if (index != 0) {
- state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
- }
- }
- state.condition.list[0].path = "pages/door/index"
- }
- })
- }
- // 将修改后的对象转换回JSON字符串
- const updated = JSON.stringify(state, null, 4);
- // 写入新的配置到manifest.json
- fs.writeFile(file, updated, 'utf8', function (err) {
- if (err) throw err;
- console.log(file + ' updated successfully');
- });
- });
- })
|