index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <view>
  3. <view class="sticky-nav">
  4. <view class="nav-bar">
  5. <view class="left-nav">
  6. <ul>
  7. <li v-for="(item,index) in navList" :class="{active:!(index-menuIndex)}">
  8. <view v-if="item.url">
  9. <navigator :url="item.url" v-text="item.name"></navigator>
  10. </view>
  11. <view v-else @click="menuShow(index)">
  12. <text v-text="item.name"></text>
  13. </view>
  14. </li>
  15. </ul>
  16. </view>
  17. <view class="right-nav">
  18. <image src="../../static/index/search_white_blod_big_icon.png" class="index_search"></image>
  19. <image src="../../static/index/notice_message_white_icon.png" class="index_info"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view>
  24. <view v-if="menuIndex===0" class="left-nav-title-box">
  25. <view class="left-nav-titles">
  26. <view v-for="(item,index) in leftNavList" :key="index">
  27. <view @click="navigate(item)">
  28. <image :src="item.imgurl" class="left-nav-title-img"></image>
  29. <text class="left-nav-title-content">{{item.content}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="uni-margin-wrap">
  34. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
  35. :interval="interval" :duration="duration" indicator-active-color="#FF713F"
  36. indicator-color="transparent">
  37. <swiper-item v-for="(item,index) in indexSwiperImgs">
  38. <view class="swiper-item">
  39. <image :src="item" style="width: 720rpx;height:320rpx;border-radius: 10rpx;"></image>
  40. </view>
  41. </swiper-item>
  42. </swiper>
  43. </view>
  44. <view class="left-nav-center">
  45. <view class="left-nav-btns">
  46. <image src="../../static/index/index_jisi_icon.png" class="jisi-img">
  47. </image>
  48. <view class="left-nav-btnBox">
  49. <view class="left-nav-btn left-nav-btn1">
  50. <image src="../../static/index/peifu_icon.png" class="small-btn-img">
  51. </image>
  52. <text class="left-nav-btn-content">培福</text>
  53. </view>
  54. <view class="left-nav-btn">
  55. <image src="../../static/index/xixing_icon.png" class="small-btn-img">
  56. </image>
  57. <text class="left-nav-btn-content">西游</text>
  58. </view>
  59. </view>
  60. </view>
  61. <view>
  62. <view class="nav-left-date">
  63. <text class="nav-left-oldDate">{{oldDate}}</text>
  64. <text class="nav-left-today">{{today}}</text>
  65. <text class="nav-left-lunarDate">{{lunarDate}}</text>
  66. </view>
  67. <view class="foli-box">
  68. <text class="nav-left-suit">宜</text><text
  69. class="nav-left-thing">{{suit.substr(0,9)+"..."}}</text>
  70. <text class="nav-left-aviod">忌</text><text
  71. class="nav-left-thing">{{avoid.substr(0,9)+"..."}}</text>
  72. <image src="../../static/index/foli_jiaobiao.png" class="foli"></image>
  73. </view>
  74. </view>
  75. <view class="ad-box">
  76. <swiper class="adSwiper" circular :indicator-dots="adIndicatorDots" vertical="true"
  77. :autoplay="adAutoplay" :interval="adInterval" :duration="adDuration">
  78. <swiper-item v-for="(item,index) in adSwiperImgs">
  79. <view>
  80. <image :src="item" style="width: 720rpx;height:120rpx;border-radius: 10rpx;">
  81. </image>
  82. </view>
  83. </swiper-item>
  84. </swiper>
  85. </view>
  86. </view>
  87. <view class="left-nav-bottom">
  88. <view class="left-nav-headline-box">
  89. <text class="left-nav-headline">头条</text>
  90. </view>
  91. <view class="news-list-box" v-for="(item,index) in newsList">
  92. <view class="news-item">
  93. <navigator :url="'/pages/headlines/detail?id='+item.id">
  94. <view class="news-list-item">
  95. <view class="news-list-item-title">
  96. <text>{{item.title}}</text>
  97. </view>
  98. <view class="news-list-item-tag">
  99. <text class="item-tag">{{item.tag}}</text>
  100. <text>{{item.publish_at}}</text>
  101. </view>
  102. </view>
  103. <image :src="item.thumb" style="width: 215rpx;height: 192rpx;display: inline-block;
  104. vertical-align: top;"></image>
  105. </navigator>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view v-else-if="menuIndex===1">
  111. <view>
  112. 修行
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. export default {
  120. data() {
  121. return {
  122. title: 'Hello',
  123. menuIndex: 0,
  124. navList: [
  125. {name: '祈福',url: ''},
  126. {name: '修行', url: ''},
  127. {name: '商城', url: '/pages/shop/index'}
  128. ],
  129. activeColor: '#007aff',
  130. styleType: 'text',
  131. leftNavList: [{
  132. imgurl: "../../static/index/home_icon_wish.png",
  133. content: "祈福",
  134. page: '../index/qifu/index'
  135. },
  136. {
  137. imgurl: "../../static/index/home_icon_excess.png",
  138. content: "超度",
  139. page: '../index/chaodu/index'
  140. },
  141. {
  142. imgurl: "../../static/index/home_icon_release.png",
  143. content: "放生",
  144. page: '../index/fangsheng/index'
  145. },
  146. {
  147. imgurl: "../../static/index/home_icon_light.png",
  148. content: "供灯",
  149. page: '../index/gongdeng/index'
  150. },
  151. {
  152. imgurl: "../../static/index/home_icon_answer.png",
  153. content: "答疑",
  154. page: '../index/answer/index'
  155. }
  156. ],
  157. background: ['color1', 'color2', 'color3'],
  158. indicatorDots: true,
  159. adIndicatorDots: false,
  160. autoplay: true,
  161. adAutoplay: true,
  162. interval: 2000,
  163. adInterval: 4000,
  164. duration: 1000,
  165. adDuration: 500,
  166. indexSwiperImgs: [
  167. "../../static/index/seat_double.png",
  168. "../../static/index/seat_sat.png",
  169. "../../static/index/seat_single.png"
  170. ],
  171. oldDate: "辛丑年壬辰月丙午日",
  172. today: "04月28日",
  173. lunarDate: "十七",
  174. suit: "出行 嫁娶 会亲友 开市",
  175. avoid: "入宅 作灶 安门 修造",
  176. adSwiperImgs: [
  177. "../../static/index/ad1.jpg",
  178. "../../static/index/ad2.jpg",
  179. "../../static/index/ad3.jpg"
  180. ],
  181. newsList: [{
  182. id: 1,
  183. title: "宽运法师对话李家杰博士(下),如何做到自在生命",
  184. tag: "头条",
  185. publish_at: "2021-04-27 17:45:25",
  186. thumb: "../../static/index/news-img.png"
  187. },
  188. {
  189. id: 2,
  190. title: "宽运法师对话李家杰博士(下),如何做到自在生命",
  191. tag: "头条",
  192. publish_at: "2021-04-27 17:45:25",
  193. thumb: "../../static/index/news-img.png"
  194. }
  195. ],
  196. form: {
  197. content: '',
  198. checked: false
  199. },
  200. }
  201. },
  202. onLoad() {
  203. this.$request.api('/api/test/',{}).then(res=> {
  204. console.log(res)
  205. }).catch(parmas => {
  206.        console.log(432142)
  207.    })
  208. },
  209. methods: {
  210. menuShow(index) {
  211. this.menuIndex = index;
  212. console.log(index)
  213. },
  214. navigate(item) {
  215. if(item.page){
  216. uni.navigateTo({
  217. url: item.page
  218. });
  219. }
  220. }
  221. }
  222. }
  223. </script>
  224. <style>
  225. page {
  226. background-color: rgb(247, 246, 242);
  227. }
  228. </style>
  229. <style lang="less" scoped>
  230. .sticky-nav{
  231. position: sticky;
  232. width: 100%;
  233. top:0;
  234. z-index: 1;
  235. }
  236. .nav-bar {
  237. padding-top: 70rpx;
  238. padding-bottom: 10rpx;
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  243. height: 125rpx;
  244. }
  245. .left-nav {
  246. ul {
  247. padding: 0;
  248. margin-left: 20rpx;
  249. }
  250. ul li {
  251. list-style: none;
  252. display: inline-block;
  253. height: 30px;
  254. line-height: 30px;
  255. width: 50px;
  256. text-align: center;
  257. color: rgb(255, 214, 205);
  258. font-size: 18px;
  259. }
  260. .active {
  261. color: #fff;
  262. font-size: 22px;
  263. border-bottom: 2px solid #fff;
  264. }
  265. }
  266. .content-text {
  267. font-size: 20px;
  268. color: #333;
  269. margin-right: 5rpx;
  270. }
  271. .right-nav {
  272. margin-right: 15rpx;
  273. .index_search {
  274. width: 45rpx;
  275. height: 45rpx;
  276. margin-right: 15rpx;
  277. }
  278. .index_info {
  279. width: 45rpx;
  280. height: 45rpx;
  281. }
  282. }
  283. .left-nav-title-box {
  284. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  285. border-radius: 0 0 180rpx 180rpx;
  286. height: 280rpx;
  287. padding: 30rpx 0;
  288. .left-nav-titles {
  289. padding-bottom: 30rpx;
  290. display: flex;
  291. justify-content: space-around;
  292. flex-direction: row;
  293. flex: 1 1 auto;
  294. .left-nav-title-img {
  295. width: 105rpx;
  296. height: 105rpx;
  297. }
  298. .left-nav-title-content {
  299. display: block;
  300. text-align: center;
  301. color: white;
  302. }
  303. }
  304. .left-nav-center {
  305. margin-top: 15rpx;
  306. background-color: #fff;
  307. padding: 0 18rpx;
  308. .left-nav-btns {
  309. display: flex;
  310. flex-direction: row;
  311. padding: 25rpx 0;
  312. .jisi-img {
  313. width: 340rpx;
  314. height: 240rpx;
  315. }
  316. .left-nav-btnBox {
  317. padding-left: 32rpx;
  318. .left-nav-btn {
  319. display: flex;
  320. justify-content: left;
  321. width: 348rpx;
  322. border: 1px solid rgb(247, 246, 242);
  323. border-radius: 10rpx;
  324. align-items: center;
  325. .small-btn-img {
  326. width: 100rpx;
  327. height: 100rpx;
  328. padding-right: 50rpx;
  329. }
  330. .left-nav-btn-content {
  331. font-size: 40rpx;
  332. }
  333. }
  334. .left-nav-btn1 {
  335. margin-bottom: 25rpx;
  336. }
  337. }
  338. }
  339. }
  340. .nav-left-oldDate {
  341. font-size: 42rpx;
  342. margin-right: 10rpx;
  343. }
  344. .nav-left-today {
  345. font-size: 32rpx;
  346. margin-right: 90rpx;
  347. color: rgb(170, 170, 170);
  348. }
  349. .nav-left-lunarDate {
  350. font-size: 40rpx;
  351. color: rgb(204, 173, 82);
  352. }
  353. .foli-box {
  354. position: relative;
  355. padding-bottom: 25rpx;
  356. .nav-left-suit {
  357. color: rgb(0, 128, 0);
  358. font-size: 40rpx;
  359. margin-right: 15rpx;
  360. }
  361. .nav-left-thing {
  362. margin-right: 30rpx;
  363. color: rgb(170, 170, 170);
  364. text-overflow: ellipsis;
  365. overflow: hidden;
  366. }
  367. .nav-left-aviod {
  368. color: rgb(255, 0, 0);
  369. font-size: 40rpx;
  370. margin-right: 15rpx;
  371. }
  372. .foli {
  373. width: 60rpx;
  374. height: 60rpx;
  375. position: absolute;
  376. bottom: 17rpx;
  377. right: 0;
  378. }
  379. }
  380. .ad-box {
  381. padding-bottom: 25rpx;
  382. .adSwiper {
  383. height: 57px;
  384. }
  385. }
  386. .left-nav-bottom {
  387. background-color: #fff;
  388. margin-top: 30rpx;
  389. padding-bottom: 100rpx;
  390. .news-list-box {
  391. display: flex;
  392. align-items: center;
  393. }
  394. .left-nav-headline-box {
  395. font-size: 45rpx;
  396. padding: 15rpx 0 15rpx 15rpx;
  397. }
  398. .news-item {
  399. padding: 16rpx 0;
  400. }
  401. .news-list-item {
  402. display: inline-block;
  403. padding-right: 10rpx;
  404. .news-list-item-title {
  405. width: 495rpx;
  406. height: 133rpx;
  407. word-wrap: break-word;
  408. font-size: 40rpx;
  409. padding-left: 20rpx;
  410. display: table-cell;
  411. vertical-align: top;
  412. }
  413. .news-list-item-tag {
  414. height: 59rpx;
  415. line-height: 59rpx;
  416. padding-left: 20rpx;
  417. color: rgb(170, 170, 170);
  418. .item-tag {
  419. padding-right: 20rpx;
  420. }
  421. }
  422. }
  423. }
  424. }
  425. .uni-margin-wrap {
  426. // width: 690rpx;
  427. width: 100%;
  428. .swiper {
  429. height: 320rpx;
  430. .swiper-item {
  431. display: block;
  432. height: 320rpx;
  433. line-height: 320rpx;
  434. text-align: center;
  435. }
  436. /deep/.uni-swiper-dot {
  437. border: 1px solid #FF713F !important;
  438. }
  439. }
  440. }
  441. </style>