代码进行分包处理

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() {
uni.navigateTo({
url: '/pages/addBrand/addBrand'
})
url: '/package_a/addBrand/addBrand'
})
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -191,7 +191,7 @@
if(res.code == 200){
data = res.data;
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{
@ -314,7 +314,7 @@
if(res.code == 200){
let data = res.data;
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{

View File

@ -24,45 +24,37 @@
"style": {
"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": [
{
"root": "pages/common",
"root": "package_a",
"pages": [
{"path": "webview/index",
"style": {
"navigationBarTitleText": "浏览网页"
}
},
{
"path": "textview/index",
"style": {
"navigationBarTitleText": "浏览文本"
}
}
{ "path": "product/product", "style": { "navigationBarTitleText": "" } },
{ "path": "translation/translation", "style": { "navigationBarTitleText": "录入清单" } },
{ "path": "addProduct/addProduct", "style": { "navigationBarTitleText": "" } },
{ "path": "batchDeleteProduct/batchDeleteProduct", "style": { "navigationBarTitleText": "" } },
{ "path": "edit/edit", "style": { "navigationBarTitleText": "" } },
{ "path": "addBrand/addBrand", "style": { "navigationBarTitleText": "" } },
{ "path": "BrandSelector/BrandSelector", "style": { "navigationBarTitleText": "选择品牌" } },
{ "path": "user/user", "style": { "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() {
uni.navigateTo({
url: '/pages/user/user'
url: '/package_a/user/user'
})
},
goSetting(){
uni.navigateTo({
url: '/pages/settings/settings'
url: '/package_a/settings/settings'
})
},
goToProduct() {
uni.navigateTo({
url: '/pages/product/product'
url: '/package_a/product/product'
})
},
goToAsset() {
uni.navigateTo({
url: '/pages/asset/asset'
url: '/package_a/asset/asset'
})
},
goToBack(){
uni.navigateTo({
url:'/pages/back/back'
url:'/package_a/back/back'
})
},
// reLaunchToA() {

View File

@ -76,12 +76,12 @@
//
handlePrivacy() {
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() {
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() {
@ -131,7 +131,7 @@
//
uni.redirectTo({
url: '/pages/storeSelect/storeSelect'
url: '/package_a/storeSelect/storeSelect'
})
})
}

View File

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

View File

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