| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /*
- * @Author: your name
- * @Date: 2021-01-25 11:32:04
- * @LastEditTime: 2021-03-19 09:40:02
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: \rebatedine-mini\src\main.js
- */
- import Vue from 'vue'
- import App from './App'
- import store from './store/index'
- import uView from 'uview-ui'
- import dayjs from './utils/dayjs.min.js'
- import dealImgUrl from '@/utils/dealImgUrl'
- import networkError from '@/components/networkError'
- Vue.config.productionTip = false
- App.mpType = 'app'
- Vue.prototype.$store = store
- Vue.prototype.$dayjs = dayjs
- Vue.use(uView)
- Vue.filter('imgFilter', (fileItem, type) => {
- return dealImgUrl(fileItem, type)
- })
- Vue.filter('imgListFilter', (fileList, type) => {
- fileList.forEach(item => {
- item.url = dealImgUrl(item, type)
- })
- return fileList
- })
- Vue.mixin({
- onLoad (options) {
- options = this.dealOptions(options)
- const inviteId = options.INVITE_ID
- if (inviteId && !this.$store.state.INVITE_ID) {
- this.$store.commit('saveInviteId', inviteId)
- }
- },
- methods: {
- dealOptions (options) {
- let option = options
- if (Object.prototype.hasOwnProperty.call(option, 'scene')) {
- const str = decodeURIComponent(option.scene).split('&')
- const json = {}
- str.forEach(item => {
- const index = item.indexOf('=')
- json[item.slice(0, index)] = item.slice(index + 1)
- })
- option = json
- }
- for (const key in option) {
- option[key.toUpperCase()] = option[key]
- }
- return option
- }
- },
- onShareAppMessage (res) {
- const title = '请你趣吃霸王餐'
- let url = '/pages/index'
- if (this.$store.userInfo) {
- url += '?invite_id=' + this.$store.userInfo.id
- }
- return {
- title: title,
- path: url
- }
- },
- onShareTimeline (res) {
- const title = '请你趣吃霸王餐'
- let url = '/pages/index'
- if (this.$store.userInfo) {
- url += '?invite_id=' + this.$store.userInfo.id
- }
- return {
- title: title,
- path: url
- }
- }
- })
- Vue.component('network-error', networkError)
- const app = new Vue({
- ...App
- })
- app.$mount()
|