证书核心功能开发完毕
This commit is contained in:
parent
95b67942cd
commit
fb636ec86c
|
@ -25,7 +25,7 @@ App({
|
||||||
// var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
// var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
||||||
// currentPage.showExp()
|
// currentPage.showExp()
|
||||||
|
|
||||||
if(res.data.userinfo.role_name == '游客'){
|
if(res.data.userinfo.role_name == '游客' && this.globalData.rlogin){
|
||||||
//匿名用户
|
//匿名用户
|
||||||
wx.reLaunch({
|
wx.reLaunch({
|
||||||
url: '/pages/login/login',
|
url: '/pages/login/login',
|
||||||
|
@ -70,10 +70,11 @@ App({
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
userinfo: {}, // 服务器传回的消费者信息
|
userinfo: {}, // 服务器传回的消费者信息
|
||||||
//host: 'https://apitest.ahctc.cn',
|
host: 'https://apitest.ahctc.cn',
|
||||||
mediahost: 'https://apitest.ahctc.cn',
|
mediahost: 'https://apitest.ahctc.cn',
|
||||||
host: 'http://127.0.0.1:8000',
|
//host: 'http://127.0.0.1:8000',
|
||||||
//mediahost: 'http://127.0.0.1:8000',
|
//mediahost: 'http://127.0.0.1:8000',
|
||||||
token : '',
|
token : '',
|
||||||
|
rlogin:true
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -38,7 +38,8 @@
|
||||||
"pages/admin/exam/detail",
|
"pages/admin/exam/detail",
|
||||||
"pages/admin/exam/index",
|
"pages/admin/exam/index",
|
||||||
"pages/candidate/show",
|
"pages/candidate/show",
|
||||||
"pages/admin/candidate/index"
|
"pages/admin/candidate/index",
|
||||||
|
"pages/candidate/my"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"tencentvideo": {
|
"tencentvideo": {
|
||||||
"version": "1.3.31",
|
"version": "1.4.0",
|
||||||
"provider": "wxa75efa648b60994b"
|
"provider": "wxa75efa648b60994b"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,10 +16,10 @@ Page({
|
||||||
let id = options.id
|
let id = options.id
|
||||||
this.getDetail(id)
|
this.getDetail(id)
|
||||||
},
|
},
|
||||||
getDetail: function(id){
|
getDetail: function (id) {
|
||||||
api.request(`/crm/candidate/${id}/`, 'GET').then(res=>{
|
api.request(`/crm/candidate/${id}/`, 'GET').then(res => {
|
||||||
this.setData({
|
this.setData({
|
||||||
candidate:res.data
|
candidate: res.data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -71,17 +71,40 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
godetail: function(e){
|
godetail: function (e) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/test/detail?id='+this.data.candidate.examtest,
|
url: '/pages/test/detail?id=' + this.data.candidate.examtest,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goCandidate:function(e){
|
goCandidate: function (e) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/candidate/show?number='+this.data.candidate.number,
|
url: '/pages/candidate/show?number=' + this.data.candidate.number,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
downDoc: function(e){
|
downDoc: function (e) {
|
||||||
|
let id = this.data.candidate.id
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在生成...',
|
||||||
|
})
|
||||||
|
api.request(`/crm/candidate/${id}/down/`, 'GET').then(res => {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在下载...',
|
||||||
|
})
|
||||||
|
wx.downloadFile({
|
||||||
|
url: getApp().globalData.host + res.data.path,
|
||||||
|
success(res) {
|
||||||
|
const filePath = res.tempFilePath
|
||||||
|
wx.openDocument({
|
||||||
|
filePath,
|
||||||
|
fileType: 'docx',
|
||||||
|
success: function (res) {
|
||||||
|
wx.hideLoading({
|
||||||
|
success: (res) => {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -1,5 +1,5 @@
|
||||||
<!--pages/candidate/detail.wxml-->
|
<!--pages/candidate/detail.wxml-->
|
||||||
<view style="margin-left:4px;margin-right:4px">
|
<view style="margin-left:12px;margin-right:12px">
|
||||||
<image style="width: 100%;height:200px" src="/images/bg.png" mode="aspectFit"></image>
|
<image style="width: 100%;height:200px" src="/images/bg.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-panel__bd">
|
<view class="weui-panel__bd">
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
const api = require("../../utils/request.js");
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
results:[]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
getList: function() {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在加载...',
|
||||||
|
})
|
||||||
|
api.request('/crm/candidate/my/', 'GET').then(res=>{
|
||||||
|
wx.hideLoading()
|
||||||
|
this.setData({
|
||||||
|
results:res.data,
|
||||||
|
})
|
||||||
|
}).catch(
|
||||||
|
wx.hideLoading()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
scanC: function() {
|
||||||
|
wx.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
success(res) {
|
||||||
|
console.log(res)
|
||||||
|
let number = res.result.split('/')[6]
|
||||||
|
let id = number.substring(number.length-4).replace("0","")
|
||||||
|
wx.navigateTo({
|
||||||
|
url: 'detail?id=' + id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText": "Ⅲ类证书"
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<view class="page__bd">
|
||||||
|
<a class="weui-btn weui-btn_primary" bindtap="scanC">扫一扫证书二维码</a>
|
||||||
|
<view class="weui-panel weui-panel_access">
|
||||||
|
<view class="weui-panel__hd">我的Ⅲ类证书</view>
|
||||||
|
<view class="weui-panel__bd" wx:if="{{results.length}}">
|
||||||
|
<navigator class="weui-media-box weui-media-box_text" wx:for="{{results}}" wx:key="unique" url="/pages/candidate/detail?id={{item.id}}">
|
||||||
|
<h4 class="weui-media-box__title">
|
||||||
|
<text style="color:blue;">{{item.consumer_name}}</text>
|
||||||
|
{{item.number}}
|
||||||
|
</h4>
|
||||||
|
<view class="weui-media-box__desc">
|
||||||
|
身份证号:{{item.ID_number}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc">
|
||||||
|
工作类别:{{item.workscope_name}}
|
||||||
|
</view>
|
||||||
|
<view class="weui-media-box__desc">
|
||||||
|
期限:{{item.start_date}}至{{item.end_date}}
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
<view wx:else style="text-align:center">暂无证书信息</view>
|
||||||
|
<!-- <view class="weui-panel__ft">
|
||||||
|
<a class="weui-cell weui-cell_active weui-cell_access weui-cell_link">
|
||||||
|
<view class="weui-cell__bd">查看更多</view>
|
||||||
|
<text class="weui-cell__ft"></text>
|
||||||
|
</a>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/candidate/my.wxss */
|
|
@ -32,6 +32,15 @@ Page({
|
||||||
},
|
},
|
||||||
submit: function(){
|
submit: function(){
|
||||||
var that = this
|
var that = this
|
||||||
|
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
||||||
|
if(!reg.test(this.data.form.ID_number))
|
||||||
|
{
|
||||||
|
wx.showToast({
|
||||||
|
title: '身份证号有误',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(this.data.form.deptname&&this.data.form.code&&this.data.form.name&&this.data.form.company_name&&this.data.form.ID_number){
|
if(this.data.form.deptname&&this.data.form.code&&this.data.form.name&&this.data.form.company_name&&this.data.form.ID_number){
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加入考试...',
|
title: '加入考试...',
|
||||||
|
|
|
@ -88,6 +88,14 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__bd">Ⅲ类自测入口</view>
|
<view class="weui-cell__bd">Ⅲ类自测入口</view>
|
||||||
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red"></view>
|
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red"></view>
|
||||||
|
</navigator>
|
||||||
|
<navigator url="/pages/candidate/my" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
|
||||||
|
<view class="weui-cell__hd">
|
||||||
|
<image src="/images/candidate.svg" style="margin-right: 16px;vertical-align: middle;width:20px; height: 20px;">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">Ⅲ类报告单</view>
|
||||||
|
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red"></view>
|
||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
<view style="margin-top:6px">
|
<view style="margin-top:6px">
|
||||||
|
|
|
@ -651,6 +651,7 @@ def candidate(request, number):
|
||||||
candidate = Candidate.objects.get(number=number)
|
candidate = Candidate.objects.get(number=number)
|
||||||
return render(request, 'index.html', {"candidate":candidate})
|
return render(request, 'index.html', {"candidate":candidate})
|
||||||
|
|
||||||
|
from examtest.exports import exportw_test
|
||||||
class CandidateViewSet(RetrieveModelMixin, ListModelMixin, GenericViewSet):
|
class CandidateViewSet(RetrieveModelMixin, ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
出征记录:列表
|
出征记录:列表
|
||||||
|
@ -662,12 +663,13 @@ class CandidateViewSet(RetrieveModelMixin, ListModelMixin, GenericViewSet):
|
||||||
serializer_class = CandidateSerializer
|
serializer_class = CandidateSerializer
|
||||||
pagination_class = CommonPagination
|
pagination_class = CommonPagination
|
||||||
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
|
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
|
||||||
|
filterset_fields = ['consumer']
|
||||||
search_fields = ('number', 'consumer_name', 'workscope_name', 'company_name')
|
search_fields = ('number', 'consumer_name', 'workscope_name', 'company_name')
|
||||||
ordering_fields = ('-id', 'update_time')
|
ordering_fields = ('-id', 'update_time')
|
||||||
ordering = ['-update_time']
|
ordering = ['-update_time']
|
||||||
|
|
||||||
def get_authenticators(self, request):
|
def get_authenticators(self):
|
||||||
if self.request.action == 'retrieve':
|
if self.detail:
|
||||||
return []
|
return []
|
||||||
return super().get_authenticators()
|
return super().get_authenticators()
|
||||||
|
|
||||||
|
@ -695,5 +697,16 @@ class CandidateViewSet(RetrieveModelMixin, ListModelMixin, GenericViewSet):
|
||||||
return Candidate.objects.none()
|
return Candidate.objects.none()
|
||||||
else:
|
else:
|
||||||
return queryset.none()
|
return queryset.none()
|
||||||
print(queryset)
|
return queryset
|
||||||
return queryset
|
|
||||||
|
@action(methods=['get'], detail = True, authentication_classes=[], permission_classes=[])
|
||||||
|
def down(self, request, *args, **kwargs):
|
||||||
|
instance = self.queryset.get(*args, **kwargs)
|
||||||
|
path = exportw_test(instance.examtest, False)
|
||||||
|
return Response({'path': path})
|
||||||
|
|
||||||
|
@action(methods=['get'], detail = False, permission_classes=[])
|
||||||
|
def my(self, request, *args, **kwargs):
|
||||||
|
queryset = self.queryset.filter(consumer=request.user)
|
||||||
|
serializer = self.get_serializer(queryset, many=True)
|
||||||
|
return Response(serializer.data)
|
|
@ -391,6 +391,11 @@ class ExamTestViewSet(PageOrNot, ModelViewSet):
|
||||||
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
||||||
filterset_fields = ['type','is_pass', 'exam']
|
filterset_fields = ['type','is_pass', 'exam']
|
||||||
|
|
||||||
|
def get_serializer_class(self):
|
||||||
|
if self.request.query_params.get('exam', None) or self.request.query_params.get('type') == '正式考试':
|
||||||
|
return ExamTestExamListSerializer
|
||||||
|
return ExamTestListSerializer
|
||||||
|
|
||||||
def filter_queryset(self, queryset):
|
def filter_queryset(self, queryset):
|
||||||
for backend in list(self.filter_backends):
|
for backend in list(self.filter_backends):
|
||||||
queryset = backend().filter_queryset(self.request, queryset, self)
|
queryset = backend().filter_queryset(self.request, queryset, self)
|
||||||
|
|
Loading…
Reference in New Issue