index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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.$api
  197. .lockLockStatus({
  198. action: "bank",
  199. })
  200. .then((res) => {
  201. if (res.data.code == 200) {
  202. //有其他端在操作,不能学习
  203. uni.showToast({
  204. icon: "none",
  205. title: res.data.msg,
  206. duration: 3000,
  207. });
  208. } else if (res.data.code == 500) {
  209. //可以学习
  210. uni.navigateTo({
  211. url: "/pages2/wd/question_bank",
  212. });
  213. }
  214. });
  215. },
  216. getNums() {
  217. this.$api.getinfoAttached().then((res) => {
  218. if (res.data.code === 200) {
  219. this.userNums = res.data.data;
  220. const nums =
  221. res.data.data.informSum +
  222. res.data.data.orderSum +
  223. res.data.data.periodSum +
  224. res.data.data.planSum +
  225. res.data.data.subscribeSum;
  226. this.$store.commit("tabNum", nums);
  227. }
  228. });
  229. },
  230. logout() {
  231. // websocket.stop()
  232. this.$method.exit();
  233. this.isLogin = this.$method.isLogin();
  234. },
  235. jumpLogin() {
  236. this.$navTo.togo("/pages4/login/login");
  237. },
  238. },
  239. computed: { ...mapGetters(["userInfo", "hideBuyState", "config"]) },
  240. };
  241. </script>
  242. <style>
  243. ::-webkit-scrollbar {
  244. width: 0;
  245. height: 0;
  246. color: transparent;
  247. }
  248. page {
  249. height: 100%;
  250. background-color: #f0f1f5;
  251. }
  252. </style>
  253. <style scoped lang="scss">
  254. .login_wrap {
  255. text-align: center;
  256. margin-top: 100rpx;
  257. .login_text {
  258. color: #007aff;
  259. font-size: 36rpx;
  260. font-weight: bold;
  261. }
  262. .loginBtn {
  263. width: 526rpx;
  264. height: 80rpx;
  265. background: linear-gradient(90deg, #015eea, #00c0fa);
  266. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  267. border-radius: 40rpx;
  268. color: #ffffff;
  269. line-height: 80rpx;
  270. margin: 0 auto;
  271. margin-top: 50rpx;
  272. }
  273. }
  274. .imgs_bg {
  275. width: 100%;
  276. height: 429rpx;
  277. position: fixed;
  278. z-index: 999;
  279. .infos {
  280. position: absolute;
  281. top: 0;
  282. left: 0;
  283. width: 100%;
  284. z-index: 99;
  285. display: flex;
  286. flex-direction: column;
  287. align-items: center;
  288. }
  289. .bg_pic {
  290. width: 100%;
  291. height: 100%;
  292. display: block;
  293. position: absolute;
  294. top: 0;
  295. left: 0;
  296. z-index: 9;
  297. }
  298. }
  299. .avatar {
  300. height: 160rpx;
  301. width: 160rpx;
  302. border-radius: 50%;
  303. margin: 110rpx 0rpx 37rpx 0rpx;
  304. }
  305. .small_menu {
  306. width: 45%;
  307. height: 104rpx;
  308. background: #ffffff;
  309. border-radius: 24rpx;
  310. display: flex;
  311. align-items: center;
  312. padding-left: 20rpx;
  313. margin-top: 30rpx;
  314. }
  315. .two_menu {
  316. font-size: 32rpx;
  317. color: #666;
  318. display: flex;
  319. justify-content: space-between;
  320. }
  321. .my_icon {
  322. width: 56rpx;
  323. height: 56rpx;
  324. margin-right: 20rpx;
  325. }
  326. .menu_box {
  327. height: 130rpx;
  328. background: #ffffff;
  329. // border-radius: 24rpx;
  330. // margin-top: 30rpx;
  331. display: flex;
  332. align-items: center;
  333. // padding: 0 20rpx;
  334. justify-content: space-between;
  335. color: #666666;
  336. font-size: 30rpx;
  337. font-weight: 500;
  338. border-bottom: 1rpx solid #eeeeee;
  339. .box_left {
  340. display: flex;
  341. align-items: center;
  342. }
  343. .box_right {
  344. font-size: 32rpx;
  345. text {
  346. color: #007aff;
  347. margin: 0 5rpx;
  348. }
  349. }
  350. }
  351. .loginBox {
  352. position: relative;
  353. padding: 0 30rpx 150rpx 30rpx;
  354. top: 430rpx;
  355. width: 100%;
  356. margin-top: 30rpx;
  357. .contents {
  358. width: 100%;
  359. height: 100%;
  360. border-radius: 24rpx;
  361. background-color: #ffffff;
  362. padding: 0rpx 30rpx 0rpx 20rpx;
  363. }
  364. }
  365. .login_full_img {
  366. display: block;
  367. width: 100%;
  368. height: 150px !important;
  369. z-index: 300;
  370. top: 0;
  371. position: fixed;
  372. }
  373. .full_img {
  374. display: block;
  375. width: 100%;
  376. z-index: -999;
  377. top: 0;
  378. }
  379. .logout {
  380. color: #999999;
  381. text-align: center;
  382. font-size: 32rpx;
  383. margin-top: 50rpx;
  384. }
  385. </style>