Kaynağa Gözat

修改框架

lilei 3 yıl önce
ebeveyn
işleme
fd1ba71ea5

+ 16 - 0
.hbuilderx/launch.json

@@ -0,0 +1,16 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"app-plus" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 26 - 16
App.vue

@@ -1,31 +1,41 @@
 <script>
-	const uat_URL = 'https://lese.test.sxzxyj.net/gc-channel/' // 预发布
-	// const uat_URL = 'http://192.168.16.102:8303/gc-channel/' // 本地
-	const pro_URL = 'https://lese.sxzxyj.net/gc-channel/'  // 生产
-	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
-	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
-	const envText = ['预发布环境','生产环境']
-	const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]
-	console.log(process.env.NODE_ENV)
 	export default {
 		globalData: {  
-			baseUrl: process.env.NODE_ENV == 'development' ? uat_URL : buildURL,
+			baseUrl: '',
 			token: '',
 			version: '', // 当前版本号
-			buildType: buildType,
-			envTips: envTips
+			buildType: 'uat', // 打包环境对应类型,pro 生产 uat 预发布 dev 本地开发
+			envTips: '', // 环境文字提示
+			theme: 'default', // 主题,default
+			isIphoneXup: false //是否iphonex以及以上的版本
 		},
 		mounted() {
 			// 非V3模式
-			if(this.$scope){
-				this.$scope.globalData.token = this.$store.state.vuex_token
-			}else{
+			if (this.$scope) {
+				this.$scope.globalData.token = this.$store.state.vuex_token;
+			} else {
 				// V3模式
-				getApp({allowDefault: true}).globalData.token = this.$store.state.vuex_token
+				getApp({ allowDefault: true }).globalData.token = this.$store.state.vuex_token;
 			}
+			this.$config('init');
 		},
 		onLaunch: function() {
-			 console.log('App onLaunch')
+			 const theme = getApp().globalData.theme
+			 uni.setTabBarStyle({
+			   color: this.$config("topBarTitleColors"),
+			   selectedColor: this.$config("primaryColor"),
+			   borderStyle: 'white'
+			 })
+			 uni.setTabBarItem({
+			   "index": 0,
+			   "iconPath": "static/"+theme+"/tabbar/record.png",
+			   "selectedIconPath": "static/"+theme+"/tabbar/record-active.png",
+			 })
+			 uni.setTabBarItem({
+			   "index": 1,
+			   "iconPath": "static/"+theme+"/tabbar/user.png",
+			   "selectedIconPath": "static/"+theme+"/tabbar/user-active.png",
+			 })
 		},
 		onShow: function() {
 			console.log('App Show')

+ 31 - 0
config/index.js

@@ -0,0 +1,31 @@
+// 主题配置信息
+const getConfig = (theme) => {
+	const config = {
+		// 默认主题
+		"default":{
+			themePath: 'default',
+			pro_URL: 'https://car.zyucgj.com/saas/clz/', // 生产地址
+			uat_URL: 'http://md.test.zyucgj.com/saas/clz/', // 预发布地址
+			dev_URL: 'http://192.168.16.102:9110/saas/clz/', // 本地地址
+			appName: 'iSCM智慧供应链系统', // app 名称
+			company: '陕西山海高科信息技术有限公司',
+			loadText:{
+					loadmore: '轻轻上拉',
+					loading: '努力加载中',
+					nomore: '没有了'
+				},
+			primaryColor: '#0485F6', // 主色调
+			warringColor: '#f3bb12', // 警告
+			errorColor: '#E70012', // 错误
+			successColor: '#13C442', // 成功
+			topBarBackground: 'linear-gradient(45deg, #fff, #fff)', // 顶部栏渐变色
+			topBarTitleColors: '#222222', // 顶部栏文字颜色
+		},
+		// 其它主题
+		"other":{}
+	}
+	
+	return config[theme]
+}
+
+export default getConfig

+ 25 - 11
main.js

@@ -1,6 +1,7 @@
 import Vue from 'vue'
 import App from './App'
 import store from '@/store'
+import getConfig from '@/config'
 Vue.config.productionTip = false
 
 App.mpType = 'app'
@@ -9,16 +10,19 @@ Vue.use(uView)
 
 let vuexStore = require("@/store/$u.mixin.js")
 Vue.mixin(vuexStore)
-/*
-* 提示信息
-*/ 
-Vue.prototype.toashMsg = function (title) {
-	title = title == undefined ? "系统繁忙" : title;
-	uni.showToast({
-		title:title,
-		icon:'none',
-		duration: 2000
-	})
+
+// 系统配置
+Vue.prototype.$config = function (key) {
+	const envText = {pro:'生产环境',dev:'开发环境',uat:'预发布环境'}
+	const theme = getApp().globalData.theme
+	const config = getConfig(theme)
+	if(key == 'init'){
+		let buildType = getApp().globalData.buildType
+		let baseUrl = config[buildType+'_URL']
+		getApp().globalData.baseUrl = baseUrl
+		getApp().globalData.envTips = envText[buildType]
+	}
+	return config[key]
 }
 /**
  * 权限检查
@@ -26,7 +30,6 @@ Vue.prototype.toashMsg = function (title) {
 Vue.prototype.$hasPermissions = function (value) {
  let isExist = false;
  let permissionsStr = store.state.vuex_userData.permCodes;
- // console.log(permissionsStr,'permissionsStr')
  if (permissionsStr == undefined || permissionsStr == null) {
   return false;
  }
@@ -38,6 +41,17 @@ Vue.prototype.$hasPermissions = function (value) {
  }
  return isExist;
 }
+/*
+* 提示信息
+*/ 
+Vue.prototype.toashMsg = function (title) {
+	title = title == undefined ? "系统繁忙" : title;
+	uni.showToast({
+		title:title,
+		icon:'none'
+	})
+}
+
 const app = new Vue({
 	store,
     ...App

+ 0 - 13
pages.json

@@ -57,27 +57,14 @@
 		}
 	},
 	"tabBar": {
-		"color": "#7A7E83",
-		"selectedColor": "#ed1c24",
-		"backgroundColor": "#ffffff",
 		"fontSize": "14px",
 		"list": [
 		{
 			"pagePath": "pages/index/index",
-			"iconPath": "static/tabbar/record.png",
-			"selectedIconPath": "static/tabbar/record-active.png",
 			"text": "首页"
 		},
-		{
-			"pagePath": "pages/cleared/index",
-			"iconPath": "static/tabbar/record.png",
-			"selectedIconPath": "static/tabbar/record-active.png",
-			"text": "扫码记录"
-		},
 		{
 			"pagePath": "pages/userCenter/index",
-			"iconPath": "static/tabbar/user.png",
-			"selectedIconPath": "static/tabbar/user-active.png",
 			"text": "我的"
 		}]
 	}

+ 0 - 0
static/tabbar/record-active.png → static/default/tabbar/record-active.png


+ 0 - 0
static/tabbar/record.png → static/default/tabbar/record.png


+ 0 - 0
static/tabbar/user-active.png → static/default/tabbar/user-active.png


+ 0 - 0
static/tabbar/user.png → static/default/tabbar/user.png