function initReward_specialNotice(type) {
    console.log('init ' + type)
    changetypeTo_specialNotice();

    // 奖励回写
    console.log('reward_info ', reward_info)
    console.log('extraData ', extraData)
    if (!reward_info || !extraData) {
        return
    }

    const extra_data = JSON.parse(extraData)
    const nodeArr = $(`input[name="specialNoticeConfig[device]"]`)
    for (let idx = 0; idx < nodeArr.length; idx++) {
        nodeArr[idx].checked = extra_data['device'] === nodeArr[idx].value;
    }

    let html = ''
    for (const field in reward_info) {
        const langInfo = extra_data['conf'][field] ?? undefined
        if (langInfo === undefined) {
            continue
        }

        let title = langInfo['title'];
        let salutation = langInfo['salutation'] ?? "";
        let content = langInfo['content'];
        let sign = langInfo['sign'] ?? "";
        html += `    
            <tr>
                <td><input type="text" placeholder="" value="${reward_info[field]}" class="form-control" disabled></td>
                <td><input type="text" placeholder="" value="${field}" class="form-control" disabled></td>
                <td><textarea rows="6" placeholder="" name="specialNoticeConfig[conf][${field}][title]"  class="form-control">${title}</textarea></td>
                <td><textarea rows="6" placeholder="" name="specialNoticeConfig[conf][${field}][salutation]"  class="form-control">${salutation}</textarea></td>
                <td><textarea rows="6" placeholder="" name="specialNoticeConfig[conf][${field}][content]"  class="form-control">${content}</textarea></td>
                <td><textarea rows="6" placeholder="" name="specialNoticeConfig[conf][${field}][sign]"  class="form-control">${sign}</textarea></td>
            </tr>`
    }

    $('#specialNoticeBody').append(html)
}

function changetypeTo_specialNotice() {
    $("#reward_info").empty();
    initSpecialNoticeWrap();
}

function initSpecialNoticeWrap() {
    var html = SpecialNoticeWrapStageTable();
    $("#reward_info").append(html);
}

function SpecialNoticeWrapStageTable() {
    return `
    <div class="form-group" >
        <label class="col-sm-1 control-label">生效平台:</label>
        <div class="col-sm-11">
            <label class="radio-inline">
                <input type="radio" name="specialNoticeConfig[device]" value="all" checked="checked"> 全部
            </label>
            <label class="radio-inline">
                <input type="radio" name="specialNoticeConfig[device]" value="android"> 安卓
            </label>
            <label class="radio-inline">
                <input type="radio" name="specialNoticeConfig[device]" value="ios"> 苹果
            </label>
        </div>
    </div>

    <div class="form-group" style="margin-top: 50px">
        <label class="col-sm-1 control-label">语言配置:</label>
        <div class="col-sm-11">
           <table class="table table-bordered">
                <thead>
                    <tr>
                        <td style="width: 10%">地区</td>
                        <td style="width: 10%">语言</td>
                        <td style="width: 20%">起头</td>
                        <td>问候语</td>
                        <td>正文</td>
                        <td>署名</td>
                    <tr>
                </thead>
                 <tbody id="specialNoticeBody"> </tbody>
           </table>    
        </div>
    </div>
    `;
}


