index.vue 11 KB

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