This commit is contained in:
Swift
2024-02-21 15:33:55 +03:30
parent 229b096d77
commit 102b5d3e6a
3 changed files with 31 additions and 20 deletions
+6 -2
View File
@@ -9,8 +9,12 @@
<div class="brandsList">
<div class="brand" :class="db_name === 'verity' && 'selected'">
<button @click="db_name = 'verity'">
<i class="fas fa-phone-laptop"></i>
<span>لوازم جانبی کامپیوتر ، موبایل و محصولات حافظه</span>
<span class="row">
<i class="fas fa-phone-laptop" style=" margin-right: -10px;"></i>
<i class="fas fa-gamepad" style="margin-top: 32px; position: absolute; margin-right: 25px;"></i>
</span>
<span>لوازم جانبی کامپیوتر ، موبایل ، حافظه و کنسول</span>
</button>
</div>
<div class="brand" :class="db_name === 'panatech' && 'selected'">
+7 -2
View File
@@ -19,8 +19,13 @@
<div class="brand-sp col-lg-6 col-md-6 col-sm-12" >
<div class="brand" :class="g === 1 && 'selected'">
<button @click="openModal(1)">
<i class="fas fa-phone-laptop"></i>
<span>لوازم جانبی کامپیوتر ، موبایل و محصولات حافظه</span>
<span class="row">
<i class="fas fa-phone-laptop" style=" margin-right: -10px;"></i>
<i class="fas fa-gamepad" style="margin-top: 32px; position: absolute; margin-right: 25px;"></i>
</span>
<span>لوازم جانبی کامپیوتر ، موبایل ، حافظه و کنسول</span>
</button>
</div>
</div>
+18 -16
View File
@@ -4,8 +4,8 @@ const readXlsxFile = require('read-excel-file/node')
const guaranteeSerialsPath = './static/uploads/serials'
const productSerialsPath = './static/uploads/serials_products'
const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
return new Promise(async (reso, rej) => {
const serialChecker = (serial, type = 'guaranteeSerial', g = 1) => {
return new Promise(async (resolve, reject) => {
let exelsPath;
if (type === 'guaranteeSerial') exelsPath = guaranteeSerialsPath + `/${g}`;
if (type === 'orginality') exelsPath = productSerialsPath + `/${g}`;
@@ -14,28 +14,30 @@ const serialChecker = async (serial, type = 'guaranteeSerial', g = 1) => {
try {
const serialFiles = await fs.readdirSync(exelsPath);
if((serialFiles?.length) <= 0){
rej("این کد در سامانه موجود نیست")
}
serialFiles.forEach(async(file, i)=>{
if ((serialFiles?.length) <= 0) {
// eslint-disable-next-line prefer-promise-reject-errors
reject("این کد در سامانه موجود نیست")
}
serialFiles.forEach(async (file, i) => {
const exelFile = await readXlsxFile(`${exelsPath}/${file}`);
for (const row of exelFile) {
for (const col of row) {
if (col == lowerSerial) {
reso(row[2]);
if ((row[1].toString()).toLowerCase() == lowerSerial) {
resolve(row[2]);
return; // Serial found, exit loop
}
}
}
if((serialFiles.length - 1) <= i){
rej("این کد در سامانه موجود نیست")
if ((serialFiles.length - 1) <= i) {
// eslint-disable-next-line prefer-promise-reject-errors
reject("این کد در سامانه موجود نیست")
}
})
})
} catch (e) {
console.log(e);
rej(e);
reject(e);
}
});
};