index.vue 9.9 KB

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