代码进行分包处理

master
denghaohaoya 2026-03-28 21:37:27 +08:00
parent 2a90fe91bc
commit 20744820b7
32 changed files with 66 additions and 70 deletions

View File

@ -124,8 +124,8 @@ export default {
// //
goToAddBrand() { goToAddBrand() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/addBrand/addBrand' url: '/package_a/addBrand/addBrand'
}) })
} }
} }
} }

View File

@ -51,10 +51,11 @@
"appid" : "wx025fc2befe501fda", "appid" : "wx025fc2befe501fda",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : false, "es6" : true,
"minified" : true, "minified" : true,
"postcss" : true "postcss" : true
}, },
"lazyCodeLoading": "requiredComponents",
"optimization" : { "optimization" : {
"subPackages" : true "subPackages" : true
}, },

View File

@ -13,7 +13,7 @@
<input <input
class="item-input" class="item-input"
type="text" type="text"
placeholder="农夫山泉东方树叶乌龙茶500ml" placeholder="名称"
v-model="productInfo.name" v-model="productInfo.name"
/> />
</view> </view>
@ -25,7 +25,7 @@
<input <input
class="item-input barcode-input" class="item-input barcode-input"
type="text" type="text"
placeholder="6921168558032" placeholder="条码/条码扫码"
v-model="productInfo.barcode" v-model="productInfo.barcode"
/> />
<view class="scan-btn" @tap="handleScan"> <view class="scan-btn" @tap="handleScan">
@ -295,12 +295,15 @@ export default {
}, },
onLoad(options) { onLoad(options) {
console.log('页面参数:', options,apiUrl); console.log('页面参数:', options,apiUrl);
this.url = apiUrl this.url = apiUrl
// //
if (options && options.fromData) { if (options && options.fromData) {
try { try {
this.productInfo.barcode = options.barcode this.productInfo.barcode = options.barcode
const fromData = JSON.parse(options.fromData)[0]; // 使 decodeURIComponent
const decodedData = decodeURIComponent(options.fromData);
console.log('解码数据',decodedData);
const fromData = JSON.parse(decodedData)[0];
this.productInfo.name = fromData.productName || ''; this.productInfo.name = fromData.productName || '';
this.productInfo.cost = fromData.costPrice || ''; this.productInfo.cost = fromData.costPrice || '';
this.productInfo.barcode = fromData.productBarCode || ''; this.productInfo.barcode = fromData.productBarCode || '';

View File

@ -842,7 +842,7 @@ export default {
goToBrandManagement() { goToBrandManagement() {
this.showBrandSelector = false; this.showBrandSelector = false;
uni.navigateTo({ uni.navigateTo({
url: '/pages/addBrand/addBrand' url: '/package_a/addBrand/addBrand'
}); });
}, },
// //
@ -873,7 +873,7 @@ export default {
goToCategoryManagement() { goToCategoryManagement() {
this.showCategorySelector = false; this.showCategorySelector = false;
uni.navigateTo({ uni.navigateTo({
url: '/pages/category/category' url: '/package_a/category/category'
}); });
} }
} }

View File

@ -145,10 +145,10 @@ export default {
uni.navigateBack({ delta: 1 }); uni.navigateBack({ delta: 1 });
}, },
goImport() { goImport() {
uni.navigateTo({ url: '/pages/import/import' }); uni.navigateTo({ url: '/package_a/import/import' });
}, },
goNoCode() { goNoCode() {
uni.navigateTo({ url: '/pages/NoCode/NoCode' }); uni.navigateTo({ url: '/package_a/NoCode/NoCode' });
}, },
goRecord() { goRecord() {
uni.showToast({ title: '记录功能开发中', icon: 'none' }); uni.showToast({ title: '记录功能开发中', icon: 'none' });

View File

@ -55,7 +55,7 @@
}, },
methods: { methods: {
handleText(item) { handleText(item) {
this.$tab.navigateTo(`/pages/common/textview/index?title=${item.title}&content=${item.content}`) this.$tab.navigateTo(`/package_a/common/textview/index?title=${item.title}&content=${item.content}`)
} }
} }
} }

View File

@ -39,7 +39,7 @@
}, },
methods: { methods: {
handleToPwd() { handleToPwd() {
this.$tab.navigateTo('/pages/mine/pwd/index') this.$tab.navigateTo('/package_a/mine/pwd/index')
}, },
handleToUpgrade() { handleToUpgrade() {
this.$modal.showToast('模块建设中~') this.$modal.showToast('模块建设中~')

View File

@ -358,7 +358,7 @@
goToStockDetail(item) { goToStockDetail(item) {
// ID // ID
uni.navigateTo({ uni.navigateTo({
url: `/pages/edit/edit?id=${item.id}` url: `/package_a/edit/edit?id=${item.id}`
}); });
}, },
@ -403,7 +403,7 @@
addNewGoods() { addNewGoods() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/translation/translation' url: '/package_a/translation/translation'
}) })
}, },
@ -473,21 +473,21 @@
batchDeleteGoods() { batchDeleteGoods() {
this.$refs.popup.close(); this.$refs.popup.close();
uni.navigateTo({ uni.navigateTo({
url: '/pages/batchDeleteProduct/batchDeleteProduct' url: '/package_a/batchDeleteProduct/batchDeleteProduct'
}); });
}, },
// //
goToCategoryManagement() { goToCategoryManagement() {
this.$refs.popup.close(); this.$refs.popup.close();
uni.navigateTo({ uni.navigateTo({
url: '/pages/category/category' url: '/package_a/category/category'
}); });
}, },
// //
goToBrandManagement() { goToBrandManagement() {
this.$refs.popup.close(); this.$refs.popup.close();
uni.navigateTo({ uni.navigateTo({
url: '/pages/addBrand/addBrand' url: '/package_a/addBrand/addBrand'
}); });
}, },
// //

View File

@ -191,7 +191,7 @@
if(res.code == 200){ if(res.code == 200){
data = res.data; data = res.data;
uni.navigateTo({ uni.navigateTo({
url: `/pages/addProduct/addProduct?barcode=${this.lastResult}&fromData=${JSON.stringify(data)}` url: `/package_a/addProduct/addProduct?barcode=${this.lastResult}&fromData=${encodeURIComponent(JSON.stringify(data))}`
}) })
} }
else{ else{
@ -314,7 +314,7 @@
if(res.code == 200){ if(res.code == 200){
let data = res.data; let data = res.data;
uni.navigateTo({ uni.navigateTo({
url: `/pages/addProduct/addProduct?barcode=6901028064835&fromData=${JSON.stringify(data)}` url: `/package_a/addProduct/addProduct?barcode=6901028064835&fromData=${encodeURIComponent(JSON.stringify(data))}`
}) })
} }
else{ else{

View File

@ -24,45 +24,37 @@
"style": { "style": {
"navigationBarTitleText": "我的" "navigationBarTitleText": "我的"
} }
}, {"path": "pages/product/product", }
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/translation/translation",
"style": { "navigationBarTitleText": "录入清单" }
},
{ "path": "pages/addProduct/addProduct", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/batchDeleteProduct/batchDeleteProduct", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/edit/edit", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/addBrand/addBrand", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/BrandSelector/BrandSelector", "style": { "navigationBarTitleText": "选择品牌" } },
{ "path": "pages/user/user", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/settings/settings", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/asset/asset", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/enter/enter", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/storeSelect/storeSelect", "style": { "navigationBarTitleText": "选择门店" } },
{ "path": "pages/import/import", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/userStores/userStores", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/category/category", "style": { "navigationBarTitleText": "" } },
{ "path": "pages/back/back", "style": { "navigationBarTitleText": "" } }
], ],
"subPackages": [ "subPackages": [
{ {
"root": "pages/common", "root": "package_a",
"pages": [ "pages": [
{"path": "webview/index", { "path": "product/product", "style": { "navigationBarTitleText": "" } },
"style": { { "path": "translation/translation", "style": { "navigationBarTitleText": "录入清单" } },
"navigationBarTitleText": "浏览网页" { "path": "addProduct/addProduct", "style": { "navigationBarTitleText": "" } },
} { "path": "batchDeleteProduct/batchDeleteProduct", "style": { "navigationBarTitleText": "" } },
}, { "path": "edit/edit", "style": { "navigationBarTitleText": "" } },
{ { "path": "addBrand/addBrand", "style": { "navigationBarTitleText": "" } },
"path": "textview/index", { "path": "BrandSelector/BrandSelector", "style": { "navigationBarTitleText": "选择品牌" } },
"style": { { "path": "user/user", "style": { "navigationBarTitleText": "" } },
"navigationBarTitleText": "浏览文本" { "path": "userStores/userStores", "style": { "navigationBarTitleText": "" } },
} { "path": "settings/settings", "style": { "navigationBarTitleText": "" } },
} { "path": "asset/asset", "style": { "navigationBarTitleText": "" } },
{ "path": "enter/enter", "style": { "navigationBarTitleText": "" } },
{ "path": "storeSelect/storeSelect", "style": { "navigationBarTitleText": "选择门店" } },
{ "path": "import/import", "style": { "navigationBarTitleText": "" } },
{ "path": "category/category", "style": { "navigationBarTitleText": "" } },
{ "path": "back/back", "style": { "navigationBarTitleText": "" } },
{ "path": "mine/info/index", "style": { "navigationBarTitleText": "个人信息" } },
{ "path": "mine/info/edit", "style": { "navigationBarTitleText": "编辑资料" } },
{ "path": "mine/setting/index", "style": { "navigationBarTitleText": "应用设置" } },
{ "path": "mine/avatar/index", "style": { "navigationBarTitleText": "修改头像" } },
{ "path": "mine/help/index", "style": { "navigationBarTitleText": "常见问题" } },
{ "path": "mine/about/index", "style": { "navigationBarTitleText": "关于我们" } },
{ "path": "mine/pwd/index", "style": { "navigationBarTitleText": "修改密码" } },
{ "path": "common/webview/index", "style": { "navigationBarTitleText": "浏览网页" } },
{ "path": "common/textview/index", "style": { "navigationBarTitleText": "浏览文本" } }
] ]
} }
], ],

View File

@ -343,27 +343,27 @@ export default {
}, },
goToUser() { goToUser() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/user' url: '/package_a/user/user'
}) })
}, },
goSetting(){ goSetting(){
uni.navigateTo({ uni.navigateTo({
url: '/pages/settings/settings' url: '/package_a/settings/settings'
}) })
}, },
goToProduct() { goToProduct() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/product/product' url: '/package_a/product/product'
}) })
}, },
goToAsset() { goToAsset() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/asset/asset' url: '/package_a/asset/asset'
}) })
}, },
goToBack(){ goToBack(){
uni.navigateTo({ uni.navigateTo({
url:'/pages/back/back' url:'/package_a/back/back'
}) })
}, },
// reLaunchToA() { // reLaunchToA() {

View File

@ -76,12 +76,12 @@
// //
handlePrivacy() { handlePrivacy() {
let site = this.globalConfig.appInfo.agreements[0] let site = this.globalConfig.appInfo.agreements[0]
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`) this.$tab.navigateTo(`/package_a/common/webview/index?title=${site.title}&url=${site.url}`)
}, },
// //
handleUserAgrement() { handleUserAgrement() {
let site = this.globalConfig.appInfo.agreements[1] let site = this.globalConfig.appInfo.agreements[1]
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`) this.$tab.navigateTo(`/package_a/common/webview/index?title=${site.title}&url=${site.url}`)
}, },
// //
getCode() { getCode() {
@ -131,7 +131,7 @@
// //
uni.redirectTo({ uni.redirectTo({
url: '/pages/storeSelect/storeSelect' url: '/package_a/storeSelect/storeSelect'
}) })
}) })
} }

View File

@ -93,25 +93,25 @@
}, },
methods: { methods: {
handleToInfo() { handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index') this.$tab.navigateTo('/package_a/mine/info/index')
}, },
handleToEditInfo() { handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit') this.$tab.navigateTo('/package_a/mine/info/edit')
}, },
handleToSetting() { handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index') this.$tab.navigateTo('/package_a/mine/setting/index')
}, },
handleToLogin() { handleToLogin() {
this.$tab.reLaunch('/pages/login') this.$tab.reLaunch('/pages/login')
}, },
handleToAvatar() { handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index') this.$tab.navigateTo('/package_a/mine/avatar/index')
}, },
handleHelp() { handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index') this.$tab.navigateTo('/package_a/mine/help/index')
}, },
handleAbout() { handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index') this.$tab.navigateTo('/package_a/mine/about/index')
}, },
handleJiaoLiuQun() { handleJiaoLiuQun() {
this.$modal.showToast('QQ群①133713780(满)、②146013835(满)、③189091635') this.$modal.showToast('QQ群①133713780(满)、②146013835(满)、③189091635')

View File

@ -5,7 +5,7 @@ const loginPage = "/pages/login"
// 页面白名单 // 页面白名单
const whiteList = [ const whiteList = [
'/pages/login', '/pages/register', '/pages/common/webview/index' '/pages/login', '/pages/register', '/package_a/common/webview/index'
] ]
// 检查地址白名单 // 检查地址白名单