index.vue 11 KB

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