Jelajahi Sumber

新增 bat 文件

lalala 6 tahun lalu
induk
melakukan
87b56dde4f

+ 0 - 1
mobile-code/src/App.vue

@@ -8,7 +8,6 @@ export default {
 	globalData: {
 	},
 	onLaunch() {
-		uni.setStorageSync('source', 'mobile')
 		// this.getAllOptions()
 		wxLoginFn()
 		// #ifdef MP-WEIXIN

+ 104 - 0
mobile-code/src/change.bat

@@ -0,0 +1,104 @@
+@echo off
+echo start......
+echo,
+set isMobile=business
+set mobile=m-
+set business=b-
+set manifest=manifest.json
+set pages=pages.json
+set config=config.js
+set /a sum=0
+
+for %%m in (*) do (
+	if "%%m"=="m-manifest.json" (
+		set isMobile=mobile
+	)
+)
+
+echo %isMobile%
+
+if "%isMobile%"=="mobile" (
+	echo %isMobile%
+	for %%z in (*) do (
+		echo %%z
+		if "%%z"=="manifest.json" (
+			ren %%z %business%%%z
+			set /a sum+=1
+		)
+		if "%%z"=="pages.json" (
+			ren %%z %business%%%z
+			set /a sum+=1
+			
+		)
+		if "%%z"=="config.js" (
+			ren %%z %business%%%z
+			set /a sum+=1
+		)
+	)
+	echo,
+	for %%z in (*) do (
+		echo %%z
+		if "%%z"=="m-manifest.json" (
+			ren %%z %manifest%
+			set /a sum+=1
+		)
+		if "%%z"=="m-pages.json" (
+			ren %%z %pages%
+			set /a sum+=1
+		)
+		if "%%z"=="m-config.js" (
+			ren %%z %config%
+			set /a sum+=1
+		)
+	)
+) else (
+	echo %isMobile%
+	for %%z in (*) do (
+		echo %%z
+		if "%%z"=="manifest.json" (
+			ren %%z %mobile%%%z
+			set /a sum+=1
+		)
+		if "%%z"=="pages.json" (
+			ren %%z %mobile%%%z
+			set /a sum+=1
+		)
+		if "%%z"=="config.js" (
+			ren %%z %mobile%%%z
+			set /a sum+=1
+		)
+	)
+	echo,
+	for %%z in (*) do (
+		echo %%z
+		if "%%z"=="b-manifest.json" (
+			ren %%z %manifest%
+			set /a sum+=1
+		)
+		if "%%z"=="b-pages.json" (
+			ren %%z %pages%
+			set /a sum+=1
+		)
+		if "%%z"=="b-config.js" (
+			ren %%z %config%
+			set /a sum+=1
+		)
+	)
+)
+echo,
+echo file change success to *********    %isMobile%
+echo,
+echo ******************  ljd  ********************
+echo,
+echo end ******  %sum%  ****** file is change confirm
+echo,
+echo ******************  jmq  *******************
+echo,
+set isMobile=
+set mobile=
+set business=
+set manifest=
+set pages=
+set config=
+set sum=
+PAUSE

+ 2 - 0
mobile-code/src/config.js

@@ -0,0 +1,2 @@
+// 项目配置--由bat脚本变更
+export const ProjectName = 'business'

+ 19 - 4
mobile-code/src/constant/index.js

@@ -1,13 +1,28 @@
+import { ProjectName } from '@/config'
+
 // 常量索引
 const envVal = {
 	imgUrl: 'https://wximg.meijiabang.com/hkds/miniapp/images/',
 	env: process.env.NODE_ENV,
 	// 本地连接地址
-	// formal: process.env.NODE_ENV == 'development' ? 'http://m.huaml.com' : `${window.location.protocol}//${window.location.host}`,
-	hostUrl: process.env.NODE_ENV == 'development' ? 'http://b.huaml.com' : `${window.location.protocol}//${window.location.host}`,
+	hostUrl: null,
 	// 请求接口地址
-	// hostUrl: process.env.NODE_ENV == 'development' ? 'http://mobile.huaml.com' : `${window.location.protocol}//mobile.huaml.com`
-	formal: process.env.NODE_ENV == 'development' ? 'http://api.b.huaml.com' : `http://api.b.huaml.com`
+	formal: null
+}
+
+// 项目配置
+if (ProjectName == 'mobile') {
+	envVal.formal = process.env.NODE_ENV == 'development' ? 'http://m.huaml.com' : `${window.location.protocol}//${window.location.host}`
+	envVal.hostUrl = process.env.NODE_ENV == 'development' ? 'http://api.b.huaml.com' : `http://api.b.huaml.com`
+
+	uni.setStorageSync('source', 'mobile')
+} else {
+	envVal.formal = process.env.NODE_ENV == 'development' ? 'http://b.huaml.com' : `${window.location.protocol}//${window.location.host}`
+	envVal.hostUrl = process.env.NODE_ENV == 'development' ? 'http://api.b.huaml.com' : `http://api.b.huaml.com`
+
+	uni.setStorageSync('source', 'business')
 }
 
+console.log(envVal)
+
 export default envVal

+ 2 - 0
mobile-code/src/m-config.js

@@ -0,0 +1,2 @@
+// 项目配置--由bat脚本自动变更
+export const ProjectName = 'mobile'

+ 0 - 0
mobile-code/src/manifest-b.json → mobile-code/src/m-manifest.json


+ 0 - 0
mobile-code/src/pages-b.json → mobile-code/src/m-pages.json


+ 0 - 176
mobile-code/src/pages111.json

@@ -1,176 +0,0 @@
-{
-	"pages": [
-		{
-			"path": "pages/page/redirect",
-			"style": {
-				"navigationBarTitleText": "加载中..."
-			}
-		},
-		{
-			"path": "pages/page/login/index",
-			"style": {
-				"navigationBarTitleText": "登录"
-			}
-		},
-		{
-			"path": "pages/page/webview/index",
-			"style": {
-				"navigationBarBackgroundColor": "#ffffff",
-				"navigationBarTextStyle": "black"
-			}
-		}
-	],
-	"subPackages": [
-		{
-			"root": "pages/home",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "首页"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/shop",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "首页"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/category",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "首页"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/user",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "注册"
-					}
-				},
-				{
-					"path": "register",
-					"style": {
-						"navigationBarTitleText": "注册"
-					}
-				},
-				{
-					"path": "password",
-					"style": {
-						"navigationBarTitleText": "修改密码"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/goods",
-			"pages": [
-				{
-					"path": "detail",
-					"style": {
-						"navigationBarTitleText": "详情"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/pay",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "支付"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/callback",
-			"pages": [
-				{
-					"path": "index"
-				}
-			]
-		},
-		{
-			"root": "pages/coupon",
-			"pages": [
-				{
-					"path": "list",
-					"style": {
-						"navigationBarTitleText": "优惠券",
-						"enablePullDownRefresh": true
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/order",
-			"pages": [
-				{
-					"path": "list",
-					"style": {
-						"navigationBarTitleText": "订单列表",
-						"enablePullDownRefresh": true
-					}
-				},
-				{
-					"path": "detail",
-					"style": {
-						"navigationBarTitleText": "订单列表",
-						"enablePullDownRefresh": true
-					}
-				},
-				{
-					"path": "buy",
-					"style": {
-						"navigationBarTitleText": "订单确认"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/interest",
-			"pages": [
-				{
-					"path": "invite",
-					"style": {
-						"navigationBarTitleText": "邀请排行",
-						"enablePullDownRefresh": true
-					}
-				},
-				{
-					"path": "level",
-					"style": {
-						"navigationBarTitleText": "会员等级",
-						"enablePullDownRefresh": true
-					}
-				}
-			]
-		}
-	],
-	"globalStyle": {
-		// #ifdef H5
-		"navigationStyle": "custom",
-		// #endif
-		"navigationBarBackgroundColor": "#fff",
-		"navigationBarTitleText": "花卉宝",
-		"navigationBarTextStyle": "black"
-	}
-}
-