help.js 798 Bytes
// 帮助 by acgpiano
'use strict';

const api = global.yoho.API;

// 获取帮助列表
exports.getHelpList = () => {
    return api.get('', {
        method: 'app.help.li'
    }).then(result => {
        if (result && result.code === 200 && result.data) {
            let final = [];

            for (let name of result.data) {
                final.push({
                    name: name.caption,
                    code: name.code,
                });
            }
            return final;
        }
    });
};

// 获取帮助详情
exports.getHelpDetail = (code) => {
    return api.get('', {
        method: 'app.help.detail',
        code: code,
    }).then(result => {
        return result.replace(/^<!DOCTYPE.*<body>/g, '').
            replace(/<\/body>.*<\/html>/g, '');
    });
};