页面
在输入框中填写英语单词的谐音
这样的话就进行了一次英语单词的记忆练习。
页面代码
<% layout('/layouts/default.html', {title: '英语单词管理', libs: ['dataGrid']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-notebook"></i> ${text('英语单词管理')}
</div>
<div class="box-tools pull-right">
<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
<% if(hasPermi('english:english:edit')){ %>
<a href="${ctx}/english/english/form" class="btn btn-default btnTool" title="${text('新增英语单词')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
<% } %>
<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
</div>
</div>
<div class="box-body">
<#form:form id="searchForm" model="${english}" action="${ctx}/english/english/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<div class="form-group">
<label class="control-label">${text('英文单词')}:</label>
<div class="control-inline">
<#form:input path="englishWord" maxlength="45" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('谐音')}:</label>
<div class="control-inline">
<#form:input path="homophonic" maxlength="45" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('中文释义')}:</label>
<div class="control-inline">
<#form:input path="chinese" maxlength="45" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
</div>
</#form:form>
<table id="dataGrid"></table>
<div id="dataGridPage"></div>
</div>
</div>
</div>
<% } %>
<script>
//# // 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $('#searchForm'),
columnModel: [
{header:'${text("英文单词")}', name:'englishWord', index:'a.english_word', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/english/english/form?englishId='+row.englishId+'" class="btnList" data-title="${text("编辑英语单词")}">'+(val||row.id)+'</a>';
}},
{header:'${text("填写谐音")}', name:'homophonic', index:'a.homophonic', width:150, align:"left", formatter: function(val, obj, row, act){
return '<input type="text">';
}},
{header:'${text("谐音")}', name:'homophonic', index:'a.homophonic', width:150, align:"left"},
{header:'${text("填写中文释义")}', name:'chinese', index:'a.chinese', width:150, align:"left", formatter: function(val, obj, row, act){
return '<input type="text">';
}},
{header:'${text("中文释义")}', name:'chinese', index:'a.chinese', width:150, align:"left"},
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
var actions = [];
//# if(hasPermi('english:english:edit')){
actions.push('<a href="${ctx}/english/english/form?englishId='+row.englishId+'" class="btnList" title="${text("编辑英语单词")}"><i class="fa fa-pencil"></i></a> ');
actions.push('<a href="${ctx}/english/english/delete?englishId='+row.englishId+'" class="btnList" title="${text("删除英语单词")}" data-confirm="${text("确认要删除该英语单词吗?")}"><i class="fa fa-trash-o"></i></a> ');
//# }
return actions.join('');
}}
],
//# // 加载成功后执行事件
ajaxSuccess: function(data){
}
});
</script>
数据库表
CREATE TABLE `english` (
`english_id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
`english_word` varchar(45) DEFAULT NULL COMMENT '英文单词',
`homophonic` varchar(45) DEFAULT NULL COMMENT '谐音',
`chinese` varchar(45) DEFAULT NULL COMMENT '中文释义',
PRIMARY KEY (`english_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='英语单词';
[{"english_id":1, "english_word":"ambition", "homophonic":"am-俺,bi-必,tion-胜:俺必胜", "chinese":"野心"},
{"english_id":2, "english_word":"touche", "homophonic":"tou-透,che-彻:透彻", "chinese":"讲得好,一阵见血地"},
{"english_id":3, "english_word":"comprehension", "homophonic":"com-看,pre-破,hen-红,sion-尘:看破红尘,就领悟了了人生的真谛", "chinese":"领悟力"},
{"english_id":4, "english_word":"administration", "homophonic":"ad俺的,mini-命令,stration-死遵循:俺的命令死遵循", "chinese":"行政管理"},
{"english_id":5, "english_word":"mendacity", "homophonic":"men-男人,da-大,city:城市:男人到了大城市,就撒谎", "chinese":"虚伪"}]