From 9e96a1535776227e65d369e14f353f544caa8373 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 8 Jun 2021 09:21:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_mini/pages/candidate/detail.js | 2 +- test_mini/pages/candidate/my.js | 3 +-- test_mini/pages/candidate/show.js | 4 ++-- test_mini/project.config.json | 5 +++-- test_server/crm/urls.py | 2 +- test_server/crm/views.py | 12 +++++++++--- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/test_mini/pages/candidate/detail.js b/test_mini/pages/candidate/detail.js index 072bc00..c6ab44b 100644 --- a/test_mini/pages/candidate/detail.js +++ b/test_mini/pages/candidate/detail.js @@ -78,7 +78,7 @@ Page({ }, goCandidate: function (e) { wx.navigateTo({ - url: '/pages/candidate/show?number=' + this.data.candidate.number, + url: '/pages/candidate/show?id=' + this.data.candidate.id, }) }, downDoc: function (e) { diff --git a/test_mini/pages/candidate/my.js b/test_mini/pages/candidate/my.js index 8b61488..4d9ddba 100644 --- a/test_mini/pages/candidate/my.js +++ b/test_mini/pages/candidate/my.js @@ -78,8 +78,7 @@ Page({ onlyFromCamera: true, success(res) { console.log(res) - let number = res.result.split('/')[6] - let id = number.substring(number.length-4).replace("0","") + let id = res.result.split('=')[1] wx.navigateTo({ url: 'detail?id=' + id, }) diff --git a/test_mini/pages/candidate/show.js b/test_mini/pages/candidate/show.js index e7c1b7b..12cedd5 100644 --- a/test_mini/pages/candidate/show.js +++ b/test_mini/pages/candidate/show.js @@ -12,9 +12,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - let number = options.number; + let id = options.id; this.setData({ - url:getApp().globalData.host+'/crm/candidate/img/'+number+'/' + url:getApp().globalData.host+'/crm/candidate/img/?id='+id }) }, diff --git a/test_mini/project.config.json b/test_mini/project.config.json index c6db745..3ce91d1 100644 --- a/test_mini/project.config.json +++ b/test_mini/project.config.json @@ -21,14 +21,15 @@ "checkSiteMap": true, "uploadWithSourceMap": true, "compileHotReLoad": false, - "useMultiFrameRuntime": false, + "useMultiFrameRuntime": true, "useApiHook": true, + "useApiHostProcess": false, "babelSetting": { "ignore": [], "disablePlugins": [], "outputPath": "" }, - "bundle": false, + "enableEngineNative": false, "useIsolateContext": true, "useCompilerModule": true, "userConfirmedUseCompilerModuleSwitch": false, diff --git a/test_server/crm/urls.py b/test_server/crm/urls.py index 6e0b3c8..f7bce72 100644 --- a/test_server/crm/urls.py +++ b/test_server/crm/urls.py @@ -14,6 +14,6 @@ urlpatterns = [ path('consumer/mplogin/', ConsumerMPLoginView.as_view()), path('consumer/register/', ConsumerRegister.as_view()), path('change_remain_count/', change_remain_count.as_view()), - path('candidate/img//',candidate), + path('candidate/img/',candidate), path('', include(router.urls)), ] diff --git a/test_server/crm/views.py b/test_server/crm/views.py index cabad24..4111ed4 100644 --- a/test_server/crm/views.py +++ b/test_server/crm/views.py @@ -647,9 +647,15 @@ class change_remain_count(APIView): return Response(status=status.HTTP_200_OK) from django.shortcuts import render -def candidate(request, number): - candidate = Candidate.objects.get(number=number) - return render(request, 'index.html', {"candidate":candidate}) +from django.http import Http404 +def candidate(request): + if request.GET.get('id', None): + try: + candidate = Candidate.objects.get(id=request.GET.get('id'), number__isnull=False) + return render(request, 'index.html', {"candidate":candidate}) + except: + raise Http404 + raise Http404 from examtest.exports import exportw_test class CandidateViewSet(RetrieveModelMixin, ListModelMixin, GenericViewSet):