personal.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <style scoped lang="scss">
  2. .main{
  3. .portrait{
  4. display: flex;
  5. height: 160rpx;
  6. align-items: center;
  7. align-content: center;
  8. /* justify-content: center; 水平居中*/
  9. font-size: 30rpx;
  10. color: #fff;
  11. background-color: rgb(97, 165, 238);
  12. .userinfo-avatar{
  13. border-radius: 50%;
  14. width: 100rpx;
  15. height: 100rpx;
  16. margin: 30rpx;
  17. }
  18. .sign{
  19. width: 120rpx;
  20. height: 60rpx;
  21. line-height: 60rpx;
  22. text-align: center;
  23. background-color: #fff;
  24. color: rgb(97, 165, 238);
  25. border-radius: 10rpx;
  26. margin: 40rpx;
  27. margin-left: auto; /*子元素靠右 */
  28. }
  29. .signs{
  30. background: #666;
  31. color: #fff;
  32. }
  33. }
  34. .userlist{
  35. margin-top: 40rpx;
  36. .iconfont{
  37. margin-right: 10rpx;
  38. }
  39. button{
  40. flex: 1;
  41. position: absolute;
  42. top: 0;
  43. left: 0;
  44. width: 100%;
  45. height: 100%;
  46. opacity: 0;
  47. }
  48. }
  49. }
  50. </style>
  51. <template>
  52. <view class="main">
  53. <view class='portrait'>
  54. <image class="userinfo-avatar" :src="userInfo.avatarUrl ? userInfo.avatarUrl : '/static/icon.png'" mode="aspectFit"></image>
  55. <view>{{userInfo.nickName}}</view>
  56. <view class='sign' :class='signState ? "signs" : ""' @tap='signState?"":"signClick"' :data-num="signNum" :data-min="min" :data-max="max" :data-be="be">{{signState?"已签到":"签到"}}</view>
  57. </view>
  58. <personal/>
  59. <view class='userlist cu-list menu'>
  60. <block v-for="(item, index) in list" :key="index">
  61. <view class='cu-item arrow' @tap="bind(item.batName)">
  62. <view class="content">
  63. <icon class='iconfont' :class="item.className"></icon>
  64. <text>{{item.name}}</text>
  65. </view>
  66. <button open-type="contact" v-if="item.batName === 'bindService'"/>
  67. <button open-type="feedback" v-if="item.batName === 'feedback'"/>
  68. </view>
  69. </block>
  70. </view>
  71. </view>
  72. </template>
  73. <script >
  74. import {
  75. mapState,
  76. mapMutations
  77. } from "vuex"
  78. import personal from "@/pages/components/personal/index.vue"
  79. export default {
  80. data() {
  81. return {
  82. signNum: 0, //签到数
  83. min: 1, //默认值日期第一天1
  84. max: 7, //默认值日期最后一天7
  85. be: 0,
  86. list:[
  87. {
  88. name: '设置',
  89. className: 'icon-shezhi',
  90. batName:"bindSeting"
  91. },
  92. {
  93. name: '问题反馈',
  94. className: 'icon-tishi',
  95. batName: "feedback"
  96. },
  97. {
  98. name: '剪切板',
  99. className: 'icon-document',
  100. batName: "bindCopy"
  101. },
  102. {
  103. name: '在线客服',
  104. className: 'icon-xiaoxizhongxin',
  105. batName: "bindService"
  106. }
  107. ]
  108. }
  109. },
  110. computed: {
  111. ...mapState({
  112. userInfo: state => state.global.userInfo,
  113. signState: state => state.global.signState,
  114. })
  115. },
  116. onShow() {
  117. },
  118. methods: {
  119. bind(signClick) {
  120. console.log("haha",signClick)
  121. },
  122. bindSeting() {
  123. },
  124. bindCopy() {
  125. let data = "haha"
  126. wx.setClipboardData({
  127. data: data,
  128. success: res => {
  129. uni.getToast('复制成功')
  130. wx.getClipboardData({
  131. success: res=> {
  132. console.log(res.data)
  133. }
  134. })
  135. }
  136. })
  137. }
  138. }
  139. }
  140. </script>