1 Star 0 Fork 0

练先生/wechatapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.js 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
import Vue from 'vue'
import App from './App'
import { BASE_URL, SIGN } from './env.js'
Vue.prototype.$BASE_URL = BASE_URL
Vue.prototype.$SIGN = SIGN
// #ifdef H5
Vue.prototype.$WXOA_CALLBACK = `${window.location.origin + window.location.pathname}?${SIGN}#/pages/login/login`
// #endif
import uView from '@/uview-ui'
Vue.use(uView)
import request from '@/common/request/index.js'
Vue.prototype.$request = request
import utils from '@/common/utils/index.js'
Vue.prototype.$utils = utils
import store from '@/common/store/index.js'
Vue.prototype.$store = store
import CustomNavbar from '@/components/CustomNavbar.vue'
Vue.component('CustomNavbar', CustomNavbar)
import CustomBackTop from '@/components/CustomBackTop.vue'
Vue.component('CustomBackTop', CustomBackTop)
// #ifdef H5
// import Vconsole from 'vconsole'
// const vConsole = new Vconsole();
import wxoaShare from '@/common/utils/share.js'
// #endif
Vue.mixin({
data() {
return {
shareData: {
spm: this.$store.state.user.userInfo?.id ? `${this.$store.state.user?.userInfo?.id}.1.0.3.1` : "",
title: this.$store.state.app.config?.share?.title ? this.$store.state.app.config?.share?.title : "",
imageUrl: this.$store.state.app.config?.share?.image ? this.$store.state.app.config?.share?.image : "",
desc: this.$store.state.app.config?.share?.description ? this.$store.state.app.config?.share?.description : ""
}
}
},
onLoad(option) {
// #ifdef MP-WEIXIN
wx.showShareMenu({
withShareTicket: false,
menus: ["shareAppMessage", "shareTimeline"]
})
// #endif
},
onShow() {
// #ifdef H5
// wxoaShare()
// #endif
},
onShareAppMessage(res) {
// #ifdef MP-WEIXIN
this.$request('user.taskFinish', { type: 'share_wx_after' })
return {
title: this.shareData.title,
path: `/pages/home/index?scene=${this.shareData.spm}`,
imageUrl: this.shareData.imageUrl
}
// #endif
},
onShareTimeline(res) {
// #ifdef MP-WEIXIN
this.$request('user.taskFinish', { type: 'share_wxf_after' })
return {
title: this.shareData.title,
query: `scene=${this.shareData.spm}`,
imageUrl: this.shareData.imageUrl
}
// #endif
},
methods: {
// 跳转页面
jumpView(url) {
uni.navigateTo({ url })
},
// 视频详情
openVideoDetail(id, title, image, desc,cId,time,limit) {
// #ifdef H5
const obj = { title, image, desc }
this.jumpView(`/pages/video/play?id=${id}&d=${JSON.stringify(obj)}&cId=${cId}&time=${time}&limit=${limit}`)
// #endif
// #ifndef H5
this.jumpView(`/pages/video/play?id=${id}&limit=${limit}`)
// #endif
},
}
})
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/einstein8/wechatapp.git
git@gitee.com:einstein8/wechatapp.git
einstein8
wechatapp
wechatapp
master

搜索帮助