index.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div id="index">
  3. <admin-frame @search="search" :limt="limit" :total="total" topType="2" @back="back" @add="toAdd" :useNav="false">
  4. <template v-slot:info>
  5. <list-1 :list="list" @toView="toView"></list-1>
  6. </template>
  7. </admin-frame>
  8. <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button ancelButtonText="返回">
  9. <info-1 :info="info" v-if="dialog.type == '1'" @onSubmit="onSubmit"></info-1>
  10. </van-dialog>
  11. </div>
  12. </template>
  13. <script>
  14. import list1 from '@/layout/question/list-1.vue';
  15. import info1 from '@/layout/question/info-1.vue';
  16. import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
  17. import { mapState, createNamespacedHelpers } from 'vuex';
  18. const { mapActions: problem_service } = createNamespacedHelpers('problem_service');
  19. export default {
  20. name: 'index',
  21. props: {},
  22. components: {
  23. adminFrame,
  24. list1,
  25. info1,
  26. },
  27. data: function () {
  28. return {
  29. list: [],
  30. limit: 4,
  31. total: 0,
  32. dialog: { show: false, title: '详细信息', type: '1' },
  33. // 详细信息
  34. info: {},
  35. };
  36. },
  37. async created() {
  38. this.search();
  39. },
  40. methods: {
  41. ...problem_service(['query', 'update']),
  42. async search({ skip = 0, limit = this.limit, ...info } = {}) {
  43. let res = await this.query({ skip, limit, ask_id: this.user.id, ...info });
  44. if (this.$checkRes(res)) {
  45. this.$set(this, `list`, res.data);
  46. this.$set(this, `total`, res.total);
  47. }
  48. },
  49. // 添加
  50. toAdd() {
  51. this.$router.push({ path: '/patent/user/chat/detail' });
  52. },
  53. // 查看信息
  54. toView(data) {
  55. this.$set(this, `info`, data);
  56. this.dialog = { show: true, title: '详细信息', type: '1' };
  57. },
  58. // 已读
  59. async onSubmit({ data }) {
  60. data.status = '4';
  61. let res = await this.update(data);
  62. if (this.$checkRes(res)) {
  63. this.$toast({ type: `success`, message: `操作完成` });
  64. this.search();
  65. this.dialog = { show: false, title: '详细信息', type: '1' };
  66. }
  67. },
  68. // 返回
  69. back() {
  70. this.$router.push({ path: '/patent/index' });
  71. },
  72. },
  73. computed: {
  74. ...mapState(['user']),
  75. },
  76. metaInfo() {
  77. return { title: this.$route.meta.title };
  78. },
  79. watch: {
  80. test: {
  81. deep: true,
  82. immediate: true,
  83. handler(val) {},
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang="less" scoped>
  89. .dialog {
  90. /deep/.van-dialog__content {
  91. max-height: 350px;
  92. overflow-y: auto;
  93. }
  94. }
  95. </style>