index.vue 10 KB

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