|
@@ -3,18 +3,47 @@
|
|
|
<view class="contain">
|
|
|
<!-- 问答类别 -->
|
|
|
<ul class="wendaFL" v-for="(e,idx) in typeList" :key="idx" style="width: 48%;">
|
|
|
- <li class="sanNong" style="width: 100%;">
|
|
|
- <image :src="loadImgSrcLocalhost(e.path)" class="lbBj" @tap="goSanNong"></image>
|
|
|
- <h2>{{obj.type}}</h2>
|
|
|
- <span>1566</span>
|
|
|
- </li>
|
|
|
+ <li class="sanNong" style="width: 100%;">
|
|
|
+ <image :src="loadImgSrcLocalhost(e.path)" class="lbBj" @tap="goType(e.id,e.type)"></image>
|
|
|
+ <h2>{{e.type}}</h2>
|
|
|
+ <span>{{e.questionNum}}</span>
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
+ <!-- 问答列表 -->
|
|
|
+ <view class="rnwdList" v-for="(item, index) in hotQuestionList" :key="index" @tap="goDetails(item.id)">
|
|
|
+ <span class="lb">{{ item.type }}</span>
|
|
|
+ <view class="list">
|
|
|
+ <span class="listTitle">{{ item.title }}</span>
|
|
|
+ <view class="jlSj">
|
|
|
+ <span class="jf">
|
|
|
+ {{ item.score }}
|
|
|
+ <em class="iconfont icon-jifen"></em>
|
|
|
+ </span>
|
|
|
+ <view class="ck">
|
|
|
+ <span>
|
|
|
+ <em class="iconfont icon-pinglun"></em>
|
|
|
+ {{ item.comment }}
|
|
|
+ </span>
|
|
|
+ <span>
|
|
|
+ <em class="iconfont icon-chakan"></em>
|
|
|
+ {{ item.browse }}
|
|
|
+ </span>
|
|
|
+ <span>
|
|
|
+ <em class="iconfont icon-shoucang"></em>
|
|
|
+ {{ item.collect }}
|
|
|
+ </span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <em class="iconfont icon-xiangyoujiantou"></em>
|
|
|
+ </view>
|
|
|
+ <button type="primary" @click="goAddQuestion()" v-if="form.id==null">新增</button>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import upload from '@/components/upload/index.vue'
|
|
|
-import {getTypeList} from '@/api/asking/asking.js'
|
|
|
+import {getTypeList,getHotQuestionList} from '@/api/asking/asking.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
upload
|
|
@@ -31,6 +60,7 @@ export default {
|
|
|
path: null
|
|
|
}
|
|
|
],
|
|
|
+ hotQuestionList: [{}],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
@@ -43,6 +73,7 @@ export default {
|
|
|
*/,
|
|
|
onLoad(options) {
|
|
|
this.getTypeList();
|
|
|
+ this.getHotQuestionList();
|
|
|
},
|
|
|
methods: {
|
|
|
//获取类型列表
|
|
@@ -51,16 +82,29 @@ export default {
|
|
|
this.typeList = res.rows
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- goSanNong() {
|
|
|
+ //获取热门问答列表
|
|
|
+ getHotQuestionList(){
|
|
|
+ getHotQuestionList().then(res =>{
|
|
|
+ this.hotQuestionList = res.rows
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //按类型跳转问题列表
|
|
|
+ goType(id,type) {
|
|
|
+ uni.setStorageSync('id', id)
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/asking/questionlist?type='+type
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //新增问题
|
|
|
+ goAddQuestion() {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/demo/sannong/sannong'
|
|
|
+ url: '/pages/asking/addquestion'
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- goDetails() {
|
|
|
+ goDetails(id) {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/demo/wenbaxiangqing/wenbaxiangqing'
|
|
|
+ url: '/pages/asking/questiondetails?id=' + id
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -71,7 +115,7 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
-@import './asking.css';
|
|
|
+@import '@/pages/asking/asking.css';
|
|
|
.contain {
|
|
|
height: 100%;
|
|
|
display: flex;
|