| 4c4f7640  梁保满
 
路由表,路由前端文件 | 1 |   <template>
 | 
| dd5150c5  阿宝
 
数据同步 | 2
3
4
5
6
7
8
9 |     <div>
      <back-box>
        <template slot="title">
          <span>数据同步</span>
        </template>
      </back-box>
      <div class="page-content">
        <div class="down-item">
 | 
| 533a17d8  梁保满
 
备题组卷添加批量设置答案 | 10 |           <p class="h-title">从U盘上传</p>
 | 
| dd5150c5  阿宝
 
数据同步 | 11 |           <p class="txt">
 | 
| 533a17d8  梁保满
 
备题组卷添加批量设置答案 | 12 |             本功能帮助无法上网的授课端软件,将本地数据同步到云平台。
 | 
| dd5150c5  阿宝
 
数据同步 | 13
14
15
16
17
18 |           </p>
          <el-upload
            class="upload-demo"
            ref="upload"
            :action="url"
            :multiple="false"
 | 
| dd5150c5  阿宝
 
数据同步 | 19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 |             :with-credentials="true"
            :limit="1"
            :on-change="change"
            :on-success="upSuccess"
            :on-error="upError"
          >
            <div class="btn-box">
              <i class="fa fa-cloud-upload"></i>
              <el-button type="primary" round>选择文件</el-button>
            </div>
          </el-upload>
        </div>
  
        <div class="down-item">
          <p class="h-title">数据导出至U盘</p>
 | 
| 503b6063  梁保满
 
判断题答案选项 | 34 |           <p class="txt">本功能将云平台的数据导出到U盘。</p>
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 35
36
37
38
39 |           <div class="btn-box btn-box2" v-loading="downLoading">
            <i class="fa fa-cloud-download" @click="downloadFile"></i>
            <el-button type="primary" round @click="downloadFile"
              >文件下载</el-button
            >
 | 
| dd5150c5  阿宝
 
数据同步 | 40
41
42 |           </div>
        </div>
      </div>
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 43 |       <el-dialog :append-to-body="true" :close-on-click-modal="false" title="" :visible.sync="dialogVisible" width="300" center>
 | 
| 503b6063  梁保满
 
判断题答案选项 | 44
45
46
47
48
49
50
51
52
53
54
55 |         <el-result icon="success" title="上传成功"> </el-result>
        <el-descriptions title="" :column="1">
          <el-descriptions-item label="导入答题卡数量">{{tipData.paperNum}}</el-descriptions-item>
          <el-descriptions-item label="导入随堂问报表数量">{{tipData.periodNum}}</el-descriptions-item>
          <el-descriptions-item label="导入即时测报表数量">{{tipData.examNum}}</el-descriptions-item>
        </el-descriptions>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="dialogVisible = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>
 | 
| dd5150c5  阿宝
 
数据同步 | 56 |     </div>
 | 
| 4c4f7640  梁保满
 
路由表,路由前端文件 | 57
58
59 |   </template>
  
  <script>
 | 
| 533a17d8  梁保满
 
备题组卷添加批量设置答案 | 60 |   import { formatDate } from "@/utils";
 | 
| 46296128  LH_PC
 
fix:提交路径不对 | 61 |   import conf from "@/config/index";
 | 
| 4c4f7640  梁保满
 
路由表,路由前端文件 | 62 |   export default {
 | 
| dd5150c5  阿宝
 
数据同步 | 63
64 |     data() {
      return {
 | 
| 46296128  LH_PC
 
fix:提交路径不对 | 65 |         downLoading: false, 
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 66 |         file: {},
 | 
| 503b6063  梁保满
 
判断题答案选项 | 67
68
69
70
71
72 |         dialogVisible: false,
        tipData: {
          paperNum: 0,
          periodNum: 0,
          examNum: 0,
        },
 | 
| dd5150c5  阿宝
 
数据同步 | 73
74 |       };
    },
 | 
| 46296128  LH_PC
 
fix:提交路径不对 | 75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 |     computed: {
      url: function () { 
        var requestUrl = ''; 
        var ogrinUrl = "/api_html/personal/importData"; 
        var baseUrl = conf.baseURL; 
        if (baseUrl == '/' && ogrinUrl.indexOf('/') == 0) {
          requestUrl = ogrinUrl;
        }
        else {
          requestUrl = baseUrl + ogrinUrl
        } 
        console.log(requestUrl);
        return requestUrl;
      }
    },
 | 
| dd5150c5  阿宝
 
数据同步 | 90 |     methods: {
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 91
92
93 |       async downloadFile() {
        if (this.downLoading) return;
        this.downLoading = true;
 | 
| 03bce046  梁保满
 
个人版调整 | 94 |         const data = await this.$request.pExportData();
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 95 |         this.downLoading = false;
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 96 |         if (data) {
 | 
| 503b6063  梁保满
 
判断题答案选项 | 97 |           let blob = new Blob([data], { type: "application/octet-stream" });
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 98
99
100 |           const url = URL.createObjectURL(blob);
          const link = document.createElement("a");
          document.body.appendChild(link);
 | 
| 503b6063  梁保满
 
判断题答案选项 | 101
102
103
104 |           link.download =
            this.$store.getters.info.name +
            formatDate(new Date(), "yyyy_MM_dd_hh_mm_ss") +
            "文件.json";
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 105
106
107
108 |           link.href = url;
          link.click();
          document.body.removeChild(link);
          URL.revokeObjectURL(url);
 | 
| dd5150c5  阿宝
 
数据同步 | 109 |         } else {
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 110 |           this.$message.error("下载失败,请重试");
 | 
| dd5150c5  阿宝
 
数据同步 | 111
112
113
114 |         }
      },
      async submitUpload() {
        this.$refs.upload.submit();
 | 
| 4c4f7640  梁保满
 
路由表,路由前端文件 | 115 |   
 | 
| dd5150c5  阿宝
 
数据同步 | 116
117
118
119
120
121
122
123
124
125
126
127 |         // const formData = new FormData()
        // formData.append('id',this.componentId)
        // formData.append('file',new File(this.file.raw))
        // let {status,info} = await uploadExcel(formData);
        // if(status===0){
        //   this.$message.success(info);
        //   this.$emit("upSuccess")
        // } else {
        //   this.$message.error(info);
        // }
      },
      upSuccess(res) {
 | 
| 503b6063  梁保满
 
判断题答案选项 | 128
129
130 |         if (res && res.status == 0) {
          this.tipData = res.data
          this.dialogVisible = true
 | 
| dd5150c5  阿宝
 
数据同步 | 131 |         } else {
 | 
| 1365ef5e  梁保满
 
优化 | 132 |           this.$message.error(res.info);
 | 
| dd5150c5  阿宝
 
数据同步 | 133
134
135 |         }
      },
      upError(res) {
 | 
| 503b6063  梁保满
 
判断题答案选项 | 136 |         debugger;
 | 
| dd5150c5  阿宝
 
数据同步 | 137 |         if (res && res.status == 0) {
 | 
| 1365ef5e  梁保满
 
优化 | 138 |           this.$message.error("上传失败");
 | 
| dd5150c5  阿宝
 
数据同步 | 139
140
141
142
143
144
145
146
147 |         } else {
          this.$message.error(res.message);
        }
      },
      change(file) {
        this.file = file;
      },
    },
  };
 | 
| 4c4f7640  梁保满
 
路由表,路由前端文件 | 148
149 |   </script>
  
 | 
| dd5150c5  阿宝
 
数据同步 | 150
151
152
153
154
155
156 |   <style lang="scss" scoped>
  .page-content {
    padding: 50px;
    display: flex;
    justify-content: center;
    .down-item {
      width: 400px;
 | 
| 503b6063  梁保满
 
判断题答案选项 | 157 |       height:330px;
 | 
| dd5150c5  阿宝
 
数据同步 | 158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175 |       border-radius: 20px;
      margin: 20px;
      background: #f8f8f8;
      box-shadow: 2px 2px 5px #ccc;
      .h-title {
        font-size: 16px;
        color: #667ffd;
        padding: 16px 0 16px 12px;
      }
      .txt {
        height: 80px;
        padding: 0 20px;
        font-size: 16px;
        color: #7f7f7f;
        line-height: 24px;
        text-align: center;
      }
    }
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 176 |     .upload-demo {
 | 
| 503b6063  梁保满
 
判断题答案选项 | 177
178
179
180 |       padding:0 20px 20px;
      :deep(.el-upload--text){
        display: block;
      }
 | 
| dd5150c5  阿宝
 
数据同步 | 181
182 |     }
    :deep(.el-upload) {
 | 
| 255e2506  梁保满
 
飞书bug及优化 | 183 |       margin: 0 auto;
 | 
| dd5150c5  阿宝
 
数据同步 | 184
185
186
187
188
189 |     }
    .btn-box {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
 | 
| 503b6063  梁保满
 
判断题答案选项 | 190 |       padding-bottom: 10px;
 | 
| dd5150c5  阿宝
 
数据同步 | 191
192
193
194
195
196
197
198
199
200
201 |       .fa {
        font-size: 80px;
        color: #aeaeae;
        padding-bottom: 10px;
        cursor: pointer;
      }
    }
    .btn-box {
      width: 100%;
    }
  }
 | 
| 4c4f7640  梁保满
 
路由表,路由前端文件 | 202 |   </style>
 |