123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- import Vue from 'vue'
- import App from './App'
- // 引入全局存储
- import store from './store'
- // 引入全局配置
- import $mAssetsPath from '@/config/assets.config.js';
- import $mConfig from '@/config/global.config.js';
- import commonMixin from '@/common/commonMixin'
- // // 注册公用渲染方法
- // import '@/utils/registerBaseStyle.js'
- // 引入全局方法
- import {
- http
- } from '@/common/request';
- import {
- yghttp
- } from '@/common/request/index-yg.js';
- import $mUtil from '@/common/util.js';
- // 全局组件
- import navbar from '@/components/hx-navbar/hx-navbar.nvue';
- import ldLoading from '@/components/ld-loading/index.vue';
- import nodata from '@/components/noData/nodata.vue';
- import loadMore from '@/components/uni-load-more/uni-load-more.vue';
- import Directives from './directives/index.js';
- import welfareGoods from '@/components/welfare-goods/index.vue';
- import donationNews from '@/components/donation-news/index.vue';
- import entrepreneurshipZoneTabbar from '@/components/entrepreneurship-zone-tabbar/index.vue';
- import initialize from "@/utils/initialize"
- // 网络状态监听
- // uni.getNetworkType({
- // success: res => {
- // console.log(res)
- // store.dispatch('networkStateChange', res.networkType);
- // }
- // });
- // uni.onNetworkStatusChange(function (res) {
- // console.log(res+'onNetworkStatusChange')
- // store.dispatch('networkStateChange', res.networkType);
- // });
- if (process.env.NODE_ENV === 'production') {
- Vue.config.productionTip = false;
- }
- // 挂载全局自定义方法
- Vue.prototype.$store = store
- Vue.prototype.$adpid = ""
- Vue.prototype.$http = http;
- Vue.prototype.$yghttp = yghttp;
- Vue.prototype.$mConfig = $mConfig;
- Vue.prototype.$mAssetsPath = $mAssetsPath;
- Vue.prototype.$mUtil = $mUtil;
- Vue.component('navbar', navbar);
- Vue.component('ldLoading', ldLoading);
- Vue.component('nodata', nodata);
- Vue.component('loadMore', loadMore);
- Vue.component('welfareGoods', welfareGoods);
- Vue.component('donationNews', donationNews);
- Vue.component('entrepreneurshipZoneTabbar', entrepreneurshipZoneTabbar);
- App.mpType = 'app'
- Vue.use(Directives);
- // 保留小数点后两位
- Vue.filter('keepTwo', value => {
- return (Math.floor((value || 0) * 100) / 100).toFixed(2);
- });
- // 整数,获取数字整数部分
- Vue.filter('integer', value => {
- if (value) {
- return Math.trunc(value)
- };
- return 0
- });
- // 整数,获取数字整数部分
- Vue.filter('integer', value => {
- if (value) {
- return Math.trunc(value)
- };
- return 0
- });
- // 整数,获取数字整数部分
- Vue.filter('decimals', value => {
- if (value) {
- try {
- value += "";
- return value.split('.')[1] || '00'
- } catch {
- return "00"
- }
- };
- return '00'
- });
- // integral(){
- // integral(num) {
- // //判断数字是否有小数
- // }
- // }
- // 添加小数
- Vue.prototype.$addDecimals = (num = 0, length = 8, type = true) => {
- // length 小数的长度,type 是否需要处理
- try {
- if (!type) {
- return num
- }
- num += '';
- if (num.indexOf('.') === -1) {
- num = `${num}.`
- for (let i = 1; i <= length; i++) {
- num += '0';
- }
- return num
- }
- const numArr = num.split('.');
- let integerNum = numArr[0],
- decimals = numArr[1];
- if (decimals.length === length) {
- return num
- }
- const addLength = length - decimals.length;
- for (let i = 1; i <= addLength > 0 ? addLength : 0; i++) {
- decimals += '0'
- }
- return `${integerNum}.${decimals}`
- } catch (err) {
- return num
- }
- }
- // import Vue from 'vue'
- /**
- * 注册指令
- */
- //引入 u-view 1.x
- import uView from 'uview-ui'
- Vue.use(uView)
- //全局组件混入mixin
- Vue.use(commonMixin);
- Vue.use(initialize)
- const app = new Vue({
- store,
- ...App
- })
- app.$mount()
|