This commit is contained in:
2023-10-11 17:34:14 +08:00
parent 98dc5cd8f7
commit 268ffecff7
35 changed files with 1947 additions and 878 deletions

View File

@@ -27,13 +27,13 @@
class="select_category"
@click.stop="showFileCategory(item)"
>
{{ getSketchLabel(item.category) }}
{{ item?.category }}
<div
:class="[
'icon',
'iconfont',
'icon-xiala',
item.categoryShow
item?.categoryShow
? 'icon_rotate'
: '',
]"
@@ -41,12 +41,12 @@
</div>
<div
class="category_list"
v-show="item.categoryShow"
v-show="item?.categoryShow"
>
<div
:class="[
'category_item',
item.category == cate.value
item?.category == cate.value
? 'select_category_item'
: '',
]"
@@ -61,11 +61,11 @@
</div>
</div>
</div>
<div v-if="selectCode == 'Sketchboard' || selectCode == 'Printboard'" class="pin_block">
<!-- <div v-if="selectCode == 'Sketchboard' || selectCode == 'Printboard'" class="pin_block">
<a-checkbox v-model:checked="item.pin">PIN</a-checkbox>
</div>
</div> -->
</div>
<div v-show="total > imgList.length" class="material_content_list_loding">
<div v-show="total > imgList.length" class="material_content_list_loding" v-observe>
<img src="@/assets/images/homePage/loading.gif" alt="">
</div>
</div>
@@ -79,7 +79,7 @@
</template>
<script lang="ts">
import { defineComponent, ref} from 'vue'
import { defineComponent, computed, ref} from 'vue'
import { Https } from "@/tool/https";
import { message } from 'ant-design-vue';
import { useStore } from "vuex";
@@ -91,7 +91,6 @@ export default defineComponent({
let myMaterialModalShow = ref(false)
let imgList = ref([
])
let store = useStore()
let isShowLoading:any = ref(false)
let selectCode:any = ref('')
let currentPage:any = ref(1)
@@ -100,32 +99,13 @@ export default defineComponent({
let total = ref(0)
let searcMaterialhName:any = ref('') //搜索名字
let designType:any = ref(null)
let disignTypeList = [
{
value: "Outwear",
label: "Outwear",
},
{
value: "Blouse",
label: "Blouse",
},
{
value: "Dress",
label: "Dress",
},
{
value: "Trousers",
label: "Trousers",
},
{
value: "Skirt",
label: "Skirt",
},
]
let disignTypeList:any = ref([
])
let workspace:any = ref({})
return{
myMaterialModalShow,
imgList,
store,
isShowLoading,
selectCode,
currentPage,
@@ -135,6 +115,7 @@ export default defineComponent({
searcMaterialhName,
designType,
disignTypeList,
workspace
}
},
data (prop) {
@@ -142,9 +123,34 @@ export default defineComponent({
type_ : {
type1:'material',
type2:prop.msg
}
},
store: useStore(),
workspaceCom:{}
}
},
directives:{
observe:{
mounted (el,binding) {
el.addEventListener('click',()=>{
})
},
// updated (el,model){
// if(model.value){
// el.style.display="block"
// setTimeout(() => {
// el.classList.add("active")
// }, 100);
// }else{
// el.classList.remove("active")
// setTimeout(() => {
// el.style.display="none"
// }, 100);
// }
// }
},
},
computed: {
getSketchLabel(value:any) {
return (value: any) => {
@@ -158,40 +164,132 @@ export default defineComponent({
return lable;
};
},
sketchboardList(){
return this.store.state.UploadFilesModule.sketchMaterialFiles
},
moodboardList(){
return this.store.state.UploadFilesModule.moodboardMaterialFiles
},
printboardList(){
return this.store.state.UploadFilesModule.printMaterialFiles
},
},
mounted () {
this.workspaceCom = computed(()=>{
return this.store?.state?.Workspace?.workspace
})
let loding = document.getElementsByClassName("material_content_list_loding")[0]
let bodyLoding = document.getElementsByClassName("material_content_body")[0]
const ob = new IntersectionObserver(callback,{
root:null,
threshold:[0.1]
})
ob.observe(loding)
console.log(loding);
// this.currentPage = 1
// this.pageSize = 12
// let this_ = this
function callback(entries:any, observer:any) {
entries.forEach((entry:any) => {
if (entry.isIntersecting) {
console.log(111);
// this_.getLibraryList()
} else {
}
});
}
},
watch:{
workspaceCom(newVal,oldVal){
this.workspace = newVal
this.getPosition()
},
sketchboardList:{
handler(newVal:any,oldVal:any){
// this.store.state.Workspace.workspace
oldVal.forEach((item:any) => {
if(newVal.findIndex((newValItem:any) =>newValItem.id == item.id) == -1){
this.imgList.forEach((i:any)=>{
if(i.id == item.id){
i.checked = false
}
})
}
});
},
},
moodboardList:{
handler(newVal:any,oldVal:any){
// this.store.state.Workspace.workspace
oldVal.forEach((item:any) => {
if(newVal.findIndex((newValItem:any) =>newValItem.id == item.id) == -1){
this.imgList.forEach((i:any)=>{
if(i.id == item.id){
i.checked = false
}
})
}
});
}
},
printboardList:{
handler(newVal:any,oldVal:any){
// this.store.state.Workspace.workspace
oldVal.forEach((item:any) => {
if(newVal.findIndex((newValItem:any) =>newValItem.id == item.id) == -1){
this.imgList.forEach((i:any)=>{
if(i.id == item.id){
i.checked = false
}
})
}
});
}
},
},
methods:{
init(code:any){
this.selectCode = code
// this.myMaterialModalShow = true
if(this.imgList.length == 0){
}
this.getLibraryList()
let loding = document.getElementsByClassName("material_content_list_loding")[0]
const ob = new IntersectionObserver(callback,{
root:null,
threshold:.8
})
let this_ = this
function callback(entries:any, observer:any) {
entries.forEach((entry:any) => {
if (entry.isIntersecting) {
this_.getLibraryList()
} else {
}
});
}
ob.observe(loding)
},
getPosition(){
let params
if(this.workspace.sex == 'Female'){
params = 'FemalePosition'
}else{
params = 'MalePosition'
}
Https.axiosGet(Https.httpUrls.workspaceenumValues,{params:{enumName:params}}).then((rv: any) => {
if (rv) {
let arr:any = []
rv.forEach((item:any) => {
let obj = {
value:item.name,
label:item.name,
}
arr.push(obj)
});
this.disignTypeList = arr
}
})
},
selectImgItem(imgData:any){
imgData.type_ = this.type_
imgData.resData = JSON.parse(JSON.stringify(imgData))
this.imgList.forEach((v:any)=>{
v.categoryShow = false
})
this.store.commit("addGenerateMaterialFils", imgData);
},
//改变页码
changePage(current: number, pageSize: number){
this.currentPage = current
@@ -204,8 +302,6 @@ export default defineComponent({
},
//选择所有的图片
getLibraryList(){
let data = {
level1Type:this.selectCode,
@@ -219,36 +315,31 @@ export default defineComponent({
(rv: any) => {
let aa:any = []
rv.content.forEach((item:any,index:any) => {
let arr
if(this.type_.type2 == 'Sketchboard'){
item.category = "Outwear";
arr = this.store.state.UploadFilesModule.sketchMaterialFiles
item.category = item.level2Type;
item.categoryShow = false;
}else if(this.type_.type2 == 'Moodboard'){
arr = this.store.state.UploadFilesModule.moodboardMaterialFiles
}else if(this.type_.type2 == 'Printboard'){
arr = this.store.state.UploadFilesModule.printMaterialFiles
}
// let arr
// if(this.type_.type2 == 'Sketchboard'){
// arr = this.store.state.UploadFilesModule.sketchMaterialFiles
// item.category = "Outwear";
// item.categoryShow = false;
// }else if(this.type_.type2 == 'Moodboard'){
// arr = this.store.state.UploadFilesModule.moodboardMaterialFiles
// }else if(this.type_.type2 == 'Printboard'){
// arr = this.store.state.UploadFilesModule.printMaterialFiles
// }
item.imgUrl = item.url
// aa.push(item)
if(!item.id_){
item.id_ = GO.id++
arr.forEach((v:any)=>{
if(item.id == v.id){
item.id_ = v.id_?v.id_:GO.id++
item.checked = true
}
})
}else{
}
aa.push(item)
// if(!item.id_){
// item.id_ = GO.id++
// aa.push(item)
// arr.forEach((v:any)=>{
// if(item.id == v.id){
// v.checked = false
// }
// })
// }else{
// aa.push(item)
// }
});
this.imgList = aa
this.total = rv.total
this.isShowLoading = false
@@ -275,6 +366,7 @@ export default defineComponent({
for (let item of (this.imgList as any)) {
item.categoryShow = false;
}
this.setSketchLibrary(file)
},
hiddenFileCategory() {
for (let item of (this.imgList as any)) {
@@ -282,6 +374,17 @@ export default defineComponent({
}
document.removeEventListener("click", this.hiddenFileCategory);
},
setSketchLibrary(item:any){
let data = {
libraryId:item.id,
level2Type:item.category,
}
Https.axiosPost(Https.httpUrls.setSketchLibrary,data).then(
(rv: any) => {
}
).catch((res)=>{
});
},
}
})
</script>