detail.js
1 import { cli, Strategy } from '@jackwener/opencli/registry'; 2 cli({ 3 site: 'xiaoe', 4 name: 'detail', 5 description: '小鹅通课程详情(名称、价格、学员数、店铺)', 6 domain: 'h5.xet.citv.cn', 7 strategy: Strategy.COOKIE, 8 args: [ 9 { name: 'url', required: true, positional: true, help: '课程页面 URL' }, 10 ], 11 columns: ['name', 'price', 'original_price', 'user_count', 'shop_name'], 12 pipeline: [ 13 { navigate: '${{ args.url }}' }, 14 { wait: 5 }, 15 { evaluate: `(() => { 16 var vm = (document.querySelector('#app') || {}).__vue__; 17 if (!vm || !vm.$store) return []; 18 var core = vm.$store.state.coreInfo || {}; 19 var goods = vm.$store.state.goodsInfo || {}; 20 var shop = ((vm.$store.state.compositeInfo || {}).shop_conf) || {}; 21 return [{ 22 name: core.resource_name || '', 23 resource_id: core.resource_id || '', 24 resource_type: core.resource_type || '', 25 cover: core.resource_img || '', 26 user_count: core.user_count || 0, 27 price: goods.price ? (goods.price / 100).toFixed(2) : '0', 28 original_price: goods.line_price ? (goods.line_price / 100).toFixed(2) : '0', 29 is_free: goods.is_free || 0, 30 shop_name: shop.shop_name || '', 31 }]; 32 })() 33 ` }, 34 ], 35 });