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.

358 lines
7.2 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. uni.navigateTo({
  164. url: '../setting/share'
  165. })
  166. }
  167. onMounted(() => {
  168. // 状态栏高度
  169. iSMT.value = uni.getSystemInfoSync().statusBarHeight
  170. console.log('??????????????', iSMT.value)
  171. console.log('通信来的用户身份', userStore.userInfo)
  172. })
  173. </script>
  174. <style scoped>
  175. .static-footer {
  176. position: fixed;
  177. bottom: 0;
  178. }
  179. .top {
  180. height: 50vh;
  181. background-color: white;
  182. }
  183. .bell {
  184. height: 9.6vh;
  185. display: flex;
  186. align-items: flex-end;
  187. justify-content: flex-end;
  188. padding-right: 50rpx;
  189. }
  190. .image-bell {
  191. width: 26rpx;
  192. height: 32rpx;
  193. }
  194. .msg {
  195. height: 10.7vh;
  196. display: flex;
  197. margin-top: 3vh;
  198. margin-bottom: 3vh;
  199. }
  200. .msg-left {
  201. width: 252rpx;
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. }
  206. .avatar {
  207. width: 175rpx;
  208. height: 175rpx;
  209. border-radius: 50%;
  210. background-color: black;
  211. }
  212. .msg-center {
  213. width: 388rpx;
  214. padding-left: 2.5vh;
  215. display: flex;
  216. flex-direction: column;
  217. justify-content: center;
  218. }
  219. .userInfo {
  220. font-size: 30rpx;
  221. font-weight: bold;
  222. }
  223. .userId {
  224. font-size: 14px;
  225. margin-top: 1vh;
  226. }
  227. .image-editName {
  228. width: 40rpx;
  229. height: 40rpx;
  230. margin-left: 15rpx;
  231. }
  232. .msg-right {
  233. display: flex;
  234. flex-direction: column;
  235. justify-content: center;
  236. }
  237. .image-attendance {
  238. width: 43rpx;
  239. height: 43rpx;
  240. }
  241. .settings-buttons {
  242. display: flex;
  243. justify-content: space-around;
  244. }
  245. .setting-btn {
  246. width: 349rpx;
  247. height: 135rpx;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. background-color: rgb(243, 243, 243);
  252. border-radius: 8%;
  253. margin-bottom: 1vh;
  254. }
  255. .setting-icon {
  256. width: 64.7rpx;
  257. height: 64.7rpx;
  258. margin-right: 25rpx;
  259. }
  260. .setting-btn text {
  261. font-size: 28rpx;
  262. font-weight: bold;
  263. color: #333;
  264. }
  265. .share {
  266. height: 12.6vh;
  267. display: flex;
  268. justify-content: center;
  269. align-items: center;
  270. }
  271. .img-share {
  272. width: 720rpx;
  273. height: 160rpx;
  274. }
  275. .bottom {
  276. height: 44.5vh;
  277. margin-top: 1vh;
  278. background-color: rgb(255, 255, 255);
  279. }
  280. .list-item {
  281. width: 670rpx;
  282. height: 7vh;
  283. display: flex;
  284. align-items: center;
  285. margin: 0rpx 40rpx;
  286. border-bottom: 1rpx solid #eee;
  287. }
  288. .list-item:last-child {
  289. border-bottom: none;
  290. }
  291. .list-icon {
  292. width: 42rpx;
  293. height: 42rpx;
  294. margin-right: 18rpx;
  295. }
  296. .arrow {
  297. margin-left: auto;
  298. }
  299. .update-tip {
  300. display: flex;
  301. color: #999;
  302. font-size: 24rpx;
  303. align-items: center;
  304. margin-left: 200rpx;
  305. justify-content: center;
  306. }
  307. .circle {
  308. width: 10rpx;
  309. height: 10rpx;
  310. border-radius: 50%;
  311. background-color: red;
  312. margin-left: 10rpx;
  313. }
  314. .edit-input {
  315. background-color: #999;
  316. }
  317. </style>