| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- import Vue from 'vue'
- import App from './App'
- //商城 begin
- import store from '@/store';
- import Server from './utils/server'
- import Storage from './utils/storage'
- import ApiEx from './utils/api'
- import Mixin from './utils/mixin'
- import Global from './utils/global'
- import Auth from './utils/auth'
- import Cache from './utils/cache'
- import Util from './utils/util2'
- import Dialog from './utils/dialog'
- import Filter from './utils/filter'
- import Mpi from './utils/mpi'
- //商城 end
- //封装api
- import {
- api
- } from 'assets/http/api.js'
- Vue.prototype.$http = api
- import wxApi from "./utils/wx_api.js"
- // 微信函数封装
- Vue.prototype.$wxApi = wxApi
- let vuexStore = require("@/store/$u.mixin.js");
- Vue.mixin(vuexStore);
- //uview
- import uView from 'uview-ui';
- Vue.use(uView);
- Vue.config.productionTip = false
- App.mpType = 'app'
- import MescrollBody from "@/comps/mescroll-body/mescroll-body.vue"
- Vue.component('mescroll-body', MescrollBody)
- //小程序参数
- Vue.prototype.$wxData = {
- APPID: 'wxaeb044e4a6b97df4',
- SECRET: '0c575e3f4ae59ea630bbb90abcc4852c',
- GRANTTYPE: 'client_credential'
- }
- //解决ios系统时间显示错误问题
- Vue.prototype.$commonDate = value => {
- return new Date(value.replace(/\-/g, '/'))
- }
- //封装小程序审核时的标题设置
- Vue.prototype.$setNavigationBarTitle = (auditTitle, title) => {
- let appletType = uni.getStorageSync('appletType')
- if (appletType == 0) {
- uni.setNavigationBarTitle({
- title: auditTitle
- })
- } else {
- uni.setNavigationBarTitle({
- title: title
- })
- }
- return appletType
- }
- Vue.prototype.$navigateTo = (url) => {
- uni.navigateTo({
- url
- })
- }
- //判空函数
- Vue.prototype.$isEmpty = function(value) {
- switch (typeof value) {
- case 'undefined':
- return true;
- case 'string':
- if (value == 'undefined') return true
- if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
- break;
- case 'boolean':
- if (!value) return true;
- break;
- case 'number':
- if (0 === value || isNaN(value)) return true;
- break;
- case 'object':
- if (null === value || value.length === 0) return true;
- for (var i in value) {
- return false;
- }
- return true;
- }
- return false;
- }
- Vue.prototype.$isNotEmpty = function(value) {
- switch (typeof value) {
- case 'undefined':
- return false;
- case 'string':
- if (value == 'undefined') return false
- if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return false;
- break;
- case 'boolean':
- if (!value) return false;
- break;
- case 'number':
- if (0 === value || isNaN(value)) return false;
- break;
- case 'object':
- if (null === value || value.length === 0) return false;
- for (var i in value) {
- return true;
- }
- return false;
- }
- return true;
- }
- // 商城 begin
- // 设置服务器
- Global.server = Server
- // 版本
- Cache.preKey = Server.version
- // 全局注入
- Vue.mixin(Mixin)
- // 全局筛选器
- Object.keys(Filter).forEach(key => {
- Vue.filter(key, Filter[key])
- })
- // 全局属性 接口
- Vue.prototype.$api = Object.assign({}, ApiEx)
- // 全局属性 全局变量
- Vue.prototype.$global = Global
- // 全局缓存
- Vue.prototype.$storage = Storage
- // 同意授权
- Vue.prototype.$auth = Auth
- // 全局属性 工具函数
- Vue.prototype.$util = Util
- // 微信函数封装
- Vue.prototype.$mpi = Mpi
- // 全局属性 对话框函数
- Dialog.config = Object.assign(Dialog.config, {
- cancelColor: '#333',
- confirmColor: '#333',
- title: '温馨提示'
- })
- Vue.prototype.$dialog = Dialog
- // 商城 end
- const app = new Vue({
- store,
- ...App
- })
- app.$mount()
|