App.vue
2.8 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!--
* @Descripttion:
* @version: 0.0.0
* @Author: genglw
* @Date: 2022-01-29 16:40:40
* @LastEditors: genglw
* @LastEditTime: 2022-10-20 16:35:42
-->
<template>
<view :style="vuex_theme">
<u-toast ref="uToast" />
</view>
</template>
<script>
import { themeList } from "./common/theme.js";
import { mapActions } from "vuex";
export default {
// 此处globalData为了演示其作用,不是uView框架的一部分
globalData: {
username: "",
},
data() {
return {
themeList,
};
},
onLaunch(e) {
if(e.path&&e.path=='pages/student/home/job-detail/job-detail'&&e.query&&e.query.id){
this.$u.vuex("vuex_alipay",true)
}
let colorObj = this.themeList[this.vuex_appId].value;
let styles = "";
for (let i in colorObj) {
styles += colorObj[i].name + ":" + colorObj[i].value + ";";
}
this.$u.vuex("vuex_theme", styles);
this.$u.vuex("vuex_baseImgUrl", this.themeList[this.vuex_appId].imagePath);
// console.log('vuex_theme----', this.vuex_theme)
uni.setTabBarStyle({
selectedColor: "var(--primary-color)",
});
// if (this.vuex_phone && this.vuex_token) {
// my.login({
// success: (res) => {
// this.$store.dispatch(`user/login1`, {
// type: "student",
// way: "wechat",
// jsCode: res.code,
// phone: this.vuex_phone,
// formType: "3",
// });
// },
// });
// }
if (e.query && e.query.id) {
return;
}
try {
// 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
let lifeData = uni.getStorageSync("lifeData");
if (
!lifeData ||
JSON.stringify(lifeData) == "{}" ||
this.vuex_role == ""
) {
uni.$u.route("/pages/common/select-role/select-role");
}
} catch (e) {
console.log(e);
}
},
methods: {
setTabBar() {
let tabBar = tabBarList.find(
(item) => item.themeName == uni.getStorageSync("themeName")
);
uni.setTabBarItem({
index: 0,
selectedIconPath: tabBar.home,
});
uni.setTabBarItem({
index: 1,
selectedIconPath: tabBar.task,
});
uni.setTabBarItem({
index: 2,
selectedIconPath: tabBar.user,
});
},
},
};
</script>
<style lang="scss">
@import "uview-ui/index.scss";
@import "common/demo.scss";
// @import '@/static/common/css/icon.css';
/* #ifdef MP-WEIXIN */
wx-swiper .wx-swiper-dot {
width: 20rpx;
height: 10rpx;
border-radius: 5rpx;
}
wx-swiper .wx-swiper-dot-active {
background-color: #000;
width: 30rpx;
height: 15rpx;
border-radius: 7.5rpx;
}
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
/* #endif */
</style>