diff --git a/test_mini/app.js b/test_mini/app.js index 307bbe3..fb5c59a 100644 --- a/test_mini/app.js +++ b/test_mini/app.js @@ -71,9 +71,9 @@ App({ userInfo: {}, userinfo: {}, // 服务器传回的消费者信息 //host: 'https://apitest.ahctc.cn', - mediahost: 'https://apitest.ahctc.cn', + //mediahost: 'https://apitest.ahctc.cn', host: 'http://127.0.0.1:8000', - //mediahost: 'http://127.0.0.1:8000', + mediahost: 'http://127.0.0.1:8000', token : '', rlogin:true } diff --git a/test_server/examtest/exports.py b/test_server/examtest/exports.py index 922ca06..b187fa0 100644 --- a/test_server/examtest/exports.py +++ b/test_server/examtest/exports.py @@ -34,17 +34,19 @@ def exportw_test(obj, bool): """ 导出个人考试记录word版本 """ - filename = obj.exam.name + '-' + obj.consumer.name + '-' + obj.consumer.username + '.docx' + filename = obj.exam.name + '-' + str(obj.exam.id) + '-' + obj.consumer.name + '-' + obj.consumer.username + '.docx' path = '/media/export/' + filename fullpath = BASE_DIR + path if bool or (not os.path.exists(fullpath)): data = ExamTestDetailSerializer(instance=obj).data #开始生成word doc = DocxTemplate(BASE_DIR + "/tmp/examtest.docx") - for i in data['qdimgs']: - i = InlineImage(doc, BASE_DIR + i,width=Mm(40)) - for i in data['xcimgs']: - i = InlineImage(doc, BASE_DIR + i,width=Mm(40)) + data['qdimgs'] = [] + data['xcimgs'] = [] + for i in data['exam_']['qdimgs']: + data['qdimgs'].append(InlineImage(doc, BASE_DIR + i,width=Mm(40))) + for i in data['exam_']['xcimgs']: + data['xcimgs'].append(InlineImage(doc, BASE_DIR + i,width=Mm(40))) doc.render(data) doc.save(fullpath) # output = BytesIO() diff --git a/test_server/tmp/examtest.docx b/test_server/tmp/examtest.docx index 1e80342..5dfb525 100644 Binary files a/test_server/tmp/examtest.docx and b/test_server/tmp/examtest.docx differ