123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <script>
- import configpath from 'config/setting.config.js';
- import api from 'api/index.js'
- import Vue from 'vue'
- const inforeq = (cb) => {
- fetch('/static/.config.json')
- .then((res) => res.json())
- .then(async (res) => {
- let obj = {
- ...res,
- img_local_host: (process.env.NODE_ENV === 'production' ?
- res.prodIp || configpath.prodIp :
- process.env.NODE_ENV === 'test' ?
- res.testIp || configpath.testIp :
- res.devIp || configpath.devIp) + '/file/',
- // 请求 地址
- baseURL: (process.env.NODE_ENV === 'production' ?
- res.prodIp || configpath.prodIp :
- process.env.NODE_ENV === 'test' ?
- res.testIp || configpath.testIp :
- res.devIp || configpath.devIp) + '/api/h5',
- }
- cb && cb(obj)
- })
- }
- export default {
- globalData: {
- SET_STATUS_BAR: 0,
- SET_CUSTOM_BAR: 0,
- SET_SYSTEM_INFO: {},
- configData: {},
- token: ''
- },
- onLaunch: function(option) {
- let token = window.location.search.split('token=')[1]
- let serialNumber = window.location.search.split('serialNumber=')[1]
- console.log('App Launch', token, serialNumber)
- // console.log(token)
- let t = this;
- inforeq((res) => {
- t.globalData.configData = res
- if (token && token.length > 0) {
- uni.setStorage({
- key: 'token',
- data: token,
- success: function() {
- console.log('success');
- }
- });
- t.globalData.token = token
- }
- if (serialNumber && serialNumber.length > 0) {
- uni.setStorage({
- key: 'serialNumber',
- data: serialNumber,
- success: function() {
- console.log('success');
- }
- });
- t.globalData.serialNumber = serialNumber
- }
- })
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- },
- }
- </script>
- <style>
- /*每个页面公共css */
- @import url("@/static/style/style.css");
- @import url("@/static/style/icon.css");
- @import url("@/static/style/color.css");
- page {
- background: #f5f5f5;
- }
- .my-button {
- border-radius: 0px;
- transform: initial;
- background-color: transparent;
- }
- .my-button:after {
- border-width: 0px !important;
- border-radius: 0px !important;
- transform: initial;
- background-color: transparent;
- width: 100%;
- height: 100%;
- }
- .bule_line {
- width: 10rpx;
- height: 30rpx;
- background-color: #1e8ff9;
- border-radius: 6rpx;
- box-shadow: 0px 2px 4px 0px rgba(121, 190, 254, 0.59);
- }
- </style>
- uni.getSystemInfo({
- success: (e) => {
- let statusBar = 0
- let customBar = 0
- // #ifdef MP
- statusBar = e.statusBarHeight
- customBar = e.statusBarHeight + 45
- if (e.platform === 'android') {
- customBar = e.statusBarHeight + 50
- }
- // #endif
- // #ifdef MP-WEIXIN
- statusBar = e.statusBarHeight
- const custom = wx.getMenuButtonBoundingClientRect()
- customBar = custom.bottom + custom.top - e.statusBarHeight
- // #endif
- // #ifdef MP-ALIPAY
- statusBar = e.statusBarHeight
- customBar = e.statusBarHeight + e.titleBarHeight
- // #endif
- // #ifdef APP-PLUS
- console.log('app-plus', e)
- statusBar = e.statusBarHeight
- customBar = e.statusBarHeight + 45
- // #endif
- // #ifdef H5
- statusBar = 0
- customBar = e.statusBarHeight + 45
- // #endif
- this.globalData.SET_SYSTEM_INFO = e
- this.globalData.SET_CUSTOM_BAR = customBar
- this.globalData.SET_STATUS_BAR = statusBar
- }
- })
|