mini-userinfo.vue 5.8 KB

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