index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view class="center">
  3. <view class="img">
  4. <image src="../../static/img/logo.png" mode=""></image>
  5. </view>
  6. <!-- 头部轮播 -->
  7. <view class="carousel-section">
  8. <view class="carousel-box">
  9. <swiper class="carousel" autoplay="true" interval="5000" duration="500">
  10. <swiper-item v-for="(item,index) in carouselList " class="carousel-item" :key="index"
  11. @click="nav(item)">
  12. <image :src="item.pic" />
  13. </swiper-item>
  14. </swiper>
  15. </view>
  16. </view>
  17. <!-- 公司介绍跳转 -->
  18. <view class="introduce" @click="navto('/pages/about/about')">
  19. 公司介绍
  20. <view class="more">
  21. 更多>>
  22. </view>
  23. </view>
  24. <view class="teachingPrinciple">
  25. <view class="teachingPrinciple_img">
  26. <image src="../../static/img/introduce.png" mode=""></image>
  27. </view>
  28. <text>台州市添利节能科技有限公司是专注于电镀行业节能减排尖端设备研发和技术服务的企业多年来为国内多家电镀企业进行技术改造,截止2021年1月累计节水量达到200多万吨,节水经济效益1.17亿元平均节水效率45%。</text>
  29. </view>
  30. <view class="introduce" @click="navto('/pages/test/test')">
  31. 节水实时数据
  32. <view class="more">
  33. 物联网登录>>
  34. </view>
  35. </view>
  36. <view class="introduce" @click="navto('/pages/case/case')">
  37. 案例展示
  38. <view class="more">
  39. 更多>>
  40. </view>
  41. </view>
  42. <view class="case" v-for="(item,index) in caseList">
  43. <view class="case_img">
  44. <image :src="item.src" mode=""></image>
  45. </view>
  46. <view class="caseBox">
  47. <view class="caseBox_top">
  48. {{item.title}}
  49. </view>
  50. <view class="caseBox_bottom">
  51. <view class="img">
  52. <image src="../../static/tabBar/1.png" mode=""></image>
  53. </view>
  54. <text>发布时间:</text>
  55. <view class="date">
  56. {{item.date}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="introduce" @click="navto('/pages/news/news')">
  62. 新闻动态
  63. <view class="more">
  64. 更多>>
  65. </view>
  66. </view>
  67. <view class="case" v-for="(item,index) in caseList">
  68. <view class="case_img">
  69. <image :src="item.src" mode=""></image>
  70. </view>
  71. <view class="caseBox">
  72. <view class="caseBox_top">
  73. {{item.title}}
  74. </view>
  75. <view class="caseBox_bottom">
  76. <view class="img">
  77. <image src="../../static/tabBar/1.png" mode=""></image>
  78. </view>
  79. <text>发布时间:</text>
  80. <view class="date">
  81. {{item.date}}
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <aboutUs></aboutUs>
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. banner,
  92. category
  93. } from '@/api/index.js';
  94. import {changeTaber} from '@/utils/tarberChange.js'
  95. //调用完组件需要声明一下,在data()上声明
  96. import aboutUs from "@/components/introduce/introduce.vue"
  97. export default {
  98. components:{
  99. aboutUs
  100. },
  101. data() {
  102. return {
  103. caseList: [{
  104. title: '1大家谁都i啊手机都i阿迪啊就能看见你空间空间帮',
  105. src: "../../static/img/introduce.png",
  106. date: '2021-06-08 16:26',
  107. }, {
  108. title: '2大家谁都i啊手机都i阿迪啊就能看见你空间空间帮',
  109. src: "../../static/img/introduce.png",
  110. date: '2021-06-08 16:26'
  111. }, {
  112. title: '3大家谁都i啊手机都i阿迪啊就能看见你空间空间帮',
  113. src: "../../static/img/introduce.png",
  114. date: '2021-06-08 16:26'
  115. }],
  116. swiperCurrent: 0,
  117. carouselList: [{
  118. pic: '../../static/img/logo.png'
  119. },
  120. {
  121. pic: '../../static/img/logo.png'
  122. },
  123. {
  124. pic: '../../static/img/logo.png'
  125. },
  126. {
  127. pic: '../../static/tabBar/1.png'
  128. }
  129. ],
  130. dataList: [],
  131. };
  132. },
  133. onLoad() {
  134. // this.loadData();
  135. changeTaber(0)
  136. },
  137. methods: {
  138. // nav(url) {
  139. // uni.navigateTo({
  140. // url: url
  141. // });
  142. // },
  143. // navto(e){
  144. // uni.navigateTo({
  145. // url:'/pages/index/message?id=' + e.id
  146. // })
  147. // },
  148. //轮播图跳转页面
  149. nav(item) {
  150. if (item.url != '/') {
  151. console.log("1111");
  152. uni.navigateTo({
  153. url: '/' + item.url,
  154. fail(error) {
  155. console.log(error);
  156. }
  157. })
  158. }
  159. },
  160. //跳转
  161. navto(url) {
  162. uni.navigateTo({
  163. url: url,
  164. fail(error) {
  165. uni.switchTab({
  166. url
  167. });
  168. }
  169. });
  170. },
  171. async loadData() {
  172. const obj = this;
  173. // banner({}).then(e => {
  174. // obj.carouselList = obj.carouselList.concat(e.data.banner);
  175. // console.log(obj.carouselList)
  176. // // });
  177. // category({
  178. // page: 1,
  179. // limit: 1000
  180. // }, 2).then(({
  181. // data
  182. // }) => {
  183. // console.log(data)
  184. // obj.dataList = data
  185. // });
  186. },
  187. swiperChange(e) {
  188. const index = e.detail.current;
  189. this.swiperCurrent = index;
  190. }
  191. }
  192. };
  193. </script>
  194. <style lang="scss">
  195. .center {
  196. background-color: rgb(255, 255, 255);
  197. height: 100%;
  198. }
  199. .img {
  200. margin: 17rpx 0 17rpx 41rpx;
  201. width: 208rpx;
  202. height: 52rpx;
  203. image {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. .carousel-section {
  209. background-color: #FFFFFF;
  210. width: 100%;
  211. height: 300rpx;
  212. .carousel-box {
  213. background-color: #FFFFFF;
  214. width: 100%;
  215. height: 300rpx;
  216. .carousel {
  217. background-color: #FFFFFF;
  218. width: 100%;
  219. height: 300rpx;
  220. .carousel-item {
  221. background-color: #FFFFFF;
  222. width: 100%;
  223. height: 300rpx;
  224. image {
  225. width: 100%;
  226. height: 100%;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. .introduce {
  233. position: relative;
  234. margin-top: 18rpx;
  235. width: 100%;
  236. height: 60rpx;
  237. background: #127FD5;
  238. display: flex;
  239. justify-content: center;
  240. align-items: center;
  241. font-size: 22rpx;
  242. font-family: Adobe Heiti Std;
  243. font-weight: normal;
  244. color: #FFFFFF;
  245. .more {
  246. position: absolute;
  247. right: 15rpx;
  248. bottom: 5rpx;
  249. font-size: 16rpx;
  250. font-family: Adobe Heiti Std;
  251. font-weight: normal;
  252. color: #FFFFFF;
  253. }
  254. }
  255. .teachingPrinciple {
  256. margin-top: 44rpx;
  257. display: flex;
  258. flex-direction: column;
  259. justify-content: center;
  260. align-items: center;
  261. .teachingPrinciple_img {
  262. width: 580rpx;
  263. height: 248rpx;
  264. image {
  265. width: 100%;
  266. height: 100%;
  267. }
  268. }
  269. text {
  270. font-size: 16rpx;
  271. font-family: Adobe Heiti Std;
  272. font-weight: normal;
  273. color: #000000;
  274. margin: 23rpx 40rpx 10rpx 40rpx;
  275. }
  276. }
  277. .case {
  278. display: flex;
  279. border-bottom: 1rpx solid #E9E9E9;
  280. justify-content: center;
  281. padding: 30rpx 0;
  282. .case_img {
  283. width: 158rpx;
  284. height: 124rpx;
  285. image {
  286. width: 100%;
  287. height: 100%;
  288. }
  289. }
  290. .caseBox {
  291. display: flex;
  292. flex-direction: column;
  293. align-items: center;
  294. justify-content: center;
  295. .caseBox_top {
  296. padding-left: 30rpx;
  297. max-width: 460rpx;
  298. overflow: hidden;
  299. text-overflow: ellipsis;
  300. white-space: nowrap;
  301. }
  302. .caseBox_bottom {
  303. margin-left: -50rpx;
  304. display: flex;
  305. align-items: center;
  306. .img {
  307. margin-right: 10rpx;
  308. width: 30rpx;
  309. height: 30rpx;
  310. image {
  311. width: 100%;
  312. height: 100%;
  313. }
  314. }
  315. text {
  316. color: #9F9F9F;
  317. font-size: 24rpx;
  318. font-family: Adobe Heiti Std;
  319. font-weight: normal;
  320. }
  321. .date {
  322. font-size: 24rpx;
  323. font-family: Adobe Heiti Std;
  324. font-weight: normal;
  325. }
  326. }
  327. }
  328. }
  329. </style>