import Magix from 'magix' import View from '../../../../../view' Magix.applyStyle('@./new-function.less') export default View.extend({ tmpl: '@new-function.html', init (options) { this.options = options }, async render () { // const loc = Magix.Router.parse() const functions = await this.getFunctions() this.updater.digest({ functions }) }, async getFunctions () { try { const loc = Magix.Router.parse() const params = { query: JSON.stringify({ size: 30, channelKey: 'DMP_weekly_Introduction' }) } const index = parseInt(loc.get('index') || '0', 10) const models = [{ name: 'yx_channel_content_findContent_get', params }] const [model] = await this.fetch(models) const data = model.get('data.result', []) // 万堂的功能介绍课程,按周报index获取对应的课程 const step = 1 return data.slice(index * step, (index + 1) * step) } catch (error) { this.alert('错误提示', error.msg || error.message || error) } } })