chore(package): fix lint caused error

This commit is contained in:
woody 2025-06-04 09:09:18 +08:00
parent 0890b44385
commit 158525544e
3 changed files with 14935 additions and 16406 deletions

30979
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -99,18 +99,18 @@
"@dcloudio/webpack-uni-pages-loader": "^2.0.2-3081220230817001", "@dcloudio/webpack-uni-pages-loader": "^2.0.2-3081220230817001",
"@vue/cli-plugin-babel": "~4.5.13", "@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-service": "~4.5.13", "@vue/cli-service": "~4.5.13",
"@vue/eslint-config-standard": "^9.0.1", "@vue/eslint-config-standard": "^8.0.1",
"babel-plugin-import": "^1.11.0", "babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^9.27.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^10.1.5", "eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^10.1.0", "eslint-plugin-vue": "^9.27.0",
"jest": "^25.4.0", "jest": "^25.4.0",
"less": "^3.9.0", "less": "^3.9.0",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"postcss-comment": "^2.0.0", "postcss-comment": "^2.0.0",
"prettier": "^3.5.3", "prettier": "^2.8.8",
"sass": "^1.67.0", "sass": "^1.67.0",
"sass-loader": "^10.4.1", "sass-loader": "^10.4.1",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"

View File

@ -13,187 +13,197 @@
<template> <template>
<view> <view>
<u-picker @cancel='pickershow=false' <u-picker
:show="pickershow" @cancel="pickershow = false"
ref="uPicker" :show="pickershow"
:defaultIndex="defaultIndex" ref="uPicker"
:columns="columns" :defaultIndex="defaultIndex"
@confirm="confirm" :columns="columns"
keyName='name' @confirm="confirm"
@change="changeHandler"></u-picker> keyName="name"
@change="changeHandler"
></u-picker>
</view> </view>
</template> </template>
<script> <script>
import * as api from '@/api/goods' import * as api from '@/api/goods';
export default { export default {
data() { data() {
return { return {
columns: [], columns: [],
pickershow: false, pickershow: false,
provinceList: [], provinceList: [],
cityList: [], cityList: [],
quList: [], quList: [],
diqu: '', diqu: '',
form: {}, form: {},
defaultIndex: [], defaultIndex: [],
user: '', user: '',
} };
},
props: {
defaultCode: {
type: Array,
default: [],
}, },
}, props: {
watch: { defaultCode: {
defaultCode: { type: Array,
deep: true, default: [],
handler(n) {
if (this.cityList.length > 0) {
this.getDefaultIndex(n)
} else {
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry).then((res) => {
if (res) {
this.getDefaultIndex(n)
}
})
}
}, },
}, },
}, watch: {
created() { defaultCode: {
this.user = uni.getStorageSync('User') deep: true,
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry) handler(n) {
}, if (this.cityList.length > 0) {
methods: { this.getDefaultIndex(n);
getDefaultIndex(arr) { } else {
let a = this.provinceList.findIndex((item) => item.pkId == arr[0]) this.getAllAreaList(
let b = this.cityList[a].arrList.findIndex((item) => item.pkId == arr[1]) uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
let c = this.quList.findIndex((item) => item.pkId == arr[1]) ).then((res) => {
let d = this.quList[c].arrList.findIndex((item) => item.pkId == arr[2]) if (res) {
this.columns = [ this.getDefaultIndex(n);
this.provinceList, }
this.cityList[a].arrList, });
this.quList[c].arrList,
]
let diqu
this.defaultIndex = [a, b, d > -1 ? d : 0]
if (d > -1) {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}-${this.quList[c].arrList[d].name}`
} else {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}`
}
this.$emit('getAddressData', diqu)
},
setShow() {
this.pickershow = true
},
getAllAreaList(pkCountry) {
return new Promise((reslove, reject) => {
api
.getAllAreaList({
pkCountry: pkCountry,
})
.then((res) => {
this.provinceList = res.data.provinceList
//
let cityList = []
res.data.provinceList.forEach((element, index) => {
cityList.push({
pkId: element.pkId,
arrList: [],
})
res.data.cityList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
cityList[index].arrList.push(item)
}
})
})
this.cityList = cityList
//
let quList = []
res.data.cityList.forEach((element, index) => {
quList.push({
pkId: element.pkId,
arrList: [],
})
res.data.countyList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
quList[index].arrList.push(item)
}
})
})
this.quList = quList
this.columns = [
res.data.provinceList,
cityList[0].arrList,
quList[0].arrList,
]
reslove(true)
})
})
},
changeHandler(e) {
const {
columnIndex,
value,
values, // values
index,
indexs,
// pickerref
picker = this.$refs.uPicker,
} = e
// ()
if (columnIndex === 0) {
picker.setColumnValues(1, this.cityList[indexs[0]].arrList)
let arr = []
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) {
arr = item.arrList
} }
}) },
picker.setColumnValues(2, arr) },
// pickerthis
} else if (columnIndex === 1) {
let arr = []
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) {
arr = item.arrList
}
})
picker.setColumnValues(2, arr)
}
}, },
// columnIndexvaluevalues created() {
confirm(e) { this.user = uni.getStorageSync('User');
this.pickershow = false this.getAllAreaList(
if (e.value[2]) { uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
this.diqu = `${e.value[0].name}-${e.value[1].name}-${e.value[2].name}` );
this.form.province = e.value[0].pkId
this.form.city = e.value[1].pkId
this.form.county = e.value[2].pkId
} else {
this.diqu = `${e.value[0].name}-${e.value[1].name}`
this.form.province = e.value[0].pkId
this.form.city = e.value[1].pkId
this.form.county = ''
}
this.$emit('addressData', this.diqu, this.form)
}, },
}, methods: {
} getDefaultIndex(arr) {
const a = this.provinceList.findIndex((item) => item.pkId == arr[0]);
const b = this.cityList[a].arrList.findIndex(
(item) => item.pkId == arr[1]
);
const c = this.quList.findIndex((item) => item.pkId == arr[1]);
const d = this.quList[c].arrList.findIndex(
(item) => item.pkId == arr[2]
);
this.columns = [
this.provinceList,
this.cityList[a].arrList,
this.quList[c].arrList,
];
let diqu;
this.defaultIndex = [a, b, d > -1 ? d : 0];
if (d > -1) {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}-${this.quList[c].arrList[d].name}`;
} else {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}`;
}
this.$emit('getAddressData', diqu);
},
setShow() {
this.pickershow = true;
},
getAllAreaList(pkCountry) {
return new Promise((reslove, reject) => {
api
.getAllAreaList({
pkCountry,
})
.then((res) => {
this.provinceList = res.data.provinceList;
//
const cityList = [];
res.data.provinceList.forEach((element, index) => {
cityList.push({
pkId: element.pkId,
arrList: [],
});
res.data.cityList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
cityList[index].arrList.push(item);
}
});
});
this.cityList = cityList;
//
const quList = [];
res.data.cityList.forEach((element, index) => {
quList.push({
pkId: element.pkId,
arrList: [],
});
res.data.countyList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
quList[index].arrList.push(item);
}
});
});
this.quList = quList;
this.columns = [
res.data.provinceList,
cityList[0].arrList,
quList[0].arrList,
];
reslove(true);
});
});
},
changeHandler(e) {
const {
columnIndex,
value,
values, // values
index,
indexs,
// pickerref
picker = this.$refs.uPicker,
} = e;
// ()
if (columnIndex === 0) {
picker.setColumnValues(1, this.cityList[indexs[0]].arrList);
let arr = [];
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) {
arr = item.arrList;
}
});
picker.setColumnValues(2, arr);
// pickerthis
} else if (columnIndex === 1) {
let arr = [];
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) {
arr = item.arrList;
}
});
picker.setColumnValues(2, arr);
}
},
// columnIndexvaluevalues
confirm(e) {
this.pickershow = false;
if (e.value[2]) {
this.diqu = `${e.value[0].name}-${e.value[1].name}-${e.value[2].name}`;
this.form.province = e.value[0].pkId;
this.form.city = e.value[1].pkId;
this.form.county = e.value[2].pkId;
} else {
this.diqu = `${e.value[0].name}-${e.value[1].name}`;
this.form.province = e.value[0].pkId;
this.form.city = e.value[1].pkId;
this.form.county = '';
}
this.$emit('addressData', this.diqu, this.form);
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.picker { .picker {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
border-width: 0.5px !important; border-width: 0.5px !important;
border-color: #dadbde !important; border-color: #dadbde !important;
border-style: solid; border-style: solid;
border-radius: 4px; border-radius: 4px;
padding: 6px 9px; padding: 6px 9px;
} }
</style> </style>