commonProblem.vue
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
<view class="">
<view class="top"><image class="wh100" src="/static/questionBg.png" mode=""></image></view>
<view class="topTitle">有什么可以帮您!</view>
<view class="botQuestion">
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
<scroll-view scroll-y="true" class="questionList" @scrolltolower="scrolltolower">
<view class="list" v-for="(item,idx) in list" :key="idx" @click="toItem(item.id)">
<view class="question">{{item.title}}</view>
<view class="arrow"><image src="/static/arrowR.png" ></image></view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import {toa} from '@/utils/toast.js'
import { problemSort,problemList } from '@/api/mine.js'
export default {
data() {
return {
list2: [{
name: '猜你想问',
}, {
name: '退换货品',
}, {
name: '服务条款'
},{name:'分期支付'}],
page:1,
lastPage:1,
curId:'',
list:[]
}
},
onLoad() {
this.problemSort()
let URL=window.location.href
this.$wxH5Share.get_jssdk("意见反馈",URL)
},
methods: {
toItem(id) {
uni.navigateTo({
url:'/pages/mine/questionDetails?id='+id
})
},
async problemSort(){
try {
const res = await problemSort()
this.list2 = res.list
this.curId = res.list[0].id
this.problemList()
console.log('problemSort', res)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('problemSort', err)
}
},
async problemList(f){
try {
toa.loading('加载中')
const res = await problemList(this.curId,this.page,15)
toa.hideLoading()
this.lastPage = res.list.last_page
this.list = f?res.list.data:this.list.concat(res.list.data)
console.log('problemList', res)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('problemList', err)
}
},
toggle(e){
console.log(e);
if(this.curId == e.id) return
this.page = 1
this.curId = e.id
this.problemList(1)
},
scrolltolower(){
if(this.page >= this.lastPage) return
this.page=this.page+1
this.problemList()
}
},
}
</script>
<style lang="less">
.top {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 400rpx;
z-index: -1;
}
.topTitle {
position: absolute;
left: 44rpx;
top: 134rpx;
color: rgba(0,0,0,1);
font-size: 44rpx;
font-weight: 700;
}
.botQuestion {
position: absolute;
left: 0;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
top: 260rpx;
// height: calc(100vh - 260rpx);
width: 100%;
background: #fff;
.questionList {
margin-top: 10rpx;
height: calc(100vh - 360rpx);
.list {
padding: 0 32rpx;
margin-bottom: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
// height: 40rpx;
.arrow {
margin-left: 10rpx;
width: 16rpx;
height: 32rpx;
image {
width: 16rpx;
height: 32rpx;
}
}
}
}
}
</style>