question.vue 2.7 KB

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