Browse Source

修改图片地址

zyh
Gao xiaosong 4 years ago
parent
commit
bd14a8f88b
  1. 2
      config/index.js
  2. 113
      main.js

2
config/index.js

@ -6,4 +6,4 @@ export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
// export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api' // export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api'
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static' export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static'

113
main.js

@ -8,14 +8,21 @@ import dialog from './utils/dialog'
import cookie from '@/utils/store/cookie' import cookie from '@/utils/store/cookie'
import cuCustom from '@/components/colorui/components/cu-custom.vue' import cuCustom from '@/components/colorui/components/cu-custom.vue'
import { parseRoute, _router, parseQuery } from '@/utils' import {
import { VUE_APP_RESOURCES_URL, VUE_APP_API_URL } from '@/config' parseRoute,
_router,
parseQuery
} from '@/utils'
import {
VUE_APP_RESOURCES_URL,
VUE_APP_API_URL
} from '@/config'
Vue.component('cu-custom', cuCustom) Vue.component('cu-custom', cuCustom)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.config.devtools = process.env.NODE_ENV !== 'production' Vue.config.devtools = process.env.NODE_ENV !== 'production'
Vue.prototype.$validator = function(rule) { Vue.prototype.$validator = function(rule) {
return new schema(rule) return new schema(rule)
} }
Vue.config.productionTip = false Vue.config.productionTip = false
@ -23,20 +30,20 @@ App.mpType = 'app'
Vue.prototype.$store = store Vue.prototype.$store = store
const app = new Vue({ const app = new Vue({
...App, ...App,
store, store,
}) })
Object.defineProperty(Vue.prototype, '$yrouter', { Object.defineProperty(Vue.prototype, '$yrouter', {
get() { get() {
return _router return _router
}, },
}) })
Object.defineProperty(Vue.prototype, '$yroute', { Object.defineProperty(Vue.prototype, '$yroute', {
get() { get() {
return this._route return this._route
}, },
}) })
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
@ -64,19 +71,35 @@ deviceType = 'routine'
// #ifdef H5 // #ifdef H5
// H5编译的代码 // H5编译的代码
import { wechat, clearAuthStatus, oAuth, auth, toAuth, pay, openAddress, openShareAll, openShareAppMessage, openShareTimeline, wechatEvevt, ready, wxShowLocation } from '@/libs/wechat' import {
wechat,
import { isWeixin } from '@/utils' clearAuthStatus,
oAuth,
auth,
toAuth,
pay,
openAddress,
openShareAll,
openShareAppMessage,
openShareTimeline,
wechatEvevt,
ready,
wxShowLocation
} from '@/libs/wechat'
import {
isWeixin
} from '@/utils'
const CACHE_KEY = 'clear_0.0.1' const CACHE_KEY = 'clear_0.0.1'
if (!cookie.has(CACHE_KEY)) { if (!cookie.has(CACHE_KEY)) {
cookie.clearAll() cookie.clearAll()
cookie.set(CACHE_KEY, 1) cookie.set(CACHE_KEY, 1)
} }
var urlSpread = parseQuery()['spread'] var urlSpread = parseQuery()['spread']
if (urlSpread) { if (urlSpread) {
cookie.set('spread', urlSpread) cookie.set('spread', urlSpread)
} }
// #endif // #endif
@ -84,37 +107,43 @@ if (urlSpread) {
// #ifdef H5 // #ifdef H5
// H5编译的代码 // H5编译的代码
// 判断是否是微信浏览器 // 判断是否是微信浏览器
if (isWeixin()) { async function init() {
deviceType = 'weixin'
let wechatInit = await wechat() if (isWeixin()) {
if (wechatInit) { deviceType = 'weixin'
await oAuth() let wechatInit = wechat();
} if (wechatInit) {
} else { await oAuth()
deviceType = 'weixinh5' }
} else {
deviceType = 'weixinh5'
}
} }
init()
// #endif // #endif
Vue.prototype.$deviceType = deviceType Vue.prototype.$deviceType = deviceType
Vue.mixin({ Vue.mixin({
onLoad() { onLoad() {
const { $mp } = this.$root const {
this._route = parseRoute($mp) $mp
}, } = this.$root
onShow() { this._route = parseRoute($mp)
_router.app = this },
_router.currentRoute = this._route onShow() {
}, _router.app = this
// 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量 _router.currentRoute = this._route
computed: { },
$VUE_APP_RESOURCES_URL() { // 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量
return VUE_APP_RESOURCES_URL computed: {
}, $VUE_APP_RESOURCES_URL() {
$deviceType() { return VUE_APP_RESOURCES_URL
return deviceType },
}, $deviceType() {
}, return deviceType
},
},
}) })
store.commit('updateDevicetype', deviceType) store.commit('updateDevicetype', deviceType)

Loading…
Cancel
Save