index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="index">
  3. <u-navbar :is-back="false" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png"></image>
  6. </view>
  7. </u-navbar>
  8. <u-swiper :list="list" @change="e => current = e.current" :autoplay="false"></u-swiper>
  9. <view class="content">
  10. <view class="notice">
  11. <image src="/static/icon/msg_icon1.png" class="icon"></image>
  12. <view class="text">
  13. 您有2条新的通知
  14. </view>
  15. <view class="btn">立即查看</view>
  16. </view>
  17. <view class="date-list">
  18. <view class="title">距离最近一次考试还剩 36 天</view>
  19. <view class="list">
  20. <view class="item" v-for="(item,index) in 7" :key="index">
  21. <view class="top">{{text[index]}}</view>
  22. <view class="bottom" :class="{red:item==1,green:item==2,blue:item==3}">
  23. {{item}}
  24. <view class="note" v-if="item==3">3</view>
  25. <view class="point" v-if="item==4"></view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="btns">
  30. <image class="left" src="/static/left.png"></image>
  31. <view class="center">二级建造师市政公用工程</view>
  32. <image class="right" src="/static/right.png"></image>
  33. </view>
  34. </view>
  35. <u-tabs class="tabs" :current="tabCurrent" @change="tab" :list="list1" :activeStyle="{fontSize:'36rpx'}" :inactiveStyle="{color:'#EAEEF1',fontSize:'30rpx'}" sticky></u-tabs>
  36. <view class="course-list">
  37. <view class="item" v-for="item in 3">
  38. <view class="img">
  39. <image src="/static/wd_bg_login.jpg"></image>
  40. <view class="time">2020</view>
  41. </view>
  42. <view class="text">
  43. <view class="title">施工现场专业人员岗位培训基础班(设备安装质量员)</view>
  44. <view class="desc">
  45. <view class="left">
  46. 60
  47. <text>学时</text>
  48. </view>
  49. <view class="right">¥ 999.00</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import { mapGetters } from 'vuex';
  59. export default {
  60. components: {},
  61. data() {
  62. return {
  63. list:[
  64. 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  65. 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  66. 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
  67. ],
  68. tabCurrent:0,
  69. text:['日','一','二','三','四','五','六'],
  70. current:0,
  71. indicatorDots: true,
  72. autoplay: true,
  73. interval: 2000,
  74. duration: 500,
  75. list1: [{
  76. name: '推荐课程',
  77. }, {
  78. name: '推荐题库',
  79. }]
  80. };
  81. },
  82. onPullDownRefresh() {},
  83. onLoad(option) {},
  84. onShow() {
  85. /* if(this.current === 2 && this.$method.isLogin()){
  86. this.$refs.refMy.init();
  87. } */
  88. },
  89. onShareAppMessage(res) {
  90. var self = this;
  91. return {
  92. title: '中正',
  93. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  94. };
  95. },
  96. methods: {
  97. tab(e) {
  98. this.tabCurrent = e;
  99. },
  100. updateHomePlan() {
  101. this.$refs.home.init();
  102. },
  103. beforeSwitch(index) {
  104. let that = this;
  105. if (index == 1) {
  106. this.isClick1 = true;
  107. }
  108. if (index == this.current) {
  109. return false;
  110. }
  111. if (!this.$method.isLogin()) {
  112. if (index == 0 || index == 1) {
  113. return true;
  114. } else {
  115. this.$navTo.togo('/pages/login/login');
  116. return false;
  117. }
  118. } else {
  119. if (index == 2) {
  120. this.$refs.refMy.init();
  121. }
  122. return true;
  123. }
  124. }
  125. },
  126. onReachBottom() {},
  127. computed: { ...mapGetters(['userInfo']) }
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .index {
  132. .slot-wrap {
  133. width:100%;
  134. display: flex;
  135. align-items: center;
  136. justify-content: flex-end;
  137. image {
  138. margin-right:98rpx;
  139. width: 178rpx;
  140. height: 31rpx;
  141. }
  142. }
  143. .swiper {
  144. width:100%;
  145. image {
  146. width:100%;
  147. }
  148. .indicator__dot {
  149. background: rgba(255, 255, 255, 1);
  150. &.indicator__dot--active {
  151. background: rgba(0, 122, 255, 1);
  152. }
  153. }
  154. }
  155. .content {
  156. padding:16rpx;
  157. background: rgba(234, 238, 241, 1);
  158. .notice {
  159. padding:0 8rpx;
  160. height: 56rpx;
  161. background: linear-gradient(-90deg, rgba(255, 209, 0, 0.3), rgba(255, 255, 255, 0.3));
  162. border-radius: 16rpx;
  163. display: flex;
  164. align-items: center;
  165. .icon {
  166. width: 40rpx;
  167. height: 40rpx;
  168. margin-right: 8rpx;
  169. }
  170. .text {
  171. flex:1;
  172. font-size: 24rpx;
  173. color: #333333;
  174. }
  175. .btn {
  176. font-size: 24rpx;
  177. color: #007AFF;
  178. }
  179. }
  180. .date-list {
  181. margin-top:16rpx;
  182. width: 718rpx;
  183. height: 330rpx;
  184. background: #FFFFFF;
  185. border-radius: 16rpx;
  186. padding:18rpx 27rpx;
  187. .title {
  188. font-size: 30rpx;
  189. font-weight: bold;
  190. color: #007AFF;
  191. }
  192. .list {
  193. margin-top:40rpx;
  194. display: flex;
  195. justify-content: space-around;
  196. .item {
  197. .top {
  198. text-align: center;
  199. font-size: 26rpx;
  200. color: rgba(102, 102, 102, 0.6);
  201. }
  202. .bottom {
  203. text-align: center;
  204. line-height: 48rpx;
  205. margin-top:30rpx;
  206. width: 48rpx;
  207. height: 48rpx;
  208. border-radius: 50%;
  209. color:rgba(51, 51, 51, 1);
  210. font-size: 26rpx;
  211. position:relative;
  212. &.red {
  213. color:red;
  214. }
  215. &.green {
  216. color:green;
  217. }
  218. &.blue {
  219. background: #007AFF;
  220. color:#fff;
  221. }
  222. .note {
  223. width: 30rpx;
  224. height: 30rpx;
  225. border: 2rpx solid #FF9500;
  226. border-radius: 50%;
  227. position:absolute;
  228. top:-20rpx;
  229. right:-20rpx;
  230. line-height: 28rpx;
  231. text-align: center;
  232. color:#FF9500;
  233. font-size: 26rpx;
  234. }
  235. .point {
  236. margin:0 auto;
  237. width: 8rpx;
  238. height: 8rpx;
  239. background: #FF9500;
  240. border-radius: 50%;
  241. }
  242. }
  243. }
  244. }
  245. .btns {
  246. margin-top:50rpx;
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. .left,.right {
  251. width: 40rpx;
  252. height: 40rpx;
  253. }
  254. .center{
  255. width: 440rpx;
  256. height: 56rpx;
  257. background: #FFFFFF;
  258. box-shadow: 0px 0px 9rpx 1rpx rgba(47, 67, 121, 0.1);
  259. border-radius: 28rpx;
  260. color:rgba(255, 149, 0, 1);
  261. line-height: 56rpx;
  262. text-align: center;
  263. font-size: 30rpx;
  264. margin:0 30rpx;
  265. }
  266. }
  267. }
  268. .tabs {
  269. /deep/ .u-tabs {
  270. background:none!important;
  271. }
  272. }
  273. .course-list {
  274. background:#fff;
  275. padding:0 8rpx;
  276. box-shadow: 0px 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  277. border-radius: 16rpx ;
  278. .item {
  279. padding:8rpx 0;
  280. border-bottom:1rpx solid #eeeeee;
  281. display: flex;
  282. .img {
  283. position:relative;
  284. margin-right:10rpx;
  285. border-radius: 16rpx ;
  286. overflow: hidden;
  287. width: 320rpx;
  288. height: 155rpx;
  289. image {
  290. width:100%;
  291. height:100%;
  292. }
  293. .time {
  294. position:absolute;
  295. bottom:0;
  296. right:0;
  297. width: 80rpx;
  298. height: 32rpx;
  299. background: rgba(1, 25, 45, 0.4);
  300. color:#fff;
  301. text-align: center;
  302. line-height: 32rpx;
  303. font-size: 24rpx;
  304. border-radius: 10rpx 0px 10rpx 0px;
  305. }
  306. }
  307. .text {
  308. flex:1;
  309. padding-right:10rpx;
  310. .title {
  311. font-size: 30rpx;
  312. color: #333333;
  313. }
  314. .desc {
  315. margin-top:40rpx;
  316. display: flex;
  317. .left {
  318. flex:1;
  319. color:#333;
  320. font-size: 26rpx;
  321. text {
  322. font-size: 24rpx;
  323. color:#999;
  324. }
  325. }
  326. .right {
  327. font-size: 24rpx;
  328. font-weight: bold;
  329. color: #FF2D55;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. }
  336. }
  337. </style>