收藏
回答

开发工具的http调用,上传时app.json配置无效?

问题是这样的,我写了个node脚本根据不同的配置生成多个小程序模板代码,每个小程序都有个独立的app.json文件,

app.json是根据打包配置生成的


这两个模板小程序的app.json是不一样的比如在tab配置这一块

"tabBar": {
        "list": [
            {
                "pagePath": "pages/home/home",
                "text": "精选",
                "iconPath": "./static/icon_tabbar_index.png",
                "selectedIconPath": "./static/icon_tabbar_index_selected.png"
            },
            {
                "pagePath": "pages/discover/discover",
                "text": "发现",
                "iconPath": "./static/icon_tabbar_discover.png",
                "selectedIconPath": "./static/icon_tabbar_discover_selected.png"
            },
            {
                "pagePath": "pages/my_center/my_center",
                "text": "我的",
                "iconPath": "./static/icon_tabbar_profile.png",
                "selectedIconPath": "./static/icon_tabbar_profile_selected.png"
            }
        ],
        "color": "#999999",
        "selectedColor": "#1a1a1a",
        "backgroundColor": "#fff",
        "borderStyle": "white"
    },
"tabBar": {
        "list": [
            {
                "pagePath": "pages/home/home",
                "text": "精选",
                "iconPath": "./static/icon_tabbar_index.png",
                "selectedIconPath": "./static/icon_tabbar_index_selected.png"
            },
            {
                "pagePath": "pages/my_center/my_center",
                "text": "我的",
                "iconPath": "./static/icon_tabbar_profile.png",
                "selectedIconPath": "./static/icon_tabbar_profile_selected.png"
            }
        ],
        "color": "#999999",
        "selectedColor": "#1a1a1a",
        "backgroundColor": "#fff",
        "borderStyle": "white"
    },

在pc编辑器内毫无异常,问题出现在上传的时候

我调用http接口上传

http://127.0.0.1:29584/upload?version=2.0.16&desc=222&projectpath=%2FUsers%2Flinzilong%2FDocuments%2Fproject%2FminiProjectCombine%2Fbuild%2F18792

http://127.0.0.1:29584/upload?version=2.0.16&desc=222&projectpath=%2FUsers%2Flinzilong%2FDocuments%2Fproject%2FminiProjectCombine%2Fbuild%2F0

最后在公众平台扫码预览最后居然两个小程序都只有两个tab

但是在开发工具中预览却是正常的(一个3个tab,一个2个),而且异常的只有和app.json相关的内容,其他部分js代码也是根据打包配置生成的是可行的

ps:project.config.json的文件也是各自生成的就是说这两个模板的appid也是不一样的

奇怪的是我如果在编辑器内点击上传按钮是可以的,调用http上传就不行

尝试了一下命令行也是一样的问题,就算我不执行打包,直接上传(命令行或者http)3个tab的那个project,上传成功后公众平台上的还是两个tab的,只有点编辑器上的上传按钮才能成功上传3个tab的

最后一次编辑于  09-17
回答关注问题邀请回答
收藏
问题标签