index.vue 9.7 KB

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