1 Star 0 Fork 0

柳成行/hcx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
App.vue 3.79 KB
一键复制 编辑 原始数据 按行查看 历史
柳成行 提交于 2023-12-29 09:05 . 2023/12/29/01:00提交
<script>
import {
checkLogin
} from "./libs/login";
import {
HTTP_REQUEST_URL
} from './config/app';
import Auth from './libs/wechat.js';
import Routine from './libs/routine.js';
import Apps from './libs/apps.js';
import {
mapActions
} from 'vuex'
export default {
globalData: {
spid: 0,
code: 0,
isLogin: false,
userInfo: {},
MyMenus: [],
windowHeight: 0,
id: 0,
withShareTicket: false,
},
onLaunch: function(option) {
let that = this;
wx.hideShareMenu({
menus: ['shareAppMessage'],
})
// #ifdef MP
if (HTTP_REQUEST_URL == '') {
console.error(
"请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret"
);
return false;
}
if (option.query.hasOwnProperty('scene')) {
switch(option.scene){
case 1047: //扫描小程序码
case 1048: //长按图片识别小程序码
case 1049: //手机相册选取小程序码
case 1001: //直接进入小程序
let value = this.$util.getUrlParams(decodeURIComponent(option.query.scene));
let values = value.split(',');
if(values.length === 2){
let v1 = values[0].split(":");
if (v1[0] === 'pid') {
that.globalData.spid = v1[1];
} else{
that.globalData.id = v1[1];
}
let v2 = values[1].split(":");
if (v2[0] === 'pid') {
that.globalData.spid = v2[1];
}else{
that.globalData.id = v2[1];
}
}else{
that.globalData.spid = values[0].split(":")[1];
}
break;
}
}
// #endif
// 获取导航高度;
uni.getSystemInfo({
success: function(res) {
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
}
});
// #ifdef MP
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
// #endif
// #ifdef MP
// 小程序静默授权
if (!this.$store.getters.isLogin) {
let spread = that.globalData.spid ? that.globalData.spid : 0;
Routine.getCode()
.then(code => {
Routine.authUserInfo(code, {
'spread_spid': spread
}).then(res => {
// that.$store.commit('AuthorizeType', res.data.type);
})
})
.catch(res => {
uni.hideLoading();
});
}
// #endif
},
async mounted() {
if(this.$store.getters.isLogin && !this.$Cache.get('USER_INFO'))await this.$store.dispatch('USERINFO');
},
methods: {
// isShare: function(){
// if(JSON.parse(this.$Cache.get('USER_INFO')).isPromoter){
// // this.shareApi();
// wx.showShareMenu({
// menus: ['shareAppMessage', 'shareTimeline'],
// });
// }else{
// wx.hideShareMenu({
// menus: ['shareAppMessage', 'shareTimeline'],
// });
// };
// },
},
onShow: function() {
},
onHide: function() {
//console.log('App Hide')
},
// getChatUrL() {
// kefuConfig().then(res => {
// let data = res.data;
// this.$store.commit("SET_CHATURL", data.yzfUrl);
// Cache.set('chatUrl', data.yzfUrl);
// })
// },
}
</script>
<style>
@import url("@/plugin/animate/animate.min.css");
@import 'static/css/base.css';
@import 'static/iconfont/iconfont.css';
@import 'static/css/guildford.css';
@import 'static/css/style.scss';
view {
box-sizing: border-box;
}
.bg-color-red {
background-color: #E93323 !important;
}
.syspadding {
padding-top: var(--status-bar-height);
}
.flex {
display: flex;
}
.uni-scroll-view::-webkit-scrollbar {
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
微信
1
https://gitee.com/liu8569559/hcx.git
git@gitee.com:liu8569559/hcx.git
liu8569559
hcx
hcx
master

搜索帮助