index.vue 8.3 KB

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