23 changed files with 706 additions and 33 deletions
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using 齐越慧眼.Models; |
|||
|
|||
namespace 齐越慧眼.ViewModels |
|||
{ |
|||
public class TaoBaoSearchWindowViewModel |
|||
{ |
|||
public static readonly TaoBaoSearchWindowViewModel Instance = new TaoBaoSearchWindowViewModel(); |
|||
|
|||
public List<SearchItemModelExt> ItemList { get; set; } |
|||
|
|||
public TaoBaoSearchWindowViewModel() |
|||
{ |
|||
ItemList = new List<SearchItemModelExt>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
<Window x:Class="齐越慧眼.Windows.TaoBaoSearchWindow" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:齐越慧眼.Windows" |
|||
mc:Ignorable="d" |
|||
|
|||
Title="TaoBaoSearchWindow" Height="768" Width="1280"> |
|||
<DockPanel Margin="0 10 0 0"> |
|||
<Border DockPanel.Dock="Bottom" Height="70" Background="White" Padding="0 9 0 0"> |
|||
|
|||
<Border.Effect> |
|||
<DropShadowEffect x:Name="OG" BlurRadius="11" Color="Black" Direction="50" Opacity="0.9" RenderingBias="Performance" ShadowDepth="1"> |
|||
<Storyboard.TargetProperty> |
|||
BlurRadius |
|||
</Storyboard.TargetProperty> |
|||
</DropShadowEffect> |
|||
</Border.Effect> |
|||
<Grid Background="White"> |
|||
<Grid Background="White" Name="firstGrid" > |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition></ColumnDefinition> |
|||
<ColumnDefinition></ColumnDefinition> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
|
|||
<Button x:Name="btn_save" Click="btn_save_Click" Grid.Column="1" Style="{StaticResource ButtonPrimary}" Content="商品分析" Height="61" Width="119" HorizontalAlignment="Right" Cursor="Hand" Background="#8080ff" FontSize="13" Foreground="White"> |
|||
<Button.Effect> |
|||
<DropShadowEffect ShadowDepth="-4" BlurRadius="5" Color="LightGray" /> |
|||
</Button.Effect> |
|||
</Button> |
|||
</Grid> |
|||
</Grid> |
|||
</Border> |
|||
|
|||
|
|||
<Grid x:Name="grid" DockPanel.Dock="Bottom" Margin="0 10 0 0"> |
|||
|
|||
</Grid> |
|||
</DockPanel> |
|||
</Window> |
@ -0,0 +1,162 @@ |
|||
using CefSharp; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Net.Http; |
|||
using System.Security.Policy; |
|||
using System.Text; |
|||
using System.Text.RegularExpressions; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Shapes; |
|||
using 齐越慧眼.cefhelper; |
|||
using 齐越慧眼.Models; |
|||
using 齐越慧眼.UserControls; |
|||
using 齐越慧眼.ViewModels; |
|||
|
|||
namespace 齐越慧眼.Windows |
|||
{ |
|||
/// <summary>
|
|||
/// CompetingWindow.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class TaoBaoSearchWindow : Window |
|||
{ |
|||
public ExtChromiumBrowser web; |
|||
public TaoBaoSearchWindow() |
|||
{ |
|||
InitializeComponent(); |
|||
this.DataContext = new TaoBaoSearchWindowViewModel(); |
|||
|
|||
|
|||
web = new ExtChromiumBrowser("nacollector://home/tbSearch") |
|||
{ |
|||
BrowserSettings = |
|||
{ |
|||
DefaultEncoding = "UTF-8", |
|||
Plugins = CefState.Enabled, |
|||
//关于跨域限制
|
|||
//WebSecurity = CefState.Disabled,
|
|||
ApplicationCache = CefState.Enabled, |
|||
LocalStorage = CefState.Enabled, |
|||
|
|||
|
|||
} |
|||
}; |
|||
|
|||
|
|||
grid.Children.Add(web); |
|||
|
|||
web.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true; |
|||
var cjs = new TaoBaoSaerchAsyncJS(); |
|||
cjs.Brower = this; |
|||
web.JavascriptObjectRepository.Register("hyCoreModel", cjs, BindingOptions.DefaultBinder); |
|||
web.StartNewWindow += Web_StartNewWindow; |
|||
web.TitleChanged += Web_TitleChanged; |
|||
|
|||
|
|||
|
|||
|
|||
this.KeyUp += BrowerControl_KeyUp; |
|||
} |
|||
private void BrowerControl_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) |
|||
{ |
|||
|
|||
if (e.Key == System.Windows.Input.Key.F12) |
|||
{ |
|||
web.ShowDevTools(); |
|||
} |
|||
} |
|||
|
|||
|
|||
private void Web_TitleChanged(object sender, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
Application.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
this.Title = e.NewValue.ToString(); |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
private void Web_StartNewWindow(object sender, NewWindowEventArgs e) |
|||
{ |
|||
//
|
|||
//WpfNoticeMsg.NoticeMessage.Show(e.Url);
|
|||
BrowerHelper.OpenUrl(e.Url); |
|||
//MainWindow.Main.brower.NewTab(e.Url);
|
|||
//web.Load(e.Url);
|
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 执行js
|
|||
/// </summary>
|
|||
/// <param name="js"></param>
|
|||
/// <returns></returns>
|
|||
public (bool isOk, object result) DoJavaScript(string js, bool needReplaceLine = true) |
|||
{ |
|||
if (needReplaceLine) |
|||
{ |
|||
js = js.Replace("\n", "").Replace("\r\n", "").Replace(System.Environment.NewLine, "").Replace("\r", ""); |
|||
} |
|||
Task<JavascriptResponse> task = null; |
|||
|
|||
Application.Current.Dispatcher.Invoke(() => |
|||
{ |
|||
task = web.EvaluateScriptAsPromiseAsync(js); |
|||
}); |
|||
|
|||
var result = task.Result; |
|||
|
|||
//判断是否加载完成
|
|||
return (result.Success, result.Result); |
|||
} |
|||
|
|||
|
|||
|
|||
private void btn_save_Click(object sender, RoutedEventArgs e) |
|||
{ |
|||
DoJavaScript("window.startFilterDatas();"); |
|||
|
|||
} |
|||
} |
|||
|
|||
public class TaoBaoSaerchAsyncJS |
|||
{ |
|||
public TaoBaoSearchWindow Brower { get; set; } |
|||
|
|||
public List<SearchItemModelExt> getData() |
|||
{ |
|||
return TaoBaoSearchWindowViewModel.Instance.ItemList.ToList(); |
|||
} |
|||
public bool saveData() |
|||
{ |
|||
return ApiHelper.UpdateItemCompeting(CompetingWindowViewModel.Instance.ItemList.ToList(), CompetingWindowViewModel.Instance.Item.Id); |
|||
} |
|||
|
|||
public bool? editItem(string itemJson) |
|||
{ |
|||
var item = Newtonsoft.Json.JsonConvert.DeserializeObject<TeamCompetingItem>(itemJson); |
|||
return ItemDetailWindow.Show(Brower, item); |
|||
} |
|||
|
|||
public bool deleteItem(string itemJson) |
|||
{ |
|||
var item = Newtonsoft.Json.JsonConvert.DeserializeObject<TeamCompetingItem>(itemJson); |
|||
var model= CompetingWindowViewModel.Instance.ItemList.FirstOrDefault(c => c.ItemUrl == item.ItemUrl || c.Sku == item.Sku); |
|||
if (model != null) |
|||
{ |
|||
CompetingWindowViewModel.Instance.ItemList.Remove(model); |
|||
} |
|||
return true; |
|||
} |
|||
} |
|||
} |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1,262 @@ |
|||
<template> |
|||
<div class="about"> |
|||
<a-tabs @change="changeTab" v-model="currentTab"> |
|||
<a-tab-pane key="0" :tab="'全部'"> </a-tab-pane> |
|||
<a-tab-pane key="1" :tab="'未打标'"> </a-tab-pane> |
|||
</a-tabs> |
|||
|
|||
<div> |
|||
<div> |
|||
<div class="item" |
|||
style=" display: inline-block; margin-left: 20px; margin-top: 20px;width: 216px;height: 200px;" |
|||
v-for="item in datas" |
|||
:key="item" |
|||
> |
|||
<div style="position: relative;;"> |
|||
<div |
|||
style=" position: absolute; top: 0px; right: 0px; font-size: 25px; " |
|||
:class="item.isAdd?'itembtnAdd show':'itembtnAdd'" |
|||
@click="addFilter(item)" |
|||
> |
|||
加入分析 |
|||
</div> |
|||
|
|||
<!--过滤--> |
|||
<div v-if="item.state==2" style="position: absolute;width: 216px; height: 216px;background: rgba(21, 21, 21, 0.5);display: flex;justify-content: center;align-items: center;"> |
|||
<img src="/img/close.png" style="width:185px;height: 185px;"> |
|||
</div> |
|||
|
|||
|
|||
<!--集团过滤--> |
|||
<div v-if="item.state==0" style="position: absolute;width: 216px; height: 216px;background: rgba(21, 21, 21, 0.5);"> |
|||
<img src="/img/close.png" style="width: 50px;height: 50px;position: absolute;bottom: 0px;"> |
|||
</div> |
|||
|
|||
|
|||
<!--筛选--> |
|||
<div v-if="item.state==5" style="position: absolute;width: 216px; height: 216px;background: rgba(21, 21, 21, 0.5);display: flex;justify-content: center;align-items: center;"> |
|||
<img src="/img/true.png" style="width:185px;height: 185px;"> |
|||
</div> |
|||
|
|||
|
|||
<!--集团筛选--> |
|||
<div v-if="item.state==1" style="position: absolute;width: 216px; height: 216px;background: rgba(21, 21, 21, 0.5);display: flex;justify-content: center;align-items: center;"> |
|||
<img src="/img/pop.png" style="width:185px;height: 185px;"> |
|||
</div> |
|||
|
|||
<img |
|||
:src="item.Img" |
|||
style="width: 216px; height: 216px" |
|||
/> |
|||
|
|||
|
|||
<div class="itembottom"> |
|||
<div style="height: 20px; padding: 5px"> |
|||
<div |
|||
style="float: left; font-size: 16px; color: #ff4400; font-weight: bold;" |
|||
> |
|||
<span>¥</span>{{ item.Price }} |
|||
</div> |
|||
|
|||
<div style="float: right">{{ item.Sales }}人收货</div> |
|||
</div> |
|||
|
|||
<div |
|||
style="clear: left; margin: 5px; height: 40px; overflow: hidden" |
|||
> |
|||
{{item.Title}} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
datas: [], |
|||
pagination: { |
|||
current: 1, |
|||
pageSize: 10, |
|||
total: 0, |
|||
showTotal: (total, range) => |
|||
`总数:${total} 当前:${range[0]}-${range[1]}`, |
|||
}, |
|||
filters: {}, |
|||
sorter: { field: "Id", order: "asc" }, |
|||
loading: false, |
|||
queryParam: { condition: "State", keyword: 0 }, |
|||
currentTab: "0", |
|||
}; |
|||
}, |
|||
mounted() { |
|||
window.getDatas = this.getDatas; |
|||
window.startFilter=this.startFilterDatas; |
|||
this.getDatas(0); |
|||
}, |
|||
activated() { |
|||
//this.getDatas(0) |
|||
}, |
|||
methods: { |
|||
getImgPath(img) { |
|||
if (!img || img == undefined) return; |
|||
|
|||
if (img.indexOf("http") >= 0) { |
|||
return img; |
|||
} else { |
|||
return "http:" + img; |
|||
} |
|||
}, |
|||
getDatas() { |
|||
hyCoreModel.getData().then((res) => { |
|||
res.forEach(item=>{ |
|||
item.isAdd=false, |
|||
item.hasFilter=false, |
|||
item.state=undefined |
|||
}) |
|||
this.datas = res; |
|||
this.getItemTag() |
|||
}); |
|||
|
|||
}, |
|||
changeTab(e) { |
|||
if(e=="1") |
|||
{ |
|||
this.filterDatas(); |
|||
}else{ |
|||
this.getDatas() |
|||
} |
|||
this.currentTab = e; |
|||
this.pagination.current = 1; |
|||
}, |
|||
|
|||
filterDatas(){ |
|||
this.datas=this.datas.filters(c=>!c.hasFilter) |
|||
}, |
|||
changePage(page, pageSize) { |
|||
this.pagination.current = page; |
|||
this.getDatas(this.currentTab); |
|||
}, |
|||
getItemTag() |
|||
{ |
|||
var itemIds=[] |
|||
this.datas.forEach(element => { |
|||
itemIds.push(element.ItemId) |
|||
}); |
|||
|
|||
|
|||
this.http.post('/HuiYan/itemlabels/GetLabelByItemIds?platform=0',itemIds).then(res=>{ |
|||
|
|||
var data=res.Data |
|||
|
|||
for(var i=0;i<data.length;i++) |
|||
{ |
|||
var item=data[i] |
|||
var itemId=item.GoodsId |
|||
|
|||
|
|||
if (!item.IsMyTeam) |
|||
{ |
|||
//判断是否集团过滤 |
|||
if (item.HasFilter) |
|||
{ |
|||
this.setItemFilter(itemId,0) |
|||
} |
|||
|
|||
//选品团海选 |
|||
if (item.IsAdded) |
|||
{ |
|||
this.setItemFilter(itemId,1) |
|||
} |
|||
continue |
|||
} |
|||
|
|||
|
|||
//判断是否团队过滤 |
|||
if (item.IsFilter) |
|||
{ |
|||
this.setItemFilter(itemId,2) |
|||
} |
|||
|
|||
if (item.IsCompeting) |
|||
{ |
|||
this.setItemFilter(itemId,3) |
|||
} |
|||
|
|||
if (item.IsScreening) |
|||
{ |
|||
this.setItemFilter(itemId,4) |
|||
} |
|||
|
|||
//海选 |
|||
if (item.IsAdded) |
|||
{ |
|||
this.setItemFilter(itemId,5) |
|||
} |
|||
|
|||
} |
|||
|
|||
}) |
|||
|
|||
} |
|||
, |
|||
setItemFilter(itemId,state) |
|||
{ |
|||
var items=this.datas.filters(c=>c.GoodsId==itemId) |
|||
if(items&&items.length>0) |
|||
{ |
|||
items[0].hasFilter=true |
|||
items[0].filterState=state |
|||
} |
|||
}, |
|||
addFilter(item){ |
|||
item.isAdd=true |
|||
}, |
|||
startFilterDatas(){ |
|||
return this.datas.filters(c=>c.isAdd) |
|||
} |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style> |
|||
.itembottom { |
|||
border: 1px solid #d7d7d7; |
|||
border-top: 0; |
|||
height: 90px; |
|||
width: 216px; |
|||
} |
|||
|
|||
.itembtnAdd |
|||
{ |
|||
width: 145px; |
|||
height: 46px; |
|||
opacity: 0.8; |
|||
background-color: #c88cfe; |
|||
box-sizing: border-box; |
|||
font-family: "Arial Bold", "Arial Normal", "Arial", sans-serif; |
|||
font-weight: 700; |
|||
color: #ffffff; |
|||
text-align: center; |
|||
line-height: normal; |
|||
display: none; |
|||
align-items: center; |
|||
justify-content: center; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
.item:hover .itembtnAdd |
|||
{ |
|||
display: flex; |
|||
} |
|||
|
|||
.show |
|||
{ |
|||
display: flex; |
|||
} |
|||
</style> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1 +1 @@ |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>client</title><link href="/css/app.c6957eae.css" rel="preload" as="style"><link href="/css/app.css" rel="preload" as="style"><link href="/css/chunk-vendors.09af4a6b.css" rel="preload" as="style"><link href="/css/chunk-vendors.css" rel="preload" as="style"><link href="/js/app.js" rel="preload" as="script"><link href="/js/chunk-vendors.js" rel="preload" as="script"><link href="/css/chunk-vendors.09af4a6b.css" rel="stylesheet"><link href="/css/chunk-vendors.css" rel="stylesheet"><link href="/css/app.c6957eae.css" rel="stylesheet"><link href="/css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.js"></script><script src="/js/app.js"></script></body></html> |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>client</title><link href="/css/app.92561a68.css" rel="preload" as="style"><link href="/css/app.css" rel="preload" as="style"><link href="/css/chunk-vendors.09af4a6b.css" rel="preload" as="style"><link href="/css/chunk-vendors.css" rel="preload" as="style"><link href="/js/app.js" rel="preload" as="script"><link href="/js/chunk-vendors.js" rel="preload" as="script"><link href="/css/chunk-vendors.09af4a6b.css" rel="stylesheet"><link href="/css/chunk-vendors.css" rel="stylesheet"><link href="/css/app.92561a68.css" rel="stylesheet"><link href="/css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.js"></script><script src="/js/app.js"></script></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue