123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <div id="index">
- <admin-frame @search="search" :limt="limit" :total="total" topType="3" @back="back" :useNav="false">
- <template v-slot:info>
- <list-1 :list="list" @toView="toView" @toUpload="toUpload"></list-1>
- </template>
- </admin-frame>
- <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
- <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
- <upload-1 :form="info" v-if="dialog.type == '2'" @onSubmit="onSubmit"></upload-1>
- </van-dialog>
- </div>
- </template>
- <script>
- import list1 from '@/layout/question/list-1.vue';
- import info1 from '@/layout/question/info-1.vue';
- import upload1 from '@/layout/question/upload-1.vue';
- import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: problem_service } = createNamespacedHelpers('problem_service');
- export default {
- name: 'index',
- props: {},
- components: {
- adminFrame,
- list1,
- info1,
- upload1,
- },
- data: function () {
- return {
- list: [],
- limit: 4,
- total: 0,
- dialog: { show: false, title: '详细信息', type: '1' },
- // 详细信息
- info: {},
- };
- },
- async created() {
- this.search();
- },
- methods: {
- ...problem_service(['query', 'update']),
- async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
- let res = await this.query({ skip, limit, answer_id: this.user.id, ...info });
- if (this.$checkRes(res)) {
- this.$set(this, `list`, res.data);
- this.$set(this, `total`, res.total);
- }
- },
- // 查看信息
- toView(data) {
- this.$set(this, `info`, data);
- this.dialog = { show: true, title: '详细信息', type: '1' };
- },
- // 答案上传
- toUpload(data) {
- this.$set(this, `info`, data);
- this.dialog = { show: true, title: '答案上传', type: '2' };
- },
- // 答案提交
- async onSubmit({ data }) {
- data.status = '2';
- let res = await this.update(data);
- if (this.$checkRes(res)) {
- this.$toast({ type: `success`, message: `操作完成` });
- this.search();
- this.dialog = { show: false, title: '答案上传', type: '2' };
- }
- },
- // 返回
- back() {
- this.$router.push({ path: '/patent/index' });
- },
- },
- computed: {
- ...mapState(['user']),
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- watch: {
- test: {
- deep: true,
- immediate: true,
- handler(val) {},
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .dialog {
- /deep/.van-dialog__content {
- max-height: 350px;
- overflow-y: auto;
- }
- }
- </style>
|