手机推荐排行榜,盗墓笔记小说全集,琅琊榜 海宴 小说 http://marshallsonline.cn/inews/ zh-CN Sat, 12 Aug 2023 08:15:32 +0800 Sat, 12 Aug 2023 08:15:32 +0800 怎樣為Egg.js注冊(cè)為windows服務(wù) http://marshallsonline.cn/inews/n3/egg-windows-service.html http://marshallsonline.cn/inews/n3/egg-windows-service.html Sat, 12 Aug 2023 08:15:32 +0800 admin 要將 Egg.js 部署為 Windows 服務(wù),可以按照以下步驟進(jìn)行操作:

  1. 安裝 Node.js:首先,確保在 Windows 服務(wù)器上安裝了 Node.js 運(yùn)行環(huán)境??梢詮?Node.js 官方網(wǎng)站(https://nodejs.org/)下載并安裝最新版本的 Node.js。
  2. 安裝 egg-windows-service:使用 npm 全局安裝 egg-windows-service 模塊。打開(kāi)命令提示符并執(zhí)行以下命令:

    npm install -g egg-windows-service
  3. 創(chuàng)建服務(wù)腳本:在 Egg.js 項(xiàng)目的根目錄下,創(chuàng)建一個(gè)名為 service.js 的腳本文件,用于定義 Windows 服務(wù)的配置和行為。以下是一個(gè)示例的 service.js 文件內(nèi)容:

    const Service = require('egg-windows-service');
    
    const svc = new Service({
      name: 'EggApp', // 服務(wù)名稱
      description: 'Egg.js Application', // 服務(wù)描述
      script: 'path/to/egg.js', // Egg.js 項(xiàng)目的入口文件路徑
    });
    
    svc.on('install', () => {
      svc.start();
    });
    
    svc.install();
  4. 安裝服務(wù):在命令提示符中,切換到 Egg.js 項(xiàng)目根目錄,并執(zhí)行以下命令來(lái)安裝服務(wù):

    egg-service install
  5. 啟動(dòng)服務(wù):執(zhí)行以下命令來(lái)啟動(dòng)服務(wù):

    egg-service start
  6. 停止服務(wù):執(zhí)行以下命令來(lái)停止服務(wù):

    egg-service stop
  7. 卸載服務(wù):執(zhí)行以下命令來(lái)卸載服務(wù):

    egg-service uninstall

通過(guò)以上步驟,就可以將 Egg.js 應(yīng)用部署為 Windows 服務(wù)了??梢允褂梅?wù)管理工具(如 Windows 的服務(wù)管理器)來(lái)啟動(dòng)、停止和管理該服務(wù)。

]]>
0 http://marshallsonline.cn/inews/n3/egg-windows-service.html#comments http://marshallsonline.cn/feed/inews/
解決局域網(wǎng)共享,另存為bat文件使用 http://marshallsonline.cn/inews/n3/local-share.html http://marshallsonline.cn/inews/n3/local-share.html Sat, 05 Aug 2023 15:02:05 +0800 admin @echo off color 2f mode con cols=50 lines=30 title OKShare 【制作:wnsdt】 ver | findstr "6.1">nul && set bulid=nt6 && goto sc_top ver | findstr "10.">nul && set bulid=nt10 && goto sc_top ver | findstr "5.">nul && set bulid=nt5 && goto sc_top ver | findstr "6.3">nul && set bulid=nt10 && goto sc_top ver | findstr "6.2">nul && set bulid=nt10 && goto sc_top echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 警 告 echo. echo.&echo.&echo. echo 軟件不支持你的系統(tǒng),按任意鍵退出! pause>nul 2>nul exit :sc_top cls del /q %temp%\info.txt>nul 2>nul :sc_menu echo.&echo.&echo. echo 局域網(wǎng)共享一鍵修復(fù) 19.3.13 echo. echo -------------------------------------------- echo.&echo.&echo. echo 1、本機(jī)網(wǎng)絡(luò)信息 echo. echo 2、簡(jiǎn)單共享(無(wú)密碼) echo. echo 3、密碼共享 echo. echo 4、共享和權(quán)限管理 echo. echo 5、權(quán)限設(shè)置指南(圖文) echo. echo 6、打印機(jī)共享指南(圖文) echo. echo 7、更新與反饋 echo.&echo.&echo.&echo.&echo. set select= set str1=1234567 set /p select= 輸入數(shù)字,按回車: if not defined select goto sc_wrong echo %select%|findstr "[%str1%]">nul||goto sc_wrong if %select%==1 (goto sc_info) if %select%==2 (goto sc_zd) if %select%==3 (goto sc_sd) if %select%==4 (goto sc_gl) if %select%==5 (goto sc_help) if %select%==6 (goto sc_print) if %select%==7 (goto sc_update) :sc_wrong mshta vbscript:msgbox("只能輸入1-7的數(shù)字",64,"提示")(window.close) goto sc_top :sc_info cls echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 正在處理信息.... if %bulid%==nt5 (goto sc_nt5) else (goto sc_nt6) :sc_nt5 (echo. echo.)>>%temp%\info.txt ping www.baidu.com -n 1 >nul || echo 互聯(lián)網(wǎng)狀態(tài): [ 離線 ]>>%temp%\info.txt && goto sc_ver_nt5 echo 互聯(lián)網(wǎng)狀態(tài): [ 在線 ]>>%temp%\info.txt :sc_ver_nt5 (echo ---------------------------------------------------------- echo.)>>%temp%\info.txt for /f "skip=1 tokens=2-4 delims=, " %%a in ('wmic os get caption') do ( if exist %windir%\SysWOW64 echo 系統(tǒng)版本: %%a %%b %%c 64位>>%temp%\info.txt & goto sc_ver_nt5_next echo 系統(tǒng)版本: %%a %%b %%c 32位>>%temp%\info.txt ) :sc_ver_nt5_next (echo. echo 計(jì)算機(jī)名: %COMPUTERNAME% echo.)>>%temp%\info.txt for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo 工作組: %%a>>%temp%\info.txt & goto sc_info_nt5 :sc_info_nt5 (echo. echo 當(dāng)前用戶: %USERNAME% echo.)>>%temp%\info.txt for /f "delims=" %%a in ('date /t') do echo 本機(jī)日期: %%a>>%temp%\info.txt echo.>>%temp%\info.txt for /f "delims=" %%a in ('time /t') do echo 本機(jī)時(shí)間: %%a>>%temp%\info.txt echo ---------------------------------------------------------->>%temp%\info.txt goto sc_info_more :sc_nt6 (echo. echo.)>>%temp%\info.txt ping www.baidu.com -n 1 >nul || echo 互聯(lián)網(wǎng)狀態(tài): [ 離線 ]>>%temp%\info.txt && goto sc_ver_nt6 echo 互聯(lián)網(wǎng)狀態(tài): [ 在線 ]>>%temp%\info.txt :sc_ver_nt6 (echo ---------------------------------------------------------- echo.)>>%temp%\info.txt for /f "skip=1 tokens=2-5 delims=?, " %%a in ('wmic os get caption') do ( if exist %windir%\SysWOW64 echo 系統(tǒng)版本: %%a %%b %%c %%d 64位>>%temp%\info.txt & goto sc_ver_nt6_next echo 系統(tǒng)版本: %%a %%b %%c %%d 32位>>%temp%\info.txt ) :sc_ver_nt6_next (echo. echo 計(jì)算機(jī)名: %COMPUTERNAME% echo.)>>%temp%\info.txt for /f "tokens=2 delims= " %%a in ('net config workstation^|findstr /c:"工作站域"') do echo 工作組: %%a>>%temp%\info.txt (echo. echo 當(dāng)前用戶: %USERNAME% echo.)>>%temp%\info.txt for /f "delims=" %%a in ('date /t') do echo 本機(jī)日期: %%a>>%temp%\info.txt echo.>>%temp%\info.txt for /f "delims=" %%a in ('time /t') do echo 本機(jī)時(shí)間: %%a>>%temp%\info.txt echo ---------------------------------------------------------->>%temp%\info.txt :sc_info_more if %bulid%==nt5 ipconfig /all|findstr /v /c:"Windows IP Configuration"|findstr /v /c:"Host Name"|findstr /v /c:"Primary Dns Suffix"|findstr /v /c:"Node Type"|findstr /v /c:"IP Routing Enabled"|findstr /v /c:"WINS Proxy Enabled">>%temp%\info.txt && goto sc_info_next ipconfig /all|findstr /v /c:"Windows IP 配置"|findstr /v /c:"主機(jī)名"|findstr /v /c:"主 DNS 后綴"|findstr /v /c:"節(jié)點(diǎn)類型"|findstr /v /c:"IP 路由已啟用"|findstr /v /c:"WINS 代理已啟用">>%temp%\info.txt :sc_info_next (echo. echo ---------------------------------------------------------- echo. echo.)>>%temp%\info.txt start /w notepad %temp%\info.txt del /q %temp%\info.txt>nul 2>nul goto sc_top :sc_zd call :sc_qxfix cls echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 開(kāi)始修復(fù)...... net user guest /active:yes>nul 2>nul net user guest "">nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v LimitBlankPasswordUse /t REG_DWORD /d 0x0 /f>nul 2>nul if %bulid%==nt10 reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v AllowInsecureGuestAuth /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymoussam /t REG_DWORD /d 0x0 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v LmCompatibilityLevel /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v everyoneincludesanonymous /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v NoLmHash /t REG_DWORD /d 0x0 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v restrictnullsessaccess /t REG_DWORD /d 0x0 /f>nul 2>nul goto sc_main :sc_sd call :sc_qxfix cls echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 開(kāi)始修復(fù)...... net user guest /active:no>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x0 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinClientSec /t REG_DWORD /d 0x0 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0" /v NtlmMinServerSec /t REG_DWORD /d 0x0 /f>nul 2>nul goto sc_main :sc_main sc config LanmanWorkstation start= auto>nul 2>nul sc config LanmanServer start= auto>nul 2>nul sc config Winmgmt start= auto>nul 2>nul sc config RpcSs start= auto>nul 2>nul sc config Netman start= auto>nul 2>nul sc config RasMan start= demand>nul 2>nul sc config SSDPSRV start= auto>nul 2>nul sc config BFE start= auto>nul 2>nul sc config ALG start= demand>nul 2>nul sc config SharedAccess start= auto>nul 2>nul net start SharedAccess /y>nul 2>nul sc config Browser start= auto>nul 2>nul net start Browser /y>nul 2>nul sc config Dnscache start= auto>nul 2>nul net start Dnscache /y>nul 2>nul sc config Dhcp start= auto>nul 2>nul net start Dhcp /y>nul 2>nul sc config lmhosts start= auto>nul 2>nul net start lmhosts /y>nul 2>nul sc config Spooler start= auto>nul 2>nul net start Spooler /y>nul 2>nul sc config upnphost start= demand>nul 2>nul net start upnphost /y>nul 2>nul reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Netlogon" /v Start|findstr "0x4">nul 2>nul && sc config Netlogon start= demand>nul 2>nul reg add "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v TransportBindName /t REG_SZ /d \Device\ /f>nul 2>nul reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB1 /F>nul 2>nul reg delete "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB2 /F>nul 2>nul reg delete "HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v SMBDeviceEnabled /F>nul 2>nul sc config netbt start= system>nul 2>nul net start netbt>nul 2>nul if %bulid%==nt5 (goto sc_sernt5) else (goto sc_sernt6) :sc_sernt5 sc config PlugPlay start= auto>nul 2>nul sc config TapiSrv start= auto>nul 2>nul sc config Nla start= auto>nul 2>nul net start Nla /y>nul 2>nul netsh firewall set service type = fileandprint mode = enable scope = subnet>nul 2>nul set "nbt=HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces" for /f "tokens=2 delims={" %%a in ('reg query "%nbt%"') do (reg query "%nbt%\TCPIP_{%%a" /s|findstr /i /c:"NetbiosOptions">nul && reg add "%nbt%\TCPIP_{%%a" /v NetbiosOptions /t REG_DWORD /d 0x0 /f>nul 2>nul) goto sc_main2_etc :sc_sernt6 sc config DcomLaunch start= auto>nul 2>nul sc config RpcEptMapper start= auto>nul 2>nul sc config SamSs start= auto>nul 2>nul sc config nsi start= auto>nul 2>nul sc config SstpSvc start= demand>nul 2>nul sc config MpsSvc start= auto>nul 2>nul net start MpsSvc /y>nul 2>nul sc config NlaSvc start= auto>nul 2>nul sc config netprofm start= auto>nul 2>nul sc config fdPHost start= auto>nul 2>nul net start fdPHost /y>nul 2>nul sc config FDResPub start= auto>nul 2>nul net start FDResPub /y>nul 2>nul sc config HomeGroupListener start= auto>nul 2>nul sc config WMPNetworkSvc start= auto>nul 2>nul net start WMPNetworkSvc /y>nul 2>nul sc config HomeGroupProvider start= auto>nul 2>nul net start HomeGroupProvider /y>nul 2>nul netsh advfirewall firewall set rule group=\"網(wǎng)絡(luò)發(fā)現(xiàn)\" new enable=Yes>nul 2>nul netsh advfirewall firewall set rule group=\"文件和打印機(jī)共享\" new enable=Yes>nul 2>nul if %bulid%==nt10 powershell -NonInteractive "Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol">nul 2>nul for /f "delims=" %%a in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces" /s /e /f "0x2"^|findstr "\Tcpip_"') do reg add "%%a" /v NetbiosOptions /t REG_DWORD /d 0x0 /f>nul 2>nul :sc_main2_etc (echo [Unicode] echo Unicode=yes echo [Version] echo signature="$CHICAGO$" echo Revision=1 echo [Privilege Rights] echo sedenynetworklogonright = echo senetworklogonright = Everyone,Administrators,Users,Power Users,Backup Operators,guest)>>%temp%\zcl.inf secedit /configure /db %temp%\zcl.sdb /cfg %temp%\zcl.inf /log %temp%\zcl.log /quiet del /q %temp%\zcl.*>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 0x0 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 0x1 /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v MaintainServerList /t REG_SZ /d Auto /f>nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters" /v IsDomainMaster /t REG_SZ /d FALSE /f>nul 2>nul reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v EnableLMHOSTS|findstr "0x0">nul 2>nul && reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v EnableLMHOSTS /t REG_DWORD /d 0x1 /f>nul 2>nul reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}" /f>nul 2>nul net use * /del /y>nul 2>nul net config server /hidden:no>nul 2>nul net share ipc$>nul 2>nul reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v NodeType /f>nul 2>nul reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v DhcpNodeType /f>nul 2>nul goto sc_tip :sc_gl cls reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest|findstr "0x1">nul 2>nul||goto classic reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x0 /f>nul 2>nul set jlb=y :classic echo.&echo.&echo.&echo. echo 功能:管理本機(jī)共享,修改共享權(quán)限 echo. echo 家庭版系統(tǒng)僅支持查看共享 echo ---------------------------------------------- echo.&echo.&echo.&echo.&echo. echo 【使用說(shuō)明】 echo.&echo. echo 點(diǎn)左側(cè)“共享”可查看本機(jī)所有共享; echo. echo 右鍵點(diǎn)左側(cè)“共享”可“新建共享”; echo. echo 右鍵點(diǎn)右側(cè)共享可“停止共享”(能多選); echo. echo 右鍵點(diǎn)右側(cè)共享選“屬性”可修改權(quán)限; echo.&echo.&echo.&echo.&echo.&echo.&echo. fsmgmt.msc if %jlb%==y reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 0x1 /f>nul 2>nul goto sc_top :sc_tip cls echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 修復(fù)已完成?。?! mshta vbscript:msgbox("請(qǐng)手動(dòng)重啟計(jì)算機(jī)",64,"提示")(window.close) exit :sc_help cls start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24285252" goto sc_top :sc_print cls start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24187152" goto sc_top :sc_update cls start "%ProgramFiles%\Internet Explorer\iexplore.exe" "https://zhuanlan.zhihu.com/p/24178142" goto sc_top goto :eof :sc_qxfix cls echo.&echo.&echo. echo 【使用說(shuō)明】 echo -------------------------------------------- echo. echo 復(fù)制共享文件夾的地址欄路徑到下方 echo. echo 如果只共享打印機(jī),按回車鍵跳過(guò) echo.&echo.&echo.&echo.&echo.&echo.&echo. echo 粘貼路徑,按回車: echo.&echo. set /p lj= for %%a in ("%lj%") do set name=%%~na net share "%name%"="%lj%">nul 2>nul if %bulid%==nt5 cacls "%lj%" /t /e /p everyone:f >nul 2>nul && goto :eof icacls "%lj%" /grant everyone:(oi)(ci)F>nul 2>nul goto :eof ]]> 0 http://marshallsonline.cn/inews/n3/local-share.html#comments http://marshallsonline.cn/feed/inews/ 山西貨通九州網(wǎng)絡(luò)科技有限公司 http://marshallsonline.cn/inews/n1/161.html http://marshallsonline.cn/inews/n1/161.html Wed, 12 Jul 2023 16:58:17 +0800 admin 貨通九州網(wǎng)終科技開(kāi)發(fā)有限公司是一家專注于軟件開(kāi)發(fā)、硬件設(shè)備和互聯(lián)網(wǎng)項(xiàng)目的公司。我們致力于為客戶提供創(chuàng)新的解決方案,以滿足不斷變化的市場(chǎng)需求。
在軟件開(kāi)發(fā)方面,我們擁有高效的開(kāi)發(fā)團(tuán)隊(duì)和豐富的經(jīng)驗(yàn),能夠開(kāi)發(fā)各種類型的應(yīng)用軟件,包括網(wǎng)站、移動(dòng)應(yīng)用、企業(yè)管理系統(tǒng)等。
在硬件設(shè)備方面,我們致力于開(kāi)發(fā)創(chuàng)新的硬件產(chǎn)品,涵蓋了多個(gè)領(lǐng)域,如物聯(lián)網(wǎng)設(shè)備、嵌入式系統(tǒng)等。
此外,我們還涉足互聯(lián)網(wǎng)項(xiàng)目的開(kāi)發(fā)。無(wú)論是電子商務(wù)平臺(tái)、在線教育系統(tǒng),還是社交媒體應(yīng)用,我們都能夠根據(jù)客戶的需求,提供定制化的解決方案,并確保項(xiàng)目的順利實(shí)施和有效運(yùn)營(yíng)。

]]>
0 http://marshallsonline.cn/inews/n1/161.html#comments http://marshallsonline.cn/feed/inews/
node 生成公鑰私鑰加密 http://marshallsonline.cn/inews/n3/126.html http://marshallsonline.cn/inews/n3/126.html Sat, 18 Mar 2023 14:04:00 +0800 admin 生成私鑰和公鑰

const { generateKeyPairSync } = require('crypto');
const { publicKey, privateKey } = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem'
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret'
  }
});

公鑰加密,私鑰解密

const crypto = require('crypto');
const fs = require('fs');
const publicKey = fs.readFileSync('./app/controller/publicKey.pem');
const privateKey = fs.readFileSync('./app/controller/privateKey.pem');
const secret = JSON.stringify({ a: 1 });


const encrypt = crypto.publicEncrypt(publicKey, Buffer.from(secret));
console.log(encrypt);

const decrypt = crypto.privateDecrypt({ key: privateKey, passphrase: '1233211234567' }, encrypt);
console.log(JSON.parse(decrypt.toString()));
]]>
0 http://marshallsonline.cn/inews/n3/126.html#comments http://marshallsonline.cn/feed/inews/
nodejs 生成 word officegen模塊使用方法 http://marshallsonline.cn/inews/n3/officegen.html http://marshallsonline.cn/inews/n3/officegen.html Tue, 16 Nov 2021 09:34:00 +0800 admin 詳細(xì)文檔鏈接

https://github.com/Ziv-Barber/officegen/blob/87dd5501968501555ea3bee60043affc9f67c1fa/manual/docx/README.md

引用

const officegen = require('officegen');

監(jiān)聽(tīng)

docx.on('finalize', function(written) {
   console.log(
     'Finish to create a Microsoft Word document.'
   );
});

// Officegen calling this function to report errors:
docx.on('error', function(err) {
  console.log(err);
});
out.on('error', function(err) {
  console.log(err);
});

生成一行

let pObj = docx.createP();

行內(nèi)添加文字元素

pObj.addText(' and back color.', { color: '00ffff', back: '000088',shdType: 'pct12',shdColor: 'ff0000' ,link: 'https://github.com'});

設(shè)置文字對(duì)齊方式

pObj.options.align = 'right';

關(guān)聯(lián)文件并導(dǎo)出

const out = fs.createWriteStream('./app/public/example.docx');
docx.generate(out);
]]>
0 http://marshallsonline.cn/inews/n3/officegen.html#comments http://marshallsonline.cn/feed/inews/
VS Code配置Vue開(kāi)發(fā)環(huán)境-Vetur+ESLint+Prettier http://marshallsonline.cn/inews/n3/89.html http://marshallsonline.cn/inews/n3/89.html Sun, 22 Aug 2021 15:31:00 +0800 admin 核心就是 Vetur+ESLint,其他的我覺(jué)得就是錦上添花的作用

快速配置

本文的配置是記錄Vue CLI生成的項(xiàng)目,若不是,請(qǐng)自行處理依賴關(guān)系

打開(kāi) vscode 的插件安裝,搜索上面的插件,一一安裝

打開(kāi) vscode 的設(shè)置,鍵入以下代碼

{
  // 保存時(shí)自動(dòng)格式化代碼

  "editor.formatOnSave": true,
  // eslint配置項(xiàng),保存時(shí)自動(dòng)修復(fù)錯(cuò)誤
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },

  // 讓vetur使用vs自帶的js格式化工具,以便在函數(shù)前面加個(gè)空格
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "javascript.format.semicolons": "remove",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  // 指定 *.vue 文件的格式化工具為vetur
  "[vue]": {
    "editor.defaultFormatter": "octref.vetur"
  },
  // 指定 *.js 文件的格式化工具為vscode自帶
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  // 默認(rèn)使用prettier格式化支持的文件
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}

在項(xiàng)目的根目錄建立.eslintrc.js文件,鍵入以下代碼(Vue CLI 已帶)

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: ['plugin:vue/essential', '@vue/standard'],
  parserOptions: {
    parser: 'babel-eslint',
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  },
}

在項(xiàng)目的根目錄建立.prettierrc文件,鍵入以下代碼

{
  "semi": false,
  "singleQuote": true
}

在項(xiàng)目的根目錄建立.editorconfig文件,鍵入以下代碼(Vue CLI 已帶)

[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

至此,即可完成,詳細(xì)解釋請(qǐng)看后面

Vetur

這個(gè)插件是 vscode 能優(yōu)雅寫 Vue 的核心,絕對(duì)的神器,它的優(yōu)點(diǎn):

  1. 代碼高亮
  2. 代碼片段
  3. Emmet 語(yǔ)法支持
  4. 語(yǔ)法錯(cuò)誤校驗(yàn)檢查
  5. 格式化代碼
  6. 代碼提醒
  7. 對(duì)三方 UI 框架的支持

這里主要說(shuō)說(shuō)格式化代碼相關(guān),防止和 ESLint 打架。

從官方文檔可以看出,Vetur集成了prettier,這就非常棒了。Vetur能夠讓 *.vue 文件中不同的塊使用不同的格式化方案,