|
@@ -76,25 +76,25 @@ $(function(){
|
|
|
keyWordArr.push(Obj);
|
|
|
localStorage.setItem("keyWord", JSON.stringify(keyWordArr));
|
|
|
var html = `<li>
|
|
|
- <div class="one">
|
|
|
- <div>
|
|
|
- <span>
|
|
|
- <strong> 关键词:</strong>
|
|
|
- <p class="key">${ keyWord }</p>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>
|
|
|
+ <div class="one">
|
|
|
+ <div>
|
|
|
+ <span>
|
|
|
+ <strong> 关键词:</strong>
|
|
|
+ <p class="key">${ keyWord }</p>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <div class="modify">
|
|
|
- <span contentEditable="true">${ keyWord }</span>
|
|
|
- <button class="addAdjunctWord">编辑 附加词</button>
|
|
|
- <button class="addExclusion">添加 排除词</button>
|
|
|
- <button class="deleteKey">删除</button>
|
|
|
- <button class="ascertainKey">确定</button>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
+ <button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>
|
|
|
+ </div>
|
|
|
+ <div class="modify">
|
|
|
+ <span contentEditable="true">${ keyWord }</span>
|
|
|
+ <button class="addAdjunctWord">编辑 附加词</button>
|
|
|
+ <button class="addExclusion">添加 排除词</button>
|
|
|
+ <button class="deleteKey">删除</button>
|
|
|
+ <button class="ascertainKey">确定</button>
|
|
|
+ </div>
|
|
|
+ </li>`
|
|
|
$('.showKeyWord > ul').prepend(html);
|
|
|
-
|
|
|
+
|
|
|
// 隐藏
|
|
|
$(".addkeyWord").hide();
|
|
|
$('.showKeyWord').show();
|
|
@@ -102,7 +102,6 @@ $(function(){
|
|
|
var buttonDOM = $('.enter.addkeyWord .btn button')[0]
|
|
|
buttonDOM.style.opacity = .5
|
|
|
buttonDOM.setAttribute("disabled", true)
|
|
|
-
|
|
|
})
|
|
|
|
|
|
// 编辑
|
|
@@ -144,33 +143,26 @@ $(function(){
|
|
|
var $this = $(this);
|
|
|
var keyWord = $(this).siblings('span').text();
|
|
|
var keyWords = $(this).parent().prev().find('.key').text();
|
|
|
- for(var i in keyWordArr){
|
|
|
- if(keyWordArr[i].keyWord === keyWords){
|
|
|
- keyWordArr[i].keyWord = keyWord;
|
|
|
+ if ($('.addkeyWord input.enterOne').val().length < 1) {
|
|
|
+
|
|
|
+ weui.toast('关键词不能为空', {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'text-overflow100',
|
|
|
+ callback: function(){
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ for(var i in keyWordArr){
|
|
|
+ if(keyWordArr[i].keyWord === keyWords){
|
|
|
+ keyWordArr[i].keyWord = keyWord;
|
|
|
+ }
|
|
|
}
|
|
|
+ localStorage.keyWord = JSON.stringify(keyWordArr);
|
|
|
+ $this.parent().siblings().find('.key').text(keyWord)
|
|
|
+ $this.parent().hide().siblings().show()
|
|
|
}
|
|
|
- localStorage.keyWord = JSON.stringify(keyWordArr);
|
|
|
- // weui.confirm('保存关键词?', {
|
|
|
- // buttons: [{
|
|
|
- // label: '我再想想',
|
|
|
- // type: 'default',
|
|
|
- // onClick: function(){
|
|
|
- // $this.parent().hide().siblings().show()
|
|
|
- // console.log('我再想想')
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // label: '确定保存',
|
|
|
- // type: 'primary',
|
|
|
- // onClick: function(){
|
|
|
- // $this.parent().siblings().find('.key').text(keyWord)
|
|
|
- // $this.parent().hide().siblings().show()
|
|
|
- // console.log(keyWord)
|
|
|
- // }
|
|
|
- // }]
|
|
|
- // });
|
|
|
- $this.parent().siblings().find('.key').text(keyWord)
|
|
|
- $this.parent().hide().siblings().show()
|
|
|
- // console.log(keyWord)
|
|
|
})
|
|
|
|
|
|
//去空格方法
|