移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

133 regels
3.8 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. title="我的咨询"
  5. left-arrow
  6. right-text="发布"
  7. fixed
  8. placeholder
  9. @click-left="goClickLeft"
  10. @click-right="goAdd"
  11. />
  12. <van-list
  13. v-model="loading"
  14. :finished="finished"
  15. :immediate-check="false"
  16. finished-text="没有更多了"
  17. style="margin-top: 10px;"
  18. @load="getList()"
  19. >
  20. <van-cell v-for="(item,index) in interactionList" :key="index">
  21. <template #title>
  22. <van-row>
  23. <van-col span="20"><van-icon name="../../static/images/icon/questions.png" size="18" style="top: 5px;margin-right: 5px;"/>
  24. {{item.content}}</van-col>
  25. <van-col span="4" style="text-align: right;font-size: 0.2rem;color: #007E72;" v-if="item.reply">已回复</van-col>
  26. <van-col span="4" style="text-align: right;font-size: 0.2rem;color: #c21F3a;" v-if="!item.reply">未回复</van-col>
  27. </van-row>
  28. </template>
  29. <template #label>
  30. <van-icon name="../../static/images/icon/answer.png" size="18" style="top: 5px;margin-right: 5px;"/>{{item.reply}}
  31. <van-row>
  32. <van-col span="18">发布时间:{{item.logintime}}</van-col>
  33. <van-col span="3" style="color: #007E72;text-align: right;" @click="goAdd('update',item.id)" v-if="!item.reply">
  34. <van-icon name="edit" size="15" style="top:3px"/>修改
  35. </van-col>
  36. <van-col span="3" style="color: #007E72;text-align: right;" @click="deleteInteraction(item.id)" v-if="!item.reply">
  37. <van-icon name="delete-o" size="15" style="top:3px"/>删除
  38. </van-col>
  39. </van-row>
  40. <p></p>
  41. </template>
  42. </van-cell>
  43. </van-list>
  44. </div>
  45. </template>
  46. <script>
  47. import { getMember , userConsulting , deleteInteraction } from "@/api/user/index";
  48. import { getInfo } from "@/api/login/index";
  49. import {Dialog} from "vant";
  50. export default {
  51. name: "interaction",
  52. data() {
  53. return {
  54. //是否显示加载
  55. loading: false,
  56. //是否滚动到底部
  57. finished: false,
  58. //数据集合
  59. interactionList:[],
  60. //查询参数
  61. queryParams:{
  62. memberId:'',
  63. pageNum:1,
  64. pageSize:10
  65. }
  66. };
  67. },
  68. created() {
  69. getInfo().then(response => {
  70. getMember(response.user.userId).then(response => {
  71. this.queryParams.memberId = response.data.id;
  72. this.getList()
  73. });
  74. });
  75. },
  76. methods: {
  77. goAdd(type,id){
  78. console.log(id)
  79. if (id == undefined){
  80. window.location='interactionAdd';
  81. }else{
  82. window.location='interactionAdd?type='+type+'&id='+id;
  83. }
  84. },
  85. goClickLeft(){
  86. window.location='user';
  87. },
  88. getList(){
  89. this.loading = true;
  90. userConsulting(this.queryParams).then(response => {
  91. for (var i = 0; i < response.rows.length; i++) {
  92. this.interactionList.push(response.rows[i]);
  93. }
  94. if(this.interactionList.length >= response.total){
  95. this.finished = true;
  96. return;
  97. }
  98. this.queryParams.pageNum += 1 ;
  99. this.loading = false;
  100. });
  101. },
  102. deleteInteraction(id){
  103. Dialog.confirm({
  104. title: '系统提示',
  105. message: '是否删除?',
  106. confirmButtonText: '确定',
  107. }).then(() => {
  108. deleteInteraction(id).then(response => {
  109. Dialog.confirm({
  110. title: '系统提示',
  111. message: '删除成功',
  112. confirmButtonText: '确定',
  113. showCancelButton:false
  114. }).then(() => {
  115. this.interactionList = [];
  116. this.getList();
  117. })
  118. });
  119. })
  120. }
  121. },
  122. };
  123. </script>
  124. <style scoped lang="scss">
  125. .app-container {
  126. }
  127. .titleClass{
  128. }
  129. </style>