123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <script>
- /**
- * vuex管理登陆状态,具体可以参考官方登陆模板示例
- */
- import Vue from 'vue'
- import { mapState,mapMutations} from 'vuex';
- import authorize from '@/common/config/authorize.js'
- import wxLogin from "@/common/config/wxLogin.js"
- export default {
- onLaunch: function() {
- let self = this
- uni.getSystemInfo({
- success: function(e) {
- let modelmes = e.model;
- console.log(e);
- if (modelmes.search('iPhone 11') || modelmes.search('iPhone 11 Pro Max') ||modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
- self.$store.dispatch('setVariableFun',true)
- }else{
- self.$store.dispatch('setVariableFun',false)
- }
- // #ifndef MP
- Vue.prototype.StatusBar = e.statusBarHeight;
- if (e.platform == 'android') {
- Vue.prototype.CustomBar = e.statusBarHeight + 50;
- Vue.prototype.platformClass = true
- } else {
- Vue.prototype.CustomBar = e.statusBarHeight + 45;
- Vue.prototype.platformClass = false
- };
- // #endif
-
- // #ifdef MP-WEIXIN || MP-QQ
- console.log(e.platform)
- if (e.platform == 'android') {
- Vue.prototype.platformClass = 'left'
- self.$store.dispatch('setVariableFun',false)
- } else {
- Vue.prototype.platformClass = 'center'
- self.$store.dispatch('setIsIphoneFun',true)
- }
- Vue.prototype.StatusBar = e.statusBarHeight;
- Vue.prototype.fontSizeSetting = e.fontSizeSetting
- Vue.prototype.screenWidth = e.screenWidth
- let capsule = wx.getMenuButtonBoundingClientRect();
- Vue.prototype.capsule = capsule
- if (capsule) {
- Vue.prototype.Custom = capsule;
- // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
- Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
- } else {
- Vue.prototype.CustomBar = e.statusBarHeight + 50;
- }
- // #endif
- // #ifdef MP-ALIPAY
- Vue.prototype.StatusBar = e.statusBarHeight;
- Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
- // #endif
- }
- })
- this.refresh()
- if(uni.getStorageSync('isActivityStatus')){
- const lockTime = uni.getStorageSync('lockTime')
- const eTime = this.diffTime(lockTime)
- this.$store.dispatch('setActivityFn',eTime)
- }else{
- this.$store.dispatch('setActivityFn',true)
- }
- },
- methods:{
- refresh(){
- let TIME = (20*60)*1000;
- setInterval(()=>{
- authorize.getSetting().then(res =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
- if(res == 1){
- wxLogin.wxLoginAuthorize()
- }else{
- console.log('授权失败============>:'+'用户取消授权或者未操作')
- }
- }).catch(error=>{
- console.log('授权失败============>:'+'用户授权失败,提醒用户重新授权')
- })
- },TIME)
- },
- diffTime(t){
- let date = Date.now();
- return (date -t) < 2*60*1000 ? false : true
- }
- },
- onShow: function() {
-
- },
- onHide: function() {
- console.log('App Hide')
- },
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import "@/common/css/common.scss";
- @import "@/common/css/iconfont.scss";
- @import "@/common/css/style/thorui.css";
- @import "@/common/css/style/icon.css";
- view,
- scroll-view,
- swiper,
- swiper-item,
- cover-view,
- cover-image,
- icon,
- text,
- rich-text,
- progress,
- button,
- checkbox,
- form,
- input,
- label,
- radio,
- slider,
- switch,
- textarea,
- navigator,
- audio,
- camera,
- image,
- video {
- // box-sizing: border-box;
- }
- // page {
- // width: 100%;
- // height: 100%;
- // background: #fff;
- // filter: grayscale(100%);
- // filter: gray;
- // filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
- // --toast-default-width: 114px;
- // }
- page{
- height: 100%;
- background-color: #FFFFFF;
- }
- /* 骨架屏替代方案 */
- .Skeleton {
- background: #f3f3f3;
- padding: 20upx 0;
- border-radius: 8upx;
- }
- .clamp {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- display: block;
- }
- .common-hover {
- background: #f5f5f5;
- }
- /* input 样式 */
- .input-placeholder {
- color: #999999;
- }
- .placeholder {
- color: #999999;
- }
- </style>
|