index.uvue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class=" mine-container" :style="{height: `${windowHeight}px`}">
  3. <!--顶部个人信息栏-->
  4. <view class=" header-section">
  5. <view class=" flex padding justify-between uni-row">
  6. <view class=" flex align-center uni-row">
  7. <view v-if="avatar==null" class="cu-avatar xl round bg-white">
  8. <view class="text-gray icon"></view>
  9. </view>
  10. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  11. </image>
  12. <view v-if="name == null" @click="handleToLogin" class=" login-tip">
  13. 点击登录
  14. </view>
  15. <view v-if="name" @click="handleToInfo" class=" user-info">
  16. <view class=" u_title">
  17. 用户名:{{ name }}
  18. </view>
  19. </view>
  20. </view>
  21. <view @click="handleToInfo" class=" flex align-center uni-row">
  22. <text>个人信息</text>
  23. <view class=""></view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class=" content-section">
  28. <view class=" mine-actions grid col-4 uni-row">
  29. </view>
  30. <view class=" menu-list">
  31. <view class=" list-cell list-cell-arrow" @click="handleToEditInfo">
  32. <view class=" menu-item-box uni-row">
  33. <view class=" menu-icon"></view>
  34. <view class="font-14">编辑资料</view>
  35. </view>
  36. </view>
  37. <view class=" list-cell list-cell-arrow" @click="handleHelp">
  38. <view class=" menu-item-box uni-row">
  39. <view class="menu-icon"></view>
  40. <view class="font-14">常见问题</view>
  41. </view>
  42. </view>
  43. <view class=" list-cell list-cell-arrow" @click="handleAbout">
  44. <view class=" menu-item-box uni-row">
  45. <view class=" menu-icon"></view>
  46. <view class="font-14">关于我们</view>
  47. </view>
  48. </view>
  49. <view class=" list-cell list-cell-arrow" @click="handleToSetting">
  50. <view class=" menu-item-box uni-row">
  51. <view class="menu-icon"></view>
  52. <view class="font-14">应用设置</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script lang="uts">
  60. import {state,LogOut} from '@/store'
  61. export default {
  62. data() {
  63. const globalData = getApp().globalData
  64. const config = globalData.config != null ? globalData.config as UTSJSONObject : null;
  65. const appInfo:UTSJSONObject|null = config?.get('appInfo') as UTSJSONObject;
  66. return {
  67. name: state.name as string,
  68. version: appInfo?.get('version') as string | ''
  69. }
  70. },
  71. computed: {
  72. avatar() {
  73. return state.avatar as string
  74. },
  75. windowHeight() {
  76. return (uni.getSystemInfoSync().windowHeight - 50 ) as number
  77. }
  78. },
  79. methods: {
  80. handleToInfo() {
  81. uni.navigateTo({
  82. url: '/pages/mine/info/index'
  83. });
  84. },
  85. handleToEditInfo() {
  86. uni.navigateTo({
  87. url: '/pages/mine/info/edit'
  88. });
  89. },
  90. handleToSetting() {
  91. uni.navigateTo({
  92. url: '/pages/mine/setting/index'
  93. });
  94. },
  95. handleToLogin() {
  96. uni.reLaunch({
  97. url: '/pages/login'
  98. });
  99. },
  100. handleToAvatar() {
  101. // 上传头像待优化
  102. // uni.navigateTo({
  103. // url: '/pages/mine/avatar/index'
  104. // });
  105. uni.showToast({
  106. title: '模块建设中~',
  107. icon: 'none'
  108. });
  109. },
  110. handleLogout() {
  111. uni.showModal({
  112. title: '提示',
  113. content: '确定注销并退出系统吗?',
  114. success: (res) => {
  115. if (res.confirm) {
  116. LogOut().then(() => {
  117. uni.reLaunch({
  118. url: '/pages/index'
  119. });
  120. });
  121. }
  122. }
  123. });
  124. },
  125. handleHelp() {
  126. uni.navigateTo({
  127. url: '/pages/mine/help/index'
  128. });
  129. },
  130. handleAbout() {
  131. uni.navigateTo({
  132. url: '/pages/mine/about/index'
  133. });
  134. },
  135. handleJiaoLiuQun() {
  136. uni.showToast({
  137. title: 'QQ群:①133713780、②146013835',
  138. icon: 'none'
  139. });
  140. },
  141. handleBuilding() {
  142. uni.showToast({
  143. title: '模块建设中~',
  144. icon: 'none'
  145. });
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .my-page {
  152. background-color: #f5f6f7;
  153. width: 100%;
  154. height: 100%;
  155. }
  156. .mine-container {
  157. width: 100%;
  158. height: 100%;
  159. .header-section {
  160. padding: 15px 15px 45px 15px;
  161. background-color: #3c96f3;
  162. color: white;
  163. .login-tip {
  164. font-size: 18px;
  165. margin-left: 10px;
  166. }
  167. .cu-avatar {
  168. border: 2px solid #eaeaea;
  169. .icon {
  170. font-size: 40px;
  171. }
  172. }
  173. .user-info {
  174. margin-left: 15px;
  175. .u_title {
  176. font-size: 18px;
  177. line-height: 30px;
  178. }
  179. }
  180. }
  181. .content-section {
  182. position: relative;
  183. top: -50px;
  184. .mine-actions {
  185. margin: 15px 15px;
  186. padding: 20px 0px;
  187. border-radius: 8px;
  188. background-color: white;
  189. .action-item {
  190. .icon {
  191. font-size: 28px;
  192. }
  193. .text {
  194. font-size: 13px;
  195. margin: 8px 0px;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. </style>