mini-userinfo.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="userinfo-container">
  3. <!-- 家长信息头部 -->
  4. <view class="userinfo-topinfo">
  5. <image class="children-avatar" src="../../static/logo.png"></image>
  6. <view class="children-name">
  7. <text class="name">微信用户</text>
  8. <text class="detail">张小伟家长</text>
  9. </view>
  10. </view>
  11. <!-- 面板区域 -->
  12. <view class="box-cart">
  13. <view class="cart-big">
  14. <image class="cart-icon" src="/static/my-icons/boy-my.png" mode="aspectFill"></image>
  15. <text class="cart-text">我的孩子</text>
  16. </view>
  17. <view class="cart-small">
  18. <view class="cart-item">
  19. <image class="cart-icon-sim" src="/static/my-icons/childrenmessage.png"></image>
  20. <text class="cart-text-sim">信息管理</text>
  21. </view>
  22. <view class="cart-item">
  23. <image class="cart-icon-sim" src="/static/my-icons/mychildren.png" mode="aspectFill"></image>
  24. <text class="cart-text-sim">孩子管理</text>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 用户功能 -->
  29. <view class="com-item">
  30. <view class="com-wrap">
  31. <view class="cell" @click="show = true">
  32. <view class="cell-left">
  33. <image class="cell-icon" src="/static/my-icons/dailyclock.png" mode="aspectFill"></image>
  34. <view class="cell-text">学习打卡</view>
  35. </view>
  36. </view>
  37. <view class="cell">
  38. <view class="cell-left">
  39. <image class="cell-icon" src="/static/my-icons/details.png" mode="aspectFill"></image>
  40. <view class="cell-text">个人信息</view>
  41. </view>
  42. </view>
  43. <view class="cell" @click="logout()">
  44. <view class="cell-left">
  45. <image class="cell-icon" src="/static/my-icons/setting.png" mode="aspectFill"></image>
  46. <view class="cell-text">退出登录</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 用户服务 -->
  52. <view class="com-item">
  53. <view class="com-wrap">
  54. <view class="cell" v-for="(item, index) in serverList" :key="index" @click="nav(item.path)">
  55. <view class="cell-left">
  56. <image class="cell-icon" :src="item.icon" mode="aspectFill"></image>
  57. <view class="cell-text">{{ item.title }}</view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import { mapState,mapMutations } from 'vuex'
  66. export default {
  67. computed:{
  68. ...mapState('m_parent',['parentinfo']),
  69. ...mapState('m_children',['childreninfo'])
  70. },
  71. name: 'mini-userinfo',
  72. data() {
  73. return {
  74. serverList: [{
  75. title: '客服中心',
  76. icon: '/static/my-icons/service.png',
  77. path: '../xq/index?id=3'
  78. },
  79. {
  80. title: '帮助中心',
  81. icon: '/static/my-icons/help.png',
  82. path: '../xq/index?id=2'
  83. },
  84. {
  85. title: '用户协议',
  86. icon: '/static/my-icons/agreement.png',
  87. path: '../xq/index?id=4'
  88. }
  89. ]
  90. };
  91. },
  92. methods:{
  93. ...mapMutations('m_parent',['updateParentInfo','updateToken']),
  94. async logout(){
  95. const [err,succ] = await uni.showModal({
  96. title: '提示',
  97. content: '确认退出登录吗?'
  98. }).catch(err => err)
  99. if(succ && succ.confirm){
  100. this.updateParentInfo({})
  101. this.updateToken('')
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. .userinfo-container{
  109. height: 100%;
  110. .userinfo-topinfo{
  111. height: 400rpx;
  112. background: linear-gradient(#ff5959, #fafafa);
  113. display: flex;
  114. justify-content: flex-start;
  115. align-items: center;
  116. }
  117. .children-avatar{
  118. margin-top: 10px;
  119. margin-left: 20px;
  120. width: 60px;
  121. height: 60px;
  122. border-radius: 35px;
  123. border: 3px solid #FFFFFF;
  124. box-shadow: 0 5px 10px rgba(0,0,0,0.2);
  125. }
  126. .children-name{
  127. margin-top: 12px;
  128. margin-left: 10px;
  129. display: flex;
  130. flex-direction: column;
  131. .name{
  132. color: #6b778d;
  133. font-size: 13px;
  134. margin: 2px 0px 0px 5px;
  135. }
  136. .detail{
  137. color: #3B4144;
  138. font-weight: bold;
  139. margin: 5px 0px 0px 5px;
  140. }
  141. }
  142. // 面板区域
  143. .box-cart{
  144. margin: -100rpx 20rpx 20rpx 20rpx;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. justify-content: space-around;
  149. .cart-big{
  150. border-radius: 25rpx;
  151. overflow: hidden;
  152. margin: 10px 0 10px 0;
  153. display: flex;
  154. flex-direction: column;
  155. justify-content: center;
  156. align-items: center;
  157. background-color: #FFFFFF;
  158. box-shadow: 0 5px 5px rgba(0,0,0,0.1);
  159. .cart-icon{
  160. width: 70px;
  161. height: 90px;
  162. margin: 10px 10px 0px 10px;
  163. }
  164. .cart-text{
  165. margin: 10px;
  166. }
  167. }
  168. .cart-small{
  169. width: 65%;
  170. height: 150px;
  171. display: flex;
  172. flex-direction: column;
  173. justify-content: space-around;
  174. .cart-item{
  175. background-color: #FFFFFF;
  176. box-shadow: 0 5px 5px rgba(0,0,0,0.1);
  177. display: flex;
  178. flex-direction: row;
  179. align-items: center;
  180. padding: 10px;
  181. border-radius: 25rpx;
  182. overflow: hidden;
  183. .cart-icon-sim{
  184. width: 50rpx;
  185. height: 50rpx;
  186. margin: 10px;
  187. }
  188. .cart-text-sim{
  189. margin: 10px;
  190. }
  191. }
  192. }
  193. }
  194. // 功能列表
  195. .com-item {
  196. margin-left: 20rpx;
  197. margin-right: 20rpx;
  198. margin-top: 20rpx;
  199. box-shadow: 0 5px 5px rgba(0,0,0,0.1);
  200. border-radius: 25rpx;
  201. .com-wrap {
  202. border-radius: 25rpx;
  203. overflow: hidden;
  204. }
  205. }
  206. .cell {
  207. height: 80rpx;
  208. padding-left: 20rpx;
  209. padding-right: 20rpx;
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. background: #fff;
  214. border-bottom: 1px solid #f8f8f8;
  215. &:active {
  216. background: #f2f2f2;
  217. }
  218. &:last-child {
  219. border-bottom: none !important;
  220. }
  221. .cell-left {
  222. display: flex;
  223. align-items: center;
  224. .cell-icon {
  225. width: 50rpx;
  226. height: 50rpx;
  227. }
  228. .cell-text {
  229. color: #666;
  230. font-size: 28rpx;
  231. margin-left: 20rpx;
  232. }
  233. }
  234. }
  235. }
  236. </style>