hrjy 2 年之前
父节点
当前提交
25715e3949
共有 5 个文件被更改,包括 67 次插入18 次删除
  1. 3 0
      public/index.html
  2. 37 6
      src/App.vue
  3. 21 7
      src/request/api.js
  4. 1 0
      src/request/request.js
  5. 5 5
      src/views/index.vue

+ 3 - 0
public/index.html

@@ -15,3 +15,6 @@
     <!-- built files will be auto injected -->
   </body>
 </html>
+<style type="text/css">
+	
+</style>

+ 37 - 6
src/App.vue

@@ -1,6 +1,6 @@
 <template>
-<div class="">
-	<div class="bg">
+<div :class="{'body-box': isGrey}">
+	<div class="bg" :class="{bgig: isGrey}">
 		<img src="@/assets/img/box-bg.png" >
 	</div>
 	<div id="app" class="app">
@@ -30,10 +30,12 @@
 </div>
 </template>
 <script>
-import { getList,getSearch } from '@/request/api.js'
+import { getTime } from '@/utils/utils.js'
+import { getList,getSearch,getgrey,index } from '@/request/api.js'
 	export default {
 		data() {
 			return {
+				isGrey: false,
 				isNav: 0,
 				searchValue: '',
 				navList: [
@@ -77,7 +79,20 @@ import { getList,getSearch } from '@/request/api.js'
 			}
 		},
 		mounted() {
-			
+			index().then(res => {
+				console.log(res);
+			})
+			getgrey().then(res => {
+				console.log(res);
+				const time = new Date().getTime()
+				if (getTime(time) == getTime(res.time)) {
+					// this.isGrey = true
+					console.log(this.isGrey);
+				} else{
+					console.log(time);
+				}
+				
+			})
 		},
 		methods: {
 			// 搜索
@@ -101,6 +116,9 @@ import { getList,getSearch } from '@/request/api.js'
 					path: url
 				})
 			},
+			getTime(time) {
+				return getTime(time)
+			},
 		},
 		// 解决刷新导航栏选择返回默认值问题
 		watch: {
@@ -119,6 +137,17 @@ import { getList,getSearch } from '@/request/api.js'
 	}
 </script>
 <style lang="scss">
+
+.body-box {
+	-webkit-filter: grayscale(100%); /* webkit */
+	-moz-filter: grayscale(100%); /*firefox*/
+	-ms-filter: grayscale(100%); /*ie9*/
+	-o-filter: grayscale(100%); /*opera*/
+	filter: grayscale(100%);
+	filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); 
+	filter:gray; /*ie9- */
+	
+}
 	.nowarp {
 		overflow: hidden;
 		text-overflow: ellipsis;
@@ -135,10 +164,12 @@ import { getList,getSearch } from '@/request/api.js'
 		top: 0;
 		z-index: -1;
 		img {
-			
-		width: 100%;
+			width: 100%;
 		}
 	}
+	.bgig {
+		top: -100px;
+	}
 	$red: #D82020;
 	.app {
 		font-family: PingFang-SC-Bold;

+ 21 - 7
src/request/api.js

@@ -1,6 +1,20 @@
 import request from "./request.js"
 
-
+// 特定时间
+export function getgrey(data) {
+	return request({
+		url: '/api/index/company',
+		method: 'get',
+		data
+	});
+}
+export function index(data) {
+	return request({
+		url: '/api/index',
+		method: 'get',
+		data
+	});
+}
 // 文章详情
 export function details(data,id) {
 	return request({
@@ -13,7 +27,7 @@ export function details(data,id) {
 // 获取文章列表
 export function getArticList(data,id,page,limit) {
 	return request({
-		url: '/api/Article/lst?ifyid='+id+'&page='+page+'&limit='+limit,
+		url: '/api/Article/lst?ifyid='+id+'&order=releasetime desc',
 		method: 'get',
 		data
 	});
@@ -29,9 +43,9 @@ export function getList(data,id) {
 }
 
 // 爱心榜
-export function getlaveList(data,page,limit) {
+export function getlaveList(data) {
 	return request({
-		url: '/api/lave/lst&page='+page+'&limit='+limit,
+		url: '/api/lave/lst',
 		method: 'get',
 		data
 	});
@@ -47,9 +61,9 @@ export function getvolunteerList(data) {
 }
 
 // 搜索
-export function getSearch(data,value,page,limit) {
+export function getSearch(data) {
 	return request({
-		url: '/api/Article/lst?ifyid=0&key='+value+'&page='+page+'&limit='+limit,
+		url: '/api/Article/lst?ifyid=0&order=releasetime',
 		method: 'get',
 		data
 	});
@@ -57,7 +71,7 @@ export function getSearch(data,value,page,limit) {
 // 志愿者搜索
 export function getvSearch(data,value,page,limit) {
 	return request({
-		url: '/api/Article/lst?ifyid=21&key='+value+'&page='+page+'&limit='+limit,
+		url: '/api/Article/lst?ifyid=21&key='+value+'&page='+page+'&limit='+limit+'&order=releasetime',
 		method: 'get',
 		data
 	});

+ 1 - 0
src/request/request.js

@@ -52,6 +52,7 @@ service.interceptors.request.use(
 			config.headers['sys-token'] = sys_token
 			config.headers['token'] = token
 		}
+		console.log(config);
 		return config
 	},
 	error => {

+ 5 - 5
src/views/index.vue

@@ -4,7 +4,7 @@
 			<div class="swiper">
 				<el-carousel :interval="5000" type="card" height="200px" class="swiper-box">
 				    <el-carousel-item v-for="(r,index) in rotation" :key="index" class="swiper-box-item">
-					    	<img :src="image(r.image)" class="swiper-img">
+					    	<img :src="image(r.image)" class="swiper-img" @click="newsTo(0,r)">
 					    	<div class="title">
 					    		{{ r.title }}
 					    	</div>
@@ -241,7 +241,7 @@ import slideLaR from '../components/slideLaR.vue'
 			},
 			// 爱心榜
 			getlaveListson() {
-				getlaveList({},1,10).then(res => {
+				getlaveList({page:1,limit:2}).then(res => {
 					this.rankingList = res.data.data
 					this.$store.commit('setRankingList',res.data.data)
 				})
@@ -249,17 +249,17 @@ import slideLaR from '../components/slideLaR.vue'
 			// 新闻
 			getNewsList() {
 				// 市红十字会新闻
-				getArticList({page:1,limit:20},27).then(({data}) => {
+				getArticList({},27,1,10).then(({data}) => {
 					this.cityNewsList = data.list
 					this.$store.commit('setCityNewsList',data.list)
 				})
 				// 县市区红十字新闻
-				getArticList({page:1,limit:20},28).then(({data}) => {
+				getArticList({},28,1,10).then(({data}) => {
 					this.countyNewsList = data.list
 					this.$store.commit('setCountyNewsList',data.list)
 				})
 				// 公示/公告
-				getArticList({page:1,limit:20},30).then(({data}) => {
+				getArticList({},30,1,10).then(({data}) => {
 					this.publicityList = data.list
 					this.$store.commit('setPublicityList',data.list)
 				})