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.1 KiB

3 weeks ago
3 weeks ago
  1. <template>
  2. <LoginPrompt ref="loginwPrompt"></LoginPrompt>
  3. <view class="main">
  4. <view class="top">
  5. <!-- <view class="bell">
  6. <image class="image-bell" src="/static/my/bell.png"></image>
  7. </view> -->
  8. <view class="msg">
  9. <view class="msg-left">
  10. <view class="avatar"></view>
  11. </view>
  12. <view class="msg-center">
  13. <view style="display: flex;">
  14. <view class="userInfo">{{ username }}</view>
  15. <image class="image-editName" src="/static/my/editName.png"></image>
  16. </view>
  17. <view class="userId">ID:{{ dccode }}</view>
  18. </view>
  19. <!-- <view class="msg-right">
  20. <image class="image-attendance" src="/static/my/Check-in.png"/>
  21. <span style="font-size:10px;">签到</span>
  22. </view> -->
  23. </view>
  24. <view class="settings-buttons">
  25. <view class="setting-btn" @click="goToMarket">
  26. <image src="/static/my/MarketSettings.png" class="setting-icon" />
  27. <text>行情设置</text>
  28. </view>
  29. <view class="setting-btn" @click="goToGeneral">
  30. <image src="/static/my/Settings.png" class="setting-icon" />
  31. <text>通用设置</text>
  32. </view>
  33. </view>
  34. <view class="share" @click="goToShare">
  35. <image class="img-share" src="/static/my/share.png" mode="widthFix" />
  36. </view>
  37. </view>
  38. <view class="bottom">
  39. <view class="list-item" @click="goToAccount">
  40. <image src="/static/my/security.png" class="list-icon" />
  41. <text>账号与安全</text>
  42. <uni-icons type="arrowright" size="16" class="arrow" />
  43. </view>
  44. <!-- <view class="list-item">
  45. <image src="/static/my/connection.png" class="list-icon" />
  46. <text>联系我们</text>
  47. <uni-icons type="arrowright" size="16" class="arrow" />
  48. </view>
  49. <view class="list-item" @click="goToNewVersion">
  50. <image src="/static/my/update.png" class="list-icon" />
  51. <text>新版本更新</text>
  52. <view class="update-tip">有新版本可更新
  53. <view class="circle"></view>
  54. </view>
  55. <uni-icons type="arrowright" size="16" class="arrow" />
  56. </view>
  57. <view class="list-item">
  58. <image src="/static/my/opinion.png" class="list-icon" />
  59. <text>意见反馈</text>
  60. <uni-icons type="arrowright" size="16" class="arrow" />
  61. </view> -->
  62. <view class="list-item" @click="goToAbout">
  63. <image src="/static/my/about.png" class="list-icon" />
  64. <text>关于DeepChart</text>
  65. <uni-icons type="arrowright" size="16" class="arrow" />
  66. </view>
  67. </view>
  68. <footerBar class="static-footer" :type="type"></footerBar>
  69. </view>
  70. </template>
  71. <script setup>
  72. import {
  73. ref,
  74. onMounted
  75. } from 'vue'
  76. import {
  77. ArrowRight
  78. } from '@element-plus/icons-vue'
  79. import footerBar from '../../components/footerBar.vue'
  80. import {
  81. getUserInfo,
  82. updateUserInfo
  83. } from "@/api/member"
  84. import {
  85. useUserStore
  86. } from "../../stores/modules/userInfo"
  87. const userStore = useUserStore()
  88. const type = ref('member')
  89. const iSMT = ref(0)
  90. const username = ref('')
  91. const dccode = ref('')
  92. const avatarUrl = ref('')
  93. const isEditingName = ref(false)
  94. const editingName = ref('')
  95. const userInfoRes = ref() // 用户身份信息
  96. userInfoRes.value = getUserInfo()
  97. userInfoRes.value.then(res => {
  98. username.value = res.data.dcname
  99. dccode.value = res.data.dccode
  100. avatarUrl.value = res.data.avatar
  101. console.log('用户信息', userInfoRes.value)
  102. })
  103. const startEditName = () => {
  104. isEditingName.value = true
  105. editingName.value = username.value
  106. }
  107. const finishEditName = async () => {
  108. if (editingName.value.trim() === '' || editingName.value === username.value) {
  109. isEditingName.value = false
  110. return
  111. }
  112. try {
  113. await updateUserInfo({
  114. dcname: editingName.value
  115. })
  116. uni.showToast({
  117. title: '昵称修改成功',
  118. icon: 'none'
  119. })
  120. } catch (err) {
  121. uni.showToast({
  122. title: '修改失败,请重试',
  123. icon: 'none'
  124. })
  125. } finally {
  126. isEditingName.value = false
  127. }
  128. }
  129. const goToGeneral = () => {
  130. uni.navigateTo({
  131. url: '/pages/setting/general'
  132. })
  133. }
  134. const goToMarket = () => {
  135. uni.navigateTo({
  136. url: '../setting/market'
  137. })
  138. }
  139. const goToAccount = () => {
  140. uni.navigateTo({
  141. url: '../setting/account'
  142. })
  143. }
  144. const goToNewVersion = () => {
  145. uni.navigateTo({
  146. url: '../setting/newVersion'
  147. })
  148. }
  149. const goToAbout = () => {
  150. uni.navigateTo({
  151. url: '../setting/about'
  152. })
  153. }
  154. const goToShare = () => {
  155. console.log('用户信息==========',userStore.userInfo.isVisitor)
  156. if (userStore.userInfo.isVisitor) {
  157. uni.showToast({
  158. title: '请先登录',
  159. icon: 'none'
  160. })
  161. return
  162. }
  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>