自传语伴小程序

徐福静0235668 d24a8f24d3 fix: correct config path and enhance web-view parameters 1 month ago
common-page d24a8f24d3 fix: correct config path and enhance web-view parameters 1 month ago
components 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
libs 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
server 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
styles 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
test 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
utils 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
yuban 1654fdb1f0 refactor: remove unnecessary permissions and optimize component paths 1 month ago
.gitignore 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
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. 5 months ago
analyse-data.json 1654fdb1f0 refactor: remove unnecessary permissions and optimize component paths 1 month ago
app.js d24a8f24d3 fix: correct config path and enhance web-view parameters 1 month ago
app.json 1654fdb1f0 refactor: remove unnecessary permissions and optimize component paths 1 month ago
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. 5 months ago
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. 5 months ago
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. 5 months ago
index.js 1e6cc41500 Initial commit: Add project structure with essential files including app configuration, main application logic, and UI components for a WeChat mini program. 5 months ago
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. 5 months ago
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. 5 months ago
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. 5 months ago
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. 5 months ago
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. 2 months ago
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. 2 months ago
project.config.json d24a8f24d3 fix: correct config path and enhance web-view parameters 1 month ago
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. 5 months ago
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. 5 months ago

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