candidate update

This commit is contained in:
caoqianming 2020-08-03 21:56:50 +08:00
parent 2273e17895
commit 7949661044
9 changed files with 113 additions and 31 deletions

View File

@ -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"

View File

@ -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 () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--pages/candidate/detail.wxml-->
<web-view src="{{url}}"></web-view>

View File

@ -0,0 +1 @@
/* pages/candidate/detail.wxss */

View File

@ -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',
})
},
}
})

View File

@ -20,20 +20,20 @@
<l-button bind:lintap="search">查询</l-button>
</view>
<view class="weui-cells__title">查询结果</view>
<view wx:if="{{candidates}}">
<view wx:if="{{candidates.length}}">
<block wx:for="{{candidates}}" wx:key="unique">
<view class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg" style="width:96px">
<image class="weui-media-box__thumb" src="{{item.img}}" bindtap="prImg" data-src="{{item.img}}"></image>
</view>
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">
<view class="weui-cell" data-url="{{item.img}}">
<view class="weui-cell__bd">
<view class="weui-media-box__title">
单号:{{item.report_number}}</view>
<view class="weui-media-box__desc">
<span style="color:darkblue">发证日期:{{item.issue_date}}</span>
<view style="color:darkblue">发证日期:{{item.issue_date}}</view>
</view>
</view>
</view>
</view>
<view class="weui-cell__ft">
<view style="color:green">通过考核</view>
</view>
</view>
</block>
</view>
<view wx:else style="text-align:center">暂无证书信息</view>

View File

@ -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",

View File

@ -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)