You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

364 lines
7.4 KiB

4 weeks ago
  1. <template>
  2. <LoginPrompt ref="loginPrompt"></LoginPrompt>
  3. <view class="main">
  4. <view class="top">
  5. <view class="bell">
  6. <!-- <image class="image-bell" src="/static/my/bell.png" /> -->
  7. </view>
  8. <view class="msg">
  9. <view class="msg-left">
  10. <image class="avatar"
  11. :src="avatarUrl || 'https://d31zlh4on95l9h.cloudfront.net/default/1961d9d2e31e78e47e885231e7514a35.png'"
  12. mode="aspectFill" />
  13. </view>
  14. <view class=" msg-center">
  15. <view style="display: flex;">
  16. <template v-if="!isEditingName">
  17. <view class="userInfo">{{ username }}</view>
  18. <image class="image-editName" src="/static/my/editName.png" @click="startEditName" />
  19. </template>
  20. <template v-else>
  21. <input v-model="editingName" class="edit-input" @blur="finishEditName"
  22. @keyup.enter="finishEditName" autofocus placeholder="请输入用户名" />
  23. </template>
  24. </view>
  25. <view class="userId">ID:{{ dccode }}</view>
  26. </view>
  27. <!-- <view class="msg-right">
  28. <image class="image-attendance" src="/static/my/Check-in.png"/>
  29. <span style="font-size:10px;">签到</span>
  30. </view> -->
  31. </view>
  32. <view class="settings-buttons">
  33. <view class="setting-btn" @click="goToMarket">
  34. <image src="/static/my/MarketSettings.png" class="setting-icon" />
  35. <text>行情设置</text>
  36. </view>
  37. <view class="setting-btn" @click="goToGeneral">
  38. <image src="/static/my/Settings.png" class="setting-icon" />
  39. <text>通用设置</text>
  40. </view>
  41. </view>
  42. <view class="share" @click="goToShare">
  43. <image class="img-share" src="/static/my/share.png" mode="widthFix" />
  44. </view>
  45. </view>
  46. <view class="bottom">
  47. <view class="list-item" @click="goToAccount">
  48. <image src="/static/my/security.png" class="list-icon" />
  49. <text>账号与安全</text>
  50. <uni-icons type="arrowright" size="16" class="arrow" />
  51. </view>
  52. <!-- <view class="list-item">
  53. <image src="/static/my/connection.png" class="list-icon" />
  54. <text>联系我们</text>
  55. <uni-icons type="arrowright" size="16" class="arrow" />
  56. </view>
  57. <view class="list-item" @click="goToNewVersion">
  58. <image src="/static/my/update.png" class="list-icon" />
  59. <text>新版本更新</text>
  60. <view class="update-tip">有新版本可更新
  61. <view class="circle"></view>
  62. </view>
  63. <uni-icons type="arrowright" size="16" class="arrow" />
  64. </view>
  65. <view class="list-item">
  66. <image src="/static/my/opinion.png" class="list-icon" />
  67. <text>意见反馈</text>
  68. <uni-icons type="arrowright" size="16" class="arrow" />
  69. </view> -->
  70. <view class="list-item" @click="goToAbout">
  71. <image src="/static/my/about.png" class="list-icon" />
  72. <text>关于DeepChart</text>
  73. <uni-icons type="arrowright" size="16" class="arrow" />
  74. </view>
  75. </view>
  76. <footerBar class="static-footer" :type="type"></footerBar>
  77. </view>
  78. </template>
  79. <script setup>
  80. import {
  81. ref,
  82. onMounted
  83. } from 'vue'
  84. import {
  85. ArrowRight
  86. } from '@element-plus/icons-vue'
  87. import footerBar from '../../components/footerBar.vue'
  88. import {
  89. getUserInfo,
  90. updateUserInfo
  91. } from "@/api/member"
  92. import {
  93. useUserStore
  94. } from "../../stores/modules/userInfo"
  95. const userStore = useUserStore()
  96. const type = ref('member')
  97. const iSMT = ref(0)
  98. const username = ref('')
  99. const dccode = ref('')
  100. const avatarUrl = ref('')
  101. const isEditingName = ref(false)
  102. const editingName = ref('')
  103. const userInfoRes = ref() // 用户身份信息
  104. userInfoRes.value = getUserInfo()
  105. userInfoRes.value.then(res => {
  106. username.value = res.data.dcname
  107. dccode.value = res.data.dccode
  108. avatarUrl.value = res.data.avatar
  109. console.log('用户信息', userInfoRes.value)
  110. })
  111. const startEditName = () => {
  112. isEditingName.value = true
  113. editingName.value = username.value
  114. }
  115. const finishEditName = async () => {
  116. if (editingName.value.trim() === '' || editingName.value === username.value) {
  117. isEditingName.value = false
  118. return
  119. }
  120. try {
  121. await updateUserInfo({
  122. dcname: editingName.value
  123. })
  124. uni.showToast({
  125. title: '昵称修改成功',
  126. icon: 'none'
  127. })
  128. } catch (err) {
  129. uni.showToast({
  130. title: '修改失败,请重试',
  131. icon: 'none'
  132. })
  133. } finally {
  134. isEditingName.value = false
  135. }
  136. }
  137. const goToGeneral = () => {
  138. uni.navigateTo({
  139. url: '/pages/setting/general'
  140. })
  141. }
  142. const goToMarket = () => {
  143. uni.navigateTo({
  144. url: '../setting/market'
  145. })
  146. }
  147. const goToAccount = () => {
  148. uni.navigateTo({
  149. url: '../setting/account'
  150. })
  151. }
  152. const goToNewVersion = () => {
  153. uni.navigateTo({
  154. url: '../setting/newVersion'
  155. })
  156. }
  157. const goToAbout = () => {
  158. uni.navigateTo({
  159. url: '../setting/about'
  160. })
  161. }
  162. const goToShare = () => {
  163. console.log('用户信息==========',userStore.userInfo.isVisitor)
  164. if (userStore.userInfo.isVisitor) {
  165. uni.showToast({
  166. title: '请先登录',
  167. icon: 'none'
  168. })
  169. return
  170. }
  171. uni.navigateTo({
  172. url: '../setting/share'
  173. })
  174. }
  175. onMounted(() => {
  176. // 状态栏高度
  177. iSMT.value = uni.getSystemInfoSync().statusBarHeight
  178. console.log('??????????????', iSMT.value)
  179. console.log('通信来的用户身份', userStore.userInfo)
  180. })
  181. </script>
  182. <style scoped>
  183. .static-footer {
  184. position: fixed;
  185. bottom: 0;
  186. }
  187. .top {
  188. height: 50vh;
  189. background-color: white;
  190. }
  191. .bell {
  192. height: 9.6vh;
  193. display: flex;
  194. align-items: flex-end;
  195. justify-content: flex-end;
  196. padding-right: 50rpx;
  197. }
  198. .image-bell {
  199. width: 26rpx;
  200. height: 32rpx;
  201. }
  202. .msg {
  203. height: 10.7vh;
  204. display: flex;
  205. margin-top: 3vh;
  206. margin-bottom: 3vh;
  207. }
  208. .msg-left {
  209. width: 252rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. }
  214. .avatar {
  215. width: 175rpx;
  216. height: 175rpx;
  217. border-radius: 50%;
  218. background-color: black;
  219. }
  220. .msg-center {
  221. width: 388rpx;
  222. padding-left: 2.5vh;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: center;
  226. }
  227. .userInfo {
  228. font-size: 30rpx;
  229. font-weight: bold;
  230. }
  231. .userId {
  232. font-size: 14px;
  233. margin-top: 1vh;
  234. }
  235. .image-editName {
  236. width: 40rpx;
  237. height: 40rpx;
  238. margin-left: 15rpx;
  239. }
  240. .msg-right {
  241. display: flex;
  242. flex-direction: column;
  243. justify-content: center;
  244. }
  245. .image-attendance {
  246. width: 43rpx;
  247. height: 43rpx;
  248. }
  249. .settings-buttons {
  250. display: flex;
  251. justify-content: space-around;
  252. }
  253. .setting-btn {
  254. width: 349rpx;
  255. height: 135rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: center;
  259. background-color: rgb(243, 243, 243);
  260. border-radius: 8%;
  261. margin-bottom: 1vh;
  262. }
  263. .setting-icon {
  264. width: 64.7rpx;
  265. height: 64.7rpx;
  266. margin-right: 25rpx;
  267. }
  268. .setting-btn text {
  269. font-size: 28rpx;
  270. font-weight: bold;
  271. color: #333;
  272. }
  273. .share {
  274. height: 12.6vh;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. }
  279. .img-share {
  280. width: 720rpx;
  281. height: 160rpx;
  282. }
  283. .bottom {
  284. height: 44.5vh;
  285. margin-top: 1vh;
  286. background-color: rgb(255, 255, 255);
  287. }
  288. .list-item {
  289. width: 670rpx;
  290. height: 7vh;
  291. display: flex;
  292. align-items: center;
  293. margin: 0rpx 40rpx;
  294. border-bottom: 1rpx solid #eee;
  295. }
  296. .list-item:last-child {
  297. border-bottom: none;
  298. }
  299. .list-icon {
  300. width: 42rpx;
  301. height: 42rpx;
  302. margin-right: 18rpx;
  303. }
  304. .arrow {
  305. margin-left: auto;
  306. }
  307. .update-tip {
  308. display: flex;
  309. color: #999;
  310. font-size: 24rpx;
  311. align-items: center;
  312. margin-left: 200rpx;
  313. justify-content: center;
  314. }
  315. .circle {
  316. width: 10rpx;
  317. height: 10rpx;
  318. border-radius: 50%;
  319. background-color: red;
  320. margin-left: 10rpx;
  321. }
  322. .edit-input {
  323. background-color: #999;
  324. }
  325. </style>