V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hucs
V2EX  ›  前端开发

集思广益:最近公司准备研究一个小程序平台,如何实现跨端发布?

  •  
  •   hucs · 294 天前 · 685 次点击
    这是一个创建于 294 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如说通过前端拖拽式生成了一个页面,如何一键发布到不同的平台?

    就拿小程序和微信公众号网页来说吧,小程序的发布提交审核是很麻烦的,而且必须得借助开发者工具上传代码(至少是据我所知)。

    我能想到的最简单的办法就是不管哪个端都打包成 h5 ,这样也不用担心发布审核的问题了。市面上能参考的东西不多,大多都是商城类的小程序(听起来很厉害,一键发布,多段运行,design once,run anywhere),请大佬们给个建议。语言:React

    3 条回复    2023-07-04 14:40:12 +08:00
    haocity
        1
    haocity  
       289 天前
    发布成 h5 不是最容易卡审核么?都成马甲包了。
    我记忆里是可以不通过开发者工具上传的 但你需要找 wx 那边注册成服务商,被小程序用户授权后,即可通过 api 上传
    LOWINC
        2
    LOWINC  
       274 天前
    前端拖拽式生成 一个页面内容相关的 json
    通过这个 json 小程序和 h5 自己还原成页面

    ````

    [
    {
    type:"Header",
    value:"hello"
    },
    {
    type:"swiper",
    value:[
    ....
    ]
    }
    ]

    ````
    justyeh
        3
    justyeh  
       268 天前
    react 就 taro ,另外小程序支持 ci

    // 自动将代码上传到小程序
    const ci = require('miniprogram-ci')
    const path = require('path')
    const mainfest = require('../src/manifest.json')
    const slog = require('single-line-log').stdout
    const robot = Number(process.env.ROBOT) || 1
    const buildVersion = process.env.npm_config_build_version || mainfest.versionName

    function getUploadDesc() {
    // dev
    if (robot === 1) {
    return 'build by robot --dev'
    }

    // test
    if (robot === 2) {
    return 'build by robot --test'
    }

    // release
    if (robot === 3) {
    return 'build by robot --release'
    }

    // uat
    if (robot === 4) {
    return 'build by robot --uat'
    }

    return mainfest.description
    }

    async function main() {
    const project = new ci.Project({
    appid: mainfest['mp-weixin'].appid, //appid
    type: 'miniProgram',
    projectPath: path.resolve(__dirname, '../dist/build/mp-weixin'), //项目路径
    privateKeyPath: path.resolve(__dirname, `./private.${mainfest['mp-weixin'].appid}.key`), //小程序后台的上传密匙
    ignores: ['node_modules/**/*']
    })

    let slogIndex = 0

    try {
    await ci.upload({
    project,
    version: buildVersion,
    desc: getUploadDesc(),
    setting: mainfest['mp-weixin'].setting,
    robot,
    onProgressUpdate: () => {
    slog('上传中' + (slogIndex === 0 ? '.' : slogIndex === 1 ? '..' : '...') + '\n')
    slogIndex++
    if (slogIndex === 3) {
    slogIndex = 0
    }
    }
    })
    console.log(`上传成功 版本${buildVersion}`)
    } catch (error) {
    console.error(`上传失败 版本${buildVersion}`, error)
    }
    }

    main()
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1354 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:42 · PVG 01:42 · LAX 10:42 · JFK 13:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.