Blame view

src/pages/question/index.vue 3.77 KB
ce4c83ff   wxy   初始提交
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
  <template>
    <div class='question'>
      <div class='questionbox' v-if='loaded'>
        <navigator v-for='(item,i) in lists' :key='i' :url="'../questiondetail/main?cwxid='+item.cwxid" hover-class='hover'>
          <div class='title'>{{item.consultant_Title}}</div>
          <div class='text'>{{item.consultant_Content}}</div>
          <div class='foot'>
            <div v-for='(tag, j) in item.cate_Name' :key='j' class='tags'>{{tag}}</div>
            <div class='time'>{{item.consultant_Date}}</div>
          </div>
        </navigator>
        <NoData v-if='lists.length==0' paddingTop=0 />
      </div>
      <!--<button class="book" name="book" @click='subscribe'>订阅消息</button>-->
    </div>
  </template>
  
  <script>
    import NoData from '@/components/NoData'
    export default {
      components:{NoData},
      data() {
        return {
          lists: [],
          tmplIds: [],
          loaded: false
        }
      },
      methods: {
        loadQuestions() {
          wx.request({
            url: this.rootUrl + '/conwx/allqaforlawyer/',
            data:{sessionID: wx.getStorageSync('sessionID')},
            success: res=> {
              if(res.statusCode=='500'){
                this.service.getUnionId(this.rootAvatar,this.rootUrl).then(res => this.loadQuestions() )
              } else {
                console.log(res)
                // this.tmplIds.push(res.data.tmplIds)
                const questionArr = res.data
                questionArr.forEach(v=>{
                  v.consultant_Date = this.service.correctTime(v.consultant_Date,'all').semantic
                  v.cate_Name = v.cate_Name.split(',')
                })
                this.lists = []
                this.lists = questionArr
                this.loaded = true
                wx.hideLoading()
              }
            },
            fail: res=> {
              console.log(err)
            }
          })
        },
        subscribe (){
          // wx.requestSubscribeMessage({
          //   tmplIds: this.tmplIds,
          //   success (res) {
          //     console.log(res)
          //     if (res['N7I9WVwRXIRzAUOG6aVK7_Zo2EVJFCKBYhqsWip-T8g'] === 'accept'){
          //       wx.showToast({
          //         title: '订阅成功!',
          //         duration: 1000,
          //         success(data) {
          //           console.log(res)
          //         }
          //       })
          //     }else if (res['N7I9WVwRXIRzAUOG6aVK7_Zo2EVJFCKBYhqsWip-T8g'] === 'reject'){
          //       wx.showToast({
          //         title: '已拒绝接受消息',
          //         duration: 1000,
          //         success(data) {
          //           console.log(res)
          //         }
          //       })
          //     }
          //   },
          //   fail (res) {
          //     // console.log(res)
          //   }
          // })
        }
      },
      onLoad(){
        wx.showLoading({ title: '正在加载' })
      },
      onShow() {
        this.loadQuestions()
      }
    }
  </script>
  <style lang="stylus" scoped>
    .question
      position absolute
      width 100%
      min-height 100%
      Background()
    .questionbox
      Background()
      > navigator
        padding 25rpx
        margin-bottom 20rpx
        background white
        .title
          font-size 32rpx
          font-weight bold
          padding-bottom 15rpx
        .text
          overflow hidden
          text-overflow ellipsis
          display -webkit-box
          -webkit-line-clamp 3
          -webkit-box-orient vertical
          Font(28rpx, 40rpx)
          color #666
        .foot
          Flex(flex, , center)
          .tags
            Font(26rpx, 40rpx)
            border-radius 8rpx
            border 1rpx solid themeColor
            color themeColor
            padding 0 10rpx
            margin-right 15rpx
          .time
            Font(28rpx)
            margin 0 0 0 auto
            color #777
    .book
      margin 25rpx auto
      width 50%
      height 80rpx
      color #fff
      background-color #aa001a
  </style>