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. 137
      src/Coldairarrow.Web/src/views/HuiYan/cats/List.vue
  7. 1
      客户端/齐越慧眼/齐越慧眼/ApiHelper.cs
  8. 7
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerTabPanelControl.xaml.cs
  9. 10
      客户端/齐越慧眼/齐越慧眼/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);
}
[HttpPost]
public async Task<PageResult<cats>> GetDataByParentAsync(PageInput<ConditionDTO> input,[FromQuery]string key)
{
return await _catsBus.GetDataByParentAsync(input, key);
}
[HttpGet]
public AjaxResult GetParentCatList()
{
@ -111,7 +117,7 @@ namespace Coldairarrow.Api.Controllers.HuiYan
[HttpPost]
public AjaxResult SetKeyOpenTime(string id,ItemPlatform platform)
{
return _catsBus.SetKeyOpenTime(id);
return _catsBus.SetKeyOpenTime(id,platform);
}
#endregion

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

@ -45,7 +45,28 @@ namespace Coldairarrow.Business.HuiYan
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()
@ -240,19 +261,31 @@ namespace Coldairarrow.Business.HuiYan
Text = x.Name,
Value = x.Id,
Type = x.Type,
IsShowJDTime = x.LastShowJDTime == null ? true : (DateTime.Now - x.LastShowJDTime.Value).TotalDays > 3,
IsShowPddTime = x.LastShowPddTime == null ? true : (DateTime.Now - x.LastShowPddTime.Value).TotalDays > 3,
IsShowTBTime = x.LastShowTBTime == null ? true : (DateTime.Now - x.LastShowTBTime.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 > 45,
IsShowTBTime = x.LastShowTBTime == null ? true : (DateTime.Now - x.LastShowTBTime.Value).TotalDays > 45,
}).ToList();
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(platform== ItemPlatform.Taobao) {
item.LastShowTBTime = DateTime.Now;
}
if (platform == ItemPlatform.ALBB)
{
item.LastShowPddTime = DateTime.Now;
}
if (platform == ItemPlatform.Jd)
{
item.LastShowJDTime = DateTime.Now;
}
}) > 0)
return Success();
return Error();

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

@ -15,13 +15,14 @@ namespace Coldairarrow.Business.HuiYan
Task DeleteDataAsync(List<string> ids);
Task<List<CatTreeDTO>> GetTreeDataListAsync(CatsTreeInputDTO input);
Task<PageResult<cats>> GetDataByParentAsync(PageInput<ConditionDTO> input, string key);
AjaxResult GetParentCatList();
AjaxResult AddKeyWord(CatDto model);
Task<List<CatTreeDTO>> GetTreeDataListAsync();
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_LocalRootUrl=http://localhost:5000
#VUE_APP_LocalRootUrl=http://hyapi.qiyue666.com
#VUE_APP_LocalRootUrl=http://localhost:5000
VUE_APP_LocalRootUrl=http://hyapi.qiyue666.com
#接口超时时间ms
VUE_APP_ApiTimeout=10000
#本地开发启动端口

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

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

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

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

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

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

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

@ -94,7 +94,12 @@ namespace 齐越慧眼.UserControls
string json = new JdApiHelper().UploadFile(imgFile, App.JdCookie);
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
Application.Current.Dispatcher.Invoke(() =>

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

@ -71,9 +71,9 @@
</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':''"
v-for="(keyword,i4) in lastCat.children.filter(c=>c.Type==1)">
<a-tag style="cursor: pointer;float: left;margin-top: 5px;" :key="i5" @click="openKey(keyword,keyword.title,keyword.Id)"
:color="getKeyColor(keyword)"
v-for="(keyword,i5) in lastCat.children.filter(c=>c.Type==1)">
{{keyword.title}}</a-tag>
</div>
</a-col>
@ -110,6 +110,7 @@
methods: {
getKeyColor(keyword)
{
console.log(keyword)
switch(this.currentTab)
{
case '0':
@ -130,8 +131,9 @@
hyCoreModel.openTabByKey(key,id,this.currentTab)
},
getDatas() {
var that=this
this.http.get('/HuiYan/cats/GetCatDatas').then(res => {
this.datas = res.Data
that.datas = res.Data
})
},
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>
<EmbeddedResource Include="vuepage\dist\favicon.ico" />
<EmbeddedResource Include="vuepage\dist\index.html" />
<EmbeddedResource Include="vuepage\dist\jp.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="vuepage\dist\jp.png" />
<EmbeddedResource Include="vuepage\dist\js\app.js" />
<EmbeddedResource Include="vuepage\dist\js\app.js.map" />
<EmbeddedResource Include="vuepage\dist\js\chunk-vendors.js" />

Loading…
Cancel
Save