index.uvue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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 class=" action-item my-view" @click="handleJiaoLiuQun">
  30. <view class=" 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=" 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=" 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=" 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=" 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="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=" 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="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 {state,LogOut} from '@/store'
  77. export default {
  78. data() {
  79. const globalData = getApp().globalData
  80. const config = globalData.config != null ? globalData.config as UTSJSONObject : null;
  81. const appInfo:UTSJSONObject|null = config?.get('appInfo') as UTSJSONObject;
  82. return {
  83. name: state.name as string,
  84. version: appInfo?.get('version') as string | ''
  85. }
  86. },
  87. computed: {
  88. avatar() {
  89. return state.avatar as string
  90. },
  91. windowHeight() {
  92. return (uni.getSystemInfoSync().windowHeight - 50 ) as number
  93. }
  94. },
  95. methods: {
  96. handleToInfo() {
  97. uni.navigateTo({
  98. url: '/pages/mine/info/index'
  99. });
  100. },
  101. handleToEditInfo() {
  102. uni.navigateTo({
  103. url: '/pages/mine/info/edit'
  104. });
  105. },
  106. handleToSetting() {
  107. uni.navigateTo({
  108. url: '/pages/mine/setting/index'
  109. });
  110. },
  111. handleToLogin() {
  112. uni.reLaunch({
  113. url: '/pages/login'
  114. });
  115. },
  116. handleToAvatar() {
  117. // 上传头像待优化
  118. // uni.navigateTo({
  119. // url: '/pages/mine/avatar/index'
  120. // });
  121. uni.showToast({
  122. title: '模块建设中~',
  123. icon: 'none'
  124. });
  125. },
  126. handleLogout() {
  127. uni.showModal({
  128. title: '提示',
  129. content: '确定注销并退出系统吗?',
  130. success: (res) => {
  131. if (res.confirm) {
  132. LogOut().then(() => {
  133. uni.reLaunch({
  134. url: '/pages/index'
  135. });
  136. });
  137. }
  138. }
  139. });
  140. },
  141. handleHelp() {
  142. uni.navigateTo({
  143. url: '/pages/mine/help/index'
  144. });
  145. },
  146. handleAbout() {
  147. uni.navigateTo({
  148. url: '/pages/mine/about/index'
  149. });
  150. },
  151. handleJiaoLiuQun() {
  152. uni.showToast({
  153. title: 'QQ群:①133713780、②146013835',
  154. icon: 'none'
  155. });
  156. },
  157. handleBuilding() {
  158. uni.showToast({
  159. title: '模块建设中~',
  160. icon: 'none'
  161. });
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss">
  167. .my-page {
  168. background-color: #f5f6f7;
  169. width: 100%;
  170. height: 100%;
  171. }
  172. .mine-container {
  173. width: 100%;
  174. height: 100%;
  175. .header-section {
  176. padding: 15px 15px 45px 15px;
  177. background-color: #3c96f3;
  178. color: white;
  179. .login-tip {
  180. font-size: 18px;
  181. margin-left: 10px;
  182. }
  183. .cu-avatar {
  184. border: 2px solid #eaeaea;
  185. .icon {
  186. font-size: 40px;
  187. }
  188. }
  189. .user-info {
  190. margin-left: 15px;
  191. .u_title {
  192. font-size: 18px;
  193. line-height: 30px;
  194. }
  195. }
  196. }
  197. .content-section {
  198. position: relative;
  199. top: -50px;
  200. .mine-actions {
  201. margin: 15px 15px;
  202. padding: 20px 0px;
  203. border-radius: 8px;
  204. background-color: white;
  205. .action-item {
  206. .icon {
  207. font-size: 28px;
  208. }
  209. .text {
  210. font-size: 13px;
  211. margin: 8px 0px;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. </style>