// Helper to run our build tasks const runBuild = (lando, options = {}, steps = []) => lando.Promise.each(steps, step => { if (_.has(step, 'func')) { return step.func(options, lando); } else { step.cmd = (_.isFunction(step.cmd)) ? step.cmd(options) : step.cmd; return build.run(lando, build.buildRun(_.merge({}, build.runDefaults(lando, options), step))); }; })
const BaseView = function BaseView(options) { assert(options.parent, "View requires parent"); assert(options.layoutConfig && _.isFunction(options.layoutConfig.getPosition), "View requires layoutConfig option with getPosition function"); this._remountOnResize = false; this._getPosition = options.layoutConfig.getPosition; this._boundRecalculatePosition = this.recalculatePosition.bind(this); options.parent.screen.on("resize", this._boundRecalculatePosition); this.parent = options.parent; this.layoutConfig = Object.assign( this.getDefaultLayoutConfig(options), options.layoutConfig.view); }
_.forEach(opts, (opt, key) => { const isRec = key === 'recipe'; // NOTE: when seems like the most relevant override here, should we consider adding more? // are we restricted by access to the answers hash or when these things actually run? _.forEach(['when'], prop => { const overrideFunc = answers => { const config = isRec ? exports.getConfig(sources, answers.source) : exports.getConfig(inits, answers.recipe); if (_.has(config, `overrides.${key}.${prop}`) && _.isFunction(config.overrides[key][prop])) { return config.overrides[key][prop](answers); } else { return opt.interactive[prop](answers); } }; opts[key] = _.merge({}, {interactive: _.set({}, prop, overrideFunc)}); }); });
if (_.isUndefined(fn) && _.isFunction(priority)) { fn = priority; priority = 5;
if (_.isFunction(run)) return run(data.options, lando); else return _.find(lando.tasks, {command}).run(data.options); })
es.merge(streamArr).on('end', function () { if (_.isFunction(opts.end)) { opts.end(); } });
function resourcesConcat (opts) { var config = _.assign({ cwd: undefined, module: undefined, dest: 'dist', end: function () {} }, opts); if (!config.cwd || !config.module) { gutil.log(gutil.colors.red('传入参数有误 at concat!')); return; } var modulePath = path.join(config.cwd, config.module); concactStatic(modulePath, config, function () { if (_.isFunction(opts.end)) { opts.end(); } }); }
scriptContent = widgetContent.splice(widgetStartLine + 1, widgetEndLine - widgetStartLine - 1).join('\n'); scriptContent = _.template(scriptContent)(paramClone); if (_.isFunction(onProcessScript)) { scriptContent = onProcessScript(scriptContent); if (_.isFunction(onProcessContent)) { widgetHtmlStr = onProcessContent(widgetPath, widgetHtmlStr, widgetItem); if (_.isFunction(ViewHelper.config.onProcessTpl)) { widgetHtmlStr = ViewHelper.config.onProcessTpl(widgetHtmlStr);
// 开始配送 async dispatch(order = this.order) { const { billNumber = '', uuid, version } = order; this.$confirm(`将开始配送订单:${billNumber}, 是否继续?`, '提示', { type: 'warning', }).then(async () => { await this.$api.order.dispatch({ uuid, version }); this.$message({ message: '订单已开始配送', type: 'success' }); return (_.isFunction(this.query) && this.query()) || (_.isFunction(this.get) && this.get()); }).catch(() => { }); }
mx_openDropdown(visible) { if (!visible && this.dropdownPrevField === this.dropdownField) return; if (this.dropdownFlag) { this.dropdownFlag = false; } else { this.dropdownFlag = true; if (_.isFunction(this.doAfterOpenDropdown)) { this.doAfterOpenDropdown(this.dropdownField); } } }
/** * Calls the given callback with the given arguments, if the callback is defined. * * @param {function|*} callback * @param {Error|null} err * @param {*} arg */ function doCallback (callback, err, arg) { if (_.isFunction(callback)) { callback(err, arg); } }
// 任务处理 registerTaskHandler(type, handler) { if (!type) { throw new Error('type不能为空'); } if (!_.isFunction(handler)) { throw new Error('handler类型非function'); } handlers[type] = handler; events[type] = true; }
// 下架 async downGoods(goods = {}) { const { uuid, version } = goods; await this.$api.goods.down({ uuid, version }); this.$message({ message: '商品下架成功', type: 'success' }); return (_.isFunction(this.query) && this.query()) || (_.isFunction(this.get) && this.get()); }
// 上架 async upGoods(goods = {}) { const { uuid, version } = goods; await this.$api.goods.up({ uuid, version }); this.$message({ message: '商品上架成功', type: 'success' }); return (_.isFunction(this.query) && this.query()) || (_.isFunction(this.get) && this.get()); }
// 完成 async complete(order = this.order) { const { billNumber = '', uuid, version } = order; this.$confirm(`将完成订单:${billNumber}, 是否继续?`, '提示', { type: 'warning', }).then(async () => { await this.$api.order.complete({ uuid, version }); this.$message({ message: '订单已完成', type: 'success' }); return (_.isFunction(this.query) && this.query()) || (_.isFunction(this.get) && this.get()); }).catch(() => { }); }