| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import App from './App'
- import messages from './locale/index'
- import GoEasy from 'goeasy'
- // 引入全局方法
- import {
- http
- } from '@/utils/request';
- import mytool from '@/utils/tool';
- // 挂载全局自定义方法
- Vue.prototype.$http = http;
- Vue.prototype.$mytool = mytool;
- Vue.prototype.$formPr = function(price) {
- var number = '0';
- var type = typeof(price);
- if (type == 'string') {
- number = price
- }
- if (type == 'number') {
- number = price.toString(); // 确保输入是字符串
- }
- const pattern = /(-?\d+)(\d{3})/;
- while (pattern.test(number)) {
- number = number.replace(pattern, "$1,$2");
- }
- return number;
- if (price % 1000 == 0) {
- return price; //price/1000+'k'
- } else {
- return price;
- }
- };
- Vue.prototype.$baseImagurl = 'https://backend.cityexpress168.com.vn/prod-api'; //生产环境
- Vue.prototype.$upImagurl = 'https://api.cityexpress168.com.vn/utils/Upload'; //生产环境
- // Vue.prototype.$baseImagurl = 'https://ctebackend.waimai-paotui.com/prod-api'; //预发布
- // Vue.prototype.$upImagurl = 'https://cteapi.waimai-paotui.com/utils/Upload'; //预发布
- const goEasy = GoEasy.getInstance({
- host: "singapore.goeasy.io", //若是新加坡区域:singapore.goeasy.io
- appkey: "BC-118535b236de4c83a1ad0341830d1c04",
- modules: ['im', 'pubsub'], //根据需要,传入'im’或'pubusub',或数组方式同时传入
- allowNotification: true, // true表示支持通知栏提醒,false则表示不需要通知栏提醒
- });
- goEasy.onClickNotification((message) => {
- let currentUrl;
- return;
- /*
- const routes = getCurrentPages();
- if (routes && routes.length) {
- const curRoute = routes[routes.length - 1].route;
- const curParam = routes[routes.length - 1].options;
- currentUrl = '/' + curRoute + `?to=${curParam.to}`;
- }
- let newUrl;
- switch (message.toType) {
- case GoEasy.IM_SCENE.PRIVATE:
-
- //newUrl = '/pages/privateChat?to=' + message.senderId;
- break;
- case GoEasy.IM_SCENE.GROUP:
- newUrl = '/pages/groupChat?to=' + message.groupId;
- break;
- }
- if (currentUrl !== newUrl) {
- uni.navigateTo({
- url: newUrl,
- });
- }
- */
- });
- Vue.prototype.GoEasy = GoEasy;
- Vue.prototype.goEasy = goEasy;
- let i18nConfig = {
- locale: uni.getLocale(),
- messages
- }
- // #ifndef VUE3
- import Vue from 'vue'
- import VueI18n from 'vue-i18n'
- // import uView from "uview-ui";
- // Vue.use(uView);
- Vue.use(VueI18n)
- const i18n = new VueI18n(i18nConfig)
- Vue.config.productionTip = false
- App.mpType = 'app'
- const app = new Vue({
- i18n,
- ...App
- })
- app.$mount()
- // #endif
- // #ifdef VUE3
- import {
- createSSRApp
- } from 'vue'
- import {
- createI18n
- } from 'vue-i18n'
- const i18n = createI18n(i18nConfig)
- export function createApp() {
- const app = createSSRApp(App)
- app.use(i18n)
- return {
- app
- }
- }
- // #endif
|