diff --git a/test_mini/app.json b/test_mini/app.json index 0ea7fab..e876a1e 100644 --- a/test_mini/app.json +++ b/test_mini/app.json @@ -25,7 +25,8 @@ "pages/quota/quota", "pages/material/index", "pages/question/detail", - "pages/candidate/index" + "pages/candidate/index", + "pages/candidate/detail" ], "window": { "backgroundTextStyle": "light", @@ -73,7 +74,6 @@ "l-toast": "/miniprogram_npm/lin-ui/toast/index", "l-message": "/miniprogram_npm/lin-ui/message/index", "l-button": "/miniprogram_npm/lin-ui/button/index" - }, "style": "v2", "sitemapLocation": "sitemap.json" diff --git a/test_mini/pages/candidate/detail.js b/test_mini/pages/candidate/detail.js new file mode 100644 index 0000000..10f1bc4 --- /dev/null +++ b/test_mini/pages/candidate/detail.js @@ -0,0 +1,69 @@ +// pages/candidate/detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(getApp().globalData.candidate_url) + this.setData({ + url:getApp().globalData.candidate_url + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/test_mini/pages/candidate/detail.json b/test_mini/pages/candidate/detail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/test_mini/pages/candidate/detail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test_mini/pages/candidate/detail.wxml b/test_mini/pages/candidate/detail.wxml new file mode 100644 index 0000000..8813a3f --- /dev/null +++ b/test_mini/pages/candidate/detail.wxml @@ -0,0 +1,2 @@ + + diff --git a/test_mini/pages/candidate/detail.wxss b/test_mini/pages/candidate/detail.wxss new file mode 100644 index 0000000..629c061 --- /dev/null +++ b/test_mini/pages/candidate/detail.wxss @@ -0,0 +1 @@ +/* pages/candidate/detail.wxss */ \ No newline at end of file diff --git a/test_mini/pages/candidate/index.js b/test_mini/pages/candidate/index.js index c0c7813..2ee25aa 100644 --- a/test_mini/pages/candidate/index.js +++ b/test_mini/pages/candidate/index.js @@ -92,7 +92,7 @@ Page({ wx.hideLoading({ success: (res) => {}, }) - console.log(res.data.candidates) + // console.log(res.data.candidates) this.setData({ candidates:res.data.candidates }) @@ -112,12 +112,12 @@ Page({ } }, - prImg: function (e) { - var current = e.target.dataset.src - - wx.previewImage({ - current: current, - urls: [current] + toDetail: function(e){ + var url = e.currentTarget.dataset.url + getApp().globalData.candidate_url = url + wx.navigateTo({ + url: 'detail', }) - }, + } + }) \ No newline at end of file diff --git a/test_mini/pages/candidate/index.wxml b/test_mini/pages/candidate/index.wxml index 5544c9e..8f3eaf6 100644 --- a/test_mini/pages/candidate/index.wxml +++ b/test_mini/pages/candidate/index.wxml @@ -20,20 +20,20 @@ 查询 查询结果 - + - - - - - - + + + 单号:{{item.report_number}} - 发证日期:{{item.issue_date}} + 发证日期:{{item.issue_date}} - - + + + 通过考核 + + 暂无证书信息 \ No newline at end of file diff --git a/test_mini/project.config.json b/test_mini/project.config.json index f7ed86e..3f8eef0 100644 --- a/test_mini/project.config.json +++ b/test_mini/project.config.json @@ -18,15 +18,15 @@ "checkInvalidKey": true, "checkSiteMap": true, "uploadWithSourceMap": true, + "compileHotReLoad": false, "babelSetting": { "ignore": [], "disablePlugins": [], "outputPath": "" }, "useIsolateContext": true, - "useCompilerModule": false, - "userConfirmedUseCompilerModuleSwitch": false, - "compileHotReLoad": false + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", "libVersion": "2.10.3", diff --git a/test_server/crm/views.py b/test_server/crm/views.py index 2ca310a..a634e80 100644 --- a/test_server/crm/views.py +++ b/test_server/crm/views.py @@ -249,16 +249,23 @@ class ConsumerViewSet(ModelViewSet): payload = {'IndexModel[name]': request.query_params['realname'], 'IndexModel[identityNumber]': request.query_params['ID_number'], 'IndexModel[certNumber]':'', 'IndexModel[candidateNumber]':''} r = requests.post('https://fushe.chinansc.cn/open/candidate-list',data=payload) html = etree.HTML(r.text) - results = html.xpath('//td/text()') - img = html.xpath('//a/@href') + results = html.xpath("//table[@class='cert-table']") candidates = [] try: - jsondata = { - 'report_number':results[4], - 'issue_date':results[5], - 'img':'https://fushe.chinansc.cn'+ img[1] - } - candidates.append(jsondata) + for i in results: + img = i.xpath('tr/td/a/@href') + name = i.xpath('tr[1]/td[1]/text()') + ID_number = i.xpath('tr[1]/td[2]/text()') + report_number = i.xpath('tr[2]/td[1]/text()') + issue_date = i.xpath('tr[2]/td[2]/text()') + jsondata = { + 'name':name[0], + 'ID_number':ID_number[0], + 'report_number':report_number[0], + 'issue_date':issue_date[0], + 'img':'https://fushe.chinansc.cn'+ img[0] + } + candidates.append(jsondata) except: pass return Response({'candidates':candidates}, status=status.HTTP_200_OK)