所有流程完全走通

This commit is contained in:
xiaogang 2024-07-10 17:59:21 +08:00
parent 4d0d1af253
commit 0300d56ec5
14 changed files with 69 additions and 110 deletions

View File

@ -40,7 +40,6 @@ const getPages = () => {
console.log('排除的模块以及页面',[...excludeModule,...excludePages]);
return {
exclude:[...excludeModule,...excludePages],
staticModule:[...completeModule,... Object.keys(targetModule)]
}
}

32
delete.js Normal file
View File

@ -0,0 +1,32 @@
const fs = require('fs-extra')
const path = require('path');
// Vite插件函数
function vitePluginRemoveDir(options = {}) {
// 默认要删除的目录名
const { dirName} = options;
if(!dirName.length){
return {}
}
return {
name: 'vite-plugin-remove-dir', // 插件名称
closeBundle(){
const distDir = path.resolve(process.cwd(), 'dist');
// 构建结束后执行的逻辑
for(const item of dirName){
const fullPath = path.join(distDir, ['production','test'].includes(process.env.NODE_ENV) ? 'build' : 'dev',process.env.UNI_PLATFORM,`static/${item}`); // 构造要删除的目录的完整路径
console.log('fullPath',fullPath);
// 尝试删除目录
try {
fs.removeSync(fullPath);
console.log(`目录${fullPath}成功删除.`);
} catch (err) {
console.log(`目录${fullPath}删除失败-->${err}`);
}
}
}
};
}
module.exports = vitePluginRemoveDir;

View File

@ -15,7 +15,7 @@
</head>
<body>
<div id="app"><!--app-html--></div>
<script src="./static/YT_Client_api.js"></script>
<script src="/static/ycnc/YT_Client_api.js"></script>
<script type="module" src="/src/main.js"></script>
<!-- 调试工具 -->
<script src="https://fastly.jsdelivr.net/npm/eruda"></script>

View File

@ -56,7 +56,6 @@
"@dcloudio/uni-quickapp-webview": "3.0.0-4010520240507001",
"@dcloudio/uni-ui": "^1.5.5",
"dayjs": "^1.11.11",
"fs.extra": "^1.3.2",
"js-md5": "^0.8.3",
"normalize.css": "^8.0.1",
"qs": "^6.12.1",
@ -72,6 +71,7 @@
"@dcloudio/vite-plugin-uni": "3.0.0-4010520240507001",
"@uni-helper/vite-plugin-uni-pages": "^0.2.23",
"@vue/runtime-core": "^3.4.21",
"fs-extra": "^11.2.0",
"sass": "^1.77.5",
"sass-loader": "^10.1.1",
"unocss": "~0.58.9",

View File

@ -56,9 +56,6 @@ importers:
dayjs:
specifier: ^1.11.11
version: 1.11.11
fs.extra:
specifier: ^1.3.2
version: 1.3.2
js-md5:
specifier: ^0.8.3
version: 0.8.3
@ -99,6 +96,9 @@ importers:
'@vue/runtime-core':
specifier: ^3.4.21
version: 3.4.28
fs-extra:
specifier: ^11.2.0
version: 11.2.0
sass:
specifier: ^1.77.5
version: 1.77.5
@ -2318,9 +2318,6 @@ packages:
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'}
foreachasync@3.0.0:
resolution: {integrity: sha512-J+ler7Ta54FwwNcx6wQRDhTIbNeyDcARMkOcguEqnEdtm0jKvN3Li3PDAb2Du3ubJYEWfYL83XMROXdsXAXycw==}
form-data@3.0.1:
resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==}
engines: {node: '>= 6'}
@ -2336,15 +2333,13 @@ packages:
resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
engines: {node: '>= 0.6'}
fs-extra@0.6.4:
resolution: {integrity: sha512-5rU898vl/Z948L+kkJedbmo/iltzmiF5bn/eEk0j/SgrPpI+Ydau9xlJPicV7Av2CHYBGz5LAlwTnBU80j1zPQ==}
fs-extra@10.1.0:
resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
engines: {node: '>=12'}
fs.extra@1.3.2:
resolution: {integrity: sha512-Ig401VXtyrWrz23k9KxAx9OrnL8AHSLNhQ8YJH2wSYuH0ZUfxwBeY6zXkd/oOyVRFTlpEu/0n5gHeuZt7aqbkw==}
fs-extra@11.2.0:
resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==}
engines: {node: '>=14.14'}
fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
@ -2769,9 +2764,6 @@ packages:
jsonc-parser@3.2.1:
resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==}
jsonfile@1.0.1:
resolution: {integrity: sha512-KbsDJNRfRPF5v49tMNf9sqyyGqGLBcz1v5kZT01kG5ns5mQSltwxCKVmUzVKtEinkUnTDtSrp6ngWpV7Xw0ZlA==}
jsonfile@6.1.0:
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
@ -2944,10 +2936,6 @@ packages:
minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
mkdirp@0.3.5:
resolution: {integrity: sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg==}
deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
mkdirp@0.5.6:
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
hasBin: true
@ -2979,10 +2967,6 @@ packages:
natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
ncp@0.4.2:
resolution: {integrity: sha512-PfGU8jYWdRl4FqJfCy0IzbkGyFHntfWygZg46nFk/dJD/XRrk2cj0SsKSX9n5u5gE0E0YfEpKWrEkfjnlZSTXA==}
hasBin: true
negotiator@0.6.3:
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
engines: {node: '>= 0.6'}
@ -3328,11 +3312,6 @@ packages:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
rimraf@2.2.8:
resolution: {integrity: sha512-R5KMKHnPAQaZMqLOsyuyUmcIjSeDm+73eoqQpaXA7AZ22BL+6C+1mcUscgOsNd8WVlJuvlgAPsegcx7pjlV0Dg==}
deprecated: Rimraf versions prior to v4 are no longer supported
hasBin: true
rimraf@3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
deprecated: Rimraf versions prior to v4 are no longer supported
@ -3785,9 +3764,6 @@ packages:
resolution: {integrity: sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==}
engines: {node: '>=10'}
walk@2.3.15:
resolution: {integrity: sha512-4eRTBZljBfIISK1Vnt69Gvr2w/wc3U6Vtrw7qiN5iqYJPH7LElcYh/iU4XWhdCy2dZqv1ToMyYlybDylfG/5Vg==}
walker@1.0.8:
resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==}
@ -7117,8 +7093,6 @@ snapshots:
locate-path: 6.0.0
path-exists: 4.0.0
foreachasync@3.0.0: {}
form-data@3.0.1:
dependencies:
asynckit: 0.4.0
@ -7131,24 +7105,17 @@ snapshots:
fresh@0.5.2: {}
fs-extra@0.6.4:
dependencies:
jsonfile: 1.0.1
mkdirp: 0.3.5
ncp: 0.4.2
rimraf: 2.2.8
fs-extra@10.1.0:
dependencies:
graceful-fs: 4.2.11
jsonfile: 6.1.0
universalify: 2.0.1
fs.extra@1.3.2:
fs-extra@11.2.0:
dependencies:
fs-extra: 0.6.4
mkdirp: 0.3.5
walk: 2.3.15
graceful-fs: 4.2.11
jsonfile: 6.1.0
universalify: 2.0.1
fs.realpath@1.0.0: {}
@ -7786,8 +7753,6 @@ snapshots:
jsonc-parser@3.2.1: {}
jsonfile@1.0.1: {}
jsonfile@6.1.0:
dependencies:
universalify: 2.0.1
@ -7938,8 +7903,6 @@ snapshots:
minimist@1.2.8: {}
mkdirp@0.3.5: {}
mkdirp@0.5.6:
dependencies:
minimist: 1.2.8
@ -7965,8 +7928,6 @@ snapshots:
natural-compare@1.4.0: {}
ncp@0.4.2: {}
negotiator@0.6.3: {}
neo-async@2.6.2: {}
@ -8287,8 +8248,6 @@ snapshots:
reusify@1.0.4: {}
rimraf@2.2.8: {}
rimraf@3.0.2:
dependencies:
glob: 7.2.3
@ -8750,10 +8709,6 @@ snapshots:
dependencies:
xml-name-validator: 3.0.0
walk@2.3.15:
dependencies:
foreachasync: 3.0.0
walker@1.0.8:
dependencies:
makeerror: 1.0.12

View File

@ -1,18 +0,0 @@
import http from "../utils/http";
export const checkTradeNo = (params) => http({
url:'/backend/zxjt_redpacket/orders/is_exist',
method:'POST',
...params
})
export const getAccessPage = (params) => http({
url:'/backend/zxjt_redpacket/orders/access_page',
...params
})
export const sendPacket = (params) => http({
url:'/backend/zxjt_redpacket/orders/send_packet',
method:'POST',
...params
})

View File

@ -3,6 +3,8 @@ import qs from 'qs'
// 请求基准地址
const baseUrl = import.meta.env.VITE_BASE_URL
// 拦截器配置
const httpInterceptor = {
// 拦截前触发

View File

@ -5,6 +5,13 @@
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
"h5" : {
"optimization":{
"treeShaking":{
"enable":true //
}
}
},
/* 5+App */
"app-plus" : {
"usingComponents" : true,

View File

@ -16,8 +16,8 @@
<view class="detail flex flex-col flex-justify-between">
<view class="proname">{{ detailObj.name }}</view>
<view class="num">
<text class="price">{{ detailObj.show_price }}</text>
<text class="ori">{{ detailObj.price }}</text>
<text class="price">{{ detailObj.price }}</text>
<text class="ori">{{ detailObj.show_price }}</text>
</view>
</view>
<view class="desc" v-html="detailObj.description">
@ -75,7 +75,7 @@
goPay({params}).then(res => {
const {order_no,notify_url} = res;
const {payFunc} = usePay();
payFunc({order_no,notify_url,voucherAmount})
payFunc({order_no,notify_url,TranAmt:detailObj.price})
}).catch(err => {
console.log(err);
})

View File

@ -12,12 +12,11 @@ const handleParams = (obj) => Object.entries(obj).reduce((total,curr) => {
export default function usePay(){
const payFunc = (args) => {
const {order_no,notify_url,voucherAmount} = args;
const {order_no,notify_url,TranAmt} = args;
const Plain = {
MercUrl:notify_url,
TranAmt:Number(voucherAmount).toFixed(2),
TranAmt:Number(TranAmt).toFixed(2),
TermSsn:order_no,
// BackLink:`${window.location.origin}/#/pages/ycnc/orderDetail?order_no=${order_no}`,
BackLink:encodeURIComponent(`${window.location.origin}/#/pages/ycnc/orderDetail?order_no=${order_no}`),
psbcmcc:'LSXD',
TxnDt:dayjs(Date.now()).format('YYYY-MM-DD'),

View File

@ -51,7 +51,7 @@
goPay({params}).then(res => {
const {order_no,notify_url} = res;
const {payFunc} = usePay();
payFunc({order_no,notify_url,voucherAmount})
payFunc({order_no,notify_url,TranAmt:voucherAmount})
}).catch(err => {
console.log(err);
})
@ -136,6 +136,6 @@
min-height:100vh;
background: url('/static/ycnc/bg.png') no-repeat;
background-size:cover;
padding-top:730rpx;
padding-top:750rpx;
}
</style>

View File

@ -95,7 +95,7 @@
console.log(orderData);
const {order_no,notify_url,price} = orderData;
const {payFunc} = usePay();
payFunc({order_no,notify_url,price})
payFunc({order_no,notify_url,TranAmt:price})
}
function viewDetail(orderData){

View File

@ -1,40 +1,23 @@
import { defineConfig } from 'vite'
import path from 'path';
import fs from 'fs-extra';
import uni from '@dcloudio/vite-plugin-uni'
import UniPages from '@uni-helper/vite-plugin-uni-pages'
import UnoCSS from 'unocss/vite'
import zipPack from "vite-plugin-zip-pack"
import dayjs from "dayjs";
// https://vitejs.dev/config/
import vitePluginRemoveDir from './delete'; // 自己写的删除插件
import getPages from './build'
const {exclude,staticModule} = getPages();
const {exclude} = getPages();
const excludeStaticModule = exclude.filter(item => item.indexOf('.vue') === -1)
const timeStringNow = dayjs().format("YYYY-MM-DD HH-mm-ss")
// const timeStringNow = dayjs().format("YYYY-MM-DD HH-mm-ss")
const timeStringNow = dayjs().format("MM-DD HH-mm-ss")
console.log('staticModule',staticModule);
function copyFile() {
return {
enforce: 'post',
async writeBundle() {
await fs.copy(
path.resolve(__dirname,`src/static/ycnc`),
path.join(
__dirname,
'dist',
process.env.NODE_ENV === 'production' ? 'build' : 'dev',
process.env.UNI_PLATFORM,
'static/ycnc'
)
);
},
};
}
export default defineConfig(({ command, mode }) => {
const { UNI_PLATFORM } = process.env // 得到 mp-weixin, h5, app 等
console.log(process.env.NODE_ENV);
console.log({command,mode});
return {
plugins: [
UniPages({
@ -45,8 +28,8 @@ export default defineConfig(({ command, mode }) => {
// subPackages: ['src/pages-sub'], // 是个数组可以配置多个但是不能为pages里面的目录
}),
uni(),
vitePluginRemoveDir({dirName:excludeStaticModule}),
UnoCSS(),
// copyFile(),
zipPack({
inDir: `dist/build/${UNI_PLATFORM}`, // 输入的文件夹,就是要打包的文件夹
outDir: `dist/build`, // 打包好的 zip 文件放到哪个文件夹下