diff --git a/test_mini/app.json b/test_mini/app.json index fed93b2..cc2cd7f 100644 --- a/test_mini/app.json +++ b/test_mini/app.json @@ -36,7 +36,9 @@ "pages/admin/login", "pages/admin/exam/add", "pages/admin/exam/detail", - "pages/admin/exam/index" + "pages/admin/exam/index", + "pages/candidate/show", + "pages/admin/candidate/index" ], "window": { "backgroundTextStyle": "light", diff --git a/test_mini/images/bg.png b/test_mini/images/bg.png new file mode 100644 index 0000000..1a5342e Binary files /dev/null and b/test_mini/images/bg.png differ diff --git a/test_mini/pages/admin/candidate/index.js b/test_mini/pages/admin/candidate/index.js new file mode 100644 index 0000000..5e8e427 --- /dev/null +++ b/test_mini/pages/admin/candidate/index.js @@ -0,0 +1,98 @@ +// pages/admin/exam/index.js +const api = require("../../../utils/request.js"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + page:1, + isLoadedAll:false, + count:0, + results:[] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getList(1) + }, + getList: function(page) { + wx.showLoading({ + title: '正在加载...', + }) + api.requesta('/crm/candidate/', 'GET', {page:page}).then(res=>{ + wx.hideLoading() + let results = this.data.results + let isLoadedAll = false + if(res.data.results){ + if(page==1){results=res.data.results}else{ + results = results.concat(res.data.results) + } + } + if(!res.data.next){ + isLoadedAll = true + } + this.setData({ + count:res.data.count, + results:results, + page:page, + isLoadedAll: isLoadedAll + }) + }).catch( + wx.hideLoading() + ) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.getList(1) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if(!this.data.isLoadedAll){ + this.data.page=this.data.page+1 + this.getList(this.data.page) + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/test_mini/pages/admin/candidate/index.json b/test_mini/pages/admin/candidate/index.json new file mode 100644 index 0000000..d0f935f --- /dev/null +++ b/test_mini/pages/admin/candidate/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "出征记录", + "enablePullDownRefresh":true +} \ No newline at end of file diff --git a/test_mini/pages/admin/candidate/index.wxml b/test_mini/pages/admin/candidate/index.wxml new file mode 100644 index 0000000..af3ddf4 --- /dev/null +++ b/test_mini/pages/admin/candidate/index.wxml @@ -0,0 +1,31 @@ + + + 已发布的证书,共{{count}}张 + + + + {{item.consumer_name}} + {{item.number}} + + + 身份证号:{{item.ID_number}} + + + 工作类别:{{item.workscope_name}} + + + 期限:{{item.start_date}}至{{item.end_date}} + + + + + 到底了 + + + + \ No newline at end of file diff --git a/test_mini/pages/admin/candidate/index.wxss b/test_mini/pages/admin/candidate/index.wxss new file mode 100644 index 0000000..6837f53 --- /dev/null +++ b/test_mini/pages/admin/candidate/index.wxss @@ -0,0 +1 @@ +/* pages/admin/candidate/index.wxss */ \ No newline at end of file diff --git a/test_mini/pages/admin/exam/detail.js b/test_mini/pages/admin/exam/detail.js index 912872b..8b05368 100644 --- a/test_mini/pages/admin/exam/detail.js +++ b/test_mini/pages/admin/exam/detail.js @@ -102,5 +102,11 @@ Page({ wx.navigateTo({ url: '/pages/test/detail?id='+e.currentTarget.dataset.id, }) + }, + goCandidate:function(e){ + let candidate_ = e.currentTarget.dataset.candidate_; + wx.navigateTo({ + url: '/pages/candidate/show?number='+candidate_.number, + }) } }) \ No newline at end of file diff --git a/test_mini/pages/admin/exam/detail.wxml b/test_mini/pages/admin/exam/detail.wxml index dc2d019..4ca686b 100644 --- a/test_mini/pages/admin/exam/detail.wxml +++ b/test_mini/pages/admin/exam/detail.wxml @@ -22,7 +22,7 @@ - 共{{tests.length}}名人员参加考试 + 共{{tests.length}}次考试记录 @@ -47,7 +47,7 @@ {{item.candidate_.number}} - 查看证书 + 查看证书 颁发证书 答卷详情 diff --git a/test_mini/pages/admin/index.wxml b/test_mini/pages/admin/index.wxml index d95310b..c41a3d2 100644 --- a/test_mini/pages/admin/index.wxml +++ b/test_mini/pages/admin/index.wxml @@ -42,7 +42,7 @@ 考试记录 - + diff --git a/test_mini/pages/candidate/detail.js b/test_mini/pages/candidate/detail.js index 10f1bc4..2e35dc8 100644 --- a/test_mini/pages/candidate/detail.js +++ b/test_mini/pages/candidate/detail.js @@ -1,4 +1,5 @@ // pages/candidate/detail.js +const api = require("../../utils/request.js"); Page({ /** @@ -12,12 +13,16 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - console.log(getApp().globalData.candidate_url) - this.setData({ - url:getApp().globalData.candidate_url + let id = options.id + this.getDetail(id) + }, + getDetail: function(id){ + api.request(`/crm/candidate/${id}/`, 'GET').then(res=>{ + this.setData({ + candidate:res.data + }) }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -65,5 +70,18 @@ Page({ */ onShareAppMessage: function () { + }, + godetail: function(e){ + wx.navigateTo({ + url: '/pages/test/detail?id='+this.data.candidate.examtest, + }) + }, + goCandidate:function(e){ + wx.navigateTo({ + url: '/pages/candidate/show?number='+this.data.candidate.number, + }) + }, + downDoc: function(e){ + } }) \ No newline at end of file diff --git a/test_mini/pages/candidate/detail.wxml b/test_mini/pages/candidate/detail.wxml index 8813a3f..eb9d0ec 100644 --- a/test_mini/pages/candidate/detail.wxml +++ b/test_mini/pages/candidate/detail.wxml @@ -1,2 +1,24 @@ - + + + + + + + {{candidate.consumer_name}} + {{candidate.number}} + + + {{candidate.ID_number}} + + + {{candidate.workscope_name}} + + + {{candidate.start_date}}至{{candidate.end_date}} + + + +查看证书 +答题信息 +下载完整文档 diff --git a/test_mini/pages/candidate/show.js b/test_mini/pages/candidate/show.js new file mode 100644 index 0000000..e7c1b7b --- /dev/null +++ b/test_mini/pages/candidate/show.js @@ -0,0 +1,69 @@ +// pages/candidate/show.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let number = options.number; + this.setData({ + url:getApp().globalData.host+'/crm/candidate/img/'+number+'/' + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/show.json b/test_mini/pages/candidate/show.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/test_mini/pages/candidate/show.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test_mini/pages/candidate/show.wxml b/test_mini/pages/candidate/show.wxml new file mode 100644 index 0000000..029c6e5 --- /dev/null +++ b/test_mini/pages/candidate/show.wxml @@ -0,0 +1,5 @@ + + + + + diff --git a/test_mini/pages/candidate/show.wxss b/test_mini/pages/candidate/show.wxss new file mode 100644 index 0000000..0c1e445 --- /dev/null +++ b/test_mini/pages/candidate/show.wxss @@ -0,0 +1 @@ +/* pages/candidate/show.wxss */ \ No newline at end of file diff --git a/test_server/crm/migrations/0034_candidate_create_admin.py b/test_server/crm/migrations/0034_candidate_create_admin.py new file mode 100644 index 0000000..9ab195f --- /dev/null +++ b/test_server/crm/migrations/0034_candidate_create_admin.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.4 on 2021-06-07 05:44 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('crm', '0033_auto_20210606_2209'), + ] + + operations = [ + migrations.AddField( + model_name='candidate', + name='create_admin', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='创建管理员'), + ), + ] diff --git a/test_server/crm/models.py b/test_server/crm/models.py index 856d105..b712860 100644 --- a/test_server/crm/models.py +++ b/test_server/crm/models.py @@ -120,7 +120,7 @@ class Candidate(CommonModel): start_date = models.DateField('有效期始', null=True, blank=True) end_date = models.DateField('有效期止', null=True, blank=True) examtest = models.OneToOneField(to='examtest.examtest', verbose_name='关联考试', null=True, blank=True, on_delete=models.DO_NOTHING) - + create_admin = models.ForeignKey(UserProfile, verbose_name="创建管理员", null=True, blank=True, on_delete=models.SET_NULL) class Meta: verbose_name = '证书' verbose_name_plural = verbose_name diff --git a/test_server/crm/serializers.py b/test_server/crm/serializers.py index 1283c54..e5be1dd 100644 --- a/test_server/crm/serializers.py +++ b/test_server/crm/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from .models import Company, Consumer, PaySubject, ConsumerPerm, ConsumerRole +from .models import Candidate, Company, Consumer, PaySubject, ConsumerPerm, ConsumerRole from question.models import Question, Questioncat from .permission import get_consumerperm_list from rbac.serializers.user_serializer import UserListSerializer @@ -72,4 +72,10 @@ class ConsumerDetailSerializer(serializers.ModelSerializer): return queryset def get_perms(self,obj): - return get_consumerperm_list(obj) \ No newline at end of file + return get_consumerperm_list(obj) + + +class CandidateSerializer(serializers.ModelSerializer): + class Meta: + model = Candidate + fields = '__all__' \ No newline at end of file diff --git a/test_server/crm/templates/index.html b/test_server/crm/templates/index.html index bb8ebe9..ad74072 100644 --- a/test_server/crm/templates/index.html +++ b/test_server/crm/templates/index.html @@ -21,7 +21,7 @@ justify-content: center; } - + .toolbar { position: fixed; top: 0; @@ -120,20 +120,22 @@ draggable="true"> 高彩眉,女,1994年03月04日生,身份证:342921199403040528,于2021年01月参加 医学其他 辐射安全与防护考核,成绩合格。 + data-tag="name">{{candidate.consumer_name}}, + + 身份证:{{candidate.ID_number}},于 + + {{candidate.examtest.start_time|date}}参加 + {{candidate.workscope_name}} 辐射安全与防护考核,成绩合格。 编号:FS21ZJ0000070 + contenteditable="false" class="inner-cell" data-tag="certnumber">{{candidate.number}} - + + @@ -154,30 +158,35 @@ draggable="true"> 至 2026年01月27日{{candidate.end_date}}2021年01月27日 + style="position: absolute; width: 32mm; text-decoration: unset; font-style: normal; color: rgb(0, 0, 0); top: 91mm; left: 107.7mm; font-size: 12pt;">{{candidate.start_date}} - +