123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import Vue from 'vue'
- import App from './App'
- import * as Api from './config/api.js'
- import * as Common from './config/common.js'
- import * as Db from './config/db.js'
- import * as Config from './config/config.js'
- import share from "@/common/share.js"
- import store from './store';
- import util from "@/common/util.js"
- const logic = {
- systemInfo: null,
- /**
- * 显示消息提示
- *
- * @param {Object} text
- * @param {Object} icon
- */
- showToast(text, icon) {
- return uni.showToast({
- title: text || '加载中',
- icon: icon || 'none',
- mask: true,
- duration: 2000
- });
- },
- /**
- * 全局方法 - px2rpx
- *
- * @param {Object} px
- */
- px2rpx(px) {
- if (this.systemInfo === null) {
- this.systemInfo = uni.getSystemInfoSync()
- }
- // 官方规定屏幕宽为750rpx
- return px / this.systemInfo.windowWidth * 750;
- },
- /**
- * 全局方法 - rpx2px
- *
- * @param {Object} rpx
- */
- rpx2px(rpx) {
- if (this.systemInfo === null) {
- this.systemInfo = uni.getSystemInfoSync()
- }
- // 官方规定屏幕宽为750rpx
- return rpx / 750 * this.systemInfo.windowWidth;
- },
- }
- // import {
- // createSSRApp
- // } from 'vue'
- // export function createApp() {
- // const app = createSSRApp(App)
- // app.use(store)
- // app.config.globalProperties.$logic = logic
- // return {
- // app
- // }
- // }
- function isPromise(obj) {
- return (!!obj &&
- (typeof obj === "object" || typeof obj === "function") &&
- typeof obj.then === "function"
- );
- }
- // uni方法转then数组
- uni.addInterceptor({
- returnValue(res) {
- if (!isPromise(res)) {
- return res;
- }
- const returnValue = [undefined, undefined];
- return res
- .then((res) => {
- returnValue[1] = res;
- })
- .catch((err) => {
- returnValue[0] = err;
- })
- .then(() => returnValue);
- },
- });
- import {tools} from '@/common/fa.mixin.js'
- Vue.mixin(tools)
- //皮肤色处理
- let styleMixin = require('@/common/fa.style.mixin.js')
- Vue.mixin(styleMixin)
- /*
- 有报错我先注释掉了
- 105行 还有config.js 5-7行
- Vue.component('cu-custom',cuCustom) */
- import uView from '@/uni_modules/uview-ui'
- Vue.use(uView)
- Vue.prototype.$api = Api;
- Vue.prototype.$common = Common;
- Vue.prototype.$db = Db;
- Vue.prototype.$config = Config;
- Vue.prototype.$logic=logic;
- Vue.prototype.$util=util;
- Vue.prototype.vuex_theme={value: {color: "#fff", bgColor: "#c7a772"}}
- Vue.prototype.vuex_parse_style={
- h1: 'padding:20rpx 0;',
- h2: 'padding:10rpx 0;',
- h3: 'padding:10rpx 0;',
- h4: 'padding:10rpx 0;',
- h5: 'padding:5rpx 0;',
- h6: 'padding:5rpx 0;',
- ul: 'margin-bottom:20rpx;padding-left:30rpx;',
- ol: 'margin-bottom:20rpx;padding-left:30rpx;',
- code: 'background-color: #f6f6f6;margin: 0 5rpx;padding: 6rpx 8rpx;border-radius: 6rpx;text-align:center;',
- pre: 'white-space: pre;overflow: auto;background: #f6f6f6;border-radius: 8rpx;border: none;color: #1a1a1a;margin-bottom: 20rpx;padding:20rpx;',
- 'pre code': 'margin:0;padding:0;',
- blockquote: 'padding: 15rpx;margin:0 0 20rpx 0;border-radius: 6rpx;',
- p: 'margin-bottom:20rpx',
- table: 'width:100%;margin-bottom:20rpx;border-collapse: collapse;',
- th: 'background-color: whitesmoke;border: 1px solid #e6e6e6;padding:10rpx;',
- td: 'border: 1px solid #e6e6e6;padding:10rpx;'
- }
- Vue.prototype.vuex_config={}
- Vue.config.productionTip = false
- Vue.mixin(share)
- App.mpType = 'app'
- const app = new Vue({
- ...App,store
- })
- app.$mount()
|