Browse Source

加入京东类目红词

master
С·æ 4 years ago
parent
commit
74cb1b398a
  1. 109
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
  2. 16
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/cats/Index.vue
  3. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js
  4. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js.map

109
客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs

@ -40,7 +40,7 @@ namespace 齐越慧眼.UserControls
web.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true; web.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true;
web.JavascriptObjectRepository.Register("hyCoreModel", new TaobaoCefAsyncJS(), BindingOptions.DefaultBinder); web.JavascriptObjectRepository.Register("hyCoreModel", new CefAsyncJS(), BindingOptions.DefaultBinder);
Main = this; Main = this;
} }
@ -121,7 +121,7 @@ namespace 齐越慧眼.UserControls
if (lastUrl.Contains("search.jd.com")) if (lastUrl.Contains("search.jd.com"))
{ {
AddJDOptionDiv(); AddJDOptionDiv();
//CheckJDPageItem(); CheckJDPageItem();
web.ShowDevTools(); web.ShowDevTools();
} }
@ -225,7 +225,7 @@ namespace 齐越慧眼.UserControls
var sales=infoDiv.find("".deal-cnt"").text(); var sales=infoDiv.find("".deal-cnt"").text();
var title=infoDiv.find("".title"").text(); var title=infoDiv.find("".title"").text();
var img=$(ele).parent().parent().find(""img"").attr(""src""); var img=$(ele).parent().parent().find(""img"").attr(""src"");
hyCoreModel.setItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type}); hyCoreModel.settaobaoItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type});
}; };
"); ");
@ -243,8 +243,6 @@ namespace 齐越慧眼.UserControls
} }
#endregion #endregion
#region 京东代码 #region 京东代码
/// <summary> /// <summary>
@ -253,11 +251,11 @@ namespace 齐越慧眼.UserControls
/// <returns></returns> /// <returns></returns>
private void CheckJDPageItem() private void CheckJDPageItem()
{ {
var res = DoJavaScript(@"var ids=[]; $('div#mainsrp-itemlist .items .item .J_ItemPicA').each(function(){ids.push($(this).attr(""data-nid""))});return ids;"); var res = DoJavaScript(@"var ids=[]; $('div#J_goodsList li').each(function(){ids.push($(this).attr(""data-sku""))});return ids;");
List<string> itemIds = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(Newtonsoft.Json.JsonConvert.SerializeObject(res.result)); List<string> itemIds = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(Newtonsoft.Json.JsonConvert.SerializeObject(res.result));
var result = ApiHelper.GetLabelByItemIds(itemIds, Models.ItemPlatform.Taobao); var result = ApiHelper.GetLabelByItemIds(itemIds, Models.ItemPlatform.Jd);
if (result.isOk) if (result.isOk)
{ {
@ -266,16 +264,16 @@ namespace 齐越慧眼.UserControls
//判断是否团队过滤 //判断是否团队过滤
if (item.IsFilter) if (item.IsFilter)
{ {
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.myitemState').addClass(""falseBg"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.myitemState').addClass(""falseBg"")");
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateGraydiv').addClass(""divshow"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
} }
else else
{ {
//判断是否集团过滤 //判断是否集团过滤
if (item.HasFilter) if (item.HasFilter)
{ {
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.myitemState').prepend('<div class=""smallfalseBg""></div>')"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.myitemState').prepend('<div class=""smallfalseBg""></div>')");
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateGraydiv').addClass(""divshow"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
} }
} }
@ -283,23 +281,23 @@ namespace 齐越慧眼.UserControls
if (item.IsCompeting) if (item.IsCompeting)
{ {
//<div style=""width:20%;height:20%"" class=""bgYellow"">竞</div> //<div style=""width:20%;height:20%"" class=""bgYellow"">竞</div>
if ((int)BrowerControl.Main.DoJavaScript(@$"return $($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateYellow').length").result <= 0) if ((int)BrowerControl.Main.DoJavaScript(@$"return $($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateYellow').length").result <= 0)
{ {
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.myitemState').prepend('<div style=""width:20%;height:20%"" class=""stateYellow"">竞</div>')"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.myitemState').prepend('<div style=""width:20%;height:20%"" class=""stateYellow"">竞</div>')");
} }
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateGraydiv').addClass(""divshow"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
} }
if (item.IsScreening) if (item.IsScreening)
{ {
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.myitemState').addClass(""trueBg"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.myitemState').addClass(""trueBg"")");
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateGraydiv').addClass(""divshow"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
} }
if (item.IsAdded) if (item.IsAdded)
{ {
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.myitemState').addClass(""popBg"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.myitemState').addClass(""popBg"")");
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).find('.stateGraydiv').addClass(""divshow"")"); DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
} }
} }
} }
@ -319,8 +317,7 @@ namespace 齐越慧眼.UserControls
var sales=$(ele).parent().parent().parent().parent().find("".p-commit"").text(); var sales=$(ele).parent().parent().parent().parent().find("".p-commit"").text();
var title=$(ele).parent().parent().parent().parent().find("".p-name a em"").text(); var title=$(ele).parent().parent().parent().parent().find("".p-name a em"").text();
var img=$(ele).parent().parent().parent().parent().find("".p-img img"").attr(""src""); var img=$(ele).parent().parent().parent().parent().find("".p-img img"").attr(""src"");
debugger; hyCoreModel.setjdItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type});
hyCoreModel.setItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type});
}; };
"); ");
@ -349,6 +346,7 @@ namespace 齐越慧眼.UserControls
position: absolute; position: absolute;
left: 0px; left: 0px;
top: 0px; top: 0px;
z-index: 9999;
} }
.trueBg .trueBg
{ {
@ -519,19 +517,19 @@ namespace 齐越慧眼.UserControls
} }
} }
public class TaobaoCefAsyncJS public class CefAsyncJS
{ {
public string getTest() public string getTest()
{ {
return ""; return "";
} }
public bool setItemData(dynamic data) public bool settaobaoItemData(dynamic data)
{ {
if (!MainWindow.Main.IsUpdateKey) if (!MainWindow.Main.IsUpdateKey)
{ {
MainWindow.Main.IsUpdateKey = true; MainWindow.Main.IsUpdateKey = true;
ApiHelper.SetKeyOpenTime(MainWindow.Main.LastKeyWord, (Models.ItemPlatform)MainWindow.Main.LastKeyPat); ApiHelper.SetKeyOpenTime(MainWindow.Main.LastKeyWord, Models.ItemPlatform.Taobao);
} }
int type = data.type; int type = data.type;
@ -590,5 +588,70 @@ namespace 齐越慧眼.UserControls
return result.isOk; return result.isOk;
} }
public bool setjdItemData(dynamic data)
{
if (!MainWindow.Main.IsUpdateKey)
{
MainWindow.Main.IsUpdateKey = true;
ApiHelper.SetKeyOpenTime(MainWindow.Main.LastKeyWord, Models.ItemPlatform.Jd);
}
int type = data.type;
string price = data.price;
price = price.Replace("¥", "").Trim();
string sales = data.sales;
sales = sales.Trim();
string title = data.title;
title = title.Trim();
string img = data.img;
string itemId = data.itemid;
var result = ApiHelper.SetItemLabel(new Models.ItemLabelDto()
{
Img = img,
ItemId = itemId,
Platform = Models.ItemPlatform.Jd,
Price = Convert.ToDecimal(price),
Sales = sales,
Status = type,
Title = title
});
if (result.isOk)
{
//判断是否团队过滤
if (type == 1)
{
BrowerControl.Main.DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.myitemState').addClass(""falseBg"")");
}
if (type == 3)
{
int row = (int)BrowerControl.Main.DoJavaScript(@$"return $($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.myitemState').find('.stateYellow').length").result;
if (row < 1)
{
BrowerControl.Main.DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.myitemState').prepend('<div style=""width:20%;height:20%"" class=""stateYellow"">竞</div>')");
}
}
if (type == 0)
{
BrowerControl.Main.DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.myitemState').addClass(""trueBg"")");
}
if (type == 2)
{
BrowerControl.Main.DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.myitemState').addClass(""popBg"")");
}
BrowerControl.Main.DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{itemId}""]')).find('.stateGraydiv').addClass(""divshow"")");
}
WpfNoticeMsg.NoticeMessage.Show(result.msg, "提示");
return result.isOk;
}
} }
} }

16
客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/cats/Index.vue

@ -71,7 +71,8 @@
</a-col> </a-col>
<a-col :span="19"> <a-col :span="19">
<div style="margin-top: -5px;"> <div style="margin-top: -5px;">
<a-tag style="cursor: pointer;float: left;margin-top: 5px;" :key="i4" @click="openKey(keyword,keyword.title,keyword.Id)" :color="keyword.IsShowTBTime?'red':''" <a-tag style="cursor: pointer;float: left;margin-top: 5px;" :key="i4" @click="openKey(keyword,keyword.title,keyword.Id)"
:color="keyword.IsShowTBTime?'red':''"
v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==1)"> v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==1)">
{{keyword.title}}</a-tag> {{keyword.title}}</a-tag>
</div> </div>
@ -103,9 +104,20 @@
window.getDatas = this.getDatas window.getDatas = this.getDatas
}, },
methods: { methods: {
getKeyColor(keyword)
{
switch(this.currentTab)
{
case '0':
return keyword.IsShowTBTime?'red':''
case '1':
return keyword.IsShowJDTime?'red':''
case '2':
return keyword.IsShowPddTime?'red':''
}
},
changeTab(e){ changeTab(e){
this.currentTab=e this.currentTab=e
console.log(e)
this.getDatas() this.getDatas()
}, },
openKey(obj,key,id) openKey(obj,key,id)

2
客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js

File diff suppressed because one or more lines are too long

2
客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save