index.uvue 6.2 KB

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