index.vue 10 KB

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