111
This commit is contained in:
1 parent
64a74564bb
commit
3105fdb07b
8 files changed
+4957
-3861
No files matched your search
@@ -1,13 +1,13 @@
|
||||
# ******************** start 开发环境 start ********************
|
||||
|
||||
VITE_APP_DEV_SERVICE =http://localhost:48080/app-api
|
||||
# VITE_APP_DEV_SERVICE =http://123.156.228.134:48080/dev-api/app-api
|
||||
# VITE_APP_DEV_SERVICE =http://localhost:48080/app-api
|
||||
VITE_APP_DEV_SERVICE =http://123.156.228.134:48080/app-api
|
||||
|
||||
# ******************** end 开发环境 end ********************
|
||||
|
||||
|
||||
# ******************** start 生产环境 start ********************
|
||||
|
||||
VITE_APP_PROD_SERVICE = http://123.156.228.134:48080
|
||||
VITE_APP_PROD_SERVICE = http://123.156.228.134:48080/app-api
|
||||
|
||||
# ******************** end 生产环境 end ********************
|
||||
Generated
+4816
-3729
File diff suppressed because it is too large.
Load diff
+42
-36
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"name" : "",
|
||||
"appid" : "",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"name": "",
|
||||
"appid": "",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
"modules": {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
"distribute": {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
@@ -41,32 +41,38 @@
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
"ios": {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
"sdkConfigs": {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
"quickapp": {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
"mp-weixin": {
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents" : true
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion" : "3"
|
||||
}
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"router": {
|
||||
"base": "/H5/",
|
||||
"mode": "hash"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
{
|
||||
"path": "pages/tabbar/home",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationBarTitleText": "首页",
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -52,7 +52,7 @@ const getShopCar = async () => {
|
||||
const { data } = await foodApi.getShopCar(_pa)
|
||||
console.log(data, "data");
|
||||
|
||||
state.carList = data
|
||||
state.carList = data ?? []
|
||||
state.totPrice = state.carList
|
||||
.map(v => v.totalPrice)
|
||||
.reduce((pre, next) => pre + next, 0);
|
||||
@@ -262,7 +262,7 @@ const doFood = () => {
|
||||
<view class="flex-row">
|
||||
<scroll-view scroll-y :style="{ height: getHeight() }"
|
||||
class="menu w-200rpx h-full p-l-12rpx p-b-20rpx bg-#f6f6f6">
|
||||
<view class="menu_item flex-row-center" v-for="( v, i ) in state.classifyList " :key="v.id"
|
||||
<view class="menu_item flex-row-center" v-for="( v, i ) in state.classifyList " :key="v.id"
|
||||
:class="[{ 'menu_item_active': i == state.currentClassifyIndex }]" @tap="doClassify(i)">
|
||||
<view class="menu_item_title show-line">
|
||||
{{ v.name }}
|
||||
@@ -270,7 +270,7 @@ const doFood = () => {
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view scroll-y :style="{ height: getHeight() }" class="flex-1 p-b-20rpx">
|
||||
<view v-for="( cV, cI ) in state.shopList " :key="cI">
|
||||
<view v-for="( cV, cI ) in state.shopList " :key="cI">
|
||||
<view class="flex-row-center m-y-20rpx">
|
||||
<view class="w-25rpx h-1px bg-#d2d2d2" />
|
||||
<text class="p-x-15rpx second-text-28">
|
||||
@@ -279,7 +279,7 @@ const doFood = () => {
|
||||
<view class="w-25rpx h-1px bg-#d2d2d2" />
|
||||
</view>
|
||||
<view class="m-x-15rpx">
|
||||
<product-row v-for="( pV, pI ) in cV.foodSPURespVOList " :key="pV.id"
|
||||
<product-row v-for="( pV, pI ) in cV.foodSPURespVOList " :key="pV.id"
|
||||
v-model="pV.productCount" :productId="pV.productId" :pic="pV.picUrl" :name="pV.name"
|
||||
:price="pV.price" :marketPrice="pV.marketPrice" :salesCount="pV.salesCount"
|
||||
:stock="pV.stock" @add="doAdd(pV)" @remove="remove(pV)" />
|
||||
|
||||
@@ -1 +1 @@
|
||||
export {useRouter} from "./use-router/vite-router-plug"
|
||||
export { useRouter } from "./use-router/vite-router-plug";
|
||||
@@ -1,99 +1,99 @@
|
||||
import fs from 'fs';
|
||||
import stripJsonComments from './strip-json-comments';
|
||||
import fs from "fs";
|
||||
import stripJsonComments from "./strip-json-comments";
|
||||
|
||||
class TransformPages {
|
||||
routes: any = []
|
||||
tabbar: any = []
|
||||
includes = []
|
||||
uniPagesJSON: any = ""
|
||||
routes: any = [];
|
||||
tabbar: any = [];
|
||||
includes = [];
|
||||
uniPagesJSON: any = "";
|
||||
|
||||
constructor({
|
||||
includes,
|
||||
pagesJsonDir
|
||||
}: any) {
|
||||
this.includes = includes;
|
||||
this.uniPagesJSON = JSON.parse(stripJsonComments(fs.readFileSync(pagesJsonDir, 'utf-8')))
|
||||
this.routes = this.getPagesRoutes().concat(this.getSubPackagesRoutes())
|
||||
this.tabbar = this.getTabbarRoutes()
|
||||
}
|
||||
constructor({ includes, pagesJsonDir }: any) {
|
||||
this.includes = includes;
|
||||
this.uniPagesJSON = JSON.parse(
|
||||
stripJsonComments(fs.readFileSync(pagesJsonDir, "utf-8"))
|
||||
);
|
||||
this.routes = this.getPagesRoutes().concat(this.getSubPackagesRoutes());
|
||||
this.tabbar = this.getTabbarRoutes();
|
||||
}
|
||||
|
||||
getPagesRoutes(pages = this.uniPagesJSON.pages, rootPath = null) {
|
||||
let routes = [];
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
const item = pages[i];
|
||||
let route: any = {};
|
||||
for (let j = 0; j < this.includes.length; j++) {
|
||||
const key = this.includes[j];
|
||||
let value = item[key];
|
||||
if (key === 'path') {
|
||||
value = rootPath ? `/${rootPath}/${value}` : `/${value}`;
|
||||
}
|
||||
if (key === 'aliasPath' && i == 0 && rootPath == null) {
|
||||
route[key] = route[key] || '/';
|
||||
} else if (value !== undefined) {
|
||||
route[key] = value;
|
||||
}
|
||||
}
|
||||
routes.push(route);
|
||||
getPagesRoutes(pages = this.uniPagesJSON.pages, rootPath = null) {
|
||||
let routes = [];
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
const item = pages[i];
|
||||
let route: any = {};
|
||||
for (let j = 0; j < this.includes.length; j++) {
|
||||
const key = this.includes[j];
|
||||
let value = item[key];
|
||||
if (key === "path") {
|
||||
value = rootPath ? `/${rootPath}/${value}` : `/${value}`;
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
getSubPackagesRoutes() {
|
||||
if (!(this.uniPagesJSON && this.uniPagesJSON.subPackages)) {
|
||||
return [];
|
||||
if (key === "aliasPath" && i == 0 && rootPath == null) {
|
||||
route[key] = route[key] || "/";
|
||||
} else if (value !== undefined) {
|
||||
route[key] = value;
|
||||
}
|
||||
const subPackages = this.uniPagesJSON.subPackages;
|
||||
let routes: any = [];
|
||||
for (let i = 0; i < subPackages.length; i++) {
|
||||
const subPages = subPackages[i].pages;
|
||||
const root = subPackages[i].root;
|
||||
const subRoutes = this.getPagesRoutes(subPages, root);
|
||||
routes = routes.concat(subRoutes);
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
routes.push(route);
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
getTabbarRoutes() {
|
||||
if (!(this.uniPagesJSON && this.uniPagesJSON.tabBar && this.uniPagesJSON.tabBar.list)) {
|
||||
return [];
|
||||
}
|
||||
const tabbar = this.uniPagesJSON.tabBar.list;
|
||||
let tabbarMap: any = [];
|
||||
tabbar.forEach((bar: { pagePath: string; }) => {
|
||||
tabbarMap.push('/' + bar.pagePath);
|
||||
});
|
||||
return tabbarMap;
|
||||
getSubPackagesRoutes() {
|
||||
if (!(this.uniPagesJSON && this.uniPagesJSON.subPackages)) {
|
||||
return [];
|
||||
}
|
||||
const subPackages = this.uniPagesJSON.subPackages;
|
||||
let routes: any = [];
|
||||
for (let i = 0; i < subPackages.length; i++) {
|
||||
const subPages = subPackages[i].pages;
|
||||
const root = subPackages[i].root;
|
||||
const subRoutes = this.getPagesRoutes(subPages, root);
|
||||
routes = routes.concat(subRoutes);
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const useRouter = ({
|
||||
pagesJsonDir,
|
||||
includes = []
|
||||
}: any) => {
|
||||
let defaultIncludes = ['path', 'aliasPath', 'name'];
|
||||
includes = [...defaultIncludes, ...includes];
|
||||
let pages = new TransformPages({
|
||||
pagesJsonDir,
|
||||
includes,
|
||||
getTabbarRoutes() {
|
||||
if (
|
||||
!(
|
||||
this.uniPagesJSON &&
|
||||
this.uniPagesJSON.tabBar &&
|
||||
this.uniPagesJSON.tabBar.list
|
||||
)
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
const tabbar = this.uniPagesJSON.tabBar.list;
|
||||
let tabbarMap: any = [];
|
||||
tabbar.forEach((bar: { pagePath: string }) => {
|
||||
tabbarMap.push("/" + bar.pagePath);
|
||||
});
|
||||
if (pages.tabbar && pages.tabbar.length) {
|
||||
console.table(pages.tabbar);
|
||||
}
|
||||
if (pages.routes && pages.routes.length) {
|
||||
console.table(pages.routes);
|
||||
}
|
||||
return {
|
||||
name: 'use-router',
|
||||
config() {
|
||||
return {
|
||||
define: {
|
||||
__ROUTES__: JSON.stringify(pages.routes),
|
||||
__TABBAR__: `(${JSON.stringify(pages.tabbar)})`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tabbarMap;
|
||||
}
|
||||
}
|
||||
|
||||
export const useRouter = ({ pagesJsonDir, includes = [] }: any) => {
|
||||
let defaultIncludes = ["path", "aliasPath", "name"];
|
||||
includes = [...defaultIncludes, ...includes];
|
||||
let pages = new TransformPages({
|
||||
pagesJsonDir,
|
||||
includes,
|
||||
});
|
||||
if (pages.tabbar && pages.tabbar.length) {
|
||||
console.table(pages.tabbar);
|
||||
}
|
||||
if (pages.routes && pages.routes.length) {
|
||||
console.table(pages.routes);
|
||||
}
|
||||
return {
|
||||
name: "use-router",
|
||||
config() {
|
||||
return {
|
||||
define: {
|
||||
__ROUTES__: JSON.stringify(pages.routes),
|
||||
__TABBAR__: JSON.stringify(pages.tabbar),
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -16,6 +16,9 @@ export default defineConfig(({ mode }) => {
|
||||
NODE_ENV == "development" ? VITE_APP_DEV_SERVICE : VITE_APP_PROD_SERVICE;
|
||||
|
||||
return {
|
||||
build: {
|
||||
target: "es6",
|
||||
},
|
||||
plugins: [
|
||||
uni(),
|
||||
Unocss(),
|
||||
|
||||
Reference in new issue
Block a user