|
@@ -16,23 +16,49 @@
|
|
|
<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
|
|
|
</head>
|
|
|
<style>
|
|
|
+ .keyWord{
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
.keyWord .enter .btn .save {
|
|
|
float: right;
|
|
|
}
|
|
|
body{
|
|
|
background: rgba(245,244,249,1);
|
|
|
}
|
|
|
+ .keyword-more-tips {
|
|
|
+ display: none;
|
|
|
+ width: 100%;
|
|
|
+ padding: .24rem .32rem;
|
|
|
+ background: rgba(249, 242, 234, 1);
|
|
|
+ color: #FF9F40;
|
|
|
+ font-size: .26rem;
|
|
|
+ line-height: .4rem;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .keyword-more-tips>a {
|
|
|
+ color: #FF3A20;
|
|
|
+ text-decoration: underline;
|
|
|
+ }
|
|
|
+ button:disabled,
|
|
|
+ button[disabled]{
|
|
|
+ opacity: 0.6!important;
|
|
|
+ }
|
|
|
</style>
|
|
|
<body>
|
|
|
|
|
|
<div class="keyWord">
|
|
|
+ <section class="content">
|
|
|
<p class="title">示例:软件系统(关键词); 开发(附加词); 运维(排除词)</p>
|
|
|
<!-- 添加关键词 -->
|
|
|
<div class="enter addkeyWord">
|
|
|
<input type="text" class="enterOne" placeholder="请输入关键词" />
|
|
|
<div class="btnChoose" style="display:none;">
|
|
|
- <button class="addAdjunctWord appended" disabled>添加 附加词</button>
|
|
|
- <button class="addExclusion exclude" disabled>添加 排除词</button>
|
|
|
+ <button class="addAdjunctWord appended" disabled data-attr="add">添加 附加词</button>
|
|
|
+ <button class="addExclusion exclude" disabled data-attr="add">添加 排除词</button>
|
|
|
</div>
|
|
|
<div class="btn">
|
|
|
<button class="save" disabled>确认</button>
|
|
@@ -43,7 +69,8 @@
|
|
|
<div class="problem">
|
|
|
疑问解答 <i class="iconfont icon-wenhao"></i>
|
|
|
</div>
|
|
|
-
|
|
|
+ </section>
|
|
|
+ <!-- <div class="keyword-more-tips">关键词已达上限,如需添加更多您可<a href="/weixin/frontPage/bigmember/free/perfect_info?source=wx_Dataself_keywordmore_customization">申请数据定制导出></a></div> -->
|
|
|
<!-- 疑难问题弹窗 -->
|
|
|
<div class="problemPop">
|
|
|
<div class="problemPopContent">
|
|
@@ -73,9 +100,73 @@
|
|
|
</div>
|
|
|
<script src="https://cdn-common.jianyu360.com/cdn/lib/zepto/1.2.0/zepto.min.js"></script>
|
|
|
<script src="{{Msg "seo" "cdn"}}/wx_dataExport/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+<script>
|
|
|
+ var limit = {{Export.exportLimit}};
|
|
|
+ var wordsLimit = limit.countLimit || 100
|
|
|
+ console.log(limit);
|
|
|
+</script>
|
|
|
<script>
|
|
|
initShare({{.T.signature}},{{.T.openid}},2,"jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
|
|
|
+ function sumArr(arr){
|
|
|
+ var sum = 0
|
|
|
+ arr.forEach(function(val){
|
|
|
+ sum += val
|
|
|
+ })
|
|
|
+ return sum
|
|
|
+ }
|
|
|
+ // 计算关键词、附加词、排除词总和
|
|
|
+ function getTotal () {
|
|
|
+ var keyWordArr = JSON.parse(localStorage.getItem("keyWord")) || []
|
|
|
+ var keyLen = keyWordArr.length
|
|
|
+ var arr = []
|
|
|
+ keyWordArr.forEach(function(item) {
|
|
|
+ if (item.appended) {
|
|
|
+ arr.push(item.appended.length)
|
|
|
+ }
|
|
|
+ if (item.exclude) {
|
|
|
+ arr.push(item.exclude.length)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.push(keyLen)
|
|
|
+ /**
|
|
|
+ * 此处取计算当前页关键词、附加词、排除词(当前页未保存前不存入localStorage)
|
|
|
+ * 关键词:输入框有值即+1
|
|
|
+ * 附加词、关键词取文案中的数字
|
|
|
+ * 原来的逻辑当前页的关键词、附加词、排除词是取sessionStorage取值,但没有及时清除(编辑、添加来回跳转的时候在其它页面会继续取sessionStorage),刷新页面仍会有值导致计算不准确
|
|
|
+ * */
|
|
|
+ if ($('.enterOne').val().trim()) {
|
|
|
+ arr.push(1)
|
|
|
+ }
|
|
|
+ var appendText= $('.addAdjunctWord.appended').text();
|
|
|
+ var excludeText = $('.addExclusion.exclude').text();
|
|
|
+ var appendCount = appendText.match(/\d/g) ? appendText.match(/\d/g)[0] : 0;
|
|
|
+ var excludeCount = excludeText.match(/\d/g) ? excludeText.match(/\d/g)[0] : 0;
|
|
|
+ arr.push(Number(appendCount))
|
|
|
+ arr.push(Number(excludeCount))
|
|
|
+ var total = sumArr(arr)
|
|
|
+ console.log(total);
|
|
|
+ return total
|
|
|
+ }
|
|
|
+ function hasWords () {
|
|
|
+ if (getTotal() >= wordsLimit) {
|
|
|
+ if (getTotal() === wordsLimit) {
|
|
|
+ $('[data-attr="add"]').attr('disabled', true)
|
|
|
+ } else {
|
|
|
+ // $('.keyword-more-tips').show()
|
|
|
+ $('.save').attr('disabled', true)
|
|
|
+ $('[data-attr="add"]').attr('disabled', true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // $('.keyword-more-tips').hide()
|
|
|
+ $('.save').removeAttr('disabled')
|
|
|
+ if ($('.enterOne').val().trim()) {
|
|
|
+ $('.appended').removeAttr('disabled')
|
|
|
+ $('.exclude').removeAttr('disabled')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
$(function(){
|
|
|
+ hasWords()
|
|
|
var isinitpage = false;
|
|
|
$(window).bind("pageshow", function(event){
|
|
|
if(event.originalEvent.persisted){
|
|
@@ -126,6 +217,7 @@
|
|
|
$(this).next().find(".appended").prop("disabled", true);
|
|
|
$(this).next().find(".exclude").prop("disabled", true);
|
|
|
}
|
|
|
+ hasWords()
|
|
|
});
|
|
|
|
|
|
// 添加 按钮的点击事件
|
|
@@ -216,22 +308,28 @@
|
|
|
var appended = keys[a].appended.length;
|
|
|
if(appended < 1){
|
|
|
str = "添加 附加词";
|
|
|
+ $(".addAdjunctWord").attr('data-attr', 'add');
|
|
|
}else{
|
|
|
str = "编辑 附加词 ("+appended+")";
|
|
|
+ $(".addAdjunctWord").removeAttr('data-attr');
|
|
|
}
|
|
|
}else{
|
|
|
str = "添加 附加词";
|
|
|
+ $(".addAdjunctWord").attr('data-attr', 'add');
|
|
|
}
|
|
|
$(".addAdjunctWord").text(str);
|
|
|
if(keys[a].exclude !== undefined){
|
|
|
var exclude =keys[a].exclude.length;
|
|
|
if(exclude < 1){
|
|
|
strs = "添加 排除词";
|
|
|
+ $(".addExclusion").attr('data-attr', 'add');
|
|
|
}else{
|
|
|
strs = "编辑 排除词 ("+exclude+")";
|
|
|
+ $(".addExclusion").removeAttr('data-attr');
|
|
|
}
|
|
|
}else{
|
|
|
strs = "添加 排除词";
|
|
|
+ $(".addExclusion").attr('data-attr', 'add');
|
|
|
}
|
|
|
$(".addExclusion").text(strs);
|
|
|
// }
|