Blame view

src/pages/myreply/index.vue 2.91 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
  <template>
  <div class='container'>
  <navigator class='reply-item' v-for='(v,i) in replyList' :key='i' :url="'../questiondetail/main?sysNewsId=0&cwxid='+v.cwxid" hover-class='hover'>
    <div class='head'>
      <img v-if='imgLoaded' :src='avatar' @error='imgLoaded=false'>
      <img v-else src='/static/imgs/avatar.png'>
      <div>
        <span class='name'>{{nickName}}</span>
        <span class='time'>{{v.replay_Date}}</span>
      </div>
    </div>
    <div class='reply'>{{v.consultant_Reply}}</div>
    <div class='question'>
      <div class='title'>{{v.consultant_Title}}</div>
      <div class='time'>{{v.consultant_Date}}</div>
      <div class='content'><span>{{v.wx_Name}}:</span>{{v.consultant_Content}}</div>
    </div>
  </navigator>
  <NoData v-if='loaded && replyList.length==0' paddingTop=0 />
  </div>
  </template>
  <script>
  import NoData from '@/components/NoData'
  export default {
    components:{NoData},
    data() {
      return {
        replyList: [],
        imgLoaded: true,
        avatar: '/static/imgs/avatar.png',
        nickName: '',
        loaded: false
      }
    },
    methods: {
      loadReply() {
        this.loaded = false
        wx.showLoading({ title: '正在加载' })
        wx.request({
          url: this.rootUrl + '/qa/lawyerreply',
          data: { sessionID: wx.getStorageSync('sessionID') },
          success: res => {
            if (res.statusCode == '500') {
              this.service.getUnionId(this.rootAvatar, this.rootUrl).then(res => this.loadReply())
            } else {
              console.log(res.data)
              this.replyList = []
              this.replyList = res.data
              this.replyList.forEach(v => {
                v.replay_Date = this.service.correctTime(v.replay_Date,'full')
                v.consultant_Date = this.service.correctTime(v.consultant_Date,'full')
              })
              this.loaded = true
              wx.hideLoading()
            }
          },
          fail: res => {
            wx.hideLoading()
            wx.showToast({ title: '加载失败', icon: 'none' })
          }
        })
      }
    },
    onLoad() {
      const userInfo = wx.getStorageSync('userInfo')
      this.avatar = userInfo.avatarUrl
      this.nickName = userInfo.nickName
      this.loadReply()
    }
  }
  </script>
  <style lang="stylus" scoped>
  .container
    position absolute
    min-height 100%
    width 100%
    Background()
  .reply-item
    padding 25rpx
    margin-bottom 20rpx
    background white
  .head
    Flex(flex, , center)
    img
      Height_Width(80rpx)
      border-radius 50%
      margin-right 20rpx
    div
      Flex(flex, center, , column)
      .name
        Font(30rpx)
        margin-bottom 15rpx
      .time
        Font(26rpx)
        color #777
  .reply
    Font(30rpx,45rpx)
    margin 20rpx 0
    text-align justify
  .question
    padding 25rpx
    background #f6f6f6
    border 1rpx solid #eee
    Font(28rpx)
    .title
      Font(30rpx, 35rpx, bold)
    .time
      Font(26rpx)
      color #888
      margin 20rpx 0
    .content
      text-overflow ellipsis
      line-height 32rpx
      text-align justify
      span
        color #777
  </style>