65 lines
3.6 KiB
Python
65 lines
3.6 KiB
Python
path = 'c:/NeoZQYY/docs/h5_ui/compare/AGENT-PLAYBOOK.md'
|
|
with open(path, 'rb') as f:
|
|
content = f.read().decode('utf-8')
|
|
|
|
# Find and replace the 2.2 section
|
|
old_marker = '### 2.2 \u5c3a\u5bf8\u53c2\u6570\u8868'
|
|
next_section = '## \u4e09\u3001\u622a\u56fe\u64cd\u4f5c'
|
|
|
|
idx_s = content.find(old_marker)
|
|
idx_e = content.find(next_section)
|
|
print(f'idx_s={idx_s} idx_e={idx_e}')
|
|
assert idx_s >= 0 and idx_e > idx_s
|
|
|
|
new_block = (
|
|
'### 2.2 \u4e24\u79cd\u9875\u9762\u6a21\u5f0f\u4e0e\u622a\u56fe\u5c3a\u5bf8\n'
|
|
'\n'
|
|
'\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9875\u9762\u6709\u4e24\u79cd\u5bfc\u822a\u680f\u6a21\u5f0f\uff0c\u5f71\u54cd MP \u622a\u56fe\u9ad8\u5ea6\uff1a\n'
|
|
'\n'
|
|
'**\u6a21\u5f0f A\uff1a\u7cfb\u7edf\u9ed8\u8ba4 navigationBar**\uff08\u9875\u9762 json \u65e0 `navigationStyle: custom`\uff09\n'
|
|
'- \u7cfb\u7edf\u6e32\u67d3\u6807\u9898\u680f\uff0c\u9875\u9762\u5185\u5bb9\u533a\u5728\u6807\u9898\u680f\u4e0b\u65b9\uff0cwindowHeight = 752px\n'
|
|
'- MP \u539f\u59cb\u622a\u56fe\uff1a**645\u00d71128**\uff0c\u65e0\u9700\u88c1\u526a\n'
|
|
'- **\u6b64\u6a21\u5f0f\u9875\u9762**\uff1aboard-finance, board-coach, board-customer, task-list, my-profile\n'
|
|
'\n'
|
|
'**\u6a21\u5f0f B\uff1a\u81ea\u5b9a\u4e49 navigationBar**\uff08\u9875\u9762 json \u542b `\"navigationStyle\": \"custom\"`\uff09\n'
|
|
'- \u9875\u9762\u81ea\u5df1\u7ba1\u7406\u5bfc\u822a\u680f\uff0c\u5185\u5bb9\u533a\u4ece\u5c4f\u5e55\u9876\u7aef\u5f00\u59cb\uff08\u5305\u542b\u72b6\u6001\u680f+\u81ea\u5b9a\u4e49\u5bfc\u822a\u680f\u533a\u57df\uff09\uff0cwindowHeight \u66f4\u9ad8\n'
|
|
'- MP \u539f\u59cb\u622a\u56fe\uff1a**645\u00d71224**\uff0c\u88c1\u526a\u53c2\u6570\uff1acrop(0, 96, 645, 1224) \u2192 645\u00d71128\n'
|
|
'- **\u6b64\u6a21\u5f0f\u9875\u9762**\uff1atask-detail, task-detail-callback, task-detail-priority, task-detail-relationship, coach-detail, customer-detail, performance, notes, chat, chat-history, customer-service-records, performance-records\n'
|
|
'\n'
|
|
'| \u53c2\u6570 | H5\uff08\u6240\u6709\u9875\u9762\uff09 | \u6a21\u5f0f A MP | \u6a21\u5f0f B MP |\n'
|
|
'|------|-----|-----|------|\n'
|
|
'| viewport \u5bbd | 430px | 430px | 430px |\n'
|
|
'| DPR | 1.5 | 1.5 | 1.5 |\n'
|
|
'| \u539f\u59cb\u622a\u56fe\u5c3a\u5bf8 | 645\u00d71128 | 645\u00d71128 | 645\u00d71224 |\n'
|
|
'| **\u5bf9\u6bd4\u57fa\u51c6\u5c3a\u5bf8** | **645\u00d71128** | **645\u00d71128\uff08\u65e0\u9700\u88c1\u526a\uff09** | **645\u00d71128\uff08\u88c1\u526a\u540e\uff09** |\n'
|
|
'| \u6eda\u52a8\u6b65\u957f | 600px | 600px | 600px |\n'
|
|
'| \u622a\u56fe\u683c\u5f0f | PNG | PNG | PNG |\n'
|
|
'\n'
|
|
'### 2.3 MP \u622a\u56fe\u88c1\u526a\uff08\u6a21\u5f0f B \u5fc5\u987b\u6267\u884c\uff09\n'
|
|
'\n'
|
|
'\u6a21\u5f0f B \u9875\u9762\u6bcf\u5f20 MP \u622a\u56fe\u540e\u7acb\u5373\u88c1\u526a\uff1a\n'
|
|
'\n'
|
|
'```python\n'
|
|
'from PIL import Image\n'
|
|
'img = Image.open(\'mp--step-N.png\') # 645x1224\n'
|
|
'img.crop((0, 96, 645, 1224)).save(\'mp--step-N.png\') # \u88c1\u526a\u540e 645x1128\n'
|
|
'```\n'
|
|
'\n'
|
|
'\u6216\u4f7f\u7528 anchor_compare.py\uff1a\n'
|
|
'```bash\n'
|
|
'uv run python scripts/ops/anchor_compare.py crop <mp_path> 0 96 645 1224\n'
|
|
'```\n'
|
|
'\n'
|
|
'\u6a21\u5f0f A \u9875\u9762\u65e0\u9700\u88c1\u526a\uff0cMP \u622a\u56fe\u76f4\u63a5\u7528\u4e8e\u5bf9\u6bd4\u3002\n'
|
|
'\n'
|
|
'> \u4ee5\u4e0a\u9ad8\u5ea6\u57fa\u4e8e 430px \u5bbd\u6a21\u62df\u5668\u5b9e\u6d4b\u3002step-0 \u622a\u56fe\u540e\u5148\u786e\u8ba4\u5b9e\u9645\u5c3a\u5bf8\uff0c\u4e0e\u4e0a\u8868\u4e0d\u7b26\u65f6\u4ee5\u5b9e\u6d4b\u4e3a\u51c6\u5e76\u66f4\u65b0\u672c\u8868\u3002\n'
|
|
'\n'
|
|
)
|
|
|
|
content = content[:idx_s] + new_block + content[idx_e:]
|
|
print(f'Section replaced. New length: {len(content)}')
|
|
|
|
with open(path, 'wb') as f:
|
|
f.write(content.encode('utf-8'))
|
|
print('Done')
|