hanfucheng 1 rok temu
rodzic
commit
118ff8e85f

+ 10 - 2
api/asking/asking.js

@@ -9,10 +9,18 @@ export function getTypeList(query) {
   })
 }
 
-// 获取热门问答列表
+// 获取展示问题列表
+export function getShowList() {
+  return request({
+    url: '/asking/question/getShowList',
+    method: 'get'
+  })
+}
+
+//  获取热门问题列表
 export function getHotQuestionList() {
   return request({
     url: '/asking/question/getHotQuestionList',
     method: 'get'
   })
-}
+}

+ 1 - 1
pages/asking/asking.vue

@@ -112,7 +112,7 @@ export default {
 				console.log('loopTimes',this.loopTimes)
             })
         },
-         //获取热门问列表
+         //获取热门问列表
         getHotQuestionList(){
             getHotQuestionList().then(res =>{
                 this.hotQuestionList = res.rows

+ 0 - 2
pages/asking/questiondetails.vue

@@ -131,7 +131,6 @@ export default {
       this.answer.id = id
       this.answer.createBy = getApp().globalData.userId
       this.answer.score = this.form.score
-      console.log(this.answer)
       adoptAnswer(this.answer).then(res => {
       })
       this.isAdopt = true
@@ -147,7 +146,6 @@ export default {
       this.collect.userId = getApp().globalData.userId;
       this.collect.questionId = id
       selectCollect(this.collect).then(res => {
-        console.log(res)
         if (res.data.length != 0) {
           this.isCollection = true
         }

+ 25 - 68
pages/index/index.vue

@@ -143,41 +143,41 @@
 				热门问答
 			</view>
 			<view class="rnwdList">
-				<view class="list" @tap="goDetails" v-for="(item, index) in indexList" :key="index">
+				<view class="list" @tap="goDetails(item.id)" v-for="(item, index) in indexList" :key="index">
 					<span class="listTitle">{{ item.title }}</span>
 
-					<view class="onePic" v-if="item.imgList.length == 1">
-						<image :src="loadImgSrc('/' + item.url)" v-for="(item, index1) in item.imgList" :key="index1">
+					<view class="onePic" v-if="item.paths!=null&&item.paths.length == 1">
+						<image :src="loadImgSrcLocalhost(item1)" v-for="(item1, index1) in item.paths" :key="index1">
 						</image>
 					</view>
 
-					<view class="twoPic" v-if="item.imgList.length == 2">
-						<image :src="loadImgSrc('/' + item.url)" v-for="(item, index1) in item.imgList" :key="index1">
+					<view class="twoPic" v-if="item.paths!=null&&item.paths.length == 2">
+						<image :src="loadImgSrcLocalhost(item1)" v-for="(item1, index1) in item.paths" :key="index1">
 						</image>
 					</view>
 
-					<view class="threePic" v-if="item.imgList.length == 3">
-						<image :src="loadImgSrc('/' + item.url)" v-for="(item, index1) in item.imgList" :key="index1">
+					<view class="threePic" v-if="item.paths!=null&&item.paths.length == 3">
+						<image :src="loadImgSrcLocalhost(item1)" v-for="(item1, index1) in item.paths" :key="index1">
 						</image>
 					</view>
 
 					<view class="jlSj">
 						<span class="jf">
-							{{ item.jf }}
+							{{ item.score }}
 							<em class="iconfont icon-jifen"></em>
 						</span>
 						<view class="ck">
 							<span>
 								<em class="iconfont icon-pinglun"></em>
-								{{ item.pl }}
+								{{ item.comment }}
 							</span>
 							<span>
 								<em class="iconfont icon-chakan"></em>
-								{{ item.ck }}
+								{{ item.browse }}
 							</span>
 							<span>
 								<em class="iconfont icon-shoucang"></em>
-								{{ item.dz }}
+								{{ item.collect }}
 							</span>
 						</view>
 					</view>
@@ -234,6 +234,9 @@
 		governmentListData
 	} from '@/api/information/information.js';
 	import {
+		getShowList
+	} from '@/api/asking/asking.js';
+	import {
 		popularKnowledgeList,
 		knowledgePay
 	} from '@/api/knowledge/knowledge.js'
@@ -281,60 +284,7 @@
 				duration: 500,
 				circular: true,
 				governmentList: [],
-				indexList: [{
-						ck: '10',
-						dz: '10',
-						id: 1,
-						imgList: [],
-						jf: '100',
-						pl: '10',
-						title: '探索乡村能源供给新模式 绘就乡村振兴美丽新画卷'
-					},
-					{
-						ck: '20',
-						dz: '200',
-						id: 2,
-						imgList: [{
-							url: '/xczx01.png'
-						}],
-						jf: '220',
-						pl: '20',
-						title: '探索乡村能源供给新模式 绘就乡村振兴美丽新画卷'
-					},
-					{
-						ck: '30',
-						dz: '320',
-						id: 3,
-						imgList: [{
-								url: '/xczx01.png'
-							},
-							{
-								url: '/xczx01.png'
-							}
-						],
-						jf: '300',
-						pl: '30',
-						title: '探索乡村能源供给新模式 绘就乡村振兴美丽新画卷'
-					},
-					{
-						ck: '40',
-						dz: '420',
-						id: 4,
-						imgList: [{
-								url: '/img1.png'
-							},
-							{
-								url: '/img1.png'
-							},
-							{
-								url: '/img1.png'
-							}
-						],
-						jf: '400',
-						pl: '40',
-						title: '探索乡村能源供给新模式 绘就乡村振兴美丽新画卷'
-					}
-				],
+				indexList: [],
 				queryParam: {
 					pageNum: 1,
 					pageSize: 10,
@@ -366,6 +316,7 @@
 		created() {
 			this.getList()
 			this.getCovers()
+			this.getShowList()
 		},
 		// 上拉加载
 		onReachBottom() {
@@ -405,13 +356,19 @@
 					this.banners = res.data
 				})
 			},
+
+			// 获取热门问答列表
+			getShowList() {
+				getShowList().then(res =>{
+					this.indexList = res.data
+				})
+			},
 			// 热门知识获取数据
 			getList() {
 				popularKnowledgeList(this.knowledgeParams).then(res => {
 					if (res.code == 200) {
 						this.dataSource = this.cutarray([...this.dataSource, ...res.rows])
 						this.total = res.total
-						console.log("this.dataSource", this.dataSource)
 					}
 				})
 			},
@@ -474,9 +431,9 @@
 				});
 			},
 
-			goDetails() {
+			goDetails(id) {
 				uni.navigateTo({
-					url: '/pages/demo/wenbaxiangqing/wenbaxiangqing'
+				    url: '/pages/asking/questiondetails?id='+id
 				});
 			},