index.vue 8.1 KB

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