index.vue 7.4 KB

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