Commit 2c2dde07 authored by tianhongyang's avatar tianhongyang

fix

parent a0faa005
<template>
<div class="dsk-email-input-container">
<el-autocomplete :popper-class="popperClass" v-model="comEmailValue" :clearable="clearable" :fetch-suggestions="searchQuery"
:placeholder="placeholder" @select="handleSelect">
<template slot-scope="{ item }">
<slot :optionData="item">
<div class="email-type-option">
</div>
</slot>
</template>
</el-autocomplete>
</div>
</template>
<script>
const emailTypeList = [
{
value: "@qq.com",
emailIcon: "",
chineseName: "QQ邮箱"
},
{
value: "@163.com",
emailIcon: "",
chineseName: "网易邮箱"
},
{
value: "@126.com",
emailIcon: "",
chineseName: "网易邮箱"
},
{
value: "@yahoo.cn",
emailIcon: "",
chineseName: "雅虎邮箱"
},
{
value: "@sina.com",
emailIcon: "",
chineseName: "搜狐邮箱"
},
{
value: "@outlook.com",
emailIcon: "",
chineseName: "微软邮箱"
},
{
value: "@gmail.com",
emailIcon: "",
chineseName: "谷歌邮箱"
},
{
value: "@163.net",
emailIcon: "",
chineseName: "尊享邮"
}
];
export default {
name: "dskEmailInput",
props: {
......@@ -43,7 +94,7 @@ export default {
},
data() {
return {
comEmailValue: this.emailValue
comEmailValue: this.emailValue,
};
},
//可访问data属性
......@@ -56,7 +107,42 @@ export default {
},
//方法集
methods: {
handleSelect() {
},
searchQuery(keywords, callback) {
// 空值不联想
if (!keywords?.trim()) {
return callback([]);
}
// 存在字符
/**
* @type {string}
*/
let key = keywords;
const index = key.indexOf("@");
// 检索到@符号进行联想
if (index != -1) {
// 截取@符号前部分
key = key.slice(0, index);
// 只有一个@符号 没有其它值的情况
if (!key) return callback([]);
/**
* @type {Array<{
* value : string;
* emailIcon : string;
* chineseName : string;
* }>}
*/
const emailTyps = JSON.parse(JSON.stringify(emailTypeList));
const _temp = emailTyps.map(item => {
item.value = `${key}${item.value}`;
return item;
});
return callback(_temp);
}
return callback([]);
}
},
}
</script>
......@@ -67,3 +153,20 @@ export default {
position: relative;
}
</style>
<style lang="scss">
.dsk-email-options-popper {
.el-autocomplete-suggestion__wrap {
.el-autocomplete-suggestion__list {
& > [id*="el-autocomplete"] {
padding: 0px 16px;
}
.email-type-option {
display: flex;
align-items: center;
width: 100%;
height: 32px;
}
}
}
}
</style>
......@@ -343,7 +343,7 @@ export default {
// 跳转到企业详情
viewEnterprise(row) {
if (!row?.advisoryBody?.advisoryBodyCid) return this.$message.warning("缺少咨询机构id");
this.$tab.openPage(row.advisoryBody.advisoryBodyName ? row.advisoryBody.advisoryBodyName : "咨询机构详情", `/enterprise/${encodeStr(row.advisoryBody.advisoryBodyCid)}`);
this.$tab.openPage(row.advisoryBody.advisoryBodyName ? row.advisoryBody.advisoryBodyName : "咨询机构详情", `/enterprise/${encodeStr(row.advisoryBody.advisoryBodyCid)}?companyName=${row.advisoryBody.advisoryBodyName}`);
}
},
}
......
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