main.js
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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: "打卡定位需要获取您的位置信息"
}
}
}
};