my.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view class="my-container">
  3. <view class="bg1"></view>
  4. <view class="bg2"></view>
  5. <!-- 家长信息头部 -->
  6. <view class="userinfo-topinfo">
  7. <image class="parent-avatar" :src="parentinfo.avatarUrl" @click="getUserInfo"></image>
  8. <view class="parent-name">
  9. <text class="name" @click="getUserInfo">{{parentinfo.nickName}}</text>
  10. <text class="detail" @click="getUserInfo">{{childreninfo.name + '家长'}}</text>
  11. </view>
  12. </view>
  13. <!-- 功能组件 -->
  14. <view class="userinfo-container">
  15. <!-- 面板区域 -->
  16. <view class="box-cart" >
  17. <view class="cart-big" @click="updateChildrenInfo">
  18. <image class="cart-icon" src="/static/my-icons/boy-my.png" mode="aspectFill"></image>
  19. <text class="cart-text">孩子信息</text>
  20. </view>
  21. <view class="cart-small">
  22. <view class="cart-item" @click="show = true">
  23. <image class="cart-icon-sim" src="/static/my-icons/childrenmessage.png"></image>
  24. <text class="cart-text-sim">学习打卡</text>
  25. </view>
  26. <view class="cart-item" @click="chooseChildren">
  27. <image class="cart-icon-sim" src="/static/my-icons/mychildren.png" mode="aspectFill"></image>
  28. <text class="cart-text-sim">孩子管理</text>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 用户功能 -->
  33. <view class="com-item">
  34. <view class="com-box">
  35. <view class="cell">
  36. <view class="cell-left">
  37. <view class="t-icon t-icon-order_dingdan" ></view>
  38. <view class="cell-text">个人信息</view>
  39. </view>
  40. </view>
  41. <view class="cell">
  42. <view class="cell-left">
  43. <view class="t-icon t-icon-comment_wodepinglun" ></view>
  44. <view class="cell-text">我的消息</view>
  45. </view>
  46. </view>
  47. <view class="cell" @click="logout">
  48. <view class="cell-left">
  49. <view class="t-icon t-icon-Setting_shezhi"></view>
  50. <view class="cell-text">退出登录</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 用户服务 -->
  56. <view class="com-item">
  57. <view class="com-box">
  58. <view class="cell">
  59. <view class="cell-left">
  60. <view class="t-icon t-icon-integration_jifen"></view>
  61. <view class="cell-text">客服中心</view>
  62. </view>
  63. </view>
  64. <view class="cell">
  65. <view class="cell-left">
  66. <view class="t-icon t-icon-question_wodewenda"></view>
  67. <view class="cell-text">帮助中心</view>
  68. </view>
  69. </view>
  70. <view class="cell">
  71. <view class="cell-left">
  72. <view class="t-icon t-icon-contract_hetong"></view>
  73. <view class="cell-text">用户协议</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 日历组件 -->
  79. <u-calendar class="calendar" :show="show" mode="single" @confirm="confirm"></u-calendar>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import { mapState,mapMutations } from 'vuex'
  85. export default {
  86. computed: {
  87. ...mapState('m_parent', ['token', 'parentdetail', 'parentinfo']),
  88. ...mapState('m_children', ['childreninfo'])
  89. },
  90. data() {
  91. return {
  92. show: false,
  93. };
  94. },
  95. onLoad() {},
  96. methods: {
  97. ...mapMutations('m_parent',['updateParentDetail','updateParentInfo','updateToken']),
  98. ...mapMutations('m_children',['updateChildrenInfo']),
  99. //日历事件
  100. confirm(e){
  101. console.log('confirm',e)
  102. uni.$showMsg('打卡成功!')
  103. this.show = false
  104. },
  105. //退出登录事件
  106. async logout(){
  107. const [err,succ] = await uni.showModal({
  108. title: '提示',
  109. content: '确认退出登录吗?'
  110. }).catch(err => err)
  111. if(succ && succ.confirm)
  112. {
  113. this.updateChildrenInfo()
  114. // this.updateParentDetail()
  115. this.updateParentInfo()
  116. this.updateToken()
  117. uni.reLaunch({
  118. url:'/subpkg/login/login'
  119. })
  120. }
  121. },
  122. //切换孩子
  123. chooseChildren(){
  124. // if(parentdetail.childrenList.length == 1)
  125. // return uni.showMsg('您只有一个孩子,不能切换')
  126. uni.navigateTo({
  127. url: '/subpkg/guide/guide'
  128. })
  129. },
  130. //修改孩子信息
  131. updateChildrenInfo(e){
  132. console.log(e);
  133. },
  134. //获取用户信息事件
  135. async getUserInfo(e) {
  136. console.log(e);
  137. console.log(uni.getStorageSync('parentinfo'));
  138. if (!uni.getStorageSync('parentinfo')) {
  139. await uni.getUserProfile({
  140. desc: '获取您的昵称,头像,地区信息',
  141. success: infoRes => {
  142. if (infoRes.errMsg === 'getUserProfile:ok') {
  143. this.updateParentInfo(infoRes.userInfo)
  144. } else {
  145. uni.$showMsg('获取不到您的基本信息!')
  146. }
  147. },
  148. fail: err => {
  149. console.log('getUserInfo-error', JSON.stringify(err))
  150. }
  151. });
  152. }
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. page,
  159. .my-container {
  160. height: 100%;
  161. .bg1{
  162. position: fixed;
  163. top: -250rpx;
  164. right: -280rpx;
  165. width: 700rpx;
  166. height: 700rpx;
  167. margin-right: 250px;
  168. border-radius: 100%;
  169. background-color: #6495ed;
  170. z-index: -1;
  171. }
  172. .bg2{
  173. position: fixed;
  174. top: -170rpx;
  175. right: -250rpx;
  176. width: 600rpx;
  177. height: 600rpx;
  178. border-radius: 100%;
  179. background-color: #4169E1;
  180. z-index: -2;
  181. }
  182. .userinfo-topinfo {
  183. height: 400rpx;
  184. // background: linear-gradient(#ff5959, #f1f3f5);
  185. display: flex;
  186. justify-content: flex-start;
  187. align-items: center;
  188. .parent-avatar {
  189. margin-top: 11px;
  190. margin-left: 20px;
  191. width: 60px;
  192. height: 60px;
  193. border-radius: 35px;
  194. border: 3px solid #FFFFFF;
  195. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  196. }
  197. .parent-name {
  198. margin-top: 10px;
  199. margin-left: 10px;
  200. display: flex;
  201. flex-direction: column;
  202. font-weight: bold;
  203. .name {
  204. color: #303133;
  205. font-size: 14px;
  206. margin: 2px 0px 0px 5px;
  207. }
  208. .detail {
  209. color: #000000;
  210. font-weight: bold;
  211. margin: 5px 0px 0px 5px;
  212. }
  213. }
  214. .parent-avatar {
  215. margin-top: 11px;
  216. margin-left: 20px;
  217. width: 60px;
  218. height: 60px;
  219. border-radius: 35px;
  220. border: 3px solid #FFFFFF;
  221. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  222. }
  223. .parent-name {
  224. margin-top: 10px;
  225. margin-left: 10px;
  226. display: flex;
  227. flex-direction: column;
  228. font-weight: bold;
  229. .name {
  230. color: #6b778d;
  231. font-size: 14px;
  232. margin: 2px 0px 0px 5px;
  233. }
  234. .detail {
  235. color: #3B4144;
  236. font-weight: bold;
  237. margin: 5px 0px 0px 5px;
  238. }
  239. }
  240. }
  241. .userinfo-container{
  242. height: 100%;
  243. // 面板区域
  244. .box-cart{
  245. margin: -100rpx 20rpx 20rpx 20rpx;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. justify-content: space-around;
  250. .cart-big{
  251. border-radius: 15rpx;
  252. width: 80px;
  253. height: 120px;
  254. overflow: hidden;
  255. margin: 10px 0 10px 0;
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: center;
  259. align-items: center;
  260. background-color: #FFFFFF;
  261. box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  262. .cart-icon{
  263. width: 55px;
  264. height: 80px;
  265. margin: 10px 10px 0px 10px;
  266. }
  267. .cart-text{
  268. margin: 10px;
  269. font-size: 15px;
  270. }
  271. }
  272. .cart-small{
  273. width: 65%;
  274. height: 130px;
  275. display: flex;
  276. flex-direction: column;
  277. justify-content: space-around;
  278. .cart-item{
  279. height: 35px;
  280. background-color: #FFFFFF;
  281. display: flex;
  282. flex-direction: row;
  283. align-items: center;
  284. padding: 10px;
  285. border-radius: 15rpx;
  286. overflow: hidden;
  287. box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  288. .cart-icon-sim{
  289. width: 50rpx;
  290. height: 50rpx;
  291. margin: 10px;
  292. }
  293. .cart-text-sim{
  294. margin: 10px;
  295. font-size: 15px;
  296. color: #3B4144;
  297. }
  298. }
  299. }
  300. }
  301. // 功能列表
  302. .com-item {
  303. margin-top: 20rpx;
  304. .com-box {
  305. overflow: hidden;
  306. }
  307. }
  308. .cell {
  309. height: 80rpx;
  310. padding-left: 20rpx;
  311. padding-right: 20rpx;
  312. display: flex;
  313. justify-content: space-between;
  314. align-items: center;
  315. background: #fff;
  316. border-bottom: 1px solid #f8f8f8;
  317. &:active {
  318. background: #f2f2f2;
  319. }
  320. &:last-child {
  321. border-bottom: none !important;
  322. }
  323. .cell-left {
  324. display: flex;
  325. align-items: center;
  326. padding-left: 20rpx;
  327. .cell-icon {
  328. width: 50rpx;
  329. height: 50rpx;
  330. }
  331. .cell-text {
  332. color: #666;
  333. font-size: 28rpx;
  334. margin-left: 20rpx;
  335. }
  336. }
  337. }
  338. .calendar{
  339. z-index: 999;
  340. }
  341. }
  342. }
  343. </style>