index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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">
  81. </image>
  82. <view class="point" v-if="total2 > 0"></view>
  83. <view>我的直播课</view>
  84. </view>
  85. <view class="box_right">
  86. <text>{{ total2 }}</text>
  87. 个课程直播中
  88. </view>
  89. </navigator>
  90. <navigator
  91. hover-class="none"
  92. url="/pages2/learn/my_learn"
  93. class="menu_box"
  94. >
  95. <view class="box_left">
  96. <image src="/static/icon/my_icon2.png" class="my_icon"></image>
  97. <view class="point" v-if="userNums.periodSum > 0"></view>
  98. <view>我的学时</view>
  99. </view>
  100. <view class="box_right">
  101. 累计
  102. <text>{{ userNums.periodSum }}</text>
  103. 学时未通过
  104. </view>
  105. </navigator>
  106. <navigator hover-class="none" url="/pages5/exam/index" class="menu_box">
  107. <view class="box_left">
  108. <image src="/static/icon/my_icon11.png" class="my_icon"></image>
  109. <view class="point" v-if="total1 > 0"></view>
  110. <view>我的模考</view>
  111. </view>
  112. <view class="box_right">
  113. <text>{{ total1 }}</text>
  114. 个模考预约
  115. </view>
  116. </navigator>
  117. <navigator hover-class="none" url="/pages2/exam/index" class="menu_box">
  118. <view class="box_left">
  119. <image src="/static/icon/my_icon10.png" class="my_icon"></image>
  120. <view class="point" v-if="userNums.subscribeSum > 0"></view>
  121. <view>我的考试</view>
  122. </view>
  123. <view class="box_right">
  124. <text>{{ userNums.subscribeSum }}</text>
  125. 考试预约
  126. </view>
  127. </navigator>
  128. <navigator
  129. hover-class="none"
  130. v-if="!hideBuyState"
  131. url="/pages2/order/index"
  132. class="menu_box"
  133. >
  134. <view class="box_left">
  135. <image src="/static/icon/my_icon7.png" class="my_icon"></image>
  136. <view class="point" v-if="userNums.orderSum > 0"></view>
  137. <view>我的订单</view>
  138. </view>
  139. <view class="box_right">
  140. <text>{{ userNums.orderSum }}</text>
  141. 笔待支付
  142. </view>
  143. </navigator>
  144. <navigator hover-class="none" url="/pages2/msg/index" class="menu_box">
  145. <view class="box_left">
  146. <image src="/static/icon/my_icon8.png" class="my_icon"></image>
  147. <view class="point" v-if="userNums.informSum > 0"></view>
  148. <view>我的消息</view>
  149. </view>
  150. <view class="box_right">
  151. <text>{{ userNums.informSum }}</text>
  152. 条未读
  153. </view>
  154. </navigator>
  155. <navigator hover-class="none" url="/pages2/wd/info" class="menu_box">
  156. <view class="box_left">
  157. <image src="/static/icon/my_icon9.png" class="my_icon"></image>
  158. <view>我的资料</view>
  159. </view>
  160. </navigator>
  161. <view class="logout" @click="logout">退出</view>
  162. </view>
  163. </view>
  164. <u-navbar
  165. :is-back="false"
  166. title="我的"
  167. :border-bottom="false"
  168. background="{ background: '#ffffff',opacity:0.4; }"
  169. title-color="#ffffff"
  170. back-icon-color="#ffffff"
  171. >
  172. <view class="slot-wrap"
  173. ><image
  174. src="/static/logo.png"
  175. style="width: 178rpx; height: 31rpx; margin-left: 30rpx"
  176. ></image
  177. ></view>
  178. </u-navbar>
  179. </view>
  180. </template>
  181. <script>
  182. // import { websocket } from '@/common/socket.js';
  183. import { mapGetters } from "vuex";
  184. export default {
  185. components: {},
  186. data() {
  187. return {
  188. list: [23, 24, 25, 26, 27, 28, 29],
  189. content: "此功能暂未开放",
  190. show: false,
  191. isLogin: false,
  192. userNums: {},
  193. total1: 0,
  194. total2: 0,
  195. };
  196. },
  197. onLoad(option) {
  198. console.log(option, 987);
  199. },
  200. onShow() {
  201. this.isLogin = this.$method.isLogin();
  202. if (this.isLogin) {
  203. this.$store.state.allowLoading = false;
  204. this.getNums();
  205. this.getCount();
  206. this.goodsLivingSectionList();
  207. this.$store.state.allowLoading = true;
  208. }
  209. // this.$store.dispatch('changeTabsNum')
  210. },
  211. methods: {
  212. getCount() {
  213. this.$api
  214. .mockSubscribeListSubscribe({
  215. mockStatus: 0,
  216. pageNum: 1,
  217. pageSize: 1,
  218. })
  219. .then((res) => {
  220. this.total1 = res.data.total;
  221. });
  222. },
  223. goodsLivingSectionList() {
  224. this.$api.goodsLivingSectionList().then((res) => {
  225. this.total2 = res.data.data.length;
  226. });
  227. },
  228. goBank() {
  229. this.$api
  230. .lockLockStatus({
  231. action: "bank",
  232. })
  233. .then((res) => {
  234. if (res.data.code == 200) {
  235. //有其他端在操作,不能学习
  236. uni.showToast({
  237. icon: "none",
  238. title: res.data.msg,
  239. duration: 3000,
  240. });
  241. } else if (res.data.code == 500) {
  242. //可以学习
  243. uni.navigateTo({
  244. url: "/pages2/wd/question_bank",
  245. });
  246. }
  247. });
  248. },
  249. getNums() {
  250. this.$api.getinfoAttached().then((res) => {
  251. if (res.data.code === 200) {
  252. this.userNums = res.data.data;
  253. const nums =
  254. res.data.data.informSum +
  255. res.data.data.orderSum +
  256. res.data.data.periodSum +
  257. res.data.data.planSum +
  258. res.data.data.subscribeSum;
  259. this.$store.commit("tabNum", nums);
  260. }
  261. });
  262. },
  263. logout() {
  264. // websocket.stop()
  265. this.$method.exit();
  266. this.isLogin = this.$method.isLogin();
  267. },
  268. jumpLogin() {
  269. this.$navTo.togo("/pages4/login/login");
  270. },
  271. },
  272. computed: { ...mapGetters(["userInfo", "hideBuyState"]) },
  273. };
  274. </script>
  275. <style>
  276. ::-webkit-scrollbar {
  277. width: 0;
  278. height: 0;
  279. color: transparent;
  280. }
  281. page {
  282. background-color: #f0f1f5;
  283. }
  284. </style>
  285. <style scoped lang="scss">
  286. .login_wrap {
  287. text-align: center;
  288. margin-top: 60rpx;
  289. .login_text {
  290. color: #007aff;
  291. font-size: 36rpx;
  292. font-weight: bold;
  293. }
  294. .loginBtn {
  295. width: 526rpx;
  296. height: 80rpx;
  297. background: linear-gradient(90deg, #015eea, #00c0fa);
  298. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  299. border-radius: 40rpx;
  300. color: #ffffff;
  301. line-height: 80rpx;
  302. margin: 0 auto;
  303. margin-top: 50rpx;
  304. }
  305. }
  306. .avatar {
  307. height: 70rpx;
  308. width: 70rpx;
  309. border-radius: 50%;
  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: 104rpx;
  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: 32rpx;
  343. .box_left {
  344. display: flex;
  345. align-items: center;
  346. position:relative;
  347. .point {
  348. width:16rpx;
  349. height:16rpx;
  350. border-radius:50%;
  351. background: red;
  352. position:absolute;
  353. left:50rpx;
  354. top:0;
  355. }
  356. }
  357. .box_right {
  358. font-size: 32rpx;
  359. text {
  360. color: #007aff;
  361. margin: 0 5rpx;
  362. }
  363. }
  364. }
  365. .loginBox {
  366. position: relative;
  367. padding: 0 30rpx;
  368. }
  369. .avatar {
  370. width: 80px;
  371. height: 80px;
  372. }
  373. .login_full_img {
  374. display: block;
  375. width: 100%;
  376. height: 150px !important;
  377. z-index: 300;
  378. top: 0;
  379. position: fixed;
  380. }
  381. .full_img {
  382. display: block;
  383. width: 100%;
  384. z-index: -999;
  385. top: 0;
  386. }
  387. .logout {
  388. color: #999999;
  389. text-align: center;
  390. font-size: 32rpx;
  391. margin-top: 50rpx;
  392. }
  393. </style>