1
jhzh
2026-05-22 ef52095f5e9f0a9fe2da779bb1573947d77d75b6
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
<template>
  <div class="safety">
    <assets-head :title="''" :show-left="true" />
    <div class="safety-content">
      <!-- 第一组:修改登录密码、修改资金密码 -->
      <div class="safety-list safety-list--white">
        <div
          v-for="(item, index) in list"
          :key="index"
          class="safety-item"
          @click="$router.push(item.url)"
        >
          <span class="safety-item-name" v-text="item.name"></span>
          <van-icon name="arrow" class="safety-item-arrow" />
        </div>
      </div>
      <!-- 第二组:语言 -->
      <div class="safety-list safety-list--gray">
        <div class="safety-item" @click="$router.push('/language')">
          <span class="safety-item-name">{{ $t('language') }}</span>
          <span class="safety-item-extra">{{ localeLabel }}</span>
          <van-icon name="arrow" class="safety-item-arrow" />
        </div>
      </div>
    </div>
    <!-- 退出登录按钮 -->
    <button class="safety-logout" @click="loginOut">{{ $t('loginOut') }}</button>
  </div>
</template>
 
<script setup>
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { _logOut } from "@/service/user.api.js";
import { useUserStore } from "@/store/user";
import { localeLabels } from "./locale-labels.js";
import AssetsHead from "@/components/Transform/assets-head/index.vue";
 
const router = useRouter();
const { t, locale } = useI18n();
const userStore = useUserStore();
 
const localeLabel = computed(() => {
  const loc = locale && typeof locale === "object" && "value" in locale ? locale.value : locale;
  return localeLabels[loc] || loc || "English";
});
 
const list = computed(() => [
  { name: t("changeLoginPassword"), url: "/changePassword" },
  { name: t("changeFunsPassword"), url: "/changeFundsPassword" },
]);
 
const loginOut = () => {
  const token = userStore.userInfo?.token;
  if (token) {
    _logOut({ token }).catch(() => {});
  }
  userStore.$patch({ userInfo: { token: "" } });
  router.replace("/login");
};
</script>
 
<style lang="scss" scoped>
@import "@/assets/init.scss";
 
.safety {
  min-height: 100vh;
  background: #fff;
  box-sizing: border-box;
  padding-bottom: 40px;
}
 
.safety-content {
  padding: 0 16px;
}
 
.safety-list {
  border-radius: 12px;
  overflow: hidden;
  margin-top: 20px;
 
  &:first-of-type {
    margin-top: 16px;
  }
}
 
.safety-list--white {
  background: #fff;
  box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.06);
}
 
.safety-list--gray {
  background: #f5f5f5;
}
 
.safety-item {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 4px 0 0;
  font-size: 16px;
  color: #333;
  background: transparent;
 
  &:not(:last-child) {
    border-bottom: 1px solid #eee;
  }
}
 
.safety-list--gray .safety-item:not(:last-child) {
  border-bottom-color: #ebebeb;
}
 
.safety-item-name {
  flex: 1;
  font-weight: 400;
}
 
.safety-item-extra {
  margin-right: 8px;
  font-size: 14px;
  color: #999;
}
 
.safety-item-arrow {
  font-size: 14px;
  color: #c8c9cc;
}
 
.safety-logout {
  display: block;
  width: calc(100% - 32px);
  margin: 32px 16px 0;
  padding: 16px 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #a443cf, #5e2bc8);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
</style>