diff --git a/test_client/src/api/consult.js b/test_client/src/api/consult.js
new file mode 100644
index 0000000..e6c1d62
--- /dev/null
+++ b/test_client/src/api/consult.js
@@ -0,0 +1,15 @@
+import request from '@/utils/request'
+
+export function getConsultList(query) {
+ return request({
+ url: '/qtest/consult/',
+ method: 'get',
+ params:query
+ })
+}
+export function deleteConsult(id) {
+ return request({
+ url: `/qtest/consult/${id}/`,
+ method: 'delete',
+ })
+}
\ No newline at end of file
diff --git a/test_client/src/router/index.js b/test_client/src/router/index.js
index 74c1f4f..244fb43 100644
--- a/test_client/src/router/index.js
+++ b/test_client/src/router/index.js
@@ -268,7 +268,21 @@ export const asyncRoutes = [
},
]
},
-
+ {
+ path: '/qtest',
+ component: Layout,
+ redirect: '/qtest/consult',
+ name: 'Qtest',
+ meta: { title: '铅当量检测', icon: '', perms: ['qtest_view']},
+ children: [
+ {
+ path: 'consult',
+ name: 'Consult',
+ component: () => import('@/views/qtest/consult.vue'),
+ meta: { title: '铅当量检测', icon: 'eye-open', perms: ['qtest_view'] }
+ },
+ ]
+ },
{
path: '/system',
component: Layout,
diff --git a/test_client/src/views/qtest/consult.vue b/test_client/src/views/qtest/consult.vue
new file mode 100644
index 0000000..7d46eeb
--- /dev/null
+++ b/test_client/src/views/qtest/consult.vue
@@ -0,0 +1,138 @@
+
+
+
+
+ 搜索
+ 刷新重置
+
+
+
+
+ {{ scope.row.name }}
+
+
+ {{ scope.row.phone }}
+
+
+
+ {{ scope.row.address }}
+
+
+
+ {{ scope.row.tests }}
+
+
+ {{ scope.row.create_time }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test_mini/app.json b/test_mini/app.json
index f351863..85b3b12 100644
--- a/test_mini/app.json
+++ b/test_mini/app.json
@@ -27,7 +27,8 @@
"pages/question/detail",
"pages/candidate/index",
"pages/candidate/detail",
- "pages/material/video"
+ "pages/material/video",
+ "pages/qtest/form"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/test_mini/images/qtest.svg b/test_mini/images/qtest.svg
new file mode 100644
index 0000000..91cb923
--- /dev/null
+++ b/test_mini/images/qtest.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test_mini/pages/main/main.wxml b/test_mini/pages/main/main.wxml
index 18ea05b..0a4ba35 100644
--- a/test_mini/pages/main/main.wxml
+++ b/test_mini/pages/main/main.wxml
@@ -37,6 +37,15 @@
+
+
+
+
+ 铅当量检测
+
+
+
+
diff --git a/test_mini/pages/qtest/form.js b/test_mini/pages/qtest/form.js
new file mode 100644
index 0000000..8180304
--- /dev/null
+++ b/test_mini/pages/qtest/form.js
@@ -0,0 +1,114 @@
+// pages/qtest/form.js
+const api = require("../../utils/request.js");
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ items: [
+ { name: '铅衣', value: '铅衣' },
+ { name: '铅帽', value: '铅帽' },
+ { name: '铅围裙', value: '铅围裙' },
+ { name: '铅围脖', value: '铅围脖' },
+ { name: '一整套防护用品', value: '一整套防护用品' },
+ ]
+ },
+ checkboxChange: function (e) {
+ this.data.tests = e.detail.value
+ },
+ addressInput: function(e){
+ this.data.address = e.detail.value
+ },
+ nameInput: function(e){
+ this.data.name = e.detail.value
+ },
+ phoneInput: function(e){
+ this.data.phone = e.detail.value
+ },
+ submit: function(){
+ if(this.data.name&&this.data.phone&&this.data.address){
+ let data = {
+ name:this.data.name,
+ phone:this.data.phone,
+ address:this.data.address,
+ tests:this.data.tests
+ }
+ api.request('/qtest/consult/','POST', data).then(res=>{
+ wx.showModal({
+ title: '提示!',
+ content: '已提交信息.',
+ confirmText: '好的',
+ showCancel:false,
+ success(res) {
+ if (res.confirm) {
+ wx.navigateBack({
+ delta: 0,
+ })
+ }
+ }
+ })
+ })
+ }else{
+ wx.showToast({
+ title: '填写不完整',
+ icon:'none'
+ })
+ }
+ },
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ 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/qtest/form.json b/test_mini/pages/qtest/form.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/test_mini/pages/qtest/form.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/test_mini/pages/qtest/form.wxml b/test_mini/pages/qtest/form.wxml
new file mode 100644
index 0000000..cff6957
--- /dev/null
+++ b/test_mini/pages/qtest/form.wxml
@@ -0,0 +1,75 @@
+
+
+
+
+ 我司开展铅当量检测业务,如有需要,请留下您的信息,我们工作人员将及时与您联系。
+
+
+ 基本信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 检测内容
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
diff --git a/test_mini/pages/qtest/form.wxss b/test_mini/pages/qtest/form.wxss
new file mode 100644
index 0000000..52e4904
--- /dev/null
+++ b/test_mini/pages/qtest/form.wxss
@@ -0,0 +1,2 @@
+/* pages/qtest/form.wxss */
+.page{height:100%}.weui-label{width:4.1em}
\ No newline at end of file
diff --git a/test_mini/project.config.json b/test_mini/project.config.json
index ab52b0f..ab2eac1 100644
--- a/test_mini/project.config.json
+++ b/test_mini/project.config.json
@@ -1,59 +1,65 @@
{
- "description": "项目配置文件",
- "packOptions": {
- "ignore": []
- },
- "setting": {
- "urlCheck": false,
- "es6": true,
- "enhance": true,
- "postcss": true,
- "minified": true,
- "newFeature": true,
- "coverView": true,
- "nodeModules": true,
- "autoAudits": false,
- "showShadowRootInWxmlPanel": true,
- "scopeDataCheck": false,
- "checkInvalidKey": true,
- "checkSiteMap": true,
- "uploadWithSourceMap": true,
- "babelSetting": {
- "ignore": [],
- "disablePlugins": [],
- "outputPath": ""
- },
- "useCompilerModule": true,
- "userConfirmedUseCompilerModuleSwitch": false,
- "compileHotReLoad": false,
- "useIsolateContext": true
- },
- "compileType": "miniprogram",
- "libVersion": "2.10.3",
- "appid": "wxf1e9471c93f05ad6",
- "projectname": "test_mini",
- "debugOptions": {
- "hidedInDevtools": []
- },
- "isGameTourist": false,
- "simulatorType": "wechat",
- "simulatorPluginLibVersion": {},
- "condition": {
- "search": {
- "current": -1,
- "list": []
- },
- "conversation": {
- "current": -1,
- "list": []
- },
- "game": {
- "currentL": -1,
- "list": []
- },
- "miniprogram": {
- "current": -1,
- "list": []
- }
- }
+ "description": "项目配置文件",
+ "packOptions": {
+ "ignore": []
+ },
+ "setting": {
+ "urlCheck": false,
+ "es6": true,
+ "enhance": true,
+ "postcss": true,
+ "preloadBackgroundData": false,
+ "minified": true,
+ "newFeature": true,
+ "coverView": true,
+ "nodeModules": true,
+ "autoAudits": false,
+ "showShadowRootInWxmlPanel": true,
+ "scopeDataCheck": false,
+ "uglifyFileName": false,
+ "checkInvalidKey": true,
+ "checkSiteMap": true,
+ "uploadWithSourceMap": true,
+ "compileHotReLoad": false,
+ "useMultiFrameRuntime": true,
+ "useApiHook": false,
+ "babelSetting": {
+ "ignore": [],
+ "disablePlugins": [],
+ "outputPath": ""
+ },
+ "useIsolateContext": true,
+ "useCompilerModule": true,
+ "userConfirmedUseCompilerModuleSwitch": false,
+ "packNpmManually": false,
+ "packNpmRelationList": []
+ },
+ "compileType": "miniprogram",
+ "libVersion": "2.10.3",
+ "appid": "wxf1e9471c93f05ad6",
+ "projectname": "test_mini",
+ "debugOptions": {
+ "hidedInDevtools": []
+ },
+ "isGameTourist": false,
+ "simulatorType": "wechat",
+ "simulatorPluginLibVersion": {},
+ "condition": {
+ "search": {
+ "current": -1,
+ "list": []
+ },
+ "conversation": {
+ "current": -1,
+ "list": []
+ },
+ "game": {
+ "currentL": -1,
+ "list": []
+ },
+ "miniprogram": {
+ "current": -1,
+ "list": []
+ }
+ }
}
\ No newline at end of file
diff --git a/test_server/cms/models.py b/test_server/cms/models.py
index 8c146b4..45256a8 100644
--- a/test_server/cms/models.py
+++ b/test_server/cms/models.py
@@ -37,3 +37,4 @@ class Material(CommonModel):
poster = models.CharField(max_length=10000, verbose_name='封面地址', null=True, blank=True)
type = models.CharField('格式', default='文档', max_length=50)
down_count = models.IntegerField('阅读量', default=0)
+
diff --git a/test_server/qtest/__init__.py b/test_server/qtest/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/test_server/qtest/admin.py b/test_server/qtest/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/test_server/qtest/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/test_server/qtest/apps.py b/test_server/qtest/apps.py
new file mode 100644
index 0000000..5d76168
--- /dev/null
+++ b/test_server/qtest/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class QtestConfig(AppConfig):
+ name = 'qtest'
diff --git a/test_server/qtest/migrations/0001_initial.py b/test_server/qtest/migrations/0001_initial.py
new file mode 100644
index 0000000..5fce674
--- /dev/null
+++ b/test_server/qtest/migrations/0001_initial.py
@@ -0,0 +1,33 @@
+# Generated by Django 3.0.4 on 2020-09-13 14:53
+
+import django.contrib.postgres.fields
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Consult',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
+ ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
+ ('is_delete', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
+ ('name', models.CharField(max_length=100, verbose_name='姓名')),
+ ('phone', models.CharField(max_length=100, verbose_name='手机号')),
+ ('address', models.CharField(blank=True, max_length=1000, null=True, verbose_name='邮寄地址')),
+ ('tests', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=2000, verbose_name='检测内容'), size=None)),
+ ],
+ options={
+ 'verbose_name': '咨询',
+ 'verbose_name_plural': '咨询',
+ },
+ ),
+ ]
diff --git a/test_server/qtest/migrations/__init__.py b/test_server/qtest/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/test_server/qtest/models.py b/test_server/qtest/models.py
new file mode 100644
index 0000000..7a44ece
--- /dev/null
+++ b/test_server/qtest/models.py
@@ -0,0 +1,18 @@
+from django.db import models
+import django.utils.timezone as timezone
+from rbac.models import SoftCommonModel, CommonModel
+from django.contrib.postgres.fields import ArrayField
+# Create your models here.
+
+class Consult(CommonModel):
+ name = models.CharField('姓名', max_length=100)
+ phone = models.CharField('手机号', max_length=100)
+ address = models.CharField('邮寄地址', max_length=1000, null=True, blank=True)
+ tests = ArrayField(models.CharField('检测内容', max_length=2000))
+
+ class Meta:
+ verbose_name = '咨询'
+ verbose_name_plural = verbose_name
+
+ def __str__(self):
+ return self.name
\ No newline at end of file
diff --git a/test_server/qtest/tests.py b/test_server/qtest/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/test_server/qtest/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/test_server/qtest/urls.py b/test_server/qtest/urls.py
new file mode 100644
index 0000000..a30427d
--- /dev/null
+++ b/test_server/qtest/urls.py
@@ -0,0 +1,11 @@
+from django.urls import path,include
+from .views import ConsultViewSet
+from rest_framework import routers
+
+
+router = routers.DefaultRouter()
+router.register('consult', ConsultViewSet, basename="consult")
+
+urlpatterns = [
+ path('', include(router.urls)),
+]
diff --git a/test_server/qtest/views.py b/test_server/qtest/views.py
new file mode 100644
index 0000000..95aa371
--- /dev/null
+++ b/test_server/qtest/views.py
@@ -0,0 +1,29 @@
+from django.shortcuts import render
+from rest_framework.viewsets import ModelViewSet
+from .models import Consult
+# Create your views here.
+from rest_framework import serializers
+from utils.custom import CommonPagination
+from .models import Consult
+from django_filters.rest_framework import DjangoFilterBackend
+from rest_framework.filters import OrderingFilter, SearchFilter
+class ConsultSerializer(serializers.ModelSerializer):
+ """
+ 咨询序列化
+ """
+ class Meta:
+ model = Consult
+ fields = '__all__'
+
+class ConsultViewSet(ModelViewSet):
+ """
+ 咨询 增删改查
+ """
+ perms_map = [
+ {'get': '*'}, {'post': '*'},
+ {'put': 'consult_update'}, {'delete': 'consult_delete'}]
+ queryset = Consult.objects.filter(is_delete=0)
+ serializer_class = ConsultSerializer
+ pagination_class = CommonPagination
+ filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
+ search_fields = ['name','tests', 'phone']
\ No newline at end of file
diff --git a/test_server/server/settings.py b/test_server/server/settings.py
index ed4b1f4..e1d3c49 100644
--- a/test_server/server/settings.py
+++ b/test_server/server/settings.py
@@ -47,7 +47,8 @@ INSTALLED_APPS = [
'question',
'examtest',
'analyse',
- 'cms'
+ 'cms',
+ 'qtest'
]
MIDDLEWARE = [
diff --git a/test_server/server/urls.py b/test_server/server/urls.py
index ffcfa08..9ecf85c 100644
--- a/test_server/server/urls.py
+++ b/test_server/server/urls.py
@@ -30,6 +30,7 @@ urlpatterns = [
path('examtest/', include('examtest.urls')),
path('cms/', include('cms.urls')),
path('analyse/', include('analyse.urls')),
+ path('qtest/', include('qtest.urls')),
path('token/', obtain_jwt_token),
path('token/refresh/', refresh_jwt_token),
path('token/verify/', verify_jwt_token),