index.vue 9.6 KB

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