Commit a5d3b2f4 authored by zhengke's avatar zhengke

优化 内容匹配数据

parent b770fc2e
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
<IconSearch class="cusor-pointer" @click.stop="searchData"></IconSearch> <IconSearch class="cusor-pointer" @click.stop="searchData"></IconSearch>
</template> </template>
</el-input> </el-input>
<div v-loading="loading" style="height: calc(100%-40px);overflow: auto;"> <div v-loading="loading" style="height: calc(100%-40px);min-height:400px;overflow: auto;">
<div class="symbol-item NormalDataCenter cursor-pointer" <div class="symbol-item NormalDataCenter cursor-pointer"
:class="[current==item.Feature?'active':'']" :class="[current==item.Id?'active':'']"
v-for="(item,index) in dataList" @click="setElText(item,index)"> v-for="(item,index) in dataList" @click="setElText(item,index)">
<div class="title fz14 text-weight-bold text-ellipsis"> <div class="title fz14 text-weight-bold text-ellipsis">
<el-tooltip <el-tooltip
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const dataList = ref([]) const dataList = ref([])
const dataListAll = ref([]) const dataListAll = ref([])
const loading = ref(false) const loading = ref(true)
const { userInfo } = storeToRefs(useUserStore()); const { userInfo } = storeToRefs(useUserStore());
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
currentImg.value = index currentImg.value = index
} }
const setElText = (item:any,index:Number) => { const setElText = (item:any,index:Number) => {
current.value = item.Feature current.value = item.Id
const contentStr = handleElement.value.contentStr const contentStr = handleElement.value.contentStr
if(contentStr!=item.Feature&&item.Feature) { if(contentStr!=item.Feature&&item.Feature) {
const content = handleElement.value.content.replace(getHtmlPlainText(handleElement.value.content),item.Feature) const content = handleElement.value.content.replace(getHtmlPlainText(handleElement.value.content),item.Feature)
...@@ -112,10 +112,10 @@ ...@@ -112,10 +112,10 @@
const searchData = () => { const searchData = () => {
if(!keywords.value) return if(!keywords.value) return
params.kw = keywords.value params.kw = keywords.value
loading.value = true
getDatas() getDatas()
} }
const getDatas = async () => { const getDatas = async () => {
loading.value = true
const response = await MatchingData.ScenicSearch(params) const response = await MatchingData.ScenicSearch(params)
if (response.data.resultCode == 1) { if (response.data.resultCode == 1) {
dataListAll.value = dataList.value = checkPoiCoverImg(response.data.data) dataListAll.value = dataList.value = checkPoiCoverImg(response.data.data)
...@@ -125,7 +125,8 @@ ...@@ -125,7 +125,8 @@
const checkPoiCoverImg = (array:any[])=>{ const checkPoiCoverImg = (array:any[])=>{
if(array.length==0) return if(array.length==0) return
array.forEach((x,index)=>{ array.forEach((x,index)=>{
if(x.Feature==handleElement.value.contentStr) current.value = x.Feature x.Id = index+1
if(x.Feature==handleElement.value.contentStr) current.value = index+1
if((!x.PicPath||x.PicPath=='') && x.ImgArray && x.ImgArray.length>0){ if((!x.PicPath||x.PicPath=='') && x.ImgArray && x.ImgArray.length>0){
x.PicPath=x.ImgArray[0] x.PicPath=x.ImgArray[0]
}else if(x.PicPath && x.PicPath!=''){ }else if(x.PicPath && x.PicPath!=''){
...@@ -140,6 +141,8 @@ ...@@ -140,6 +141,8 @@
getDatas() getDatas()
watch(()=>handleElementId.value, () => { watch(()=>handleElementId.value, () => {
loading.value = true
keywords.value = ''
params.kw = HtmlUtil.htmlEncodeByRegExp(handleElement.value.contentStr) params.kw = HtmlUtil.htmlEncodeByRegExp(handleElement.value.contentStr)
getDatas() getDatas()
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment