123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <script>
- var ekanfang = uni.requireNativePlugin("Ekanfang")
- export default {
- onLaunch: function() {
- let BASE_URL = "";
- var env ='';
- let res = uni.getStorageSync('env')
- switch(res){
- case '1': //dev
- BASE_URL = 'http://101.231.166.56:16666' // 开发环境
- env = 'dev'
- break;
- case '2': //test
- BASE_URL = 'https://gatewaytest.elab-plus.vip'
- env = 'test'
- break;
- case '3'://test2
- BASE_URL = 'http://gatewaytest1.elab-plus.com'
- env = 'test2'
- break;
- case '4'://test3
- BASE_URL = 'https://gatewaytest3.skyforestcity.com'
- env = 'test3'
- break;
- case '5'://test4
- BASE_URL = 'https://gatewaytest4.skyforestcity.com'
- env = 'test4'
- break;
- case '6'://uat3
- BASE_URL = "https://api-uat3.elaber.cn"
- env = 'uat3'
- break;
- case '7': //uat
- BASE_URL = "https://api-uat.elaber.cn"
- env = 'uat'
- break;
- case '8': // 线上 product
- default:
- BASE_URL = "https://dm-api.elab-plus.cn"
- env = 'production'
- break;
- }
- this.globalData.BASE_URL = BASE_URL;
- this.globalData.env = env;
-
- let plat = uni.getSystemInfoSync().platform;
- this.globalData.platform = plat
- // // console.log('App Launch')
- // #ifdef APP-VUE
- var self = this
-
- let userInfo = uni.getStorageSync('userInfo');//获得保存在本地的用户信息
- if(userInfo){//有数据,已登录
- let roleMenulList = userInfo.roleMenuList
- this.reloadMeunStatus(roleMenulList);
- }else{
- //不存在则跳转登录页
- uni.reLaunch({
- url: "/pages/loginPage/index",
- success: () => {
- //跳转完页面后再关闭启动页
- plus.navigator.closeSplashscreen();
- }
- })
- }
- // #endif
-
- },
- onShow: function() {
- // console.log("App onshow")
- document.body.style.setProperty("background-color",this.globalData.backgorundThemeColor)
- },
- onHide: function() {
- // console.log('App Hide')
- },
- methods: {
-
- reloadMeunStatus(roleMenulList) {
- var self = this
- if(roleMenulList.length>0){
- let menuCode = roleMenulList[0].menuCode
- if (menuCode == 100){
- plus.navigator.closeSplashscreen();
- }else if (menuCode == 200) {
- plus.navigator.closeSplashscreen();
- uni.reLaunch({
- url:'./pages/loginsuccess/loginSuccess',
- })
- } else if (menuCode == 300) {
- plus.navigator.closeSplashscreen();
- uni.reLaunch({
- url:'./pages/mine/mine',
- })
- }
- }
- },
- getThemeInfo() {
- // console.log("调用了")
- let self = this;
- uni.getStorage({ //获得保存在本地的用户信息
- key: 'userInfo',
- success: (res) => {
- if (res.data) {
- //存在则关闭启动页进入首页
- if (res.data.hasOwnProperty('theme') && null != res.data.theme) {
- let theme = JSON.parse(res.data.theme);
- self.globalData.themeColor = theme.themeColor;
- self.globalData.fuzhuColor = theme.fuzhuColor;
- self.globalData.fuzhuColor15 = theme.fuzhuColor15;
- self.globalData.themeColor50 = theme.themeColor50;
- self.globalData.themeColor25 = theme.themeColor25;
- self.globalData.fuzhuColor50 = theme.fuzhuColor50;
- self.globalData.backgorundThemeColor = theme.backgorundThemeColor
- }
- self.globalData.token = res.data.token;
- }
- },
- });
- }
- },
- globalData: {
- token: "",
- themeColor: "#3CD9D9",
- fuzhuColor: "#FEC350",
- fuzhuColor15: "#FFF6E5",
- themeColor50: "#9DECEC",
- themeColor25: "#CEF6F6",
- fuzhuColor50: "#FEE1A7",
- backgorundThemeColor:"#F1F5F9",
- unReadNumTotal:0,
- BASE_URL:"https://dm-api.elab-plus.cn",//默认环境
- }
- }
- </script>
- <style>
- /*每个页面公共css */
- /* #ifndef APP-NVUE */
- @import url("./static/font/iconfont.css");
- page {
- background-color: #F4F7F7;
- }
- /* #endif */
- </style>
|