kz-page-my-simple.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="page">
  3. <view class="bg-user user-info ">
  4. <view class="user" @tap="login">
  5. <view class="cu-avatar xl round user-avatar" v-if="userInfo" :style="'background-image:url(' + userInfo.avatar + ')'">
  6. <text class="cuIcon-people" v-if="!userInfo.avatar"></text>
  7. </view>
  8. <view class="user-name" v-if="userInfo && userInfo.nickname">{{ userInfo.nickname }}</view>
  9. <view class="user-name" v-else>点击授权登录</view>
  10. <navigator class="merchant_num" url="score" hover-class="none"></navigator>
  11. </view>
  12. </view>
  13. <view class="cu-card case" style="margin-top: -50px;z-index: 11;position: relative;">
  14. <view class="cu-item shadow">
  15. <view class="cu-list grid col-3">
  16. <view class="cu-item" @tap="goTo" data-url="../room/index">
  17. <view class="cuIcon-list text-blue"></view>
  18. <text>考场</text>
  19. </view>
  20. <view class="cu-item" @tap="goTo" data-url="../room/signup-index">
  21. <view class="cuIcon-edit text-olive"></view>
  22. <text>报名记录</text>
  23. </view>
  24. <view class="cu-item" @tap="goTo" data-url="../room/grade">
  25. <view class="cuIcon-formfill text-yellow"></view>
  26. <text>考场成绩</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="cu-card case">
  32. <view class="cu-item shadow">
  33. <view class="cu-list grid col-3">
  34. <view class="cu-item" @tap="goTo" data-url="../search/index">
  35. <view class="cuIcon-searchlist text-purple"></view>
  36. <text>试题查询</text>
  37. </view>
  38. <view class="cu-item" @tap="goTo" data-url="../collect/index">
  39. <view class="cuIcon-likefill text-orange"></view>
  40. <text>试题收藏</text>
  41. </view>
  42. <view class="cu-item" @tap="goTo" data-url="../wrong/index">
  43. <view class="cuIcon-roundclose text-blue"></view>
  44. <text>我的错题</text>
  45. </view>
  46. <view class="cu-item" @tap="goTo" data-url="../paper/grade">
  47. <view class="cuIcon-newshotfill text-cyan"></view>
  48. <text>考卷成绩</text>
  49. </view>
  50. <view class="cu-item" @tap="goTo" data-url="../user/set">
  51. <view class="cuIcon-my text-mauve"></view>
  52. <text>个人设置</text>
  53. </view>
  54. <view class="cu-item" @tap="goTo" data-url="../user/my-cate">
  55. <view class="cuIcon-favor text-green"></view>
  56. <text>常用题库</text>
  57. </view>
  58. <view class="cu-item" @tap="goTo" data-url="../user/my-correction">
  59. <view class="cuIcon-wenzi text-red"></view>
  60. <text>纠错反馈</text>
  61. </view>
  62. <view class="cu-item" @tap="clickFollow()" v-show="showFollowBtn">
  63. <view class="cuIcon-weixin tn-color-green"></view>
  64. <text>关注我们</text>
  65. </view>
  66. <!-- #ifdef MP-WEIXIN -->
  67. <view class="cu-item">
  68. <button class="content" style="color: #333333;" open-type="contact">
  69. <view class="cuIcon-weixin text-green"></view>
  70. <text>联系客服</text>
  71. </button>
  72. </view>
  73. <!-- #endif -->
  74. <view class="cu-item" @tap="clearStorage">
  75. <view class="cuIcon-deletefill text-grey"></view>
  76. <text>清除缓存</text>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 关注我们 -->
  82. <tui-modal :show="showFollow" @cancel="showFollow = false" :custom="true">
  83. <view class="tui-modal-custom">
  84. <image :src="followImage" mode="widthFix"></image>
  85. <view class="tui-modal-custom-text">
  86. </view>
  87. <tui-button height="72rpx" :size="28" type="primary" shape="circle" @click="showFollow = false">确定</tui-button>
  88. </view>
  89. </tui-modal>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. name:"kz-page-my-simple",
  95. // emits: ['login', 'goTo', 'clearStorage'],
  96. props: {
  97. // 用户信息
  98. user: {
  99. type: Object,
  100. default: () => null
  101. },
  102. },
  103. watch: {
  104. /**
  105. * 监听user
  106. * @param value
  107. */
  108. user(value) {
  109. console.log('watch user', value)
  110. this.userInfo = value
  111. var page = uni.getStorageSync('page')
  112. this.showFollowBtn = parseInt(page.page_my_follow_mp_btn) == 1
  113. },
  114. },
  115. data() {
  116. return {
  117. userInfo: null,
  118. // 关注公众号
  119. showFollowBtn: false,
  120. showFollow: false,
  121. followImage: '',
  122. };
  123. },
  124. methods: {
  125. login() {
  126. this.$emit('login')
  127. },
  128. goTo(e) {
  129. let page = e.currentTarget.dataset.url
  130. this.$emit('goTo', page)
  131. },
  132. clearStorage() {
  133. this.$emit('clearStorage')
  134. },
  135. clickFollow() {
  136. var page = uni.getStorageSync('page')
  137. if (page.page_my_follow_mp_click == 'image') {
  138. this.followImage = this.appInfo.api_host + page.follow_mp_image
  139. this.showFollow = true
  140. } else if (page.page_my_follow_mp_click == 'article') {
  141. this.goTo('/pages/webview/webview?url=' + page.follow_mp_article_url)
  142. }
  143. },
  144. }
  145. }
  146. </script>
  147. <style>
  148. .page {
  149. height: 100vh;
  150. }
  151. .bg-user {
  152. background: #5677fc;
  153. color: #fff;
  154. }
  155. .user-info {
  156. width: 100%;
  157. height: 150px;
  158. position: relative;
  159. border-radius: 0 0 10% 10%;
  160. }
  161. .user {
  162. width: 100%;
  163. height: 80px;
  164. }
  165. .avatar {
  166. width: 80px;
  167. height: 80px;
  168. border: 1px solid #fff;
  169. margin-left: 5%;
  170. float: left;
  171. }
  172. .avatar image {
  173. width: 100%;
  174. height: 100%;
  175. display: block;
  176. }
  177. .user-avatar {
  178. margin-left: 50rpx;
  179. margin-top: 50rpx;
  180. }
  181. .user-name {
  182. font-size: 18px;
  183. width: calc(95% - 100px);
  184. float: right;
  185. margin-top: 80rpx;
  186. color: #fff;
  187. }
  188. button.contact::after {
  189. border: none;
  190. }
  191. button.content {
  192. background-color: #fff;
  193. padding-left: 0;
  194. padding-right: 0;
  195. line-height: inherit;
  196. border-radius: 0;
  197. }
  198. </style>