自传语伴小程序

彭峰 cb11e0b59d Keep the live H5 checkout bridge alongside native cashier 16 часов назад
common-page cb11e0b59d Keep the live H5 checkout bridge alongside native cashier 16 часов назад
components ba2c639e92 fix(miniprogram): keep native credentials out of H5 navigation 6 дней назад
docs e7857ad060 Extract verified WeChat payment status reconciliation 16 часов назад
libs 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
server 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
styles 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
test cb11e0b59d Keep the live H5 checkout bridge alongside native cashier 16 часов назад
utils e7857ad060 Extract verified WeChat payment status reconciliation 16 часов назад
yuban 398ad7c67f Send AI reply reporting back to the conversation 2 дней назад
.gitignore 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
README.md 25dc758e87 Enhance app functionality and configuration: Added device info handling in app.js, integrated preload rules in app.json, and improved web-view component with payment features. Updated component usage across various pages and adjusted project settings for better performance. 7 месяцев назад
analyse-data.json 1654fdb1f0 refactor: remove unnecessary permissions and optimize component paths 4 месяцев назад
app.js d24a8f24d3 fix: correct config path and enhance web-view parameters 4 месяцев назад
app.json 395bb79c5f Add native WeChat cashier for WebView orders 1 день назад
app.wxss 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
config.js 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
exportToPlugin.js 25dc758e87 Enhance app functionality and configuration: Added device info handling in app.js, integrated preload rules in app.json, and improved web-view component with payment features. Updated component usage across various pages and adjusted project settings for better performance. 7 месяцев назад
index.js 8a26336889 Handle verified account restrictions in mini program sign-in 4 дней назад
index.json 25dc758e87 Enhance app functionality and configuration: Added device info handling in app.js, integrated preload rules in app.json, and improved web-view component with payment features. Updated component usage across various pages and adjusted project settings for better performance. 7 месяцев назад
index.wxml 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
index.wxss 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
karma.conf.js 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
package-lock.json 8096021295 Update dependencies and enhance home component: Upgraded miniprogram-api-typings to version 5.2.1 in package.json and package-lock.json. Improved home component with a new startup source parameter, added slide functionality, and enhanced UI elements including a carousel for better user experience. 4 месяцев назад
package.json 8096021295 Update dependencies and enhance home component: Upgraded miniprogram-api-typings to version 5.2.1 in package.json and package-lock.json. Improved home component with a new startup source parameter, added slide functionality, and enhanced UI elements including a carousel for better user experience. 4 месяцев назад
project.config.json 64c8727af2 Keep published share behavior with protected H5 navigation 4 дней назад
settings.json 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад
sitemap.json 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 7 месяцев назад

README.md

WAPP 微信小程序:小程序页面、样式、MOCK数据规范

NovaWapp脚手架工具

初始化子项目

# 安装依赖
npm i
# 初始化子项目
npm run nova init nova-doctor
# 开发者工具选择 nova-wapp 目录启动项目

项目结构

  • 子项目配置文件目录:/config/<project> 目录为
    • config.js 账套及三方参数配置文件
    • app.json 小程序项目分包依赖文件
  • 开发者首先需要加载子项目的配置文件才能正常运行子项目
    • 例如:npm run nova init nova-doctor
    • 将nova-doctor精英内推项目配置文件,复制到当前项目进行开发
  • 更多目录介绍请查看:目录及开发规范

    命令帮助

    npm run nova help

    > node .release-tool.js help
    usage: .release-tool.js <command>
    
    命令:
    .release-tool.js list            列出所有可用小程序清单
    .release-tool.js init <appname>  初始化小程序:根据appname
    
    选项:
    --help     显示帮助信息                                                 [布尔]
    --version  显示版本号                                                   [布尔]
    

NovaWapp技术文档

# 调试打包 完整
rm -r dist/docs/*
jsdoc -c .config-jsdoc.json
cp -r docs/* dist/docs/
http-server ./dist/docs/
# 调试打包
npm run docs

# 发布上线
rsync -avPW dist/docs/ root@server.fmode.cn:/var/www/ng-fmode/wapp/
scp -r dist/docs/* root@server.fmode.cn:/var/www/ng-fmode/wapp/

H5 嵌套小程序支付迁移(不改 nova-payment 组件)

H5 -> 小程序消息协议

H5 在小程序 web-view 容器内,支付时发送:

wx.miniProgram.postMessage({
  data: {
    type: 'requestMiniPay',
    payload: {
      tradeNo: 'ORDER202604090001',
      price: 99.9,
      orderId: 'parse_order_object_id',
      orderType: 'shopgoods',
      showType: 'all',
      showBonus: false,
      profileId: '',
      // 可选:用于接收小程序支付结果(会刷新 web-view 到该地址)
      callbackUrl: 'https://www.yuban.co/pay/result'
    }
  }
});

小程序侧回传结果约定

小程序内部统一生成 miniPayResult 结构:

{
  type: 'miniPayResult',
  payload: {
    success: true,
    tradeNo: 'ORDER202604090001',
    payType: 'wxpay',
    cancelled: false,
    errMsg: ''
  }
}

说明:

  • web-view 不支持小程序反向 postMessage 到 H5。
  • 若传了 callbackUrl,小程序会把结果拼接到 URL 查询参数并刷新到该地址。
  • 若不传 callbackUrl,建议 H5 按 tradeNo 轮询订单状态。

H5 运行时分流(不影响原 H5 支付)

function isMiniProgramEnv() {
  return window.__wxjs_environment === 'miniprogram';
}

function pay(order) {
  if (isMiniProgramEnv() && window.wx?.miniProgram?.postMessage) {
    wx.miniProgram.postMessage({
      data: {
        type: 'requestMiniPay',
        payload: {
          tradeNo: order.tradeNo,
          price: order.price,
          orderId: order.orderId,
          orderType: order.orderType || 'shopgoods',
          callbackUrl: order.callbackUrl || ''
        }
      }
    });
    return;
  }

  // 非小程序容器:保持原 H5 支付逻辑(chooseWXPay/WeixinJSBridge)
  runLegacyH5Pay(order);
}

代码质量平台排除建议(第三方依赖)

当质量检查命中 miniprogram_npm/@vant/weapp/** 下的第三方文件时,建议在微信代码质量平台配置路径排除:

  • miniprogram_npm/@vant/weapp/**

建议保留业务目录扫描:

  • common-page/**
  • components/**
  • yuban/**
  • app.js
  • app.json