forked from stavyan/TinyShop-UniApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset.vue
More file actions
executable file
·185 lines (185 loc) · 4.37 KB
/
Copy pathset.vue
File metadata and controls
executable file
·185 lines (185 loc) · 4.37 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<template>
<view class="set">
<view
class="list-cell b-b"
:class="{ 'm-t': item.class === 'mT' }"
v-for="item in setList"
:key="item.title"
@tap="navTo(item.url)"
hover-class="cell-hover"
:hover-stay-time="50"
>
<text class="cell-tit">{{ item.title }}</text>
<text class="cell-tip">{{ item.content }}</text>
<text class="cell-more iconfont iconyou"></text>
</view>
<!-- #ifdef APP-PLUS -->
<view class="list-cell m-t">
<text class="cell-tit">消息推送</text>
<switch :checked="notifyChecked" :color="themeColor.color" />
</view>
<!-- #endif -->
<view class="cu-list menu sm-border card-menu" v-if="styleUserIsOpen">
<view class="cu-item">
<view class="content flex align-center">
<text
class="cuIcon-colorlens"
:class="'text-' + themeColor.name"
></text>
<view
class="padding solid radius shadow-blur"
:class="'bg-' + themeColor.name"
></view>
<view class="title"
>主题色:<text :class="'text-' + themeColor.name">{{
themeColor.title
}}</text></view
>
</view>
<view class="action">
<button
class="cu-btn round shadow"
@click="showColorModal"
:class="'bg-' + themeColor.name"
>
<text class="cuIcon-colorlens"></text> 选择主题
</button>
</view>
</view>
</view>
<view
class="list-cell log-out-btn"
:class="'text-' + themeColor.name"
@tap="toLogout"
>
<text class="cell-tit">退出登录</text>
</view>
<!-- modal -->
<!-- 选择颜色模态框 -->
<view class="cu-modal" :class="{ show: colorModal }">
<view class="cu-dialog">
<view class="cu-bar justify-end solid-bottom">
<view class="content">选择颜色</view>
<view class="action" @tap="colorModal = false">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="grid col-5 padding">
<view
class="padding-xs"
v-for="(item, index) in themeList"
:key="index"
@tap="SetColor(item)"
:data-color="item.name"
>
<view class="padding-tb radius" :class="'bg-' + item.name">
{{ item.title }}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { logout } from '@/api/login';
export default {
data() {
return {
isVersionUpgradeShow: false,
loadProgress: 0,
CustomBar: this.CustomBar,
user: {},
setList: this.$mConstDataConfig.setList,
styleUserIsOpen: this.$mSettingConfig.styleUserIsOpen,
notifyChecked: false,
isNewVersion: false,
colorModal: false,
themeList: this.$mConstDataConfig.themeList
};
},
onLoad() {
this.initData();
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform === 'ios') {
this.CustomBar = 0;
}
// #endif
},
methods: {
// 初始化数据
initData() {
this.user = uni.getStorageSync('user');
// 缓存大小
this.setList[5].content = `${uni.getStorageInfoSync().currentSize} kb`;
// #ifdef APP-PLUS
// eslint-disable-next-line
this.setList[8].content = `当前版本 ${plus.runtime.version}`;
// #endif
},
// 通用跳转
navTo(route) {
if (!route) return;
if (route === 'clearCache') {
uni.showModal({
content: '确定要清除缓存吗',
success: e => {
if (e.confirm) {
uni.clearStorageSync();
this.setList[5].content = '0 kb';
this.$mStore.commit('login', this.user);
this.$mHelper.toast('清除缓存成功');
}
}
});
return;
} else if (route === 'versionUpgrade') {
this.isVersionUpgradeShow = true;
if (this.isNewVersion) {
this.$mHelper.toast('已经是最新版本');
}
return;
}
this.$mRouter.push({ route });
},
// 退出登录
toLogout() {
uni.showModal({
content: '确定要退出登录么',
success: e => {
if (e.confirm) {
this.$http.post(`${logout}`).then(() => {
this.$mStore.commit('logout');
uni.reLaunch({
url: '/pages/profile/profile'
});
});
}
}
});
},
showColorModal() {
this.colorModal = true;
},
SetColor(item) {
this.colorModal = false;
this.themeColor = item;
this.$mStore.commit('setThemeColor', item);
}
}
};
</script>
<style lang="scss">
page {
background: $page-color-base;
}
.set {
padding: $spacing-base 0;
}
.cu-list.card-menu {
margin: $spacing-base 0;
.title {
margin-left: $spacing-base;
}
}
</style>