优化图片选中,居中,优化搜索模糊查询

jc
fanluyan 10 months ago
parent c22c1090fe
commit ebbeddbefb

@ -421,6 +421,26 @@ export default {
if (data.channelId) { if (data.channelId) {
this.getPointList(data); this.getPointList(data);
} }
const items = this.$refs.scrollBox.querySelectorAll(".smallPic");
const selectedItem = items[i];
const selectedItemLeft = selectedItem.offsetLeft;
const scrollContainer = this.$refs.scrollBox;
const scrollContainerWidth = scrollContainer.offsetWidth;
const selectedItemWidth = selectedItem.offsetWidth;
//
let scrollDistance =
selectedItemLeft - (scrollContainerWidth - selectedItemWidth) / 2;
if (scrollDistance < 0) {
scrollDistance = 0;
} else if (
scrollDistance + scrollContainerWidth >
scrollContainer.scrollWidth
) {
scrollDistance = scrollContainer.scrollWidth - scrollContainerWidth;
}
// scrollLeft
scrollContainer.scrollLeft = scrollDistance;
}, },
loadImage() { loadImage() {
console.log("loading"); console.log("loading");
@ -649,6 +669,7 @@ export default {
// flex-direction: column; // flex-direction: column;
height: calc(100% - 32px); height: calc(100% - 32px);
box-sizing: border-box; box-sizing: border-box;
.radioBox { .radioBox {
position: absolute; position: absolute;
top: 8px; top: 8px;

@ -160,7 +160,7 @@ export default {
//radio //radio
getRadio() { getRadio() {
console.log(this.zzradio); console.log(this.zzradio);
this.filterText = ""; //this.filterText = "";
localStorage.setItem("radio", JSON.stringify(this.zzradio)); localStorage.setItem("radio", JSON.stringify(this.zzradio));
this.getLineTreeStatus(); this.getLineTreeStatus();
}, },
@ -169,7 +169,29 @@ export default {
console.log("点击了刷新"); console.log("点击了刷新");
if (this.filterText !== "") { if (this.filterText !== "") {
getdyTreeListJoggle({ type: this.zzradio })
.then((res) => {
console.log(res);
this.lineTreeData = res.data.list;
this.isfavorList = res.data.favorlist;
this.lineTreeData.unshift({
id: 0,
name: "收藏夹",
bsManufacturer: "收藏夹",
list: this.isfavorList,
});
this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData"));
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentData.id); //
this.$refs.tree.filter(this.filterText); this.$refs.tree.filter(this.filterText);
});
})
.catch((err) => {
console.log(err); //
});
} else { } else {
getdyTreeListJoggle({ type: this.zzradio }) getdyTreeListJoggle({ type: this.zzradio })
.then((res) => { .then((res) => {

Loading…
Cancel
Save