123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <style lang="scss">
- /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
- @import "@/uni_modules/uview-ui/index.scss";
- @import 'static/css/common.scss';
- </style>
- <script>
- import {
- mapMutations
- } from 'vuex';
- import Vue from 'vue'
- import * as config from '@/config'
- import appUpdate from 'common/appUpdate.js'
- // import app_push from './components/APPPush/app_push.js'
- export default {
- methods: {
- ...mapMutations(['login']),
- },
- onLaunch: function() {
- uni.getSystemInfo({
- success:function(e){
- Vue.prototype.statusBar = e.statusBarHeight
- // #ifndef MP
- if(e.platform == 'android') {
- Vue.prototype.customBar = e.statusBarHeight + 50
- }else {
- Vue.prototype.customBar = e.statusBarHeight + 45
- }
- // #endif
-
- // #ifdef MP-WEIXIN
- let custom = wx.getMenuButtonBoundingClientRect()
- Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
- // #endif
-
- // #ifdef MP-ALIPAY
- Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
- // #endif
- }
- })
- uni.onTabBarMidButtonTap(()=>{
- uni.navigateTo({
- url: '/pages/release/release'
- });
- })
- // #ifdef APP-PLUS
- let type = uni.getSystemInfoSync().platform
- console.log(type)
- if (type == "android") {
- console.log(111111111111111111111111111111111111111111111111111)
- appUpdate()
- }
- // var that = this
- // plus.push.getClientInfoAsync((info) => {
- // var name = 'clientId'
- // var value = info.clientid
- // that.$store.commit('$uStore', {
- // name,
- // value
- // });
- // uni.setStorageSync("clientId", info.clientid)
- // console.log("info.clientid", info.clientid)
- // }, err => {});
- // // 监听在线消息事件
- // plus.push.addEventListener("receive", function(msg) {
- // var title = msg.content.split(':')[0]
- // var content = msg.content.split(':')[1]
- // let params = {
- // inApp: true, // app内横幅提醒
- // voice: true, // 声音提醒
- // vibration: true, // 振动提醒
- // messageType: "",
- // messageTitle: title,
- // messageContent: content,
- // messageImage: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/logo.png'
- // }
- // console.log("msg", msg)
- // // new app_push({
- // // ...params
- // // }).show();
- // var userInfo = uni.getStorageSync("userInfo")
- // var that = this
- // that.$request.baseRequest('get', '/notice/query/noticeNumber').then(res => {
- // if (res.data.data) {
- // let name = 'myTip';
- // let value = res.data.data.task;
- // that.$store.commit('$uStore', {
- // name,
- // value
- // });
- // if (value != 0 && value) {
- // uni.setTabBarBadge({
- // index: 4,
- // text: value + ""
- // })
- // }
- // name = 'taskTip';
- // value = res.data.data.task;
- // that.$store.commit('$uStore', {
- // name,
- // value
- // });
- // // name = 'contractTip';
- // // value = res.data.data.contractTip;
- // // that.$store.commit('$uStore', {
- // // name,
- // // value
- // // });
- // }
- // })
- // //其它逻辑
- // }, false);
- // //监听系统通知栏消息点击事件
- // plus.push.addEventListener('click', function(msg) {
- // //处理点击消息的业务逻辑代码
- // if (msg.content && msg.content.contains("任务")) {
- // uni.navigateTo({
- // url: '/pages/task/my_task'
- // })
- // } else if (msg.content && (msg.content.contains("合同") || msg.content.contains("交易"))) {
- // uni.navigateTo({
- // url: '/pageB/contract/contract'
- // })
- // }
- // }, false);
- // #endif
- this.$socket.initWebIM(this.$ws, true, true)
- let userInfo = uni.getStorageSync('userInfo') || '';
- if (userInfo.id) {
- //更新登陆状态
- uni.getStorage({
- key: 'userInfo',
- success: (res) => {
- this.login(res.data);
- }
- });
- }
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- },
- }
- </script>
- <style>
- /*每个页面公共css */
- </style>
|