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.Register("hyCoreModel", new TaobaoCefAsyncJS(), BindingOptions.DefaultBinder);
web.JavascriptObjectRepository.Register("hyCoreModel", new CefAsyncJS(), BindingOptions.DefaultBinder);
Main = this;
}
@ -121,7 +121,7 @@ namespace 齐越慧眼.UserControls
if (lastUrl.Contains("search.jd.com"))
{
AddJDOptionDiv();
//CheckJDPageItem();
CheckJDPageItem();
web.ShowDevTools();
}
@ -225,7 +225,7 @@ namespace 齐越慧眼.UserControls
var sales=infoDiv.find("".deal-cnt"").text();
var title=infoDiv.find("".title"").text();
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
#region 京东代码
/// <summary>
@ -253,11 +251,11 @@ namespace 齐越慧眼.UserControls
/// <returns></returns>
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));
var result = ApiHelper.GetLabelByItemIds(itemIds, Models.ItemPlatform.Taobao);
var result = ApiHelper.GetLabelByItemIds(itemIds, Models.ItemPlatform.Jd);
if (result.isOk)
{
@ -266,16 +264,16 @@ namespace 齐越慧眼.UserControls
//判断是否团队过滤
if (item.IsFilter)
{
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).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('.myitemState').addClass(""falseBg"")");
DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
}
else
{
//判断是否集团过滤
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#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('.myitemState').prepend('<div class=""smallfalseBg""></div>')");
DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
}
}
@ -283,23 +281,23 @@ namespace 齐越慧眼.UserControls
if (item.IsCompeting)
{
//<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)
{
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).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('.myitemState').addClass(""trueBg"")");
DoJavaScript($@"$($('div#J_goodsList li[data-sku=""{item.GoodsId}""]')).find('.stateGraydiv').addClass(""divshow"")");
}
if (item.IsAdded)
{
DoJavaScript($@"$($('div#mainsrp-itemlist .items .item').find('a[data-nid=""{item.GoodsId}""]').parent().parent()).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('.myitemState').addClass(""popBg"")");
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 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"");
debugger;
hyCoreModel.setItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type});
hyCoreModel.setjdItemData({itemid:itemid,price:price,sales:sales,title:title,img:img,type:type});
};
");
@ -349,6 +346,7 @@ namespace 齐越慧眼.UserControls
position: absolute;
left: 0px;
top: 0px;
z-index: 9999;
}
.trueBg
{
@ -519,19 +517,19 @@ namespace 齐越慧眼.UserControls
}
}
public class TaobaoCefAsyncJS
public class CefAsyncJS
{
public string getTest()
{
return "";
}
public bool setItemData(dynamic data)
public bool settaobaoItemData(dynamic data)
{
if (!MainWindow.Main.IsUpdateKey)
{
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;
@ -590,5 +588,70 @@ namespace 齐越慧眼.UserControls
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 :span="19">
<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)">
{{keyword.title}}</a-tag>
</div>
@ -103,9 +104,20 @@
window.getDatas = this.getDatas
},
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){
this.currentTab=e
console.log(e)
this.getDatas()
},
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