| 123456789101112131415161718192021222324252627282930313233343536 |
- // ==============================================================================
- // VOC 验证报告 · Ch3 定价调研 · 4 子章(快照模式)
- // 详见 ch2-package.js 头部说明。
- // ==============================================================================
- const fs = require('fs');
- const path = require('path');
- let _snapshot = null;
- function getSnapshot() {
- if (!_snapshot) {
- _snapshot = JSON.parse(fs.readFileSync(
- path.join(__dirname, '..', '_slides-snapshot.json'), 'utf8',
- ));
- }
- return _snapshot;
- }
- function fromSnapshot(id, slideNum) {
- const sec = getSnapshot()[id];
- if (!sec) {
- return `<section class="report-section" id="${id}" data-slide-num="${slideNum}"><div class="section-inner"><h2 class="text-h1">[Missing] ${id}</h2></div></section>`;
- }
- return sec.html.replace(/data-slide-num="[^"]+"/, `data-slide-num="${slideNum}"`);
- }
- function renderPricing1Channel({ slideNum } = {}) { return fromSnapshot('pricing-1', slideNum); }
- function renderPricing2SpecBand({ slideNum } = {}) { return fromSnapshot('pricing-2', slideNum); }
- function renderPricing3Competitor({ slideNum } = {}) { return fromSnapshot('pricing-3', slideNum); }
- function renderPricing4Value({ slideNum } = {}) { return fromSnapshot('pricing-4', slideNum); }
- module.exports = {
- renderPricing1Channel,
- renderPricing2SpecBand,
- renderPricing3Competitor,
- renderPricing4Value,
- };
|