|
@@ -39,7 +39,7 @@ $(function(){
|
|
// 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
|
|
// 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
|
|
$('.addkeyWord input.enterOne').on('input', function() {
|
|
$('.addkeyWord input.enterOne').on('input', function() {
|
|
var buttonDOM = $(this).siblings().find('button')[1]
|
|
var buttonDOM = $(this).siblings().find('button')[1]
|
|
- if ($(this).val().length >= 1) {
|
|
|
|
|
|
+ if ($.trim($(this).val()).length >= 1) {
|
|
buttonDOM.style.opacity = 1
|
|
buttonDOM.style.opacity = 1
|
|
buttonDOM.removeAttribute("disabled")
|
|
buttonDOM.removeAttribute("disabled")
|
|
} else {
|
|
} else {
|
|
@@ -51,8 +51,13 @@ $(function(){
|
|
// 添加 按钮的点击事件
|
|
// 添加 按钮的点击事件
|
|
$('.addkeyWord .btn button:nth-child(2)').on('click', function(){
|
|
$('.addkeyWord .btn button:nth-child(2)').on('click', function(){
|
|
var timestamp = new Date().getTime();//动态生成不同的id,因为id唯一不能重复,所以 用时间戳 代替 防止重复
|
|
var timestamp = new Date().getTime();//动态生成不同的id,因为id唯一不能重复,所以 用时间戳 代替 防止重复
|
|
- var keyWord = $('.addkeyWord input.enterOne').val();
|
|
|
|
- if(keyWord==""){
|
|
|
|
|
|
+ var keyWord = $.trim($('.addkeyWord input.enterOne').val());
|
|
|
|
+ if(keyWord==""&&keyWord.length==0){
|
|
|
|
+ weui.toast('附加词不能为空', {
|
|
|
|
+ duration: 2000,
|
|
|
|
+ className: 'custom-toast',
|
|
|
|
+ callback: function () { console.log('close') }
|
|
|
|
+ });
|
|
return
|
|
return
|
|
}
|
|
}
|
|
_addindex = 0;
|
|
_addindex = 0;
|
|
@@ -114,7 +119,7 @@ $(function(){
|
|
// 编辑 删除
|
|
// 编辑 删除
|
|
$('.showKeyWord').on('click', '.deleteKey', function(e) {
|
|
$('.showKeyWord').on('click', '.deleteKey', function(e) {
|
|
var jQueryDOM = $(this).parents('li');
|
|
var jQueryDOM = $(this).parents('li');
|
|
- _addkws = $(this).siblings('textarea').val();
|
|
|
|
|
|
+ _addkws = $.trim($(this).siblings('textarea').val());
|
|
var _index = $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
|
|
var _index = $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
|
|
weui.confirm('确定要删除附加词?', {
|
|
weui.confirm('确定要删除附加词?', {
|
|
buttons: [{
|
|
buttons: [{
|
|
@@ -134,9 +139,15 @@ $(function(){
|
|
})
|
|
})
|
|
// 编辑 确定
|
|
// 编辑 确定
|
|
$('.showKeyWord').on('click', '.ascertainKey', function(e) {
|
|
$('.showKeyWord').on('click', '.ascertainKey', function(e) {
|
|
- var keyWord = $(this).siblings('textarea').val();
|
|
|
|
|
|
+ var keyWord = $.trim($(this).siblings('textarea').val());
|
|
var _index = $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
|
|
var _index = $('.showKeyWord li').length - $(this).parent().parent("li").index() -1;
|
|
- if(keyWord.length > 20){
|
|
|
|
|
|
+ if(keyWord.length==0){
|
|
|
|
+ weui.toast('附加词不能为空', {
|
|
|
|
+ duration: 2000,
|
|
|
|
+ className: 'custom-toast',
|
|
|
|
+ callback: function () { console.log('close') }
|
|
|
|
+ });
|
|
|
|
+ }else if(keyWord.length > 20){
|
|
weui.toast('每组附加词不能超过20字', {
|
|
weui.toast('每组附加词不能超过20字', {
|
|
duration: 2000,
|
|
duration: 2000,
|
|
className: 'custom-toast',
|
|
className: 'custom-toast',
|