1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770 |
- <template>
- <div>
- <el-container style="height: 100vh;">
- <!-- #333744 -->
- <el-aside width="180px" style="user-select: none; border-right: 1px solid #fafafa; background-color: #333744; overflow-x: hidden;">
- <p class="soft-name" style="-webkit-app-region: drag; color: #fff;">
- <img src="../assets/image/icon.png" class="soft-icon" />
- <span style="letter-spacing: 1px;">{{productName}}</span>
- </p>
-
- <el-menu :default-openeds="['a', 'b']" :default-active="menuIndex" @select="setMenuIndex" active-text-color="#409EFF" background-color="#333744" text-color="#fff" style="margin-top: 10px;">
- <el-submenu index="a">
- <template slot="title"><img src="../assets/image/m-download.png" class="m-image"/>图片下载</template>
- <el-menu-item index="3">
- <img src="../assets/image/m-tmall.png" class="m-image"/><span slot="title">天猫</span>
- </el-menu-item>
- <el-menu-item index="2">
- <img src="../assets/image/m-jd.png" class="m-image"/><span slot="title">京东</span>
- </el-menu-item>
- <el-menu-item index="4">
- <img src="../assets/image/m-taobao.png" class="m-image"/><span slot="title">淘宝</span>
- </el-menu-item>
- <el-menu-item index="1">
- <img src="../assets/image/m-alibaba.png" class="m-image"/><span slot="title">阿里巴巴</span>
- </el-menu-item>
- <el-menu-item index="5">
- <img src="../assets/image/m-hong.png" class="m-image"/><span slot="title">小红书</span>
- </el-menu-item>
- <el-menu-item index="10">
- <img src="../assets/image/m-chrome.png" class="m-image"/><span slot="title">其他网址(Beta)</span>
- </el-menu-item>
- </el-submenu>
-
- <el-submenu index="b">
- <template slot="title"><img src="../assets/image/m-edit.png" class="m-image"/>图片处理</template>
- <el-menu-item index="2-1">
- <img src="../assets/image/m-geshi.png" class="m-image"/><span slot="title">格式转换</span>
- </el-menu-item>
- <el-menu-item index="2-2">
- <img src="../assets/image/m-yasuo.png" class="m-image"/><span slot="title">图片压缩</span>
- </el-menu-item>
- <el-menu-item index="2-3">
- <img src="../assets/image/m-chicun.png" class="m-image"/><span slot="title">修改尺寸</span>
- </el-menu-item>
- <el-menu-item index="2-5">
- <img src="../assets/image/m-shuiyin.png" class="m-image"/><span slot="title">添加水印</span>
- </el-menu-item>
- </el-submenu>
- </el-menu>
- </el-aside>
-
- <el-container>
- <el-header height="45px" style="background-color: #fafafa; padding: 0 10px;">
- <soft-header ref="headerRef" @update-soft="updateSoft()" @export-file="exportFile" @login-url="loginUrl" @clear-cache="clearCache"></soft-header>
- </el-header>
-
- <soft-img ref="imgRef" v-show="['2-1', '2-2', '2-3', '2-5'].indexOf(menuIndex) > -1" @open-vip="openVip" @check-authority="checkAuthority"></soft-img>
-
- <el-main v-show="['1', '2', '3', '4', '5', '10'].indexOf(menuIndex) > -1" ref="el-main" style="background-color: #fafafa;">
- <template>
- <div class="content-top">
- <div>
- <el-button-group>
- <el-button type="primary" size="mini" icon="el-icon-circle-plus-outline"
- @click="addVisible = true;">添加链接</el-button>
- <el-button type="primary" size="mini" icon="el-icon-upload"
- @click="pickLink()">导入链接</el-button>
- <el-button type="primary" size="mini" icon="el-icon-delete"
- @click="clearList()">清空链接</el-button>
- </el-button-group>
-
- <el-link type="info" style="margin-left: 20px; vertical-align:baseline;" @click="downloadExample()">模板下载<i class="el-icon-download"></i></el-link>
- </div>
-
- <el-row type="flex" style="align-items: center;">
- <div class="set-item">
- <span class="set-title">保存目录:</span>
- <el-input :title="downloadDir" ref="upload-input" size="mini" @focus="pickPath" placeholder="请选择输出目录" v-model="downloadDir" readonly style="width:200px;" prefix-icon="el-icon-folder"></el-input>
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="打开保存目录">
- <i class="el-icon-folder-opened" slot="reference" style="padding-left: 5px; cursor: pointer; font-size: 22px; vertical-align: middle;" @click="openFolder()"></i>
- </el-popover>
- </div>
-
- <el-button type="danger" @click="exportFile()" :loading="loading">开始下载</el-button>
- </el-row>
- </div>
-
- <div style="padding: 20px 20px 0 20px; height: calc(100% - 62px);">
- <el-row type="flex" justify="space-between">
- <div>
- <h3 style="display: inline-block;">
- <span v-if="menuIndex == '1'">阿里巴巴 - </span>
- <span v-if="menuIndex == '2'">京东 - </span>
- <span v-if="menuIndex == '3'">天猫 - </span>
- <span v-if="menuIndex == '4'">淘宝 - </span>
- <span v-if="menuIndex == '5'">小红书 - </span>
- <span v-if="menuIndex == '10'">网页 - </span>
- 图片下载
- </h3>
- <el-link v-if="menuIndex == '5'" :underline="false" type="danger" style="text-align: center; font-size: 12px;">
- 仅支持win10及以上系统,浏览器请选择最新版本
- </el-link>
-
- <!-- <el-link v-if="menuIndex == '3' || menuIndex == '4'" :underline="false" type="danger" style="text-align: center; font-size: 12px;">
- (需登录{{menuIndex == '3' ? '天猫' : '淘宝'}}账号后才能下载)
- </el-link>
- <el-link v-if="menuIndex == '2'" :underline="false" type="danger" style="text-align: center; font-size: 12px;">
- (需登录京东账号后才能下载)
- </el-link>
- <el-link v-if="menuIndex == '10'" :underline="false" type="info" style="text-align: center; font-size: 12px;">
- (非会员功能,仅提供试用)
- </el-link> -->
- </div>
- </el-row>
-
- <div style="padding: 15px 0 20px;">
- <el-row type="flex" justify="space-between">
- <div v-if="menuIndex == '5'" style="padding-top: 10px;">
- <label>下载类型:</label>
- <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">文章图/视频</el-checkbox>
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="实况(Live)图下载的格式是mp4,且同时下载任务量必须为1个">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </div>
-
- <div v-if="menuIndex == '10'" style="padding-top: 10px;">
- <label>下载类型:</label>
- <el-checkbox :value="true" style="opacity: 0.6; cursor: not-allowed;">图片</el-checkbox>
- </div>
-
- <div v-if="['1', '2', '3', '4'].indexOf(menuIndex) > -1" style="padding-top: 10px;">
- <label>下载类型:</label>
- <el-checkbox-group :min="1" v-model="settingArr" style="display: inline-block;" @input="settingGroup">
- <el-checkbox label="mainImg">主图</el-checkbox>
- <el-checkbox label="detailImg">详情图</el-checkbox>
- <el-checkbox label="skuImg">SKU图</el-checkbox>
- <el-checkbox label="commentImg" v-if="menuIndex == '3' || menuIndex == '4'">评论图</el-checkbox>
- <el-checkbox label="video">视频</el-checkbox>
- </el-checkbox-group>
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="下载类型至少选一个,评论图默认只下载商品首页展示的评论内容">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </div>
-
- <!-- 阿里巴巴账号 -->
- <template v-if="menuIndex == '1'">
- <div>
- <el-tag type="info" size="mini" v-if="alibabaStatus == 1">未检测</el-tag>
- <el-tag type="success" size="mini" v-if="alibabaStatus == 2">阿里巴巴账号已登录</el-tag>
- <el-link type="danger" style="text-decoration: underline;" v-if="alibabaStatus == 3" :underline="false" @click="loginUrl('https://www.1688.com')">未登录,点击登录阿里巴巴账号</el-link>
- <el-button size="mini" type="warning" :loading="checkLoading" style="margin-left: 10px;" :disabled='alibabaStatus == 2' @click="checkAlibabaLogin">检测登录状态</el-button>
- </div>
- </template>
-
- <!-- 天猫/淘宝 -->
- <template v-if="menuIndex == '3' || menuIndex == '4'">
- <div>
- <el-tag type="info" size="mini" v-if="tbStatus == 1">未检测</el-tag>
- <el-tag type="success" size="mini" v-if="tbStatus == 2">{{menuIndex == '3' ? '天猫' : '淘宝'}}账号已登录</el-tag>
- <el-link type="danger" style="text-decoration: underline;" v-if="tbStatus == 3" :underline="false" @click="loginUrl('https://login.taobao.com')">未登录,点击登录<span>{{menuIndex == '3' ? '天猫' : '淘宝'}}</span>账号</el-link>
- <el-button size="mini" type="warning" :loading="checkLoading" style="margin-left: 10px;" :disabled='tbStatus == 2' @click="checkLogin">检测登录状态</el-button>
- </div>
- </template>
-
- <!-- 京东账号 -->
- <template v-if="menuIndex == '2'">
- <div>
- <el-tag type="info" size="mini" v-if="jdStatus == 1">未检测</el-tag>
- <el-tag type="success" size="mini" v-if="jdStatus == 2">京东账号已登录</el-tag>
- <el-link type="danger" style="text-decoration: underline;" v-if="jdStatus == 3" :underline="false" @click="loginUrl('https://passport.jd.com/new/login.aspx')">未登录,点击登录京东账号</el-link>
- <el-button size="mini" type="warning" :loading="checkLoading" style="margin-left: 10px;" :disabled='jdStatus == 2' @click="checkJdLogin">检测登录状态</el-button>
- </div>
- </template>
-
- <!-- 小红书 -->
- <template v-if="menuIndex == '5'">
- <div>
- <el-tag type="info" size="mini" v-if="redStatus == 1">未检测</el-tag>
- <el-tag type="success" size="mini" v-if="redStatus == 2">小红书账号已登录</el-tag>
- <el-link type="danger" style="text-decoration: underline;" v-if="redStatus == 3" :underline="false" @click="loginUrl('https://www.xiaohongshu.com')">未登录,点击登录小红书账号</el-link>
- <el-button size="mini" type="warning" :loading="checkLoading" style="margin-left: 10px;" :disabled='redStatus == 2' @click="checkRedLogin">检测登录状态</el-button>
- </div>
- </template>
- </el-row>
- </div>
-
- <div class="table-scroll">
- <!-- 1、 -->
- <vxe-table ref="xTable" show-overflow class="img-table" max-height="100%" empty-text="没有更多数据了!" :loading="tabLoading" :row-config="{isHover: true}"
- :loading-config="{icon: 'vxe-icon-indicator roll', text: '列表加载中...'}" :data="this[listStr+'List']" :scroll-y="{enabled: true}">
- <vxe-column type="seq" width="60"></vxe-column>
- <vxe-column field="title" title="目录名称" width="200">
- <template #default="{ row, rowIndex }">
- <span v-if="row.title">{{row.title}}</span>
- <el-tag size="mini" v-else>默认使用网页标题</el-tag>
- </template>
- </vxe-column>
- <vxe-column field="url" title="网页链接"></vxe-column>
- <vxe-column field="status" title="下载状态" width="200">
- <template #default="{ row }">
- <template v-if="row.status == '1'">
- <i class="el-icon-info" style="font-size: 16px; color: #999;"></i>
- <span>待操作</span>
- </template>
- <template v-if="row.status == '2'">
- <i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
- <span>任务处理中...</span>
- </template>
- <template v-if="row.status == '3'">
- <i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
- <span>图片下载中..<span v-if="row.num > 0">第{{row.num}}张</span></span>
- </template>
- <template v-if="row.status == '4'">
- <i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
- <span>下载完成</span>
- </template>
- <template v-if="row.status == '5'">
- <i class="el-icon-error" style="font-size: 16px; color: #ed4014;"></i>
- <span>网络异常,请重试!</span>
- </template>
- <template v-if="row.status == '6'">
- <i class="el-icon-error" style="font-size: 16px; color: #ed4014;"></i>
- <span>验证码拦截,请手动验证!</span>
- </template>
- </template>
- </vxe-column>
- <vxe-column title="操作" width="80">
- <template #default="{ row, rowIndex }">
- <i class="el-icon-delete cur-pointer" style="font-size: 20px;" @click="delFile(rowIndex)"></i>
- </template>
- </vxe-column>
- </vxe-table>
- </div>
- </div>
-
- </template>
-
-
- <el-dialog title="添加链接" :visible.sync="addVisible" width="500px" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
- <div>
- <el-form label-position="right" label-width="80px" :rules="rules" :model="formData" ref="formData">
- <el-form-item label="目录名称" prop="title">
- <el-input v-model="formData.title" placeholder="为空则默认使用网页标题前50个字符"></el-input>
- </el-form-item>
- <el-form-item label="网页链接" prop="url">
- <el-input type="textarea" :rows="10" v-if="menuIndex < 10" :placeholder="'请输入网址链接(例:' + exampleUrl[menuIndex-1] + ')'" v-model="formData.url"></el-input>
- <el-input type="textarea" :rows="10" v-else :placeholder="'请输入网址链接'" v-model="formData.url"></el-input>
- </el-form-item>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="addVisible = false; $refs['formData'].resetFields();">取 消</el-button>
- <el-button type="primary" @click="onSubmit">确 定</el-button>
- </span>
- </el-dialog>
-
- <el-dialog title="提示" :visible.sync="loginVisible" width="400px" :close-on-click-modal="false" :close-on-press-escape="false">
- <div style="text-align: center; color: #999; font-size: 14px;">
- <template v-if="menuIndex == '2'">
- <p>京东渠道需要登录后才能下载</p>
- <p class="visible-tips-style">目前检测还未登录京东账号,需立即登录</p>
- </template>
- <template v-else-if="menuIndex == '5'">
- <p>小红书渠道需要登录后才能下载</p>
- <p class="visible-tips-style">目前检测还未登录小红书账号,需立即登录</p>
- </template>
- <template v-else>
- <p>天猫/淘宝渠道需要登录后才能下载</p>
- <p class="visible-tips-style">目前检测还未登录天猫/淘宝账号,需立即登录</p>
- </template>
-
- </div>
- <div slot="footer" class="dialog-footer-center">
- <el-button v-if="menuIndex == '2'" @click="loginVisible = false; loginUrl('https://passport.jd.com/new/login.aspx')">点击登录京东账号</el-button>
- <el-button v-else-if="menuIndex == '5'" @click="loginVisible = false; loginUrl('https://www.xiaohongshu.com')">点击登录小红书账号</el-button>
- <el-button v-else @click="loginVisible = false; loginUrl('https://login.taobao.com')">点击登录天猫/淘宝账号</el-button>
- </div>
- </el-dialog>
-
- <!-- 非会员转换提示框 -->
- <el-dialog title="非会员提示" :visible.sync="tipsModal" width="400px">
- <div class="member-model">
- <div class="tips-flex">
- <i class="el-icon-s-opportunity"></i>
- <p class="m-title">{{tipsDesc}}</p>
- </div>
- <div class="member-btn">
- <el-button size="small" round type="primary" @click="openVip()">开通会员</el-button>
- </div>
- </div>
- </el-dialog>
-
- </el-main>
-
- <el-footer height="48px">
- <!-- 更新 -->
- <soft-update ref="updateRef" :showDowload="dowloadModel" :dowloadFinish="finishModel"></soft-update>
- </el-footer>
- </el-container>
- </el-container>
- </div>
- </template>
- <script>
- import os from 'os'
- import fs from 'fs'
- import request from 'request'
- import path from 'path';
- import xlsx from 'node-xlsx';
- import softUpdate from './update.vue';
- import softHeader from './header.vue';
- import softImg from './img.vue';
- import electronApi from '@/utils/electronApi';
- import pjson from '/package.json'
- // import puppeteer from 'puppeteer'
- import puppeteer from 'puppeteer-extra'
- const StealthPlugin = require('puppeteer-extra-plugin-stealth');
- let separator = '';
- if (os.platform == 'linux') {
- separator = '/'
- } else {
- separator = '\\'
- }
-
- // let chromePath = process.cwd() + '\\resources\\app\\node_modules\\puppeteer\\.local-chromium\\win64-1045629\\chrome-win\\chrome.exe';
- // if (process.env.NODE_ENV == 'development') {
- // chromePath = process.cwd() + '\\node_modules\\puppeteer\\.local-chromium\\win64-1045629\\chrome-win\\chrome.exe';
- // }
- export default {
- name: 'landing-page',
- components: {
- softUpdate,
- softHeader,
- softImg
- },
- data() {
- return {
- tipsModal: false,
- tipsDesc: "非VIP用户不能下载视频,如需完整功能请开通VIP会员。",
- settingArr: ['mainImg'],
- loginVisible: false,
- addVisible: false,
- formData: {
- title: '',
- url: ''
- },
- rules:{ //
- title: [
- { min: 0, max: 50, message: '不能超过 50 个字符', trigger: 'blur' },
- { pattern: /^[^\\/:*?"<>|]*$/, message: '标题中不能包含 \\ / : * ? " < > |', trigger: 'blur' }
- ],
- url: [
- { required: true, message: '请输入网页链接', trigger: 'blur' },
- { pattern: /^(http|https):\/\/.+$/, message: '请输入正确的网址链接(http://或https://开头)', trigger: 'blur' }
- ],
- },
- tabLoading: false,
- alibabaList: [],
- jdList: [],
- tbList: [],
- tmallList: [],
- redList: [],
- commonList: [],
- productName: pjson.softInfo.softName,
- imgUrl: this.$api.imgUrl,
- imgSrc: '',
- menuIndex: '3',
- settingData: {
- detailImg: true,
- skuImg: true,
- commentImg: false,
- video: false,
- },
- exampleUrl: ['https://www.1688.com', 'https://www.jd.com', 'https://www.tmall.com', 'https://www.taobao.com', 'https://www.xiaohongshu.com'],
- fileList: [],
-
- downloadDir: os.userInfo().homedir + separator + "Downloads",
- dowloadModel: false,
- finishModel: false,
- loading: false,
- checkLoading: false, //点击检测登录状态
- tbStatus: 1, // 1、未检测 2、已经登录 3、未登录
- jdStatus: 1, // 1、未检测 2、已经登录 3、未登录
- redStatus: 1, //同上
- alibabaStatus: 1, //同上上
- execLimit: 2,
- execNum: 3, // 限制5张
-
- /** 浏览器名称 **/
- alibabaBrowser: null,
- tbBrowser: null,
- jdBrowser: null,
- otherBrowser: null,
- redBrowser: null,
- loginBrowser: null, // 登录用的浏览器实例
- };
- },
- computed: {
- listStr: function(){
- let str = 'alibaba';
- switch(this.menuIndex){
- case '1':
- str = 'alibaba';
- break;
- case '2':
- str = 'jd';
- break;
- case '3':
- str = 'tmall';
- break;
- case '4':
- str = 'tb';
- break;
- case '5':
- str = 'red';
- break;
- case '10':
- str = 'common';
- break;
- }
- return str;
- }
- },
- async mounted() {
- this.$refs.updateRef.updateSoft(true);
- let homedir = os.userInfo().homedir;
- if (fs.existsSync(homedir + separator + "Desktop")) {
- this.downloadDir = homedir + separator + "Desktop"
- } else {
- this.downloadDir = homedir + separator + "Downloads"
- }
-
- if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture')) {
- fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture');
- }
-
- if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture-jd')) {
- fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture-jd');
- }
-
- let path = os.tmpdir() + separator + 'chrome-data-capture';
- let path2 = os.tmpdir() + separator + 'chrome-data-capture-jd';
- //this.deleteAll(path, false);
- //this.deleteAll(path2, false);
- // 打开浏览器
- const {
- shell
- } = require('electron');
- const links = document.querySelectorAll('a[href]');
- links.forEach(link => {
- link.addEventListener('click', e => {
- const url = link.getAttribute('href');
- e.preventDefault();
- shell.openExternal(url);
- });
- });
-
- // 判断系统版本 低于10使用兼容模式
- if(os.release() && os.release().indexOf('.') > -1){
- let systemVersion = Number(os.release().split('.')[0]);
- if(systemVersion < 10){ // 低于win10,软件打开时候浏览器设置为兼容版
- this.$utils.setStorage('versionType', 1);
- }else{
- this.$utils.setStorage('versionType', 2);
- }
- }
- },
- methods: {
- // 实时获取浏览器路径
- initPath(){
- let chromePath = puppeteer.executablePath().replace('win32-1', 'win64-1');
- let versionType = this.$utils.getStorage('versionType');
- if(versionType && versionType == 1){
- chromePath = chromePath.replace('chrome-win', 'chrome7');
- }
- return chromePath;
- },
- // 删除文件夹内容
- deleteAll(folderPath, flag) {
- if (fs.existsSync(folderPath)) {
- fs.readdirSync(folderPath).forEach((file, index) => {
- var curPath = path.join(folderPath, file);
- if (fs.lstatSync(curPath).isDirectory()) {
- this.deleteAll(curPath, true);
- } else {
- fs.unlinkSync(curPath);
- }
- });
- if(flag){
- fs.rmdirSync(folderPath);
- }
- }
- },
- checkAuthority(){
- let authority = this.$refs.headerRef.authority;
- this.$refs.imgRef.authority = authority;
- },
- setMenuIndex(index){
- this.menuIndex = index;
- if(index.indexOf('2-') > -1){
- let num = Number(index.split('-')[1]);
- this.$refs.imgRef.setMenuIndex(num);
- }
- },
- // 选择目录
- pickPath() {
- this.$refs['upload-input'].blur();
- electronApi.call('pickDir', []).then((path) => {
- if (path) {
- this.downloadDir = path;
- }
- });
- },
- // 打开自定义下载目录
- openFolder() {
- let path = this.downloadDir;
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName)) {
- path = this.downloadDir + separator + pjson.softInfo.softName;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName);
- path = this.downloadDir + separator + pjson.softInfo.softName;
- }
- electronApi.call('showItemInfolder', [path + '\\tty.tty'])
- },
- openVip() {
- this.$refs.headerRef.openVip();
- },
- updateSoft() {
- this.$refs.updateRef.updateSoft();
- },
- // 删除文件
- delFile(rowIndex){
- let type = 'alibaba';
- switch(this.menuIndex){
- case '1':
- type = 'alibaba';
- break;
- case '2':
- type = 'jd';
- break;
- case '3':
- type = 'tmall';
- break;
- case '4':
- type = 'tb';
- break;
- case '5':
- type = 'red';
- break;
- case '10':
- type = 'common';
- break;
- }
- this.$confirm('确认删除此行数据吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this[type+'List'].splice(rowIndex, 1);
- if(this[type+'List'].length == 0) {
- this.clearList();
- }
- }).catch(() => {
-
- });
- },
- // 清除列表
- clearList() {
- switch(this.menuIndex){
- case '1':
- this.alibabaList = [];
- break;
- case '2':
- this.jdList = [];
- break;
- case '3':
- this.tmallList = [];
- break;
- case '4':
- this.tbList = [];
- break;
- case '5':
- this.redList = [];
- break;
- case '10':
- this.commonList = [];
- break;
- }
- },
- // 提交表单
- onSubmit(){
- this.$refs['formData'].validate((valid) => {
- if (valid) {
- let info = {
- url: this.formData.url,
- title: this.formData.title,
- status: '1',
- num: 0,
- newPath: ''
- }
- switch(this.menuIndex){
- case '1':
- this.alibabaList.push(info);
- break;
- case '2':
- this.jdList.push(info);
- break;
- case '3':
- this.tmallList.push(info);
- break;
- case '4':
- this.tbList.push(info);
- break;
- case '5':
- this.redList.push(info);
- break;
- case '10':
- this.commonList.push(info);
- break;
- }
- this.$refs['formData'].resetFields();
- this.addVisible = false;
- } else {
- return false;
- }
- });
- },
- async pickLink() { // 导入链接
- const spinLoad = this.$loading();
- await electronApi.call('pickFile', ['xlsx,xls', true]).then(async (path) => {
- spinLoad.close();
- if(path.length > 0){
- this.$notify({
- title: '提示',
- message: '导入成功',
- type: 'success'
- });
- let workSheetsFromBuffer = xlsx.parse(fs.readFileSync(path[0]));
- if(workSheetsFromBuffer && workSheetsFromBuffer.length > 0){
- let errMsg = "";
- workSheetsFromBuffer[0].data.map((item, index) => {
- if(item.length > 0){
- let ititle = '';
- if(item[0]){
- ititle = item[0].toString().trim();
- }
-
- if(item[0] == '目录名称' && item[1] == '网页链接'){
- return false;
- }
- if(this.containsAnyChar(ititle.toString(), ['\\', '/', ':', '*', '?', '"', '<', '>', '|'])){ //判断是否含有特殊字符
- errMsg += "第" + (index+1) + '行-名称不能包以下字符 \\ / : * ? " < > |';
- ititle = ititle.replace(/[\\|/|:|*|?|"|<|>||]/g, "");
- }
- if(item[1] == undefined){
- errMsg += "第" + (index+1) + "行格式有误</br>";
- item[1] = '';
- }else if(!/^(http|https):\/\/.+$/.exec(item[1])){
- errMsg += "第" + (index+1) + "行网址格式有误</br>";
- }else{
- let info = {
- url: item[1],
- title: ititle,
- status: '1',
- num: 0,
- newPath: ''
- }
- switch(this.menuIndex){
- case '1':
- this.alibabaList.push(info);
- break;
- case '2':
- this.jdList.push(info);
- break;
- case '3':
- this.tmallList.push(info);
- break;
- case '4':
- this.tbList.push(info);
- break;
- case '5':
- this.redList.push(info);
- break;
- case '10':
- this.commonList.push(info);
- break;
- }
- }
- }
- });
- if(errMsg){
- this.$notify({
- title: '请检查文件以下问题',
- dangerouslyUseHTMLString: true,
- message: errMsg,
- type: 'warning'
- });
- }
- }else{
- this.$notify({
- title: '提示',
- message: '格式有误,请重新导入',
- type: 'warning'
- });
- }
- }
- });
- },
- settingGroup(name){
- let authority = this.$refs.headerRef.authority.isAuthority;
- let index = name.indexOf('video');
- if(index > -1 && !authority){ // 非会员选中下载视频选项-提示
- this.tipsModal = true;
- name.splice(index, 1);
- }
- },
- // 清除缓存
- async clearCache(){
- this.jdStatus = 3;
- this.tbStatus = 3;
- this.redStatus = 3;
-
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- if(this.alibabaBrowser){
- await this.alibabaBrowser.close();
- this.alibabaBrowser = null;
- }
- if(this.tbBrowser){
- await this.tbBrowser.close();
- this.tbBrowser = null;
- }
- if(this.jdBrowser){
- await this.jdBrowser.close();
- this.jdBrowser = null;
- }
- if(this.redBrowser){
- await this.redBrowser.close();
- this.redBrowser = null;
- }
- if(this.otherBrowser){
- await this.otherBrowser.close();
- this.otherBrowser = null;
- }
- },
-
- // 去登录
- loginUrl(url){
- (async () => {
- try{
- if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture')) {
- fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture');
- }
- if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture-jd')) {
- fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture-jd');
- }
-
- let userDataDir = os.tmpdir() + separator + 'chrome-data-capture';
- if(url.indexOf('.jd.com/') > -1){
- userDataDir = os.tmpdir() + separator + 'chrome-data-capture-jd';
- }
-
- this.loginBrowser = await puppeteer.launch({
- headless: false,
- executablePath: this.initPath(),
- args: ['--window-size=1280,800'],
- userDataDir: userDataDir,
- });
- const page = await this.loginBrowser.newPage();
- await page.setViewport({ width: 1280, height: 800 });
-
- await page.evaluateOnNewDocument(() => {
- const newProto = navigator.__proto__;
- delete newProto.webdriver;
- navigator.__proto__ = newProto;
- });
- await page.goto(url, {waitUntil : 'networkidle2'});
- }catch(e){
- this.showError(e);
- }
- })();
- },
-
- // 开始下载
- async exportFile(flag) {
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- let authority = this.$refs.headerRef.authority.isAuthority;
- if (!fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName)) {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName);
- }
-
- let fileList = [];
- switch(this.menuIndex){
- case '1': // 阿里巴巴
- fileList = this.alibabaList;
- break;
- case '2': // 京东
- fileList = this.jdList;
- break;
- case '3': // 天猫
- fileList = this.tmallList;
- break;
- case '4': // 淘宝
- fileList = this.tbList;
- break;
- case '5': // 小红书
- fileList = this.redList;
- break;
- case '10': // 普通网址
- fileList = this.commonList;
- break;
- }
-
- if(fileList.length > 0){
- if (!authority && !flag) { // 非会员点击转换弹出提示框
- this.$refs.headerRef.memberModel = true;
- this.$refs.headerRef.isClick = true;
- return false;
- } else {
- this.$refs.headerRef.memberModel = false;
- this.loading = true;
- setTimeout(() => {
- this.loading = false;
- }, 60000);
- }
-
- if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture')) {
- fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture');
- }
-
- if(this.menuIndex == '2'){ // 京东
- if(this.jdStatus == 1 || this.jdStatus == 3){ // 未检测登录状态/或提示未登录状态,开始检测
- await this.checkJdLogin().then((data) => {
- if(data != 2){ // 未登录
- this.jdStatus = 3;
- this.loginVisible = true;
- }
- }).catch(err => {
- this.jdStatus = 3;
- });
- if(this.jdStatus == 3){
- this.loading = false;
- return false;
- }
- }
- }
-
- if(this.menuIndex == '3' || this.menuIndex == '4'){ // 天猫/淘宝
- if(this.tbStatus == 1 || this.tbStatus == 3){ // 未检测登录状态/或提示未登录状态,开始检测
- await this.checkLogin().then((data) => {
- if(data != 2){ // 未登录
- this.tbStatus = 3;
- this.loginVisible = true;
- }
- }).catch(err => {
- this.tbStatus = 3;
- });
- }
- if(this.tbStatus == 3){
- this.loading = false;
- return false;
- }
- }
-
- if(this.menuIndex == '5'){ // 小红书
- if(this.redStatus == 1 || this.redStatus == 3){ // 未检测登录状态/或提示未登录状态,开始检测
- await this.checkRedLogin().then((data) => {
- if(data != 2){ // 未登录
- this.redStatus = 3;
- this.loginVisible = true;
- }
- }).catch(err => {
- this.redStatus = 3;
- });
- if(this.redStatus == 3){
- this.loading = false;
- return false;
- }
- }
- }
-
- let taskArr = [];
- let task = "";
- let browserName = '';
- let userDataDir = os.tmpdir() + separator + 'chrome-data-capture';
- switch(this.menuIndex){
- case '1': // 阿里巴巴
- browserName = 'alibaba';
- break;
- case '2': // 京东
- browserName = 'jd';
- userDataDir = os.tmpdir() + separator + 'chrome-data-capture-jd';
- break;
- case '3': // 天猫
- case '4': // 淘宝
- browserName = 'tb';
- break;
- case '5': // 小红书
- browserName = 'red';
- break;
- case '10': // 普通网址
- browserName = 'other';
- break;
- }
- // 运行不同平台的浏览器
- puppeteer.use(StealthPlugin());
- this[browserName + 'Browser'] = await puppeteer.launch({
- executablePath: this.initPath(),
- userDataDir: userDataDir,
- args: [
- '--start-maximized',
- '--no-sandbox',
- '--disable-setuid-sandbox',
- '--disable-blink-features=AutomationControlled',
- ]
- });
-
- for(let i = 0; i < fileList.length; i++){
- let item = fileList[i];
-
- switch(this.menuIndex){
- case '1': // 阿里巴巴
- task = this.alibabaDownload(item, this.alibabaBrowser);
- break;
- case '2': // 京东
- task = this.jdScanImg(item, this.jdBrowser);
- break;
- case '3': // 天猫
- case '4': // 淘宝
- task = this.tbScanImg(item, this.tbBrowser);
- break;
- case '5': // 小红书
- task = this.redDownload(item, this.redBrowser);
- break;
- case '10': // 普通网址
- task = this.normalDownload(item, this.otherBrowser);
- break;
- }
-
- if(task){
- taskArr.push(task);
- }
-
- let numType = this.$utils.getStorage('numType');
- if(numType){
- this.execLimit = numType;
- }
-
- if((i+1) % this.execLimit == 0){
- await Promise.all(taskArr).then(result => {
- taskArr = [];
- }).catch(err => {
- console.log('err'+i, err)
- })
- }
- }
-
- if(taskArr.length > 0){
- await Promise.all(taskArr).then(result => {
- taskArr = [];
- }).catch(err => {
- // 错误文件添加到服务中
- console.log('err',err)
- })
- }
-
- if(this[browserName + 'Browser']){
- this[browserName + 'Browser'].close();
- this[browserName + 'Browser'] = null;
- }
-
- this.loading = false;
- // 打开文件夹
- if(fileList.length > 0){
- this.$message({message: '恭喜你,任务已完成!', type: 'success'});
- electronApi.call('showItemInfolder',[this.downloadDir + separator + pjson.softInfo.softName +'\\tty.tty'])
- }
- }
- },
-
- // 10-普通网址下载
- async normalDownload(urlInfo, otherBrowser){
- let task = await new Promise((resolve,reject) =>{
- (async () => {
- try{
- let authority = this.$refs.headerRef.authority.isAuthority;
- let number = 0;
- urlInfo.status = '2';
- urlInfo.num = 0;
- // puppeteer.use(StealthPlugin());
- // const otherBrowser = await puppeteer.launch({
- // executablePath: this.initPath(),
- // userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- // args: [
- // '--start-maximized',
- // '--no-sandbox',
- // '--disable-setuid-sandbox',
- // '--disable-blink-features=AutomationControlled',
- // ]
- // });
- const page = await otherBrowser.newPage();
-
- page.on('response', async(response) => {
- // 检查响应的 MIME 类型是否以 'image/' 开头
- if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('image/') && response.headers()['content-length']) {
- let imgArr = ['gif', 'jpeg', 'png', 'webp', 'svg', 'tiff', 'bmp', 'ico', 'avif'];
- let imgType = 'jpg';
- let isBase = false;
- imgArr.map((item, index) => {
- if(response.headers()['content-type'].indexOf(item) > -1){
- imgType = item;
- if(item == 'jpeg'){
- imgType = 'jpg';
- }else if(item == 'avif'){
- imgType = 'png';
- }
- }
- });
-
- let url = response.url();
- let regex = /^data:image\/[\w|+|-]+;base64,/;
- if(regex.exec(url)){
- url = response.url().replace(/^data:image\/[\w|+|-]+;base64,/, '');
- isBase = true;
- }
-
- let imgInfo = {
- url: url,
- contentType: response.headers()['content-type'],
- status: response.status(),
- imgType: imgType,
- isBase: isBase
- }
-
- if(urlInfo.title){
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- }
- }else{
- await this.getTitle(page, urlInfo); // 生成页面标题对应的文件夹
- }
-
- let outputPath = urlInfo.newPath + '\\' + this.randomString(35) + '.' + imgInfo.imgType;
-
- urlInfo.status = '3';
- number++;
- if(!authority && number <= this.execNum){
- if(imgInfo.isBase){ //base64位图片下载
- this.downloadBaseImage(imgInfo.url, outputPath, urlInfo)
- }else{
- this.downloadImage(imgInfo.url, outputPath, urlInfo);
- }
- }
-
- if(authority){
- if(imgInfo.isBase){ //base64位图片下载
- this.downloadBaseImage(imgInfo.url, outputPath, urlInfo)
- }else{
- this.downloadImage(imgInfo.url, outputPath, urlInfo);
- }
- }
-
- }
- });
- await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
-
- let pageInfo = await page.evaluate(() => {
- let cHeight = document.documentElement.clientHeight;
- let scrollHeight = document.body.scrollHeight;
- return {'scrollHeight': scrollHeight, 'cHeight': cHeight}
- });
-
- let scrollHeight = pageInfo.scrollHeight;
- let cHeight = pageInfo.cHeight;
-
- let num = Math.ceil(scrollHeight / cHeight);
- let start = -1;
- let scrollInt = setInterval(async() => {
- start ++;
- await page.evaluate((start) => {
- let cHeight = document.documentElement.clientHeight;
- window.scrollTo({
- top: cHeight * start,
- behavior: "smooth"
- });
- }, start);
- if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
- clearInterval(scrollInt);
- await page.close();
- urlInfo.status = '4';
- resolve(true);
- this.loading = false;
- }
- }, 300);
-
- }catch(e){
- urlInfo.status = '5';
- reject(e);
- this.showError(e);
- }
- })();
- });
-
- },
-
- // 检查天猫淘宝登录状态
- checkAlibabaLogin(){
- this.checkLoading = true;
- this.alibabaStatus = 1;
- return new Promise((resolve, reject) => {
- (async () => {
- try{
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- this.loginBrowser = await puppeteer.launch({
- executablePath: this.initPath(),
- args: ['--window-size=1280,800'],
- userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- });
- const page = await this.loginBrowser.newPage();
- await page.setViewport({ width: 1280, height: 800 });
- let testUrl = 'https://www.1688.com';
- await page.goto(testUrl, {waitUntil : 'networkidle2'});
-
- let loginInfo = await page.evaluate(() => {
- let navTags = document.querySelector('.site-nav-sign a');
- let userTags = document.querySelector('.site-nav-user a');
-
- if(navTags && navTags.innerHTML.indexOf('登录') > -1){
- return false;
- }else if(userTags){
- return true;
- }else{
- return false;
- }
- });
-
- if(loginInfo){
- this.tbStatus = 2;
- }else{
- this.tbStatus = 3;
- }
-
- resolve(this.tbStatus);
- this.checkLoading = false;
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }catch(e){
- this.checkLoading = false;
- reject(3);
- this.showError(e);
- }
- })();
- });
-
- },
-
- // 1 - 阿里巴巴下载
- async alibabaDownload(urlInfo, browser){
- let task = await new Promise((resolve,reject) =>{
- (async () => {
- try{
- let authority = this.$refs.headerRef.authority.isAuthority;
- urlInfo.status = '2';
- urlInfo.num = 0;
- // puppeteer.use(StealthPlugin());
- // const browser = await puppeteer.launch({
- // executablePath: this.initPath(),
- // userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- // });
- const page = await browser.newPage();
- await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
-
- if(urlInfo.title){
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- }
- }else{
- await this.getTitle(page, urlInfo); // 生成页面标题对应的文件夹
- }
-
- let pageInfo = await page.evaluate(() => {
- let cHeight = document.documentElement.clientHeight;
- let scrollHeight = document.body.scrollHeight;
- return {'scrollHeight': scrollHeight, 'cHeight': cHeight}
- });
-
- let scrollHeight = pageInfo.scrollHeight;
- let cHeight = pageInfo.cHeight;
-
- let num = Math.ceil(scrollHeight / cHeight);
- let start = -1;
- let scrollInt = setInterval(async() => {
- start ++;
- if(this.settingArr.indexOf('detailImg') > -1){
- let scrollHeight2 = await page.evaluate((start) => {
- let scrollHeight = document.body.scrollHeight;
- let cHeight = document.documentElement.clientHeight;
- // let num = Math.ceil(scrollHeight / cHeight);
- window.scrollTo({
- top: cHeight * start,
- behavior: "smooth"
- });
- return scrollHeight;
- }, start);
- num = Math.ceil(scrollHeight2 / cHeight);
- }
-
- if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
- urlInfo.status = '3';
- clearInterval(scrollInt);
- await this.alibabaScanImg(browser, page, urlInfo, authority);
- this.loading = false;
- urlInfo.status = '4';
- resolve(true);
- }
- }, 300);
-
- }catch(e){
- urlInfo.status = '5';
- reject(e);
- this.showError(e);
- }
- })();
- });
- },
-
- // 检查京东登录状态
- checkJdLogin(){
- this.checkLoading = true;
- this.jdStatus = 1;
- return new Promise((resolve, reject) => {
- (async () => {
- try{
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- this.loginBrowser = await puppeteer.launch({
- executablePath: this.initPath(),
- args: ['--window-size=1280,800'],
- userDataDir: os.tmpdir() + separator + 'chrome-data-capture-jd',
- });
- const page = await this.loginBrowser.newPage();
- await page.setViewport({ width: 1280, height: 800 });
- let testUrl = 'https://www.jd.com';
- await page.goto(testUrl, {waitUntil : 'networkidle2'});
-
- let loginInfo = await page.evaluate(() => {
- let navTags = document.querySelector('.link-login');
- let userTags = document.querySelector('.nickname');
- let userTags2 = document.querySelector('.nick'); //企业账号
-
- if(navTags && navTags.innerHTML.indexOf('请登录') > -1){
- return false;
- }else if(userTags || userTags2){
- return true;
- }else{
- return false;
- }
- });
-
- if(loginInfo){
- this.jdStatus = 2;
- }else{
- this.jdStatus = 3;
- }
-
- resolve(this.jdStatus);
- this.checkLoading = false;
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }catch(e){
- this.checkLoading = false;
- reject(3);
- this.showError(e);
- }
- })();
- });
- },
-
- // 京东下载
- async jdScanImg(urlInfo, jdBrowser){
- let task = await new Promise((resolve,reject) =>{
- (async () => {
- try{
- let authority = this.$refs.headerRef.authority.isAuthority;
- urlInfo.status = '2';
- urlInfo.num = 0;
- // puppeteer.use(StealthPlugin());
- // const jdBrowser = await puppeteer.launch({
- // executablePath: this.initPath(),
- // userDataDir: os.tmpdir() + separator + 'chrome-data-capture-jd',
- // args: [
- // '--no-sandbox',
- // '--disable-setuid-sandbox',
- // '--disable-blink-features=AutomationControlled',
- // ]
- // });
- const page = await jdBrowser.newPage();
- await page.evaluateOnNewDocument(() => {
- const newProto = navigator.__proto__;
- delete newProto.webdriver;
- navigator.__proto__ = newProto;
- });
-
- let jdImgInfo = {
- mainImg: [],
- skuImg: [],
- commentImg: [],
- detailImg: [],
- video: []
- };
-
- let titleFlag = true;
- let skuNum = 0, mainNum = 0, videoNum = 0;
-
- page.on('response', async(response) => {
- if(titleFlag){ // 第一次生成页面标题
- if(urlInfo.title){
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- }
- }else{
- await this.getTitle(page, urlInfo); // 生成页面标题对应的文件夹
- }
- titleFlag = false;
- }
-
- // 检查响应的 MIME 类型是否以 'image/' 开头
- if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('application/json')) {
-
- let detailUrl = '';
- let videoUrl = '';
- if(response.url().indexOf('/description/') > -1){ // 商品详情接口
- detailUrl = response.url();
- }
-
- if(response.url().indexOf('/tencent/video_v3') > -1){ // 商品视频接口
- videoUrl = response.url();
- }
-
- urlInfo.status = '3';
-
- if(detailUrl && this.settingArr.indexOf('detailImg') > -1){ // jd商品详情
- try {
- let data = await response.text();
- if(data.indexOf('showdesc(') > -1){
- data = data.slice(0, -1).replace('showdesc(', '');
- }
- let detailInfo = JSON.parse(data);
- let regex = /\/\/img[0-9]+.360buyimg.com\S+.(jpg|jpeg|png|gif|avif|tif|tiff)/g;
- let detailImgArr = [];
- if(detailInfo && detailInfo.content){
- detailImgArr = detailInfo.content.match(regex);
- }
-
- jdImgInfo.detailImg = detailImgArr;
-
- for(let i = 0; i < detailImgArr.length; i++){
- let imgUrl = 'https:' + detailImgArr[i];
- imgUrl = imgUrl.replace('.avif', '');
- let fileName = imgUrl.split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(i) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
- fs.mkdirSync(urlInfo.newPath + '\\详情图');
- }
-
- let outputPath = urlInfo.newPath + '\\详情图\\详情图' + num + suffix;
- if(!authority && i < this.execNum){
- await this.downloadImage(imgUrl, outputPath, urlInfo);
- }
- if(authority){
- await this.downloadImage(imgUrl, outputPath, urlInfo);
- }
- }
- }
-
- } catch (error) {
- console.error('详情图片解析失败:', error);
- }
- }
-
- if(videoUrl && this.settingArr.indexOf('video') > -1){ // jd商品视频
- try {
- let data = await response.text();
- data = data.slice(0, -1).replace(/^jQuery[0-9]+\(/, '');
- let videoInfo = JSON.parse(data);
- let videoUrl = videoInfo.playUrl;
- jdImgInfo.video.push(videoUrl);
-
- let fileName = videoUrl.split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\视频')) {
- fs.mkdirSync(urlInfo.newPath + '\\视频');
- }
-
- let outputPath = urlInfo.newPath + '\\视频\\' + fileName;
- await this.downloadImage(videoUrl, outputPath, urlInfo);
- }
-
- } catch (error) {
- console.error('视频解析失败:', error);
- }
- }
- }
-
- });
- await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
-
- /**new**/
- //detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
- const imgInfo = await page.evaluate((authority, execNum) => {
- let outObj = {
- mainImg: [],
- skuImg: [],
- };
- //主图
- let arr1 = document.querySelectorAll('#spec-list img');
- for(let i=0; i< arr1.length; i++){
- let mainImgUrl = arr1[i].src;
- let reg = /\/n[0-9]+\/jfs\//;
- let reg2 = /\/n[0-9]+\/s(54|50)x(54|66)_jfs\//;
- let reg3 = /![a-z]+_[0-9]+x[0-9]+(.avif)?/;
- let replaceStr = '/n1/s800x800_jfs/';
- if(mainImgUrl.match(/\/n[0-9]+\/s50x66_jfs\//)){
- replaceStr = '/n1/s750x1000_jfs/';
- }
- mainImgUrl = mainImgUrl.replace(reg, replaceStr).replace(reg2, replaceStr).replace(reg3, '').replace('.avif', '');
-
- if(!authority && i < execNum){
- outObj.mainImg.push(mainImgUrl);
- }
- if(authority){
- outObj.mainImg.push(mainImgUrl);
- }
- }
- //sku图片
- let arr2 = document.querySelectorAll('#choose-attr-1 img');
- for(let i=0; i< arr2.length; i++){
- let skuImgUrl = arr2[i].src;
- let skuReg = /\/n[0-9]+\/s(60|40)x(80|40)_jfs\//;
- let replaceStr = '/n1/s800x800_jfs/';
- if(skuImgUrl.match(/\/n[0-9]+\/s60x80_jfs\//)){
- replaceStr = '/n1/s750x1000_jfs/';
- }
- skuImgUrl = skuImgUrl.replace(skuReg, replaceStr).replace('.avif', '');
- if(!authority && i < execNum){
- outObj.skuImg.push(skuImgUrl);
- }
- if(authority){
- outObj.skuImg.push(skuImgUrl);
- }
-
- }
-
- return outObj;
- }, authority, this.execNum);
-
- if(this.settingArr.indexOf('mainImg') > -1){
- // 主图下载
- for(let j = 0; j < imgInfo.mainImg.length; j++){
- let fileName = imgInfo.mainImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
- fs.mkdirSync(urlInfo.newPath + '\\主图');
- }
-
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
- }
- }
- }
-
-
- // sku图片下载
- if(this.settingArr.indexOf('skuImg') > -1){
- for(let j = 0; j < imgInfo.skuImg.length; j++){
- let fileName = imgInfo.skuImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
- fs.mkdirSync(urlInfo.newPath + '\\sku图');
- }
-
- let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
- await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
- }
- }
- }
- /**end**/
- await page.close();
- urlInfo.status = '4';
- resolve(true);
- }catch(e){
- reject(e);
- this.showError(e);
- }
- })();
- });
- },
-
- // 检查天猫淘宝登录状态
- checkLogin(){
- this.checkLoading = true;
- this.tbStatus = 1;
- return new Promise((resolve, reject) => {
- (async () => {
- try{
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- this.loginBrowser = await puppeteer.launch({
- executablePath: this.initPath(),
- args: ['--window-size=1280,800'],
- userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- });
- const page = await this.loginBrowser.newPage();
- await page.setViewport({ width: 1280, height: 800 });
- let testUrl = 'https://www.taobao.com';
- await page.goto(testUrl, {waitUntil : 'networkidle2'});
-
- let loginInfo = await page.evaluate(() => {
- let navTags = document.querySelector('.site-nav-sign a');
- let userTags = document.querySelector('.site-nav-user a');
-
- if(navTags && navTags.innerHTML.indexOf('登录') > -1){
- return false;
- }else if(userTags){
- return true;
- }else{
- return false;
- }
- });
-
- if(loginInfo){
- this.tbStatus = 2;
- }else{
- this.tbStatus = 3;
- }
-
- resolve(this.tbStatus);
- this.checkLoading = false;
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }catch(e){
- this.checkLoading = false;
- reject(3);
- this.showError(e);
- }
- })();
- });
-
- },
-
- // 淘宝天猫扫描下载图片
- async tbScanImg(urlInfo, tbBrowser){
- let task = await new Promise((resolve,reject) =>{
- (async () => {
- try{
- let authority = this.$refs.headerRef.authority.isAuthority;
- urlInfo.status = '2';
- urlInfo.num = 0;
- // puppeteer.use(StealthPlugin());
- // const tbBrowser = await puppeteer.launch({
- // executablePath: this.initPath(),
- // userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- // });
- const page = await tbBrowser.newPage();
- await page.goto(urlInfo.url, {waitUntil : 'networkidle0'});
-
- if(urlInfo.title){
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- }
- }else{
- await this.getTitle(page, urlInfo); // 生成页面标题对应的文件夹
- }
-
- let responseVideo = [];
- page.on('response', async(response) => {
- // 检查响应的 MIME 类型是否以 'video/' 开头
- if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('video/')) {
- responseVideo.push(response.url());
- }
- });
-
- if(this.settingArr.indexOf('video') > -1){ // 用户选择下载视频的时候才会触发
- //鼠标放在主图第一张,生成视频
- const elementHandle = await page.$('li[class*=thumbnail--]');
- if(elementHandle){
- const classListProperty = await elementHandle.getProperty('classList');
- const classList = await classListProperty.jsonValue();
- const classesArray = Object.values(classList);
- const allClasses = classesArray.join('.');
- if(allClasses && allClasses.indexOf('active-') < 0){
- await page.hover('li.'+allClasses);
- }
- }
- }
-
- let iframeElementHandle = await page.$('iframe');
- if(iframeElementHandle){
- let m1 = await page.$('img[class^=PicGallery--thumbnailPic--]');
- let m2 = await page.$('img[class*=thumbnailPic--]');
- if(!m1 && !m2){ // 出现弹窗而且没有主图,判断为拦截模式
- await page.close();
- urlInfo.status = '6';
- resolve(true);
- this.loading = false;
- return false;
- }
- }
-
- let pageInfo = await page.evaluate(() => {
- let cHeight = document.documentElement.clientHeight;
- let scrollHeight = document.body.scrollHeight;
- return {'scrollHeight': scrollHeight, 'cHeight': cHeight}
- });
- let scrollHeight = pageInfo.scrollHeight;
- let cHeight = pageInfo.cHeight;
- let num = Math.ceil(scrollHeight / cHeight);
- let start = -1;
- let scrollInt = setInterval(async() => {
- start ++;
- if(this.settingArr.indexOf('commentImg') > -1 && this.settingArr.indexOf('detailImg') < 0){ // 选择了评论图没选择详情图
- let scrollHeight2 = await page.evaluate((start) => {
- let scrollHeight = document.body.scrollHeight;
- let cHeight = document.documentElement.clientHeight;
- let obj = document.getElementById('container') || document.getElementById('content');
- if(obj && obj.getBoundingClientRect().top < -500){
- return -1;
- }
- window.scrollTo({
- top: cHeight * start,
- behavior: "smooth"
- });
- return scrollHeight;
- }, start);
-
- if(scrollHeight2 > 0){
- num = Math.ceil(scrollHeight2 / cHeight);
- }else{
- num = 0;
- }
- }
- if(this.settingArr.indexOf('detailImg') > -1){ // 选择详情图
- let scrollHeight2 = await page.evaluate((start) => {
- let scrollHeight = document.body.scrollHeight;
- let cHeight = document.documentElement.clientHeight;
- let obj = document.getElementById('container') || document.getElementById('content');
- if(obj && obj.getBoundingClientRect().bottom < 100){
- return -1;
- }
- window.scrollTo({
- top: cHeight * start,
- behavior: "smooth"
- });
- return scrollHeight;
- }, start);
-
- if(scrollHeight2 > 0){
- num = Math.ceil(scrollHeight2 / cHeight);
- }else{
- num = 0;
- }
- }
- if(this.settingArr.indexOf('skuImg') > -1 && this.settingArr.indexOf('commentImg') < 0 && this.settingArr.indexOf('detailImg') < 0){ // 选择了sku图片没选择评论和详情
- let scrollHeight2 = await page.evaluate((start) => {
- let scrollHeight = document.body.scrollHeight;
- let cHeight = document.documentElement.clientHeight;
- let obj = document.querySelector('div[class^=SkuContent--]');
- if(obj && obj.getBoundingClientRect().bottom < 500){
- return -1;
- }
- window.scrollTo({
- top: cHeight * start,
- behavior: "smooth"
- });
- return scrollHeight;
- }, start);
-
- if(scrollHeight2 > 0){
- num = Math.ceil(scrollHeight2 / cHeight);
- }else{
- num = 0;
- }
- }
- if(this.settingArr.indexOf('skuImg') < 0 && this.settingArr.indexOf('detailImg') < 0 && this.settingArr.indexOf('commentImg') < 0){ // 没有选择评论图和详情图
- num = 0;
- }
- if(start > num || start > 200){ // 防止页面过长,滚动200次自动停止
- urlInfo.status = '3';
- clearInterval(scrollInt);
-
- //detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
- const imgInfo = await page.evaluate((authority, execNum) => {
- let outObj = {
- mainImg: [],
- detailImg: [],
- skuImg: [],
- commentImg: [],
- video: []
- };
-
- // 正则表达式匹配字符 重写图片路径
- let regex = /\.(.{3,4})_[0-9a-zA-z]+\.(.{3,4})_\.(.{3,4})/;
-
- //主图
- let arr1 = document.querySelectorAll('img[class^=PicGallery--thumbnailPic--]');
- if(arr1.length === 0){
- arr1 = document.querySelectorAll('img[class*=thumbnailPic--]');
- }
- for(let i=0; i< arr1.length; i++){
- let mainImgUrl = arr1[i].src;
- let result = regex.exec(mainImgUrl);
- if(result){
- mainImgUrl = mainImgUrl.replace(result[0], '.'+result[1]);
- }
- if(!authority && i < execNum){
- outObj.mainImg.push(mainImgUrl);
- }
- if(authority){
- outObj.mainImg.push(mainImgUrl);
- }
- }
- //sku图片
- let arr2 = document.querySelectorAll('img[class^=SkuContent--valueItemImg--]');
- if(arr2.length === 0){
- arr2 = document.querySelectorAll('img[class*=valueItemImg--]');
- }
- for(let i=0; i< arr2.length; i++){
- let skuImgUrl = arr2[i].src;
- let result = regex.exec(skuImgUrl);
- if(result){
- skuImgUrl = skuImgUrl.replace(result[0], '.'+result[1]);
- }
- if(!authority && i < execNum){
- outObj.skuImg.push(skuImgUrl);
- }
- if(authority){
- outObj.skuImg.push(skuImgUrl);
- }
- }
- //详情图片
- let arr3 = document.querySelectorAll('#content img');
- for(let i=0; i< arr3.length; i++){
- let detailImgUrl = arr3[i].src;
- let lazyUrl = arr3[i].getAttribute('data-src');
- if(arr3[i].src.indexOf('/s.gif') > -1 && lazyUrl){
- detailImgUrl = lazyUrl;
- if(!/^http/.exec(lazyUrl)){
- detailImgUrl = 'https:' + lazyUrl;
- }
- }
- let result = regex.exec(detailImgUrl);
- if(result){
- detailImgUrl = detailImgUrl.replace(result[0], '.'+result[1]);
- }
- if(!authority && i < execNum){
- outObj.detailImg.push(detailImgUrl);
- }
- if(authority){
- outObj.detailImg.push(detailImgUrl);
- }
- }
- //评论图片
- let arr4 = document.querySelectorAll('div[class^=Comments--comments--] img');
- if(arr4.length === 0){
- arr4 = document.querySelectorAll('div[class^=comments--] img');
- }
- for(let i=0; i< arr4.length; i++){
- if(arr4[i].src.indexOf('/avatar/sns/user/flag/sns_logo') == -1){ //过滤淘宝用户头像
- if(!authority && i < execNum){
- outObj.commentImg.push(arr4[i].src);
- }
- if(authority){
- outObj.commentImg.push(arr4[i].src);
- }
- }
- }
- // 视频
- let arr5 = document.querySelectorAll('video.lib-video');
- for(let i=0; i< arr5.length; i++){
- if(outObj.video.indexOf(arr5[i].src) == -1){
- if(!authority && i < execNum){
- outObj.video.push(arr5[i].src);
- }
- if(authority){
- outObj.video.push(arr5[i].src);
- }
- }
- }
- return outObj;
- }, authority, this.execNum);
-
- if(imgInfo.video.length == 0 && responseVideo.length > 0){
- imgInfo.video = responseVideo;
- }
-
- if(this.settingArr.indexOf('mainImg') > -1){
- // 主图下载
- for(let j = 0; j < imgInfo.mainImg.length; j++){
- let fileName = imgInfo.mainImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
- fs.mkdirSync(urlInfo.newPath + '\\主图');
- }
-
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
- }
- }
- }
-
- // sku图片下载
- if(this.settingArr.indexOf('skuImg') > -1){
- for(let j = 0; j < imgInfo.skuImg.length; j++){
- let fileName = imgInfo.skuImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
- fs.mkdirSync(urlInfo.newPath + '\\sku图');
- }
-
- let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
- await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
- }
- }
- }
-
- //详情图下载
- if(this.settingArr.indexOf('detailImg') > -1){
- for(let j = 0; j < imgInfo.detailImg.length; j++){
- let fileName = imgInfo.detailImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
- fs.mkdirSync(urlInfo.newPath + '\\详情图');
- }
-
- let outputPath = urlInfo.newPath + '\\详情图\\详情图' + num + suffix;
- await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
- }
- }
- }
-
- //评论图下载
- if(this.settingArr.indexOf('commentImg') > -1){
- for(let j = 0; j < imgInfo.commentImg.length; j++){
- let fileName = imgInfo.commentImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\评论图')) {
- fs.mkdirSync(urlInfo.newPath + '\\评论图');
- }
-
- let outputPath = urlInfo.newPath + '\\评论图\\评论图' + num + suffix;
- await this.downloadImage(imgInfo.commentImg[j], outputPath, urlInfo);
- }
- }
- }
-
- //视频下载
- if(this.settingArr.indexOf('video') > -1){
- for(let j = 0; j < imgInfo.video.length; j++){
- let fileName = imgInfo.video[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\视频')) {
- fs.mkdirSync(urlInfo.newPath + '\\视频');
- }
-
- let outputPath = urlInfo.newPath + '\\视频\\' + fileName;
- await this.downloadImage(imgInfo.video[j], outputPath, urlInfo);
- }
- }
- }
-
- await page.close();
- urlInfo.status = '4';
- resolve(true);
- this.loading = false;
- }
- }, 300);
- }catch(e){
- reject(e);
- this.showError(e);
- }
- })();
- });
- },
-
- // 阿里巴巴 - 扫描并下载图片
- async alibabaScanImg(browser, page, urlInfo, authority){
- //detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
- const imgInfo = await page.evaluate((authority, execNum) => {
- let outObj = {
- mainImg: [],
- detailImg: [],
- skuImg: [],
- commentImg: [],
- video: []
- };
-
- //主图
- let arr1 = document.querySelectorAll('img[class*="-gallery-img"]');
- for(let i=0; i< arr1.length; i++){
- if(!authority && i < execNum){
- outObj.mainImg.push(arr1[i].src);
- }
- if(authority){
- outObj.mainImg.push(arr1[i].src);
- }
- }
- //sku图片
- let type = 'bg';
- let arr2 = document.querySelectorAll('.prop-img');
- if(arr2.length == 0){
- arr2 = document.querySelectorAll('.sku-item-image');
- }
- if(arr2.length == 0){
- arr2 = document.querySelectorAll('.ant-image-img');
- type = 'img';
- }
- for(let i=0; i< arr2.length; i++){
- let src;
- if(type == 'bg'){
- src = window.getComputedStyle(arr2[i]).backgroundImage.replace(/url\(["']?(.+?)["']?\)/i, '$1');
- }
- if(type == 'img'){
- src = arr2[i].src;
- }
- if(!authority && i < execNum){
- outObj.skuImg.push(src);
- }
- if(authority){
- outObj.skuImg.push(src);
- }
- }
- //详情图片
- let arr3 = document.querySelectorAll('img.desc-img-loaded');
- if(arr3.length == 0){
- if(document.getElementById('description') && document.getElementById('description').querySelector('.html-description')){
- arr3 = document.getElementById('description').querySelector('.html-description').shadowRoot.querySelectorAll('img');
- }
- }
- for(let i=0; i< arr3.length; i++){
- if(!authority && i < execNum){
- outObj.detailImg.push(arr3[i].src);
- }
- if(authority){
- outObj.detailImg.push(arr3[i].src);
- }
- }
- // 视频
- let arr5 = document.querySelectorAll('video.lib-video');
- for(let i=0; i< arr5.length; i++){
- if(outObj.video.indexOf(arr5[i].src) == -1){
- if(!authority && i < execNum){
- outObj.video.push(arr5[i].src);
- }
- if(authority){
- outObj.video.push(arr5[i].src);
- }
- }
- }
- return outObj;
- }, authority, this.execNum);
-
- // 主图下载
- if(this.settingArr.indexOf('mainImg') > -1){
- for(let j = 0; j < imgInfo.mainImg.length; j++){
- let fileName = imgInfo.mainImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\主图')) {
- fs.mkdirSync(urlInfo.newPath + '\\主图');
- }
-
- let outputPath = urlInfo.newPath + '\\主图\\主图' + num + suffix;
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
- }
- }
- }
-
- // sku图片下载
- if(this.settingArr.indexOf('skuImg') > -1){
- for(let j = 0; j < imgInfo.skuImg.length; j++){
- let fileName = imgInfo.skuImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\sku图')) {
- fs.mkdirSync(urlInfo.newPath + '\\sku图');
- }
-
- let outputPath = urlInfo.newPath + '\\sku图\\sku图' + num + suffix;
- await this.downloadImage(imgInfo.skuImg[j], outputPath, urlInfo);
- }
- }
- }
-
- //详情图下载
- if(this.settingArr.indexOf('detailImg') > -1){
- for(let j = 0; j < imgInfo.detailImg.length; j++){
- let fileName = imgInfo.detailImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\详情图')) {
- fs.mkdirSync(urlInfo.newPath + '\\详情图');
- }
-
- let outputPath = urlInfo.newPath + '\\详情图\\' + '详情图' + num + suffix;
- await this.downloadImage(imgInfo.detailImg[j], outputPath, urlInfo);
- }
- }
- }
- //视频下载
- if(this.settingArr.indexOf('video') > -1){
- for(let j = 0; j < imgInfo.video.length; j++){
- let fileName = imgInfo.video[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- if (!fs.existsSync(urlInfo.newPath + '\\视频')) {
- fs.mkdirSync(urlInfo.newPath + '\\视频');
- }
-
- let outputPath = urlInfo.newPath + '\\视频\\' + fileName;
- await this.downloadImage(imgInfo.video[j], outputPath, urlInfo);
- }
- }
- }
-
- await page.close(); // 关闭页面但不关闭浏览器
- },
-
- // 检查小红书登录状态
- checkRedLogin(){
- this.checkLoading = true;
- this.redStatus = 1;
- return new Promise((resolve, reject) => {
- (async () => {
- try{
- if(this.loginBrowser){
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }
- puppeteer.use(StealthPlugin());
- this.loginBrowser = await puppeteer.launch({
- executablePath: this.initPath(),
- userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- args: [
- '--start-maximized',
- '--no-sandbox',
- '--disable-setuid-sandbox',
- '--disable-blink-features=AutomationControlled',
- '--window-size=1280,800'
- ],
- });
- const page = await this.loginBrowser.newPage();
- await page.setViewport({ width: 1280, height: 800 });
- let testUrl = "https://www.xiaohongshu.com";
- await page.goto(testUrl, {waitUntil : 'networkidle2'});
-
- let loginBtn = await page.$$('#login-btn');
- let loginContainer = await page.$$('.login-container');
- if(loginContainer.length > 0 || loginBtn.length > 0){
- this.redStatus = 3; //未登录
- }else{
- this.redStatus = 2;
- }
-
- resolve(this.redStatus);
- this.checkLoading = false;
- await this.loginBrowser.close();
- this.loginBrowser = null;
- }catch(e){
- this.checkLoading = false;
- reject(3);
- this.showError(e);
- }
- })();
- });
- },
- // 5-小红书下载
- async redDownload(urlInfo, redBrowser){
- let task = await new Promise((resolve,reject) =>{
- (async () => {
- try{
- let authority = this.$refs.headerRef.authority.isAuthority;
- let number = 0;
- urlInfo.status = '2';
- urlInfo.num = 0;
- // puppeteer.use(StealthPlugin());
- // const redBrowser = await puppeteer.launch({
- // headless: false,
- // executablePath: this.initPath(),
- // userDataDir: os.tmpdir() + separator + 'chrome-data-capture',
- // args: [
- // '--start-maximized',
- // '--no-sandbox',
- // '--disable-setuid-sandbox',
- // '--disable-blink-features=AutomationControlled',
- // ]
- // });
- const page = await redBrowser.newPage();
- let responseVideo = [];
- page.on('response', async(response) => {
- // 检查响应的 MIME 类型是否以 'video/' 开头
- if (response.headers()['content-type'] && response.headers()['content-type'].startsWith('video/')) {
- if(responseVideo.indexOf(response.url()) < 0 && !response.url().startsWith('blob:https://')){
- responseVideo.push(response.url());
- }
- }
- });
- await page.goto(urlInfo.url, {waitUntil : 'networkidle2'});
-
- if(urlInfo.title){
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + urlInfo.title;
- }
- }else{
- await this.getTitle(page, urlInfo); // 生成页面标题对应的文件夹
- }
- urlInfo.status = '3';
-
- // 定位元素
- const handle = await page.$$('.pagination-media-container .pagination-item');
- if(handle.length > 0){ // 模拟鼠标拖动 将鼠标移动到元素的中心,然后开始拖动
- let handleLength = handle.length;
- const box = await handle[0].boundingBox();
- const boxEnd = await handle[handleLength - 1].boundingBox();
- const center = {
- x: box.x + box.width / 2,
- y: box.y + box.height / 2
- };
- const centerEnd = {
- x: boxEnd.x + boxEnd.width / 2,
- y: boxEnd.y + boxEnd.height / 2
- };
- await page.mouse.move(center.x, center.y);
- await page.mouse.down();
- await page.mouse.move(centerEnd.x, centerEnd.y, { steps: 50 }); // 新的位置,可以根据需要调整步骤数
- }
-
- //detailImg:详情图;skuImg:sku图片;commentImg: 评论图;video: 视频
- const imgInfo = await page.evaluate((authority, execNum) => {
- let outObj = {
- mainImg: [],
- detailImg: [],
- skuImg: [],
- commentImg: [],
- video: []
- };
-
- // 正则表达式匹配字符 重写图片路径
- let regex = /\.(.{3,4})_[0-9a-zA-z]+\.(.{3,4})_\.(.{3,4})/;
-
- //主图
- let arr1 = document.querySelectorAll('img[class^=note-slider-img]');
- for(let i=0; i< arr1.length; i++){
- let mainImgUrl = arr1[i].src;
- let result = regex.exec(mainImgUrl);
- if(result){
- mainImgUrl = mainImgUrl.replace(result[0], '.'+result[1]);
- }
- if(!authority && i < execNum){
- outObj.mainImg.push(mainImgUrl);
- }
- if(authority){
- outObj.mainImg.push(mainImgUrl);
- }
- }
- // 视频
- let arr5 = document.querySelectorAll('video.lib-video');
- for(let i=0; i< arr5.length; i++){
- if(outObj.video.indexOf(arr5[i].src) == -1){
- if(!authority && i < execNum){
- outObj.video.push(arr5[i].src);
- }
- if(authority){
- outObj.video.push(arr5[i].src);
- }
- }
- }
- return outObj;
- }, authority, this.execNum);
-
- if(imgInfo.mainImg.length >= 3){
- imgInfo.mainImg = imgInfo.mainImg.slice(1, imgInfo.mainImg.length-1); //小红书轮播图第一个/最后一个和内容重复去掉
- }
- imgInfo.video = responseVideo;
-
- // 主图下载
- for(let j = 0; j < imgInfo.mainImg.length; j++){
- let fileName = imgInfo.mainImg[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '.jpg';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
-
- let outputPath = urlInfo.newPath + '\\文章图' + num + suffix;
- await this.downloadImage(imgInfo.mainImg[j], outputPath, urlInfo);
- }
- }
-
- //视频下载
- for(let j = 0; j < imgInfo.video.length; j++){
- let fileName = imgInfo.video[j].split('/').pop();
- if(fileName){
- let queryIndex = fileName.indexOf('?');
- if (queryIndex !== -1) {
- fileName = fileName.substr(0, queryIndex);
- }
-
- let num = Number(j) + 1;
- let suffix = '.mp4';
- if(fileName.lastIndexOf('.') > -1){
- suffix = fileName.substr(fileName.lastIndexOf('.'));
- }
- let outputPath = urlInfo.newPath + '\\视频' + num + suffix;
- await this.downloadImage(imgInfo.video[j], outputPath, urlInfo);
- }
- }
-
- await page.close();
- urlInfo.status = '4';
- resolve(true);
- this.loading = false;
- }catch(e){
- urlInfo.status = '5';
- reject(e);
- this.showError(e);
- }
- })();
- });
- },
-
- //
- downloadExample(){
- let url = 'https://www.xingyousoft.com/soft/XYCapture/example.xlsx';
- if (!fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName)) {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName);
- }
- let path = this.downloadDir + separator + pjson.softInfo.softName + '\\链接模板下载.xlsx';
- this.downloadImage(url, path, 'example');
- },
-
- // 下载网址链接的图片
- async downloadImage(imageUrl, outputPath, urlInfo) {
- let _this = this;
- let received_bytes = 0;
- let total_bytes = 0;
- try {
- let req = request({
- method: 'GET', uri: imageUrl, strictSSL: false
- });
- let out = fs.createWriteStream(outputPath);
- req.pipe(out);
-
- return new Promise((resolve, reject) => {
- req.on('response', (data) => {
- total_bytes = parseInt(data.headers['content-length']);
- const status = data.statusCode;
- if (status < 200 || status >= 300) {
- //reject(false);
- this.$notify.error({
- title: '网络图片访问异常!- 1',
- message: imageUrl.slice(0,50)
- });
- }else if(isNaN(total_bytes)){
- //reject(false);
- this.$notify.error({
- title: '网络图片访问异常!- 2',
- message: imageUrl.slice(0,50)
- });
- }else{
- // console.log('下载中...')
- }
- });
-
- req.on('data', (chunk) => {
- received_bytes += chunk.length;
- });
-
- req.on('end', ()=> {
- if(urlInfo != 'example'){
- urlInfo.num += 1;
- }else{
- this.$msgbox({
- title: '消息',
- message: '模板下载成功,保存位置:' + this.downloadDir + separator + pjson.softInfo.softName,
- showCancelButton: true,
- confirmButtonText: '去查看',
- cancelButtonText: '取消',
- }).then(action => {
- this.openFolder();
- }).catch(action => {
-
- });
- }
- //console.log('下载完成', outputPath)
- resolve(true);
- });
- });
- } catch (error) {
- console.error(imageUrl, `Failed to download image: ${error.message}`);
- throw error;
- }
- },
-
- // 获取页面标题 - 生成对应的文件夹
- async getTitle(page, urlInfo){
- // 已页面标题作为新建文件夹,保留前50个字
- let title = await page.title();
- if(title){
- title = title.substring(0, 50);
- if(this.containsAnyChar(title, ['\\', '/', ':', '*', '?', '"', '<', '>', '|'])){ //判断是否含有特殊字符
- title = title.replace(/[\\|/|:|*|?|"|<|>||]/g, "");
- }
- if (fs.existsSync(this.downloadDir + separator + pjson.softInfo.softName + separator + title)) {
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + title;
- } else {
- fs.mkdirSync(this.downloadDir + separator + pjson.softInfo.softName + separator + title);
- urlInfo.newPath = this.downloadDir + separator + pjson.softInfo.softName + separator + title;
- }
- }
- },
-
- // 下载base64位的图片
- async downloadBaseImage(base64String, outputPath, urlInfo) {
- const buffer = Buffer.from(base64String, 'base64');
- const writeStream = fs.createWriteStream(outputPath);
- writeStream.write(buffer);
- writeStream.end();
- writeStream.on('finish', () => {
- urlInfo.num += 1;
- });
- // 监听错误事件
- writeStream.on('error', (err) => {
- console.error('base64位写入文件时出错:', err);
- });
- },
-
- // 错误提示
- showError(e){
- let str = '';
- if(e.toString().indexOf('ERR_NAME_NOT_RESOLVE') > -1){
- str = '无法解析该网址,请查看网址是否正确!-1';
- }else if(e.toString().indexOf('Cannot navigate to invalid URL') > -1){
- str = '无效的网址,请查看网址格式是否正确!-2';
- }else if(e.toString().indexOf('ERR_CONNECTION_TIMED_OUT') > -1){
- str = '链接请求超时,请查看网络状态!-3';
- }else if(e.toString().indexOf('TimeoutError') > -1){
- str = '链接请求超时,请查看网络状态!-4';
- }else if(e.toString().indexOf('operation not permitted') > -1){
- str = '权限受限,请以管理员权限运行软件!-5';
- }else if(e.toString().indexOf('browser has disconnected') > -1){
- str = '内置浏览器已关闭!-6';
- }else if(e.toString().indexOf('Failed to launch the browser') > -1){
- str = '请先关闭内置浏览器!-7';
- }else{
- str = e.toString();
- //console.log(e);
- }
- this.loading = false;
- this.$notify.error({
- title: '提示',
- message: str
- });
- },
-
- // 是否包含特殊字符
- containsAnyChar(str, charsArray) {
- for (let i = 0; i < charsArray.length; i++) {
- if (str.includes(charsArray[i])) {
- return true;
- }
- }
- return false;
- },
-
- // 随机生成字符
- randomString(length) {
- let result = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- for (let i = 0; i < length; i++ ) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
- }
-
- }
- };
- </script>
- <style lang="scss">
- @import "../assets/css/fontx/iconfont.css";
- @import "../assets/css/home.scss";
- .ivu-input-number-controls-outside-btn i {
- font-weight: 800;
- }
- .update-point {
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 8px;
- background: #ff0000;
- top: 14px;
- position: absolute;
- left: -13px;
- }
- .menu-item {
- padding: 8px 0;
- font-size: 14px;
- .iconfont {
- font-size: 32px;
- }
- &:hover,
- &.active {
- color: #ed4014;
- }
- }
- .ivu-progress-show-info .ivu-progress-outer {
- padding-right: 40px !important;
- margin-right: -40px !important;
- }
- .tips {
- text-align: center;
- padding: 10px 0;
- color: #ed4014;
- font-size: 12px;
- }
- .handle-desc {
- display: inline-block;
- width: calc(100% - 100px);
- overflow: hidden;
- }
- .ivu-menu-submenu-title {
- font-weight: 600;
- }
- .ivu-menu .ivu-menu-item {
- line-height: 1;
- }
- // new-el
- .el-menu {
- border-right: none !important;
- }
- .cmenu-item {
- padding: 0 20px 20px;
- margin-bottom: 15px;
- .cmenu-title {
- font-size: 18px;
- font-weight: 600;
- padding-bottom: 20px;
- }
- .citem-nav {
- text-align: center;
- border-radius: 10px;
- min-height: 110px;
- padding: 15px 0;
- background-color: #fff;
- font-size: 15px;
- cursor: pointer;
- &.bg-linear1 {
- color: #fff;
- font-size: 20px;
- background: linear-gradient(to right bottom, #2A56CA, #5795F4);
- }
- &.bg-linear2 {
- color: #fff;
- font-size: 20px;
- background: linear-gradient(to right top, #147FBB, #5EB3E3);
- }
- &.bg-linear3 {
- color: #fff;
- font-size: 20px;
- background: linear-gradient(to right bottom, #2F9E8A, #56CDB1);
- }
- &:hover {
- margin-top: -5px;
- box-shadow: 3px 3px 6px #ccc, -3px -3px 6px #ccc;
- }
- .citem-img {
- width: 50px;
- margin-bottom: 10px;
- }
- }
- }
-
- .popper-open{
- text-align: center !important;
- padding: 10px !important;
- background: #303133 !important;
- color: #fff !important;
- min-width: 120px !important;
- opacity: 0.8;
- }
-
- .popper-open[x-placement^=bottom] .popper__arrow::after{
- border-bottom-color: #303133 !important;
- }
-
- textarea.el-textarea__inner{
- height: 100% !important;
- font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
- }
-
- .set-item{
- margin-right: 15px;
-
- .set-title{
- font-size: 13px;
- }
- }
-
- .outarea{
- height: 100%;
- border: 1px solid #DCDFE6;
- background-color: #4851a415;
- padding: 15px;
- font-size: 20px;
- overflow: hidden auto;
- }
-
- .outtext{
- height: 100%;
- font-size: 20px;
- overflow: hidden auto;
-
- textarea{
- background-color: #4851a415;
- }
- }
-
- .pin-tips{
- font-size: 14px;
- position: absolute;
- bottom: 10px;
- color: #ff0000;
- left: 0;
- right: 0;
- margin: auto;
- text-align: center;
- }
-
- .outarea.red-border{
- border: 1px solid #F56C6C;
- }
-
- .outtext.red-border textarea{
- border: 1px solid #F56C6C;
- }
-
- h3{
- margin: 0;
- }
-
- .m-image{
- width: 20px;
- margin-right: 5px;
- }
-
- .dialog-footer-center{
- text-align: center;
- }
-
- .visible-tips-style{
- font-size: 18px;
- color: #f73131;
- font-weight: 600;
- padding: 30px 40px 0;
- }
-
- .no-select{
- user-select: none;
- }
-
- .tips-flex{
- display: flex;
- flex-wrap: nowrap;
- justify-content: space-around;
- align-items: center;
-
- .el-icon-s-opportunity{
- font-size: 50px;
- color: #f73131;
- margin-right: 10px;
- }
-
- .m-title{
- flex: 1;
- color: #f73131;
- }
- }
-
- </style>
|