1 Star 0 Fork 10

江苏栢瑞文大数据科技有限公司/来一桶水站管理系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
App.vue 5.39 KB
一键复制 编辑 原始数据 按行查看 历史
lumw_sina 提交于 2021-02-20 11:27 . 初始提交
<script>
import { checkLogin } from "./libs/login";
import { HTTP_REQUEST_URL } from './config/app';
import Vue from 'vue'
import {
wechatAuth
} from "@/api/public";
import {
WX_AUTH,
STATE_KEY,
LOGINTYPE,
BACK_URL,
WX_USER_OPENID,
OPEN_ID
} from '@/config/cache';
import Cache from '@/utils/cache';
export default {
globalData: {
spid: 0,
code:0,
isLogin:false,
userInfo:{},
MyMenus:[]
},
onLaunch: function(option) {
let that = this;
// #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:
let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.code = val.pid;
break;
//长按图片识别小程序码
case 1048:
that.globalData.code = option.query.scene;
break;
//手机相册选取小程序码
case 1049:
that.globalData.code = option.query.scene;
break;
//直接进入小程序
case 1001:
that.globalData.spid = option.query.scene;
break;
}
}
// #endif
// 获取导航高度;
uni.getSystemInfo({
success: function (e) {
that.globalData.navHeight = e.statusBarHeight * (750 / e.windowWidth) + 91;
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
};
// #endif
// #ifdef MP-WEIXIN
Vue.prototype.StatusBar = e.statusBarHeight;
let custom = wx.getMenuButtonBoundingClientRect();
Vue.prototype.Custom = custom;
Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif
// #ifdef MP-ALIPAY
Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// #endif
}
});
let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') !== -1) {
let openid = this.$queue.getData('openid');
let that = this;
if (!openid) {
if (window.location.href.indexOf('?code=') !== -1 || window.location.href.indexOf('&code=') !== -1) {
let code;
if (window.location.href.indexOf('?code=') !== -1) {
code = window.location.href.split('?code=')[1].split('&')[0];
} else {
code = window.location.href.split('&code=')[1].split('&')[0];
}
let loginType = Cache.get(LOGINTYPE);
wechatAuth(code, Cache.get("spread"), loginType)
.then(({
data
}) => {
console.log(data);
that.$store.commit("LOGIN", {'token': data.token});
Cache.set(WX_AUTH, code);
this.$queue.setData('openid', data.user.openId);
}).catch(data => {
that.$util.Tips({title: data});
});
} else {
window.location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
that.$queue.getWxAppid() +
'&redirect_uri=' +
window.location.href.split('#')[0] +
'&response_type=code&scope=snsapi_userinfo#wechat_redirect';
}
}
}
},
mounted() {
},
onShow: function() {
// #ifdef H5
uni.getSystemInfo({
success(e){
/* 窗口宽度大于420px且不在PC页面且不在移动设备时跳转至 PC.html 页面 */
if(e.windowWidth>420 && !window.top.isPC && !/iOS|Android/i.test(e.system)){
// window.location.pathname = 'https://java.crmeb.net/';
/* 若你的项目未设置根目录(默认为 / 时),则使用下方代码 */
window.location.pathname = '/static/html/pc.html';
}
}
})
// #endif
},
onHide: function() {
//console.log('App Hide')
}
}
</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';
@import 'static/css/main.css'; */
@import 'static/css/app.scss';
/* @import 'static/css/main.css';
*/
/* @import 'static/css/base.css';
*/
@import 'static/css/icon.css';
@import 'static/iconfont/iconfont.css';
/* 条件编译,仅在H5平台生效 */
// #ifdef H5
body::-webkit-scrollbar,html::-webkit-scrollbar {
display: none;
}
// #endif
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>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiangsu-pereven-big-data/waterSystem.git
git@gitee.com:jiangsu-pereven-big-data/waterSystem.git
jiangsu-pereven-big-data
waterSystem
来一桶水站管理系统
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385