|
@@ -0,0 +1,825 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport"
|
|
|
+ content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
|
+ <title>关键词</title>
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}">
|
|
|
+ <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}">
|
|
|
+ <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}">
|
|
|
+ <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/keyWord.css?v={{Msg "seo" "version"}}">
|
|
|
+ <style>
|
|
|
+ .ios-user-select {
|
|
|
+ -webkit-user-select: text;
|
|
|
+ }
|
|
|
+ .opacity6{
|
|
|
+ opacity: 0.6;
|
|
|
+ }
|
|
|
+ .keysexplain{
|
|
|
+ position: fixed;
|
|
|
+ height: .8rem;
|
|
|
+ background: rgba(245,244,249,1);
|
|
|
+ width: 100%;
|
|
|
+ font-size: .3rem;
|
|
|
+ padding-top: .18rem;
|
|
|
+ padding-left: .3rem;
|
|
|
+ color: #888;
|
|
|
+ }
|
|
|
+ .classifyKeysShow{
|
|
|
+ font-size: .25rem;
|
|
|
+ color: #686868;
|
|
|
+ margin-top: 0.1rem;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-line-clamp: 1;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ }
|
|
|
+ .addClassify{
|
|
|
+ height: 1rem;
|
|
|
+ text-align: center;
|
|
|
+ background: #2CB7CA;
|
|
|
+ width: 100%;
|
|
|
+ line-height: 1rem;
|
|
|
+ color:#FFFFFF;
|
|
|
+ font-size: .32rem;
|
|
|
+ position:fixed;
|
|
|
+ bottom:0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__hd {
|
|
|
+ padding: 0;
|
|
|
+ text-align: center;
|
|
|
+ font-size: .34rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__hd {
|
|
|
+ padding-left: .3rem;
|
|
|
+ height: .88rem;
|
|
|
+ line-height: .88rem;
|
|
|
+ background-color: #F4F4F9;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__bd {
|
|
|
+ padding: .38rem .1rem;
|
|
|
+ text-align: center;
|
|
|
+ font-size: .32rem;
|
|
|
+ color: #1d1d1d;
|
|
|
+ line-height: .6rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__bd .classify-keyword {
|
|
|
+ padding: 0 .17rem;
|
|
|
+ height: 0.8rem;
|
|
|
+ width: 100%;
|
|
|
+ font-size: .32rem;
|
|
|
+ border: 1px solid #CECECE;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__ft {
|
|
|
+ margin-top: .1rem;
|
|
|
+ margin-bottom: .3rem;
|
|
|
+ justify-content: space-around;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__ft .dialog__btn {
|
|
|
+ display: inline-block;
|
|
|
+ width: 1.72rem;
|
|
|
+ height: .72rem;
|
|
|
+ line-height: .72rem;
|
|
|
+ color: #fff;
|
|
|
+ font-size: .32rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__ft .dialog__btn_confirm {
|
|
|
+ background-color: #2CB7CA;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__ft .dialog__btn_cancel {
|
|
|
+ background-color: #BFBFC3;
|
|
|
+ }
|
|
|
+
|
|
|
+ .classify-show-pop .weui-dialog .weui-dialog__ft:after {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .all-classify-column{
|
|
|
+ position: relative;
|
|
|
+ padding-bottom: 1rem;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+
|
|
|
+<body>
|
|
|
+ <div class="keyWord">
|
|
|
+ <section class="add-keyword-container" style="display: none;">
|
|
|
+ <div>
|
|
|
+ <div class="classify">
|
|
|
+ <span class="classify-l">关键词分类</span>
|
|
|
+ <span class="classify-r">
|
|
|
+ <span class="classify-detail">未分类</span>
|
|
|
+ <span class="iconfont icon-arrow"></span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <p class="classify-tips">
|
|
|
+ 关键词分类便于对同类别关键词做整合管理
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <section class="content">
|
|
|
+ <!-- 添加关键词 -->
|
|
|
+ <div class="enter addkeyWord" style="display: none;">
|
|
|
+ <input type="text" class="enterOne" placeholder="请输入关键词" maxlength="20" />
|
|
|
+ <!-- <textarea style="resize:none;" rows="1" class="enterOne" name="" id="" placeholder="请输入关键词" maxlength="100"></textarea> -->
|
|
|
+ <div class="btnChoose" style="display:none;">
|
|
|
+ <button onclick="toappendkey(this)">添加 附加词</button>
|
|
|
+ <button onclick="tonotkey(this)">添加 排除词</button>
|
|
|
+ </div>
|
|
|
+ <div class="btn">
|
|
|
+ <button disabled>确认</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 添加关键词显示列表 -->
|
|
|
+ <div class="showKeyWord">
|
|
|
+ <ul>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="problem">
|
|
|
+ 疑问解答 <i class="iconfont icon-wenhao"></i>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+
|
|
|
+ <div class="addKeyWord addNewKeyword" style="display: none;">
|
|
|
+ <i class="iconfont icon-tianjia"></i>
|
|
|
+ <p> 关键词添加数量:<em style="color: #2cb7ca;" class="kws_count">0 </em>/ 300</p>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ <section class="all-classify-column" style="display: none;">
|
|
|
+ <div class="keysexplain"><p> 关键词添加数量:<em style="color: #2cb7ca;" class="kws_count">0 </em> / 300</p></div>
|
|
|
+ <ul class="classify-list">
|
|
|
+
|
|
|
+ </ul>
|
|
|
+
|
|
|
+ <div class="addKeyWord addNewKeyword" style="display: none;"><div class="addClassify">新增关键词分类</div></div>
|
|
|
+ </section>
|
|
|
+
|
|
|
+ <!-- 疑难问题弹窗 -->
|
|
|
+ <div class="problemPop dialog-container">
|
|
|
+ <div class="problemPopContent">
|
|
|
+ <h3>疑问解答</h3>
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ <p>例:某公司主营业务为软件系统开发</p>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <h4>关键词:</h4>
|
|
|
+ <p>目标信息中的关键性词语,如“软件系统”</p>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <h4>附加词:</h4>
|
|
|
+ <p>与关键词形成一体/组合,便于查找准确信息,如“开发”</p>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <h4>排除词:</h4>
|
|
|
+ <p>与关键词互斥,可排除一部分非目标信息,如“运维”</p>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <button class="knowBtn">我知道了</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 关键词分类弹框 -->
|
|
|
+ <div class="classify-edit-pop dialog-container">
|
|
|
+ <!-- <div class="weui-mask weui-animate-fade-in"></div> -->
|
|
|
+ <div class="weui-dialog weui-animate-fade-in">
|
|
|
+ <div class="weui-dialog__hd">
|
|
|
+ <strong class="weui-dialog__title">关键词分类</strong>
|
|
|
+ </div>
|
|
|
+ <div class="weui-dialog__bd">
|
|
|
+ <input type="text" class="classify-keyword" maxlength="20" placeholder="输入分类名称">
|
|
|
+ </div>
|
|
|
+ <div class="weui-dialog__ft">
|
|
|
+ <a href="javascript:;" class="dialog__btn dialog__btn_confirm opacity6">确定</a>
|
|
|
+ <a href="javascript:;" class="dialog__btn dialog__btn_cancel">取消</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 关键词分类说明 -->
|
|
|
+ <div class="classify-show-pop dialog-container">
|
|
|
+ <!-- <div class="weui-mask weui-animate-fade-in"></div> -->
|
|
|
+ <div class="weui-dialog weui-animate-fade-in">
|
|
|
+ <div class="weui-dialog__hd">
|
|
|
+ <strong class="weui-dialog__title">提示信息</strong>
|
|
|
+ </div>
|
|
|
+ <div class="weui-dialog__bd">
|
|
|
+ 关键词分类有利于关键词做整合管理<br>工作更为高效!
|
|
|
+ </div>
|
|
|
+ <div class="weui-dialog__ft">
|
|
|
+ <a href="javascript:;" class="dialog__btn dialog__btn_confirm">去设置</a>
|
|
|
+ <a href="javascript:;" class="dialog__btn dialog__btn_cancel">取消</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/js/jquery-3.2.1.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ {{include "/common/weixin.html"}}
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <script>
|
|
|
+ initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
|
|
|
+
|
|
|
+ var a_items = [];//全部数据
|
|
|
+ var classify_name = "";//分类名称
|
|
|
+ var classify_index = 0;//分类索引
|
|
|
+ var kws_name = "";//分类关键词内容
|
|
|
+ var kws_index = 0;//分类关键词索引
|
|
|
+ var kws_count = 0;//关键词个数
|
|
|
+ var modifyFlag = false;//附加词 排除词变动
|
|
|
+ var addition_kws = []; //附加词
|
|
|
+ var not_kws = []; //排除词
|
|
|
+ var classify_arr = [];//分类对象
|
|
|
+ var kws_arr = {};//所有关键词对象
|
|
|
+ var kws_tips = 0;
|
|
|
+ // 页面状态
|
|
|
+ var pageState = {
|
|
|
+ //是否第一次设置关键词
|
|
|
+ isFirstSetKeyword: true
|
|
|
+ }
|
|
|
+ //
|
|
|
+ function initSess(){
|
|
|
+ weui.loading();
|
|
|
+ setTimeout(function(){
|
|
|
+ weui.loading().hide();
|
|
|
+ if(window.location.search.indexOf("page=2")>-1){
|
|
|
+ history.replaceState("{id:1}","","/front/vipsubscribe/toSetKeyWordPage")
|
|
|
+ }else if(history.state){
|
|
|
+ window.history.go(-1)
|
|
|
+ }
|
|
|
+ },500)
|
|
|
+ }
|
|
|
+ //
|
|
|
+ $(function(){
|
|
|
+ var isinitpage = false;
|
|
|
+ $(window).bind("pageshow", function(event){
|
|
|
+ if(event.originalEvent.persisted){
|
|
|
+ initpage();
|
|
|
+ isinitpage = true;
|
|
|
+ initSess();
|
|
|
+ reloadFunc();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(!isinitpage) {
|
|
|
+ initpage();
|
|
|
+ initSess();
|
|
|
+ reloadFunc();
|
|
|
+ }
|
|
|
+ window.addEventListener('popstate', function(event){
|
|
|
+ if(!isinitpage){
|
|
|
+ if(a_items.length==0){
|
|
|
+ window.history.go(-1)
|
|
|
+ }
|
|
|
+ var loading = weui.loading('', {
|
|
|
+ className: 'custom-classname'
|
|
|
+ })
|
|
|
+ $('.classify-show-pop').hide();
|
|
|
+ $('.classify-edit-pop').hide();
|
|
|
+ //重新加载数据
|
|
|
+ initpage();
|
|
|
+ // 用定时器模拟请求耗时
|
|
|
+ setTimeout(function () {
|
|
|
+ loading.hide(function() {
|
|
|
+ console.log('`loading` has been hidden');
|
|
|
+ })
|
|
|
+ // 判断是否是第一次(没有关键词进入)
|
|
|
+ // 隐藏关键词列表section,显示分类列表section
|
|
|
+ var isClassifyColumnShow = $('.add-keyword-container').is(':hidden')
|
|
|
+ if (!isClassifyColumnShow) {
|
|
|
+ $('.add-keyword-container').hide()
|
|
|
+ $('.all-classify-column').show()
|
|
|
+ }
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
+ isinitpage = false
|
|
|
+ })
|
|
|
+ // 关键词分类 - 去设置按钮点击事件
|
|
|
+ $('.classify-show-pop .dialog__btn_confirm').on('click', function() {
|
|
|
+ $('.classify-show-pop').hide();
|
|
|
+ setTimeout(function(){
|
|
|
+ modalOne();
|
|
|
+ },200)
|
|
|
+ })
|
|
|
+ // 关键词分类 - 取消按钮点击事件
|
|
|
+ $('.classify-show-pop .dialog__btn_cancel').on('click', function() {
|
|
|
+ $('.enterOne').focus();
|
|
|
+ $('.classify-show-pop').hide();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //获取数据
|
|
|
+ function initpage(){
|
|
|
+ if(sessionStorage&&sessionStorage.kwspage){
|
|
|
+ if(sessionStorage.addition_kws!=undefined){
|
|
|
+ addition_kws = JSON.parse(sessionStorage.addition_kws);
|
|
|
+ }
|
|
|
+ if(sessionStorage.not_kws!=undefined){
|
|
|
+ not_kws = JSON.parse(sessionStorage.not_kws);
|
|
|
+ }
|
|
|
+ showKorshowC(sessionStorage.kwspage);
|
|
|
+ a_items = JSON.parse(sessionStorage.a_items)
|
|
|
+ kws_arr = JSON.parse(sessionStorage.kws_arr)
|
|
|
+ classify_name = sessionStorage.classify_name;
|
|
|
+ classify_index = sessionStorage.classify_index;
|
|
|
+ kws_name = sessionStorage.kws_name;
|
|
|
+ kws_index = sessionStorage.kws_index;
|
|
|
+ modifyFlag = true;
|
|
|
+ kws_count = sessionStorage.kws_count;
|
|
|
+ $(".kws_count").text(kws_count);
|
|
|
+ $('.addKeyWord').hide();
|
|
|
+ toSetKws();
|
|
|
+ }else{
|
|
|
+ //获取用户设置信息类型
|
|
|
+ $.post("/subscribepay/afterPay/getUserInfo",{},function(r){
|
|
|
+ if(r.userData){
|
|
|
+ var _userData = r.userData;
|
|
|
+ var _vipData = _userData["o_vipjy"];
|
|
|
+ modifyFlag = false;
|
|
|
+ if (_vipData["a_items"]!=undefined&&_vipData["a_items"].length>0){
|
|
|
+ a_items = _vipData["a_items"]
|
|
|
+ pageState.isFirstSetKeyword = false;
|
|
|
+ appendHtml(a_items);
|
|
|
+ }else{
|
|
|
+ pageState.isFirstSetKeyword = true;
|
|
|
+ }
|
|
|
+ hasWords();
|
|
|
+ }else{
|
|
|
+ pageState.isFirstSetKeyword = true;
|
|
|
+ }
|
|
|
+ showKorshowC(pageState.isFirstSetKeyword);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //强制弹出 提示信息
|
|
|
+ function showMeg(){
|
|
|
+ // 如果是苹果手机,打开时候要设置top
|
|
|
+ var agent = navigator.userAgent.toLowerCase();
|
|
|
+ var dialog = $('.classify-show-pop .weui-dialog')
|
|
|
+ if( /iphone|ipod|ipad|ios/.test(agent) ){
|
|
|
+ dialog.css({ 'top': '30%' })
|
|
|
+ } else {
|
|
|
+ dialog.css({ 'top': '50%' })
|
|
|
+ }
|
|
|
+ $('.classify-show-pop').show()
|
|
|
+ }
|
|
|
+ //关键词和分类列表切换
|
|
|
+ function showKorshowC(state){
|
|
|
+ if (state) {
|
|
|
+ $('.add-keyword-container').show()
|
|
|
+ $('.all-classify-column').hide()
|
|
|
+ } else {
|
|
|
+ $('.add-keyword-container').hide()
|
|
|
+ $('.all-classify-column').show()
|
|
|
+ }
|
|
|
+ $(".addNewKeyword").show();
|
|
|
+ }
|
|
|
+ //分类列表
|
|
|
+ function appendHtml(kwsdata){
|
|
|
+ kws_count = 0;
|
|
|
+ var classifyHtml = '';
|
|
|
+ classify_arr = [];//每次初始化分类对象
|
|
|
+ kws_arr = {};//每次初始化关键词对象
|
|
|
+ for (var i = 0; i < kwsdata.length; i++) {
|
|
|
+ var s_item = kwsdata[i]["s_item"]
|
|
|
+ if(s_item==""){
|
|
|
+ s_item = "未分类"
|
|
|
+ }
|
|
|
+ classify_arr.push(s_item);
|
|
|
+ var a_key = kwsdata[i]["a_key"]
|
|
|
+ kws_count += a_key.length;
|
|
|
+ var keystr = '';
|
|
|
+ for(var j=0;j<a_key.length;j++){
|
|
|
+ if(keystr!=""){
|
|
|
+ keystr += "、"
|
|
|
+ }
|
|
|
+ keystr += a_key[j]["key"].join('、');
|
|
|
+ kws_arr[a_key[j]["key"].join(' ')]=j+"-"+i
|
|
|
+ }
|
|
|
+ classifyHtml +='<li class="classify-item">'
|
|
|
+ +'<div><span class="classify-item-l">'+s_item+'</span>'
|
|
|
+ +'<span class="classify-item-r">'
|
|
|
+ +'<span class="classify-item-detail">关键词'+a_key.length+'个</span>'
|
|
|
+ +'<span class="iconfont icon-arrow"></span>'
|
|
|
+ +'</span></div>'
|
|
|
+ +'<div class="classifyKeysShow">'+keystr+'</div>'
|
|
|
+ +'</li>'
|
|
|
+
|
|
|
+ }
|
|
|
+ if(classifyHtml!=""){
|
|
|
+ $(".classify-list").html(classifyHtml);
|
|
|
+ }
|
|
|
+ $(".kws_count").text(kws_count);
|
|
|
+ }
|
|
|
+ //是否有关键词
|
|
|
+ function hasWords() {
|
|
|
+ var showKeyWordLength = $(".showKeyWord ul").find('li').length;
|
|
|
+ if (showKeyWordLength === 0) {
|
|
|
+ $(".content .addkeyWord").show();
|
|
|
+ } else {
|
|
|
+ $(".content .addkeyWord").hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //修改关键词内容
|
|
|
+ function toSetKws(){
|
|
|
+ //分类列表进入
|
|
|
+ if(kws_index==-1){
|
|
|
+ var edhtml = '<input type="text" class="enterOne" placeholder="请输入关键词" maxlength="20">'
|
|
|
+ +'<div class="btnChoose">'
|
|
|
+ if(addition_kws.length>0){
|
|
|
+ edhtml +='<button onclick="toappendkey(this)">编辑 附加词<i>('+addition_kws.length+')</i></button>'
|
|
|
+ }else{
|
|
|
+ edhtml +='<button onclick="toappendkey(this)">添加 附加词</button>'
|
|
|
+ }
|
|
|
+ if(not_kws.length>0){
|
|
|
+ edhtml +='<button onclick="tonotkey(this)">编辑 排除词<i>('+not_kws.length+')</i></button>'
|
|
|
+ }else{
|
|
|
+ edhtml +='<button onclick="tonotkey(this)">添加 排除词</button>'
|
|
|
+ }
|
|
|
+ edhtml +='</div>'
|
|
|
+ +'<div class="btn">'
|
|
|
+ +'<button style="opacity: 1;">确认</button>'
|
|
|
+ +'</div>'
|
|
|
+ $(".enter.addkeyWord").html(edhtml);
|
|
|
+ setTimeout(function(){
|
|
|
+ $(".enter.addkeyWord").find("input").val(kws_name)
|
|
|
+ $(".enter.addkeyWord").show();
|
|
|
+ },200)
|
|
|
+ }
|
|
|
+ if(classify_name==""){
|
|
|
+ $(".classify-detail").text("未分类");
|
|
|
+ }else{
|
|
|
+ $(".classify-detail").text(classify_name);
|
|
|
+ }
|
|
|
+ var kwsHtml = '';
|
|
|
+ if( a_items[classify_index]!=undefined){
|
|
|
+ var _keyArr = a_items[classify_index]["a_key"];
|
|
|
+ //未分类 关键词强制提醒标识
|
|
|
+ kws_tips = a_items[classify_index]["i_tips"];
|
|
|
+ if(kws_tips==undefined){
|
|
|
+ kws_tips = 0;
|
|
|
+ }
|
|
|
+ if (kws_tips==0&&classify_name.indexOf("未分类")>-1&&window.location.search.indexOf("page=2")<0){
|
|
|
+ //第一次进来分类提示
|
|
|
+ showMeg();
|
|
|
+ var param = {};
|
|
|
+ param.classify_index = classify_index;
|
|
|
+ param.kws_tips = 1;
|
|
|
+ $.post("/subscribepay/afterPay/updateUserTips",param,function(r){
|
|
|
+ if(r.flag){
|
|
|
+ kws_tips = param.kws_tips;
|
|
|
+ $(".classify").attr("tips",kws_tips);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ for (var i = _keyArr.length - 1; i >= 0; i--) {
|
|
|
+ var ak_showClass = 'hide';//是否显示附加词个数
|
|
|
+ var nk_showClass = 'hide';//是否显示排除词个数
|
|
|
+ var ak_remark = '添加';
|
|
|
+ var nk_remark = '添加';
|
|
|
+ var appendkeylth = 0;
|
|
|
+ var notkeylth = 0;
|
|
|
+ kwsHtml +='<li>'
|
|
|
+ if(modifyFlag&&i==kws_index){
|
|
|
+ kwsHtml +='<div class="one" style="display:none;">'
|
|
|
+ _keyArr[i]["appendkey"] = addition_kws;
|
|
|
+ _keyArr[i]["notkey"] = not_kws;
|
|
|
+ }else{
|
|
|
+ kwsHtml +='<div class="one" style="">'
|
|
|
+ }
|
|
|
+ kwsHtml +='<div>'
|
|
|
+ +'<span><strong> 关键词:</strong>'
|
|
|
+ +'<p class="key">'+_keyArr[i]["key"].join(" ")+'</p></span>'
|
|
|
+ if (_keyArr[i]["appendkey"]!=undefined&&_keyArr[i]["appendkey"].length>0){
|
|
|
+ ak_showClass = "";
|
|
|
+ ak_remark = '编辑';
|
|
|
+ appendkeylth = _keyArr[i]["appendkey"].length;
|
|
|
+ kwsHtml +='<span>'
|
|
|
+ +'<strong> 附加词:</strong>'
|
|
|
+ +'<p class="addition">'+_keyArr[i]["appendkey"].join(" ")+'</p>'
|
|
|
+ +'</span>'
|
|
|
+ }
|
|
|
+ if (_keyArr[i]["notkey"]!=undefined&&_keyArr[i]["notkey"].length>0){
|
|
|
+ nk_showClass = "";
|
|
|
+ nk_remark = '编辑';
|
|
|
+ notkeylth = _keyArr[i]["notkey"].length;
|
|
|
+ kwsHtml +='<span>'
|
|
|
+ +'<strong> 排除词:</strong>'
|
|
|
+ +'<p class="notkey">'+_keyArr[i]["notkey"].join(" ")+'</p>'
|
|
|
+ +'</span>'
|
|
|
+ }
|
|
|
+ kwsHtml +='</div>'
|
|
|
+ +'<button class="editKeyWord" dataIndex="'+i+'"><i class="iconfont icon-xiugai"></i> 修改</button>'
|
|
|
+ +'</div>'
|
|
|
+
|
|
|
+ if(modifyFlag&&i==kws_index){
|
|
|
+ kwsHtml +='<div class="modify" style="display:block;">'
|
|
|
+ if(addition_kws.length>0){
|
|
|
+ appendkeylth = addition_kws.length;
|
|
|
+ }
|
|
|
+ if(not_kws.length>0){
|
|
|
+ notkeylth = not_kws.length;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ kwsHtml +='<div class="modify" style="display: none;">'
|
|
|
+ }
|
|
|
+ var p = kws_arr[_keyArr[i]["key"].join(" ")].split("-")[0]
|
|
|
+ kwsHtml +='<textarea name="" rows="1" placeholder="" maxlength="20">'+_keyArr[i]["key"].join(" ")+'</textarea>'
|
|
|
+ +'<button class="addAdjunctWord" onclick="toappendkey(this)">'+ak_remark+' 附加词 <i class="appendkey '+ak_showClass+'">('+appendkeylth+')</i></button>'
|
|
|
+ +'<button class="addExclusion" onclick="tonotkey(this)">'+nk_remark+' 排除词 <i class="notkey '+nk_showClass+'">('+notkeylth+')</i></button>'
|
|
|
+ +'<button class="deleteKey">删除</button>'
|
|
|
+ +'<button class="ascertainKey" dataIndex="'+p+'" onclick="saveK(this)">确定</button>'
|
|
|
+ +'</div>'
|
|
|
+ +'</li>'
|
|
|
+ }
|
|
|
+ $(".showKeyWord ul").html(kwsHtml);
|
|
|
+ }
|
|
|
+ hasWords();
|
|
|
+ // 发送请求刷新数据,在ajax回调中执行
|
|
|
+ $('.add-keyword-container').show();
|
|
|
+ $('.all-classify-column').hide();
|
|
|
+ clearSesstion();
|
|
|
+ }
|
|
|
+ //跳转附加词
|
|
|
+ function toappendkey(th){
|
|
|
+ history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
|
|
|
+ if(!$('.enter.addkeyWord').is(':hidden')){
|
|
|
+ if($('.addkeyWord input.enterOne').val()==""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ kws_index = -1
|
|
|
+ kws_name = $('.addkeyWord input.enterOne').val();
|
|
|
+ }else{
|
|
|
+ if($(th).parent(".modify").find("textarea").val()==""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ kws_name = $(th).parent(".modify").find("textarea").val();
|
|
|
+ }
|
|
|
+ setSesstion();
|
|
|
+ window.location.href="/front/vipsubscribe/toSetadditionPage";
|
|
|
+ }
|
|
|
+ //
|
|
|
+ function tonotkey(th){
|
|
|
+ history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=242")
|
|
|
+ if(!$('.enter.addkeyWord').is(':hidden')){
|
|
|
+ if($('.addkeyWord input.enterOne').val()==""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ kws_index = -1
|
|
|
+ kws_name = $('.addkeyWord input.enterOne').val();
|
|
|
+ }else{
|
|
|
+ if($(th).parent(".modify").find("textarea").val()==""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ kws_name = $(th).parent(".modify").find("textarea").val();
|
|
|
+ }
|
|
|
+ setSesstion();
|
|
|
+ window.location.href='/front/vipsubscribe/toSetexclusivePage';
|
|
|
+ }
|
|
|
+ //保存缓存
|
|
|
+ function setSesstion(){
|
|
|
+ sessionStorage.kwspage = true;//关键词页面标识
|
|
|
+ sessionStorage.kws_name = kws_name;//当前关键词
|
|
|
+ sessionStorage.classify_name = classify_name;//当前分类
|
|
|
+ sessionStorage.kws_index = kws_index;//当前关键词索引
|
|
|
+ sessionStorage.classify_index = classify_index;//当前分类索引
|
|
|
+ sessionStorage.a_items = JSON.stringify(a_items);//当前数据
|
|
|
+ sessionStorage.addition_kws = JSON.stringify(addition_kws);//当前编辑关键词附加词
|
|
|
+ sessionStorage.not_kws = JSON.stringify(not_kws);//当前编辑关键词排除词
|
|
|
+ sessionStorage.kws_arr = JSON.stringify(kws_arr);//当前所有关键词排
|
|
|
+
|
|
|
+ sessionStorage.kws_count=kws_count;//关键词个数
|
|
|
+ }
|
|
|
+ //
|
|
|
+ function clearSesstion(){
|
|
|
+ if(!sessionStorage){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ sessionStorage.removeItem("kwspage");
|
|
|
+ sessionStorage.removeItem("kws_name");
|
|
|
+ sessionStorage.removeItem("classify_name");
|
|
|
+ sessionStorage.removeItem("kws_index");
|
|
|
+ sessionStorage.removeItem("classify_index");
|
|
|
+ sessionStorage.removeItem("a_items");
|
|
|
+ sessionStorage.removeItem("addition_kws");
|
|
|
+ sessionStorage.removeItem("not_kws");
|
|
|
+ sessionStorage.removeItem("kws_count");
|
|
|
+ sessionStorage.removeItem("kws_arr");
|
|
|
+ }
|
|
|
+ //保存关键词
|
|
|
+ function saveK(th){
|
|
|
+ var $this = $(th);
|
|
|
+ var yuan_index = $this.attr("dataIndex")
|
|
|
+ kws_name = $(th).siblings('textarea').val();
|
|
|
+ console.log(kws_arr[kws_name])
|
|
|
+ if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(yuan_index+"-"+classify_index)){
|
|
|
+ weui.toast('您设置的关键词已存在,请调整后再添加。', {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'custom-toast',
|
|
|
+ callback: function () { console.log('close') }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(kws_name.length > 20){
|
|
|
+ weui.toast('关键词不能超过20字', {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'custom-toast',
|
|
|
+ callback: function () { console.log('close') }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if(saveData('SK')){
|
|
|
+ $this.attr("dataindex",kws_index);
|
|
|
+ $this.parent().siblings().find('.key').text(kws_name)
|
|
|
+ $this.parent().hide().siblings().show()
|
|
|
+ $('.addKeyWord').show();
|
|
|
+ //
|
|
|
+ doSessionData();
|
|
|
+ //把kws_name,kws_index,addition_kws,not_kws初始化
|
|
|
+ kws_index = 0;
|
|
|
+ kws_name = "";
|
|
|
+ addition_kws = [];
|
|
|
+ not_kws = [];
|
|
|
+ }else{
|
|
|
+ weui.toast('保存出错,稍后再试', {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'custom-toast',
|
|
|
+ callback: function () { console.log('close') }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存数据
|
|
|
+ function saveData(actionType){
|
|
|
+ var _flag = false;
|
|
|
+ var kwscount = $(".content .showKeyWord li").length;
|
|
|
+ var param = {};
|
|
|
+ param.pageType = "keyWords";
|
|
|
+ param.classify_index = classify_index;
|
|
|
+ param.classify_name = classify_name;
|
|
|
+ param.kws_index = kws_index;
|
|
|
+ param.kws_name = kws_name;
|
|
|
+ param.actionType = actionType;
|
|
|
+ param.kwscount = kwscount;
|
|
|
+ param.addition_kws = addition_kws;
|
|
|
+ param.not_kws = not_kws;
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "/subscribepay/afterPay/setUserInfo",
|
|
|
+ data: param,
|
|
|
+ dataType: "json",
|
|
|
+ async: false,
|
|
|
+ traditional: true,
|
|
|
+ success: function(r){
|
|
|
+ if(r.flag){
|
|
|
+ console.log("保存成功")
|
|
|
+ _flag = r.flag;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return _flag
|
|
|
+ }
|
|
|
+ //处理缓存数据
|
|
|
+ function doSessionData(t){
|
|
|
+ //删除关键词
|
|
|
+ if(t!="DK"){
|
|
|
+ kws_arr[kws_name] = kws_index+"-"+classify_index
|
|
|
+ if(kws_index == $(".showKeyWord li").length){
|
|
|
+ //新加
|
|
|
+ var karr = {"key":kws_name.split(" "),"appendkey":addition_kws,"notkey":not_kws}
|
|
|
+ var keyM = [];
|
|
|
+ keyM.push(karr);
|
|
|
+ var classifyArr = {"s_item":classify_name,"a_key":keyM}
|
|
|
+ if (kws_index==0){
|
|
|
+ a_items.push(classifyArr);
|
|
|
+ }else{
|
|
|
+ a_items[classify_index]["a_key"].push(karr);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ a_items[classify_index]["a_key"][kws_index]["key"]= kws_name.split(' ')
|
|
|
+ a_items[classify_index]["a_key"][kws_index]["appendkey"]= addition_kws
|
|
|
+ a_items[classify_index]["a_key"][kws_index]["notkey"]= not_kws
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ delete kws_arr[kws_name];
|
|
|
+ if (a_items[classify_index]["a_key"].length==1){
|
|
|
+ a_items.splice(classify_index,1);
|
|
|
+ }else{
|
|
|
+ a_items[classify_index]["a_key"].splice(kws_index,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
+ function modalOne(){
|
|
|
+ // 如果是苹果手机,打开时候要设置top
|
|
|
+ var agent = navigator.userAgent.toLowerCase();
|
|
|
+ var dialog = $('.classify-edit-pop .weui-dialog')
|
|
|
+ if( /iphone|ipod|ipad|ios/.test(agent) ){
|
|
|
+ dialog.css({ 'top': '30%' })
|
|
|
+ } else {
|
|
|
+ dialog.css({ 'top': '50%' })
|
|
|
+ }
|
|
|
+ $('.classify-edit-pop').show()
|
|
|
+ var currentClassifyName = $(".classify").find('.classify-detail').text()
|
|
|
+ if(currentClassifyName.indexOf("未分类")>-1){
|
|
|
+ currentClassifyName = ""
|
|
|
+ }
|
|
|
+ $('input.classify-keyword').val(currentClassifyName).focus()
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}21"></script>
|
|
|
+ <script>
|
|
|
+ // 设置一条空记录,用户第一次进入添加关键词点击确定时候调用
|
|
|
+ function setEmptyHistory() {
|
|
|
+ if (pageState.isFirstSetKeyword) {
|
|
|
+ history.pushState({id:1}, "","")
|
|
|
+ pageState.isFirstSetKeyword = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
+ $(function(){
|
|
|
+ $(".addNewKeyword div").on('click', function () {
|
|
|
+ history.pushState({id:1}, "","");
|
|
|
+ classify_index = $(".classify-list li").length;
|
|
|
+ var noNameIndex = -1;
|
|
|
+ var noName = "未分类"
|
|
|
+ for (var i = classify_arr.length - 1; i >= 0; i--) {
|
|
|
+ if(classify_arr[i].indexOf("未分类")>-1){
|
|
|
+ if (noNameIndex < Number(classify_arr[i].split("未分类")[1])){
|
|
|
+ noNameIndex = Number(classify_arr[i].split("未分类")[1])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(noNameIndex!=-1){
|
|
|
+ noNameIndex = noNameIndex + parseInt(1)
|
|
|
+ noName = noName + noNameIndex
|
|
|
+ }
|
|
|
+ classify_name = noName;
|
|
|
+ // 还原有数据
|
|
|
+ $('.classify .classify-detail').text(noName);
|
|
|
+ $('.add-keyword-container .showKeyWord ul').html('');
|
|
|
+
|
|
|
+ $('.add-keyword-container').show();
|
|
|
+ $('.all-classify-column').hide();
|
|
|
+
|
|
|
+ // 显示添加关键词的输入框
|
|
|
+ $(".enter.addkeyWord").find(".btnChoose button").eq(0).html('添加 附加词');
|
|
|
+ $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 附加词');
|
|
|
+ $(".enter.addkeyWord").find("input").val("");
|
|
|
+ $(".enter.addkeyWord").show();
|
|
|
+ $(".add-keyword-container .addNewKeyword").hide();
|
|
|
+ setTimeout(function(){
|
|
|
+ modalOne();
|
|
|
+ },200)
|
|
|
+ })
|
|
|
+ // 通过判断是那个隐藏来判断是添加关键词还是添加新分类
|
|
|
+ $(".addNewKeyword i").on('click', function () {
|
|
|
+ // 如果是在分类列表点击添加(此时关键词列表是隐藏的)
|
|
|
+ // isClassifyColumnShow = true说明是添加新分类
|
|
|
+ var isClassifyColumnShow = $('.add-keyword-container').is(':hidden');
|
|
|
+ if (isClassifyColumnShow) {
|
|
|
+ history.pushState({}, "","");
|
|
|
+ classify_index = $(".classify-list li").length;
|
|
|
+ // 还原有数据
|
|
|
+ $('.classify .classify-detail').text('未分类');
|
|
|
+ $('.add-keyword-container .showKeyWord ul').html('');
|
|
|
+
|
|
|
+ }
|
|
|
+ $(".add-keyword-container .addNewKeyword").hide();
|
|
|
+ $('.add-keyword-container').show();
|
|
|
+ $('.all-classify-column').hide();
|
|
|
+
|
|
|
+ // 显示添加关键词的输入框
|
|
|
+ $(".enter.addkeyWord").find(".btnChoose button").eq(0).html('添加 附加词');
|
|
|
+ $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 排除词');
|
|
|
+ $(".enter.addkeyWord").find("input").val("");
|
|
|
+ $(".enter.addkeyWord").show();
|
|
|
+ $('.enterOne').focus();
|
|
|
+ })
|
|
|
+
|
|
|
+ // 点击分类目录的每一项,进入对应列表
|
|
|
+ $('.classify-list').on('click', '.classify-item', function() {
|
|
|
+ // 添加一条空历史记录
|
|
|
+ history.pushState({id:1}, "","");
|
|
|
+ classify_name = $(this).find('.classify-item-l').text();
|
|
|
+ classify_index = $(this).index()
|
|
|
+ //展示此关键词信息
|
|
|
+ toSetKws();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ </script>
|
|
|
+ {{include "/common/baiducc.html"}}
|
|
|
+</body>
|
|
|
+
|
|
|
+</html>
|