import Vue from "vue"; import App from "./App"; import service from "./utils/service"; Vue.config.productionTip = false; App.mpType = "app"; Vue.mixin({ data() { return { service: '', hasMessage: false, number: '', // rootUrl: 'https://mp.whmxrj.com/lawyerApp/', // rootAvatar: 'https://mp.whmxrj.com/' // rootUrl: 'http://192.168.1.112:9393/lawyerApp/', // rootAvatar: 'http://192.168.1.112:9393/' // rootUrl: 'http://47.104.11.101:8080/lawyerApp/', // rootAvatar: 'http://47.104.11.101:8080/', rootUrl: 'https://lawyer.hylawyer.com.cn/lawyerApp/', rootAvatar: 'https://lawyer.hylawyer.com.cn/' }; }, methods: { getLawMessage(){ wx.request({ url: this.rootUrl + 'message/getUnReadMessage', method: 'get', data: { sessionID: wx.getStorageSync('sessionID') }, success: res => { console.log(res) var ruselt = res.data if(ruselt>0){ this.hasMessage = true wx.setTabBarBadge({ index: 3, text: ruselt.toString() }) }else{ //移除角标 wx.removeTabBarBadge({ index: 3 }) } } }) } }, onShow() { this.getLawMessage() }, onUnload(){ this.hasMessage = false this.number = '' }, created() { this.service = service } }); const app = new Vue(App); app.$mount(); if (/http:/.test(app.rootAvatar)) wx.setEnableDebug({ enableDebug: true }); export default { // 这个字段走 app.json config: { // 页面前带有 ^ 符号的,会被编译成首页,其他页面可以选填,我们会自动把 webpack entry 里面的入口页面加进去 pages: ["^pages/news/main"], window: { backgroundTextStyle: "light", navigationBarBackgroundColor: "#AA001A", navigationBarTextStyle: "white" }, tabBar: { color: "#AAAAAA", selectedColor: "#AA001A", borderStyle: "black", backgroundColor: "#FFFFFF", list: [ { selectedIconPath: "/static/imgs/tab/1_selected.png", iconPath: "/static/imgs/tab/1.png", pagePath: "pages/news/main", text: "首页" }, { selectedIconPath: "/static/imgs/tab/2_selected.png", iconPath: "/static/imgs/tab/2.png", pagePath: "pages/workspace/main", text: "工作台" }, { selectedIconPath: "/static/imgs/tab/3_selected.png", iconPath: "/static/imgs/tab/3.png", pagePath: "pages/question/main", text: "提问" }, { selectedIconPath: "/static/imgs/tab/4_selected.png", iconPath: "/static/imgs/tab/4.png", pagePath: "pages/me/main", text: "我的" } ] }, permission: { "scope.userLocation": { desc: "打卡定位需要获取您的位置信息" } } } };