Browse Source

添加红词显示

master
feng 4 years ago
parent
commit
8a4acfb27a
  1. 8
      src/Coldairarrow.Api/Controllers/HuiYan/catsController.cs
  2. 41
      src/Coldairarrow.Business/HuiYan/catsBusiness.cs
  3. 3
      src/Coldairarrow.IBusiness/HuiYan/IcatsBusiness.cs
  4. 4
      src/Coldairarrow.Web/.env
  5. 2
      src/Coldairarrow.Web/src/views/HuiYan/cats/EditForm.vue
  6. 145
      src/Coldairarrow.Web/src/views/HuiYan/cats/List.vue
  7. 1
      客户端/齐越慧眼/齐越慧眼/ApiHelper.cs
  8. 7
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerTabPanelControl.xaml.cs
  9. 14
      客户端/齐越慧眼/齐越慧眼/vuepage/client/src/views/cats/Index.vue
  10. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js
  11. 2
      客户端/齐越慧眼/齐越慧眼/vuepage/dist/js/app.js.map
  12. 4
      客户端/齐越慧眼/齐越慧眼/齐越慧眼.csproj

8
src/Coldairarrow.Api/Controllers/HuiYan/catsController.cs

@ -75,6 +75,12 @@ namespace Coldairarrow.Api.Controllers.HuiYan
return await _catsBus.GetTreeDataListAsync(input); return await _catsBus.GetTreeDataListAsync(input);
} }
[HttpPost]
public async Task<PageResult<cats>> GetDataByParentAsync(PageInput<ConditionDTO> input,[FromQuery]string key)
{
return await _catsBus.GetDataByParentAsync(input, key);
}
[HttpGet] [HttpGet]
public AjaxResult GetParentCatList() public AjaxResult GetParentCatList()
{ {
@ -111,7 +117,7 @@ namespace Coldairarrow.Api.Controllers.HuiYan
[HttpPost] [HttpPost]
public AjaxResult SetKeyOpenTime(string id,ItemPlatform platform) public AjaxResult SetKeyOpenTime(string id,ItemPlatform platform)
{ {
return _catsBus.SetKeyOpenTime(id); return _catsBus.SetKeyOpenTime(id,platform);
} }
#endregion #endregion

41
src/Coldairarrow.Business/HuiYan/catsBusiness.cs

@ -45,7 +45,28 @@ namespace Coldairarrow.Business.HuiYan
return TreeHelper.BuildTree(treeList); return TreeHelper.BuildTree(treeList);
} }
public async Task<PageResult<cats>> GetDataByParentAsync(PageInput<ConditionDTO> input, string key)
{
var q = GetIQueryable();
var where = LinqHelper.True<cats>();
var search = input.Search;
//筛选
if (!search.Keyword.IsNullOrEmpty())
{
where = where.And(c => c.ParentId == search.Keyword);
}
else {
where = where.And(c => string.IsNullOrEmpty(c.ParentId));
}
if (!string.IsNullOrEmpty(key))
{
where = where.And(c => c.Name.Contains(key));
}
return await q.Where(where).GetPageResultAsync(input);
}
public AjaxResult GetParentCatList() public AjaxResult GetParentCatList()
@ -240,19 +261,31 @@ namespace Coldairarrow.Business.HuiYan
Text = x.Name, Text = x.Name,
Value = x.Id, Value = x.Id,
Type = x.Type, Type = x.Type,
IsShowJDTime = x.LastShowJDTime == null ? true : (DateTime.Now - x.LastShowJDTime.Value).TotalDays > 3, IsShowJDTime = x.LastShowJDTime == null ? true : (DateTime.Now - x.LastShowJDTime.Value).TotalDays > 45,
IsShowPddTime = x.LastShowPddTime == null ? true : (DateTime.Now - x.LastShowPddTime.Value).TotalDays > 3, IsShowPddTime = x.LastShowPddTime == null ? true : (DateTime.Now - x.LastShowPddTime.Value).TotalDays > 45,
IsShowTBTime = x.LastShowTBTime == null ? true : (DateTime.Now - x.LastShowTBTime.Value).TotalDays > 3, IsShowTBTime = x.LastShowTBTime == null ? true : (DateTime.Now - x.LastShowTBTime.Value).TotalDays > 45,
}).ToList(); }).ToList();
return TreeHelper.BuildTree(treeList); return TreeHelper.BuildTree(treeList);
} }
public AjaxResult SetKeyOpenTime(string id) public AjaxResult SetKeyOpenTime(string id, ItemPlatform platform)
{ {
if (Db.Update<cats>(c => c.Id == id, (item) => if (Db.Update<cats>(c => c.Id == id, (item) =>
{ {
if(platform== ItemPlatform.Taobao) {
item.LastShowTBTime = DateTime.Now; item.LastShowTBTime = DateTime.Now;
}
if (platform == ItemPlatform.ALBB)
{
item.LastShowPddTime = DateTime.Now;
}
if (platform == ItemPlatform.Jd)
{
item.LastShowJDTime = DateTime.Now;
}
}) > 0) }) > 0)
return Success(); return Success();
return Error(); return Error();

3
src/Coldairarrow.IBusiness/HuiYan/IcatsBusiness.cs

@ -15,13 +15,14 @@ namespace Coldairarrow.Business.HuiYan
Task DeleteDataAsync(List<string> ids); Task DeleteDataAsync(List<string> ids);
Task<List<CatTreeDTO>> GetTreeDataListAsync(CatsTreeInputDTO input); Task<List<CatTreeDTO>> GetTreeDataListAsync(CatsTreeInputDTO input);
Task<PageResult<cats>> GetDataByParentAsync(PageInput<ConditionDTO> input, string key);
AjaxResult GetParentCatList(); AjaxResult GetParentCatList();
AjaxResult AddKeyWord(CatDto model); AjaxResult AddKeyWord(CatDto model);
Task<List<CatTreeDTO>> GetTreeDataListAsync(); Task<List<CatTreeDTO>> GetTreeDataListAsync();
AjaxResult AddKeyWord(KeyWordDto model); AjaxResult AddKeyWord(KeyWordDto model);
AjaxResult SetKeyOpenTime(string id); AjaxResult SetKeyOpenTime(string id, ItemPlatform platform);
} }

4
src/Coldairarrow.Web/.env

@ -7,8 +7,8 @@ VUE_APP_DesktopPath=/Home/Introduce
#发布后接口根地址 #发布后接口根地址
VUE_APP_PublishRootUrl=http://hyapi.qiyue666.com VUE_APP_PublishRootUrl=http://hyapi.qiyue666.com
#本地调试接口根地址 #本地调试接口根地址
VUE_APP_LocalRootUrl=http://localhost:5000 #VUE_APP_LocalRootUrl=http://localhost:5000
#VUE_APP_LocalRootUrl=http://hyapi.qiyue666.com VUE_APP_LocalRootUrl=http://hyapi.qiyue666.com
#接口超时时间ms #接口超时时间ms
VUE_APP_ApiTimeout=10000 VUE_APP_ApiTimeout=10000
#本地开发启动端口 #本地开发启动端口

2
src/Coldairarrow.Web/src/views/HuiYan/cats/EditForm.vue

@ -98,7 +98,7 @@
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].clearValidate() this.$refs['form'].clearValidate()
}) })
this.catList = this.parentObj.data.slice(0) this.catList = this.parentObj.parentData.slice(0)
}, },
openForm(id, title) { openForm(id, title) {
this.init() this.init()

145
src/Coldairarrow.Web/src/views/HuiYan/cats/List.vue

@ -8,27 +8,52 @@
@click="handleDelete(selectedRowKeys)" @click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()" :disabled="!hasSelected()"
:loading="loading" :loading="loading"
>删除</a-button> >删除</a-button
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button> >
<a-button type="primary" icon="redo" @click="getDataListByParent(selectThree, 4)">刷新</a-button>
</div> </div>
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :md="4" :sm="24"> <a-col :md="4" :sm="24">
<a-form-item label="查询类别"> <a-form-item label="一级类目">
<a-select allowClear v-model="queryParam.condition"> <a-select allowClear @change="oneCatChange">
<a-select-option key="Text">品类词</a-select-option> <a-select-option v-for="item in oneCats" :key="item.Id">{{ item.Name }}</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="4" :sm="24">
<a-form-item label="二级类目">
<a-select allowClear v-model="selectTwo" @change="twoCatChange">
<a-select-option v-for="item in twoCats" :key="item.Id">{{ item.Name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item label="三级类目">
<a-select allowClear v-model="selectThree">
<a-select-option v-for="item in threeCats" :key="item.Id">{{ item.Name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24"> <a-col :md="4" :sm="24">
<a-form-item> <a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" /> <a-input v-model="searchKey" placeholder="关键字" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button> <a-button
type="primary"
@click="
() => {
this.pagination.current = 1
this.getDataListByParent(this.selectThree, 4)
}
"
>查询</a-button
>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button> <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col> </a-col>
</a-row> </a-row>
@ -38,7 +63,7 @@
<a-table <a-table
ref="table" ref="table"
:columns="columns" :columns="columns"
:rowKey="row => row.Id" :rowKey="(row) => row.Id"
:dataSource="data" :dataSource="data"
:pagination="pagination" :pagination="pagination"
:loading="loading" :loading="loading"
@ -54,15 +79,6 @@
<a @click="handleDelete([record.Id])">删除</a> <a @click="handleDelete([record.Id])">删除</a>
</template> </template>
</span> </span>
<span slot="catKey" slot-scope="text, record">
<span v-if="record.Level===4">{{record.Text}}</span>
<sapn v-else>-</sapn>
</span>
<span slot="Text" slot-scope="text, record">
<span v-if="record.Level!=4">{{record.Text}}</span>
<sapn v-else></sapn>
</span>
</a-table> </a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form> <edit-form ref="editForm" :parentObj="this"></edit-form>
@ -75,33 +91,41 @@ import EditForm from './EditForm'
import EditNameForm from './EditNameForm' import EditNameForm from './EditNameForm'
const columns = [ const columns = [
{ title: '类目', dataIndex: 'Text', width: '10%', scopedSlots: { customRender: 'Text' } }, { title: '品类词', dataIndex: 'Name', width: '10%' },
{ title: '品类词', dataIndex: 'catKey', width: '10%', scopedSlots: { customRender: 'catKey' } }, { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
] ]
export default { export default {
components: { components: {
EditForm, EditForm,
EditNameForm EditNameForm,
}, },
mounted() { mounted() {
this.getDataList() this.getDataList()
this.getDataListByParent('', 1)
}, },
data() { data() {
return { return {
data: [], data: [],
parentData: [],
oneCats: [],
twoCats: [],
threeCats: [],
searchKey:undefined,
selectThree: undefined,
selectOne: undefined,
selectTwo: undefined,
pagination: { pagination: {
current: 1, current: 1,
pageSize: 10, pageSize: 500,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}` showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`,
}, },
filters: {}, filters: {},
sorter: { field: 'Id', order: 'asc' }, sorter: { field: 'Id', order: 'asc' },
loading: false, loading: false,
columns, columns,
queryParam: {}, queryParam: { Condition: 'Id', Keyword: '' },
selectedRowKeys: [] selectedRowKeys: [],
} }
}, },
methods: { methods: {
@ -109,27 +133,69 @@ export default {
this.pagination = { ...pagination } this.pagination = { ...pagination }
this.filters = { ...filters } this.filters = { ...filters }
this.sorter = { ...sorter } this.sorter = { ...sorter }
this.getDataList() this.getDataListByParent(this.selectThree, 4)
}, },
getDataList() { oneCatChange(val) {
this.selectOne = val
this.selectTwo=undefined
this.selectThree=undefined
this.getDataListByParent(val, 2)
},
twoCatChange(val) {
this.selectTwo = val
this.selectThree=undefined
this.getDataListByParent(val, 3)
},
getDataListByParent(parentId, type) {
this.queryParam.Keyword = parentId
this.selectedRowKeys = [] this.selectedRowKeys = []
this.loading = true this.loading = true
var url='/HuiYan/cats/GetDataByParent'
if(type==4&&this.searchKey)
{
url=`${url}?key=${this.searchKey}`
}
this.$http this.$http
.post('/HuiYan/cats/GetTreeDataList', { .post(url, {
PageIndex: this.pagination.current, PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize, PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id', SortField: this.sorter.field || 'Id',
SortType: this.sorter.order, SortType: this.sorter.order,
Search: this.queryParam, Search: this.queryParam,
...this.filters ...this.filters,
}) })
.then(resJson => { .then((resJson) => {
this.loading = false this.loading = false
this.data = resJson.Data if (type == 1) {
const pagination = { ...this.pagination } this.oneCats = resJson.Data
pagination.total = resJson.Total }
this.pagination = pagination if (type == 2) {
this.twoCats = resJson.Data
}
if (type == 3) {
this.threeCats = resJson.Data
}
if (type == 4) {
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
}
})
},
getDataList() {
this.$http
.post('/HuiYan/cats/GetTreeDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
...this.filters,
})
.then((resJson) => {
this.parentData = resJson.Data
}) })
}, },
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
@ -150,21 +216,22 @@ export default {
title: '确认删除吗?', title: '确认删除吗?',
onOk() { onOk() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
thisObj.$http.post('/HuiYan/cats/DeleteData', ids).then(resJson => { thisObj.$http.post('/HuiYan/cats/DeleteData', ids).then((resJson) => {
resolve() resolve()
if (resJson.Success) { if (resJson.Success) {
thisObj.$message.success('操作成功!') thisObj.$message.success('操作成功!')
thisObj.getDataList() thisObj.pagination.current = 1
thisObj.getDataListByParent(thisObj.selectThree, 4)
} else { } else {
thisObj.$message.error(resJson.Msg) thisObj.$message.error(resJson.Msg)
} }
}) })
}) })
} },
}) })
} },
} },
} }
</script> </script>

1
客户端/齐越慧眼/齐越慧眼/ApiHelper.cs

@ -21,6 +21,7 @@ namespace 齐越慧眼
public static string JwtToken { public static string JwtToken {
get get
{ {
// return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTA3NDY1MDMzNDIwODAwIiwidGVhbUlkIjoiMTQzNjI4ODUwMDIzNTI0MzUyMCIsImV4cCI6MTY3MTAwOTkyM30.p3yLjbeUilDZxkfRv4GaCvIYJ_jFoe_8Sw8hY18swdA";
if (string.IsNullOrEmpty(jwtToken)) if (string.IsNullOrEmpty(jwtToken))
{ {

7
客户端/齐越慧眼/齐越慧眼/UserControls/BrowerTabPanelControl.xaml.cs

@ -94,7 +94,12 @@ namespace 齐越慧眼.UserControls
string json = new JdApiHelper().UploadFile(imgFile, App.JdCookie); string json = new JdApiHelper().UploadFile(imgFile, App.JdCookie);
string path = System.Text.RegularExpressions.Regex.Match(json, ".callback\\('(.*?)'\\);").Groups[1].Value; string path = System.Text.RegularExpressions.Regex.Match(json, ".callback\\('(.*?)'\\);").Groups[1].Value;
string url = $"https://search.jd.com/image?path={System.Web.HttpUtility.UrlEncode(path)}&op=search"; if (string.IsNullOrEmpty(path))
{
WpfNoticeMsg.NoticeMessage.Show("图片上传失败", "搜图失败");
}
string url = $"https://search.jd.com/image?path={path}&op=search";
//https://search.jd.com/image?path={}&op=search //https://search.jd.com/image?path={}&op=search
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>

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

@ -57,7 +57,7 @@
<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)" <a-tag style="cursor: pointer;float: left;margin-top: 5px;" :key="i4" @click="openKey(keyword,keyword.title,keyword.Id)"
v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==0)"> v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==0)">
{{keyword.title}}</a-tag> {{keyword.title}}</a-tag>
</div> </div>
</a-col> </a-col>
@ -71,10 +71,10 @@
</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)" <a-tag style="cursor: pointer;float: left;margin-top: 5px;" :key="i5" @click="openKey(keyword,keyword.title,keyword.Id)"
:color="keyword.IsShowTBTime?'red':''" :color="getKeyColor(keyword)"
v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==1)"> v-for="(keyword,i5) in lastCat.children.filter(c=>c.Type==1)">
{{keyword.title}}</a-tag> {{keyword.title}}</a-tag>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
@ -110,6 +110,7 @@
methods: { methods: {
getKeyColor(keyword) getKeyColor(keyword)
{ {
console.log(keyword)
switch(this.currentTab) switch(this.currentTab)
{ {
case '0': case '0':
@ -130,8 +131,9 @@
hyCoreModel.openTabByKey(key,id,this.currentTab) hyCoreModel.openTabByKey(key,id,this.currentTab)
}, },
getDatas() { getDatas() {
var that=this
this.http.get('/HuiYan/cats/GetCatDatas').then(res => { this.http.get('/HuiYan/cats/GetCatDatas').then(res => {
this.datas = res.Data that.datas = res.Data
}) })
}, },
addCats(lastCat) { addCats(lastCat) {

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

4
客户端/齐越慧眼/齐越慧眼/齐越慧眼.csproj

@ -83,9 +83,7 @@
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="vuepage\dist\favicon.ico" /> <EmbeddedResource Include="vuepage\dist\favicon.ico" />
<EmbeddedResource Include="vuepage\dist\index.html" /> <EmbeddedResource Include="vuepage\dist\index.html" />
<EmbeddedResource Include="vuepage\dist\jp.png"> <EmbeddedResource Include="vuepage\dist\jp.png" />
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="vuepage\dist\js\app.js" /> <EmbeddedResource Include="vuepage\dist\js\app.js" />
<EmbeddedResource Include="vuepage\dist\js\app.js.map" /> <EmbeddedResource Include="vuepage\dist\js\app.js.map" />
<EmbeddedResource Include="vuepage\dist\js\chunk-vendors.js" /> <EmbeddedResource Include="vuepage\dist\js\chunk-vendors.js" />

Loading…
Cancel
Save