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

325 天前
 hucs

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

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

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

717 次点击
所在节点    前端开发
3 条回复
haocity
320 天前
发布成 h5 不是最容易卡审核么?都成马甲包了。
我记忆里是可以不通过开发者工具上传的 但你需要找 wx 那边注册成服务商,被小程序用户授权后,即可通过 api 上传
LOWINC
304 天前
前端拖拽式生成 一个页面内容相关的 json
通过这个 json 小程序和 h5 自己还原成页面

````

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

````
justyeh
298 天前
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()

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/946882

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX