kz-page-index-simple.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <view>
  3. <!-- banner -->
  4. <!-- <view class="tui-banner-box">
  5. <swiper
  6. :indicator-dots="true"
  7. :autoplay="true"
  8. :interval="5000"
  9. :duration="150"
  10. class="tui-banner-swiper"
  11. :circular="true"
  12. previous-margin="60rpx"
  13. next-margin="60rpx"
  14. >
  15. <swiper-item v-for="(item, index) in banners" :key="index" class="tui-banner-item">
  16. <image :src="imgUrl + item" class="tui-slide-image" :class="[current != index ? 'tui-banner-scale' : '']" mode="scaleToFill" lazy-load></image>
  17. </swiper-item>
  18. </swiper>
  19. </view> -->
  20. <!-- color-ui样式 -->
  21. <!--
  22. <swiper class="swiper" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500"
  23. style="height: 220px;">
  24. <swiper-item v-for="(item, index) in banner" :key="index">
  25. <image :src="imgUrl + item" style="width: 100%;height: 100%;"></image>
  26. </swiper-item>
  27. </swiper>
  28. -->
  29. <!-- banner end -->
  30. <!-- 公告 -->
  31. <!-- <view class="tui-rolling-news">
  32. <tui-icon name="news-fill" :size='24' color='#5677fc'></tui-icon>
  33. <swiper vertical autoplay circular interval="3000" class="tui-swiper">
  34. <swiper-item v-for="(item,index) in headlines" :key="index" class="tui-swiper-item">
  35. <view class="tui-news-item">{{item}}</view>
  36. </swiper-item>
  37. </swiper>
  38. </view> -->
  39. <!-- 菜单 -->
  40. <view class="nav-list margin-top-xl">
  41. <navigator hover-class="none" :url="item.url" class="nav-li" navigateTo :class="'bg-'+item.color"
  42. :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]" v-for="(item,index) in modules"
  43. :key="index">
  44. <view class="nav-title">{{ item.title }}</view>
  45. <view class="nav-name">{{ item.name }}</view>
  46. <text :class="'cuIcon-' + item.cuIcon"></text>
  47. </navigator>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. name:"kz-page-index-simple",
  54. props: {
  55. // 关注提示
  56. focusOnTip: {
  57. type: String,
  58. default: '点击「添加小程序」,下次访问更便捷'
  59. },
  60. // banner图集合
  61. banners: {
  62. type: Array,
  63. default: () => []
  64. },
  65. // 公告集合
  66. headlines: {
  67. type: Array,
  68. default: () => []
  69. },
  70. // 功能集合
  71. modules: {
  72. type: Array,
  73. default: () => [
  74. {
  75. title: '看题模式',
  76. name: 'train',
  77. color: 'green',
  78. cuIcon: 'creative',
  79. url: '/pages/train/index?page=look',
  80. },
  81. {
  82. title: '答题练习',
  83. name: 'train',
  84. color: 'olive',
  85. cuIcon: 'copy',
  86. url: '/pages/train/index?page=train',
  87. },
  88. {
  89. title: '模拟考试',
  90. name: 'exam',
  91. color: 'cyan',
  92. cuIcon: 'newsfill',
  93. url: '/pages/paper/index'
  94. },
  95. {
  96. title: '我的收藏',
  97. name: 'collect',
  98. color: 'blue',
  99. cuIcon: 'colorlens',
  100. url: '/pages/collect/index'
  101. },
  102. {
  103. title: '我的错题',
  104. name: 'wrong',
  105. color: 'purple',
  106. cuIcon: 'font',
  107. url: '/pages/wrong/index'
  108. },
  109. {
  110. title: '题目搜索',
  111. name: 'search',
  112. color: 'mauve',
  113. cuIcon: 'cuIcon',
  114. url: '/pages/search/index'
  115. },
  116. {
  117. title: '考场报名',
  118. name: 'signup',
  119. color: 'green',
  120. cuIcon: 'btn',
  121. url: '/pages/room/index'
  122. },
  123. {
  124. title: '报名记录',
  125. name: 'signupLog',
  126. color: 'orange',
  127. cuIcon: 'tagfill',
  128. url: '/pages/room/signup-index'
  129. },
  130. ]
  131. },
  132. },
  133. watch: {
  134. /**
  135. * 监听headlines
  136. * @param val
  137. */
  138. headlines(val) {
  139. console.log('watch headlines', val)
  140. }
  141. },
  142. data() {
  143. return {
  144. imgUrl: this.imgUrl,
  145. };
  146. }
  147. }
  148. </script>
  149. <style>
  150. .nav-list {
  151. display: flex;
  152. flex-wrap: wrap;
  153. padding: 0px 40 upx 0px;
  154. justify-content: space-between;
  155. padding-bottom: 100px;
  156. }
  157. .nav-li {
  158. padding: 30 upx;
  159. border-radius: 12 upx;
  160. width: 45%;
  161. margin: 0 2.5% 40 upx;
  162. background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
  163. background-size: cover;
  164. background-position: center;
  165. position: relative;
  166. z-index: 1;
  167. }
  168. .nav-li::after {
  169. content: "";
  170. position: absolute;
  171. z-index: -1;
  172. background-color: inherit;
  173. width: 100%;
  174. height: 100%;
  175. left: 0;
  176. bottom: -10%;
  177. border-radius: 10 upx;
  178. opacity: 0.2;
  179. transform: scale(0.9, 0.9);
  180. }
  181. .nav-li.cur {
  182. color: #fff;
  183. background: rgb(94, 185, 94);
  184. box-shadow: 4 upx 4 upx 6 upx rgba(94, 185, 94, 0.4);
  185. }
  186. .nav-title {
  187. font-size: 32 upx;
  188. font-weight: 300;
  189. }
  190. .nav-title::first-letter {
  191. font-size: 40 upx;
  192. margin-right: 4 upx;
  193. }
  194. .nav-name {
  195. font-size: 28 upx;
  196. text-transform: Capitalize;
  197. margin-top: 20 upx;
  198. position: relative;
  199. }
  200. .nav-name::before {
  201. content: "";
  202. position: absolute;
  203. display: block;
  204. width: 40 upx;
  205. height: 6 upx;
  206. background: #fff;
  207. bottom: 0;
  208. right: 0;
  209. opacity: 0.5;
  210. }
  211. .nav-name::after {
  212. content: "";
  213. position: absolute;
  214. display: block;
  215. width: 100 upx;
  216. height: 1px;
  217. background: #fff;
  218. bottom: 0;
  219. right: 40 upx;
  220. opacity: 0.3;
  221. }
  222. .nav-name::first-letter {
  223. font-weight: bold;
  224. font-size: 36 upx;
  225. margin-right: 1px;
  226. }
  227. .nav-li text {
  228. position: absolute;
  229. right: 30 upx;
  230. top: 30 upx;
  231. font-size: 52 upx;
  232. width: 60 upx;
  233. height: 60 upx;
  234. text-align: center;
  235. line-height: 60 upx;
  236. }
  237. .text-light {
  238. font-weight: 300;
  239. }
  240. @keyframes show {
  241. 0% {
  242. transform: translateY(-50px);
  243. }
  244. 60% {
  245. transform: translateY(40 upx);
  246. }
  247. 100% {
  248. transform: translateY(0px);
  249. }
  250. }
  251. @-webkit-keyframes show {
  252. 0% {
  253. transform: translateY(-50px);
  254. }
  255. 60% {
  256. transform: translateY(40 upx);
  257. }
  258. 100% {
  259. transform: translateY(0px);
  260. }
  261. }
  262. /*banner*/
  263. .tui-banner-box {
  264. width: 100%;
  265. padding-top: 20rpx;
  266. box-sizing: border-box;
  267. background: #fff;
  268. }
  269. .tui-banner-swiper {
  270. width: 100%;
  271. height: 320rpx;
  272. }
  273. .tui-banner-item {
  274. padding: 0 16rpx;
  275. box-sizing: border-box;
  276. }
  277. .tui-slide-image {
  278. width: 100%;
  279. height: 320rpx;
  280. display: block;
  281. border-radius: 12rpx;
  282. /* transition: all 0.1s linear; */
  283. }
  284. .tui-banner-scale {
  285. transform: scaleY(0.9);
  286. transform-origin: center center;
  287. }
  288. /* #ifdef MP-WEIXIN */
  289. .tui-banner-swiper .wx-swiper-dot {
  290. width: 8rpx;
  291. height: 8rpx;
  292. display: inline-flex;
  293. background: none;
  294. justify-content: space-between;
  295. }
  296. .tui-banner-swiper .wx-swiper-dot::before {
  297. content: '';
  298. flex-grow: 1;
  299. background: rgba(255, 255, 255, 0.8);
  300. border-radius: 16rpx;
  301. overflow: hidden;
  302. }
  303. .tui-banner-swiper .wx-swiper-dot-active::before {
  304. background: #fff;
  305. }
  306. .tui-banner-swiper .wx-swiper-dot.wx-swiper-dot-active {
  307. width: 16rpx;
  308. }
  309. /* #endif */
  310. /* #ifndef MP-WEIXIN */
  311. >>>.tui-banner-swiper .uni-swiper-dot {
  312. width: 8rpx;
  313. height: 8rpx;
  314. display: inline-flex;
  315. background: none;
  316. justify-content: space-between;
  317. }
  318. >>>.tui-banner-swiper .uni-swiper-dot::before {
  319. content: '';
  320. flex-grow: 1;
  321. background: rgba(255, 255, 255, 0.8);
  322. border-radius: 16rpx;
  323. overflow: hidden;
  324. }
  325. >>>.tui-banner-swiper .uni-swiper-dot-active::before {
  326. background: #fff;
  327. }
  328. >>>.tui-banner-swiper .uni-swiper-dot.uni-swiper-dot-active {
  329. width: 16rpx;
  330. }
  331. /* #endif */
  332. /*banner*/
  333. .tui-rolling-news {
  334. width: 100%;
  335. padding: 12rpx 30rpx;
  336. box-sizing: border-box;
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. flex-wrap: nowrap;
  341. background: #fff;
  342. }
  343. .tui-swiper {
  344. font-size: 24rpx;
  345. height: 50rpx;
  346. flex: 1;
  347. }
  348. .tui-swiper-item {
  349. display: flex;
  350. align-items: center
  351. }
  352. .tui-news-item {
  353. line-height: 24rpx;
  354. white-space: nowrap;
  355. overflow: hidden;
  356. text-overflow: ellipsis;
  357. }
  358. </style>