Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: update eslint
Browse files Browse the repository at this point in the history
lin594 committed Mar 9, 2024
1 parent 9a0391c commit 25f887a
Showing 5 changed files with 32 additions and 48 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ module.exports = {
// override/add rules settings here, such as:
'vue/multi-word-component-names': 'off',
'no-undef': 'off',
'no-continue': 'off',
'no-restricted-syntax': 'off',
},
settings: {
'import/resolver': {
32 changes: 14 additions & 18 deletions src/pages/tools/condition.vue
Original file line number Diff line number Diff line change
@@ -132,16 +132,14 @@ export default {
};
},
onLoad(options) {
// 声母
// 声母
const shengmu = [];
for (const k in utils.shengmu) {
if ({}.hasOwnProperty.call(utils.shengmu, k)) {
shengmu.push({
value: k,
text: utils.shengmu[k],
});
}
}
Object.keys(utils.shengmu).forEach((k) => {
shengmu.push({
value: k,
text: utils.shengmu[k],
});
});
this.shengmu = [...shengmu];
for (let i = 0; i < this.shengmu.length; i += 1) {
if (this.shengmu[i].value === options.shengmu) {
@@ -152,14 +150,12 @@ export default {
// 声调
const shengdiao = [];
for (const k in utils.shengdiao) {
if ({}.hasOwnProperty.call(utils.shengdiao, k)) {
shengdiao.push({
value: k,
text: utils.shengdiao[k],
});
}
}
Object.keys(utils.shengdiao).forEach((k) => {
shengdiao.push({
value: k,
text: utils.shengdiao[k],
});
});
shengdiao.unshift(shengdiao.pop()); // make 'all' at the first
this.shengdiao = [...shengdiao];
for (let i = 0; i < this.shengdiao.length; i += 1) {
@@ -171,7 +167,7 @@ export default {
// 韵母
if (options.yunmu) {
// check if options.yunmu is valid
// check if options.yunmu is valid
for (let i = 0; i < this.yunmu.length; i += 1) {
if (this.yunmuValue !== 'all') break;
if (this.yunmu[i].value === options.yunmu) {
31 changes: 11 additions & 20 deletions src/pages/tools/dictionary.vue
Original file line number Diff line number Diff line change
@@ -141,29 +141,20 @@ export default {
nextNodeList() {
const { record } = this;
const ans = {};
for (const i in record) {
if (i === 'word_count') continue;
Object.keys(record).forEach((i) => {
if (i === 'word_count') return;
if (i[0] in ans) {
ans[i[0]] = [...ans[i[0]], i];
} else {
ans[i[0]] = [i];
}
}
// sort ans
for (const i in ans) {
if ({}.hasOwnProperty.call(ans, i)) {
ans[i].sort();
}
}
// convert to array
const ansArray = [];
for (const i in ans) {
if ({}.hasOwnProperty.call(ans, i)) {
ansArray.push([i, ans[i]]);
}
}
ansArray.sort();
return ansArray;
});
Object.keys(ans).forEach((i) => {
ans[i].sort();
});
return Object.entries(ans).sort();
},
},
watch: {
@@ -213,9 +204,9 @@ export default {
popPinyin(index) {
this.order.splice(index);
let record = this.fullRecord;
for (const i of this.order) {
this.order.forEach((i) => {
record = record[i];
}
});
this.record = record;
this.prefix = '';
},
10 changes: 5 additions & 5 deletions src/pages/tools/relative.vue
Original file line number Diff line number Diff line change
@@ -127,10 +127,9 @@ export default {
},
},
watch: {
/* eslint-disable no-await-in-loop */
async top(value) {
const ans = [];
for (const item of value.words) {
await Promise.all(value.words.map(async (item) => {
let tmp = {
word: item.word,
id: null,
@@ -145,9 +144,10 @@ export default {
tmp = { ...item };
}
ans.push(tmp);
}
}));
this.words = ans;
},
},
async onLoad() {
await getWordDetails(1966).then((res) => {
@@ -166,9 +166,9 @@ export default {
if (!this.top.relations[field]) { return false; }
const ans = [];
if (typeof this.top.relations[field] !== 'string') {
for (const i in this.top.relations[field]) {
Object.keys(this.top.relations[field]).forEach((i) => {
if (this.top.relations[field]) { ans.push(find(this.top.relations[field][i])); }
}
});
} else {
ans.push(find(this.top.relations[field]));
}
5 changes: 2 additions & 3 deletions src/pages/words/pronunciations/upload.vue
Original file line number Diff line number Diff line change
@@ -318,15 +318,14 @@ export default {
town: towns[this.pickerIndex[0]][this.pickerIndex[1]],
};
for (const i in pronunciation) {
Object.keys(pronunciation).forEach((i) => {
if (!pronunciation[i]) {
uni.showToast({
title: '请填写完整信息',
icon: 'none',
});
return;
}
}
});
// 上传录音文件
uploadFile(pronunciation.source).then((res) => {

0 comments on commit 25f887a

Please sign in to comment.