index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view style="height: 100%">
  3. <nav-logo title="我的"></nav-logo>
  4. <view v-if="isLogin" class="imgs_bg">
  5. <view class="infos" v-if="userInfo">
  6. <image :src="$method.splitImgHost(userInfo.avatar, true)" class="avatar"></image>
  7. <view style="color: #ffffff; font-size: 32rpx">{{
  8. userInfo.nickname
  9. }}</view>
  10. <view style="color: #ffffff; font-size: 20rpx; margin-top: 17rpx">{{
  11. userInfo.telphone
  12. }}</view>
  13. </view>
  14. <!-- <image src="/static/me/me_bgpic.jpg" class="bg_pic"></image> -->
  15. </view>
  16. <view class="login_wrap" v-if="!isLogin">
  17. <view class="login_text">您还没有登录哦~</view>
  18. <view class="loginBtn" @click="jumpLogin">立即登录/注册</view>
  19. </view>
  20. <view v-if="isLogin" class="loginBox">
  21. <view class="contents">
  22. <navigator hover-class="none" url="/pages2/learn/my_learn" class="menu_box">
  23. <view class="box_left">
  24. <image src="/static/icon/my_icon2.png" class="my_icon"></image>
  25. <view>我的学时</view>
  26. </view>
  27. <view class="box_right">
  28. 累计
  29. <text>{{ userNums.periodSum }}</text>
  30. 学时未通过
  31. </view>
  32. </navigator>
  33. <navigator hover-class="none" url="/pages5/exam/index" class="menu_box">
  34. <view class="box_left">
  35. <image src="/static/icon/my_icon11.png" class="my_icon"></image>
  36. <view>我的模考</view>
  37. </view>
  38. <view class="box_right">
  39. <text>{{ total1 }}</text>
  40. 个模考预约
  41. </view>
  42. </navigator>
  43. <!-- /pages2/exam/index-->
  44. <navigator hover-class="none" url="/pages2/exam/exam_appointment" class="menu_box">
  45. <view class="box_left">
  46. <image src="/static/icon/my_icon10.png" class="my_icon"></image>
  47. <view>我的考试</view>
  48. </view>
  49. <view class="box_right">
  50. <text>{{ userNums.subscribeSum }}</text>
  51. 考试预约
  52. </view>
  53. </navigator>
  54. <navigator hover-class="none" v-if="!hideBuyState" url="/pages2/order/index" class="menu_box">
  55. <view class="box_left">
  56. <image src="/static/icon/my_icon7.png" class="my_icon"></image>
  57. <view>我的订单</view>
  58. </view>
  59. <view class="box_right">
  60. <text>{{ userNums.orderSum }}</text>
  61. 笔待支付
  62. </view>
  63. </navigator>
  64. <navigator hover-class="none" url="/pages2/msg/index" class="menu_box">
  65. <view class="box_left">
  66. <image src="/static/icon/my_icon8.png" class="my_icon"></image>
  67. <view>我的消息</view>
  68. </view>
  69. <view class="box_right">
  70. <text>{{ userNums.informSum }}</text>
  71. 条未读
  72. </view>
  73. </navigator>
  74. <navigator hover-class="none" url="/pages2/wd/info" class="menu_box">
  75. <view class="box_left">
  76. <image src="/static/icon/my_icon9.png" class="my_icon"></image>
  77. <view>我的资料</view>
  78. </view>
  79. <view class="box_right">
  80. <u-icon name="arrow-right" color="#999" size="24"></u-icon>
  81. </view>
  82. </navigator>
  83. <navigator hover-class="none" url="/pages2/wd/stuff" class="menu_box">
  84. <view class="box_left">
  85. <image src="/static/icon/my_icon14.png" class="my_icon"></image>
  86. <view>讲义资料</view>
  87. </view>
  88. <view class="box_right">
  89. <u-icon name="arrow-right" color="#999" size="24"></u-icon>
  90. </view>
  91. </navigator>
  92. </view>
  93. <view class="logout" @click="logout">退出</view>
  94. </view>
  95. <!-- tabbar -->
  96. <myTabbar :backTopBtn="backTopBtn"></myTabbar>
  97. </view>
  98. </template>
  99. <script>
  100. // import { websocket } from '@/common/socket.js';
  101. import {
  102. mapGetters
  103. } from "vuex";
  104. export default {
  105. data() {
  106. return {
  107. backTopBtn:false,
  108. list: [23, 24, 25, 26, 27, 28, 29],
  109. content: "此功能暂未开放",
  110. show: false,
  111. isLogin: false,
  112. userNums: {},
  113. total1: 0,
  114. total2: 0,
  115. current: 4,
  116. };
  117. },
  118. onLoad(option) {
  119. uni.hideTabBar();
  120. // console.log(option,987)
  121. },
  122. onPageScroll(e) {
  123. if (e.scrollTop > 100) {
  124. this.backTopBtn = true
  125. } else {
  126. this.backTopBtn = false
  127. }
  128. },
  129. onShow() {
  130. this.isLogin = this.$method.isLogin();
  131. if (this.isLogin) {
  132. this.$store.state.allowLoading = false;
  133. this.getNums();
  134. this.getCount();
  135. this.goodsLivingSectionList();
  136. this.$store.state.allowLoading = true;
  137. !this.userInfo && this.$api.refreshUserInfo();
  138. }
  139. // this.$store.dispatch('changeTabsNum')
  140. },
  141. methods: {
  142. getCount() {
  143. this.$api
  144. .mockSubscribeListSubscribe({
  145. mockStatus: 0,
  146. pageNum: 1,
  147. pageSize: 1,
  148. })
  149. .then((res) => {
  150. this.total1 = res.data.total;
  151. });
  152. },
  153. goodsLivingSectionList() {
  154. this.$api.goodsLivingSectionList().then((res) => {
  155. this.total2 = res.data.data.length;
  156. });
  157. },
  158. goBank() {
  159. this.$method.checkLock("bank").then((res) => {
  160. uni.navigateTo({
  161. url: "/pages2/wd/question_bank",
  162. });
  163. });
  164. },
  165. getNums() {
  166. this.$api.getinfoAttached().then((res) => {
  167. if (res.data.code === 200) {
  168. this.userNums = res.data.data;
  169. const nums =
  170. res.data.data.informSum +
  171. res.data.data.orderSum +
  172. res.data.data.periodSum +
  173. res.data.data.planSum +
  174. res.data.data.subscribeSum;
  175. this.$store.commit("tabNum", nums);
  176. }
  177. });
  178. },
  179. logout() {
  180. // websocket.stop()
  181. this.$method.exit();
  182. this.isLogin = this.$method.isLogin();
  183. },
  184. jumpLogin() {
  185. this.$navTo.togo("/pages4/login/login");
  186. },
  187. },
  188. computed: {
  189. ...mapGetters(["userInfo", "hideBuyState", "config"])
  190. },
  191. };
  192. </script>
  193. <style>
  194. ::-webkit-scrollbar {
  195. width: 0;
  196. height: 0;
  197. color: transparent;
  198. }
  199. page {
  200. height: 100%;
  201. background-color: #f0f1f5;
  202. }
  203. </style>
  204. <style scoped lang="scss">
  205. .login_wrap {
  206. text-align: center;
  207. margin-top: 100rpx;
  208. .login_text {
  209. color: #007aff;
  210. font-size: 36rpx;
  211. font-weight: bold;
  212. }
  213. .loginBtn {
  214. width: 526rpx;
  215. height: 80rpx;
  216. background: linear-gradient(90deg, #015eea, #00c0fa);
  217. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  218. border-radius: 40rpx;
  219. color: #ffffff;
  220. line-height: 80rpx;
  221. margin: 0 auto;
  222. margin-top: 50rpx;
  223. }
  224. }
  225. .imgs_bg {
  226. width: 100%;
  227. height: 429rpx;
  228. position: fixed;
  229. z-index: 999;
  230. background: linear-gradient(180deg, rgba(0, 122, 255, 1) 0%, #f0f1f5 100%);
  231. .infos {
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. width: 100%;
  236. z-index: 99;
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. }
  241. .bg_pic {
  242. width: 100%;
  243. height: 100%;
  244. display: block;
  245. position: absolute;
  246. top: 0;
  247. left: 0;
  248. z-index: 9;
  249. }
  250. }
  251. .avatar {
  252. height: 160rpx;
  253. width: 160rpx;
  254. border-radius: 50%;
  255. margin: 60rpx 0rpx 37rpx 0rpx;
  256. }
  257. .small_menu {
  258. width: 45%;
  259. height: 104rpx;
  260. background: #ffffff;
  261. border-radius: 24rpx;
  262. display: flex;
  263. align-items: center;
  264. padding-left: 20rpx;
  265. margin-top: 30rpx;
  266. }
  267. .two_menu {
  268. font-size: 32rpx;
  269. color: #666;
  270. display: flex;
  271. justify-content: space-between;
  272. }
  273. .my_icon {
  274. width: 56rpx;
  275. height: 56rpx;
  276. margin-right: 20rpx;
  277. }
  278. .menu_box {
  279. height: 130rpx;
  280. background: #ffffff;
  281. // border-radius: 24rpx;
  282. // margin-top: 30rpx;
  283. display: flex;
  284. align-items: center;
  285. // padding: 0 20rpx;
  286. justify-content: space-between;
  287. color: #666666;
  288. font-size: 30rpx;
  289. font-weight: 500;
  290. border-bottom: 1rpx solid #eeeeee;
  291. .box_left {
  292. display: flex;
  293. align-items: center;
  294. }
  295. .box_right {
  296. font-size: 32rpx;
  297. text {
  298. color: #007aff;
  299. margin: 0 5rpx;
  300. }
  301. }
  302. }
  303. .loginBox {
  304. position: relative;
  305. padding: 0 30rpx 200rpx 30rpx;
  306. top: 430rpx;
  307. width: 100%;
  308. margin-top: 30rpx;
  309. .contents {
  310. width: 100%;
  311. height: 100%;
  312. border-radius: 24rpx;
  313. background-color: #ffffff;
  314. padding: 0rpx 30rpx 0rpx 20rpx;
  315. }
  316. }
  317. .login_full_img {
  318. display: block;
  319. width: 100%;
  320. height: 150px !important;
  321. z-index: 300;
  322. top: 0;
  323. position: fixed;
  324. }
  325. .full_img {
  326. display: block;
  327. width: 100%;
  328. z-index: -999;
  329. top: 0;
  330. }
  331. .logout {
  332. color: #999999;
  333. text-align: center;
  334. font-size: 32rpx;
  335. margin-top: 50rpx;
  336. }
  337. </style>