1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <script>
- import {hasUpdate} from '@/utils/common.js'
- export default {
- onLaunch: function(options) {
- if(options.query.thirdCode){
- this.$store.commit('setThirdCode',options.query.thirdCode)
- }
- this.$store.dispatch('getUserInfo')
- this.$store.dispatch('getTabBar')
- const ENV=uni.getAccountInfoSync().miniProgram
- console.log('当前版本',ENV);
- uni.getSystemInfo({
- success: function (res) {
- console.log('宽度:',res.windowWidth);
- console.log('设备:',res.platform);
- if (res.windowWidth > 750||['windows','mac'].includes(res.platform)) {
- const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
- let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
- for(const key in params){
- paramsStr=`${paramsStr}&${key}=${params[key]}`
- }
- console.log('进入pc');
- uni.reLaunch({
- url: `/pages/pc?${paramsStr}&platform_source=xcx`,
- });
- }
- },
- fail:function(res){
- }
- })
-
- // 用户通过分享看看有没有code
- if (options.query && options.query.InviteShareCode) {
- console.log('进来了没有?');
- this.$store.commit("getInviteShareCode", options.query.InviteShareCode);
- }
- // 开启ios静音也行播放语音
- wx.setInnerAudioOption({
- obeyMuteSwitch:false
- })
- //设置在小程序内屏幕常亮(防止录音等操作自动息屏会停止录音)
- wx.setKeepScreenOn({
- keepScreenOn: true,
- fail(res){
- console.log('设置屏幕常亮失败:',res);
- }
- })
- if(ENV.envVersion!=='release'){
- // 打开调试
- wx.setEnableDebug({
- enableDebug: true
- })
- }
- },
- onShow: function(options) {
- console.log('App Show')
- hasUpdate()
- },
- onHide: function() {
- console.log('App Hide')
- }
- }
- </script>
- <style lang='scss'>
- @import "/wxcomponents/vant/common/index.wxss";
- /* 页面公共样式 */
- @import "./style/common.scss";
-
- </style>
|