Selaa lähdekoodia

关键词库版本bug修改

yuwenjun1997 2 vuotta sitten
vanhempi
commit
6fd2877e3e

+ 1 - 1
.env.development

@@ -9,4 +9,4 @@ VUE_APP_BASE_API = 'https://mapi-b.caimei365.com'
 VUE_APP_CORE_API = 'https://core-b.caimei365.com'
 
 # 采美网站url
-VUE_APP_CAIMEI_URL = 'https://www.caimei365.com'
+VUE_APP_CAIMEI_URL = 'https://zzjtest.gz.aeert.com'

+ 1 - 1
src/components/SearchModel/index.vue

@@ -33,7 +33,7 @@ export default {
       const localhost = process.env.VUE_APP_CAIMEI_URL
       const urls = {
         1: localhost + '/product/list.html?keyword=' + this.keyword,
-        2: localhost,
+        2: localhost + '/document/beauty-archive.html?keyword=' + this.keyword,
         3: localhost + '/info/search-1.html?keyword=' + this.keyword,
         4: localhost + '/encyclopedia/search.html?keyword=' + this.keyword
       }

+ 18 - 0
src/utils/index.js

@@ -364,3 +364,21 @@ export async function downloadWithUrl(url, name, options = {}) {
     console.log(error)
   }
 }
+
+export function getYestodayTime() {
+  // 获取当前日期
+  const today = new Date()
+
+  // 获取昨天的日期
+  const yesterday = new Date(today)
+  yesterday.setDate(today.getDate() - 1)
+
+  // 获取昨天的开始时间和结束时间
+  const yesterdayStart = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate(), 0, 0, 0)
+  const yesterdayEnd = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate(), 23, 59, 59)
+
+  return {
+    start: yesterdayStart,
+    end: yesterdayEnd
+  }
+}

+ 14 - 6
src/views/library/keyword/list.vue

@@ -45,7 +45,7 @@
     </div>
 
     <!-- 关键词列表 -->
-    <el-table v-loading="isLoading" :data="list" border @selection-change="handleSelectionChange">
+    <el-table ref="table" v-loading="isLoading" :data="list" border @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="序号" :index="indexMethod" type="index" sortable="custom" align="center" width="80" />
       <el-table-column prop="keyword" label="关键词" align="center" />
@@ -86,7 +86,7 @@
 
 <script>
 import SearchModel from '@/components/SearchModel'
-import { parseTime } from '@/utils'
+import { getYestodayTime, parseTime } from '@/utils'
 import { fetchKeywordList, joinKeywordLibrary } from '@/api/library/keyword'
 import { export_json_to_excel } from '@/vendor/Export2Excel'
 
@@ -134,9 +134,7 @@ export default {
         {
           text: '昨天',
           onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
+            const { start, end } = getYestodayTime()
             picker.$emit('pick', [start, end])
           }
         }
@@ -215,13 +213,19 @@ export default {
     // 添加到标签库提交
     async addLibrarySubmit(row) {
       const keywords = row instanceof Event ? this.currentList : [].concat(row)
-      const ids = keywords.map((item) => item.id).join(',')
+      let ids = keywords.filter((item) => item.labelStatus === 0).map((item) => item.id)
+      if (keywords.length > ids.length) {
+        this.$refs.table.clearSelection()
+        return this.$message.info('已添加到标签库的标签不可重复添加')
+      }
+      ids = ids.join(',')
       try {
         await joinKeywordLibrary({ id: ids })
         this.$message.success('添加关键词库成功')
         keywords.forEach((item) => {
           item.labelStatus = 1
         })
+        this.$refs.table.clearSelection()
       } catch (error) {
         console.log(error)
       }
@@ -277,6 +281,10 @@ export default {
 
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
+    },
+
+    isSelectable(row) {
+      return row.labelStatus === 0
     }
   }
 }

+ 10 - 5
src/views/library/keyword/recommend.vue

@@ -22,6 +22,7 @@
           start-placeholder="开始日期"
           end-placeholder="结束日期"
           :picker-options="pickerOptions"
+          value-format="yyyy-MM-dd"
           @change="getList"
         />
       </div>
@@ -93,7 +94,7 @@
 
 <script>
 import SearchModel from '@/components/SearchModel'
-import { parseTime } from '@/utils'
+import { getYestodayTime, parseTime } from '@/utils'
 import { fetchKeywordRecommendList, ignoreKeyword, joinKeywordLibrary } from '@/api/library/keyword'
 import { export_json_to_excel } from '@/vendor/Export2Excel'
 export default {
@@ -140,9 +141,7 @@ export default {
         {
           text: '昨天',
           onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
+            const { start, end } = getYestodayTime()
             picker.$emit('pick', [start, end])
           }
         }
@@ -228,13 +227,19 @@ export default {
     // 添加到标签库提交
     async addLibrarySubmit(row) {
       const keywords = row instanceof Event ? this.currentList : [].concat(row)
-      const ids = keywords.map((item) => item.id).join(',')
+      let ids = keywords.filter((item) => item.labelStatus === 0).map((item) => item.id)
+      if (keywords.length > ids.length) {
+        this.$refs.table.clearSelection()
+        return this.$message.info('已添加到标签库的标签不可重复添加')
+      }
+      ids = ids.join(',')
       try {
         await joinKeywordLibrary({ id: ids })
         this.$message.success('添加关键词库成功')
         keywords.forEach((item) => {
           item.labelStatus = 1
         })
+        this.$refs.table.clearSelection()
       } catch (error) {
         console.log(error)
       }

+ 3 - 4
src/views/library/tag/list.vue

@@ -30,6 +30,7 @@
           start-placeholder="开始日期"
           end-placeholder="结束日期"
           :picker-options="pickerOptions"
+          value-format="yyyy-MM-dd"
           @change="getList"
         />
       </div>
@@ -144,7 +145,7 @@
 
 <script>
 import SearchModel from '@/components/SearchModel'
-import { parseTime } from '@/utils'
+import { getYestodayTime, parseTime } from '@/utils'
 import { addKeyword, deleteKeyword, fetchKeywordList, importKeywordXlsx } from '@/api/library/keyword'
 import { export_json_to_excel } from '@/vendor/Export2Excel'
 export default {
@@ -191,9 +192,7 @@ export default {
         {
           text: '昨天',
           onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
+            const { start, end } = getYestodayTime()
             picker.$emit('pick', [start, end])
           }
         }