index.vue 7.1 KB

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