This commit is contained in:
caoqianming 2020-08-02 09:36:39 +08:00
parent dcd77ce65b
commit 0542bf40db
29 changed files with 335 additions and 36 deletions

View File

@ -31,6 +31,14 @@ App({
})
}
}
}).then(res=>{
api.request('/crm/consumer/process/', 'GET').then(res => {
for (var key in res.data) {
try {
wx.setStorageSync(key, res.data.key)
} catch (e) { }
}
})
})
}
})
@ -57,9 +65,9 @@ App({
globalData: {
userInfo: {},
userinfo: {}, // 服务器传回的消费者信息
host: 'https://apitest.ahctc.cn',
//host: 'https://apitest.ahctc.cn',
mediahost: 'https://apitest.ahctc.cn',
//host: 'http://127.0.0.1:8011',
host: 'http://127.0.0.1:8000',
//mediahost: 'http://127.0.0.1:8000',
token : '',
}

View File

@ -24,7 +24,9 @@
"pages/article/detail",
"pages/quota/quota",
"pages/material/index",
"pages/question/detail"
"pages/question/detail",
"pages/candidate/index",
"pages/candidate/form.js"
],
"window": {
"backgroundTextStyle": "light",
@ -71,7 +73,7 @@
"usingComponents": {
"l-toast": "/miniprogram_npm/lin-ui/toast/index",
"l-message": "/miniprogram_npm/lin-ui/message/index",
"l-button":"/miniprogram_npm/lin-ui/button/index"
"l-button": "/miniprogram_npm/lin-ui/button/index"
},
"style": "v2",
"sitemapLocation": "sitemap.json"

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1596297111502" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2690" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><defs><style type="text/css"></style></defs><path d="M331.6 522c0.5-5.9 1.5-11.6 2.9-17.1h-0.1c-1.4 5.6-2.4 11.3-2.8 17.1 0 0.1 0 0.1 0 0 0 0.1 0 0 0 0zM443 423.2c0 0.1-0.1 0.3-0.1 0.4 57.4 2.2 103.3 49.2 103.4 107.1v-0.2c0-57.9-45.9-105-103.3-107.3z" fill="#F9D5B4" p-id="2691"></path><path d="M177.7 374.9c-3.6-4.2-7.2-8.5-10.4-13.1v-28.6c0.1-43.3 35.2-78.3 78.4-78.5H483v0.4h126.9v-58.5c-0.2-41.4-33.7-74.8-75.1-75H382.9v-0.4H145.6c-43.3 0.1-78.3 35.2-78.4 78.5v28.6c3.2 4.6 6.8 8.9 10.4 13.1-3.7-4.2-7.2-8.5-10.5-13.1v467.9c-0.1 41.5 33.5 75.2 75 75.4h25.1V361.8c3.3 4.6 6.8 8.9 10.5 13.1z m-54.1-52.1v-3.4c0.1-41.4 33.7-75 75.1-75.1h3.6c-43.4 0-78.6 35.1-78.7 78.5zM510.3 691.8c0 7.3-4.3 13.8-11.1 16.6-6.7 2.8-14.4 1.2-19.6-3.9l-41.1-41.1-41.1 41.1c-1.6 1.6-3.5 2.9-5.7 3.8-2.2 0.9-4.6 1.4-7 1.4-4.8 0-9.3-1.9-12.7-5.2-1.5-1.5-2.6-3.3-3.5-5.2v0.1c0.9 2.1 2.2 4 3.8 5.7 3.3 3.3 7.7 5.1 12.4 5.2 2.4 0 4.8-0.5 7-1.4 2.1-0.9 4-2.2 5.7-3.8l41.2-41 41.1 41.1c5.1 5.1 12.9 6.7 19.6 3.9 6.7-2.8 11.1-9.3 11.1-16.6l0.3-59c-0.1 0.1-0.3 0.2-0.4 0.3v58zM367.3 633.4v0.3c21.5 14.9 46.5 22.4 71.5 22.3-25 0-50-7.5-71.5-22.6zM438.7 638.7c5 0 9.9-0.5 14.8-1.2-4.8 0.7-9.8 1-14.8 1v0.2zM514.9 607c0.4-0.4 0.7-0.9 1.2-1.4-6.4 6.7-13.7 12.5-21.7 17.3 7.4-4.4 14.4-9.7 20.5-15.9zM98.6 110.9c-41.4 0.1-75 33.7-75.1 75.1v3.4c0.1-43.4 35.3-78.4 78.7-78.4h-3.6zM710 330.2v155.7l26.7-113.6v-30.4c0-4 1.8-7.8 5-10.3 1.5-1.2 3.3-2 5.2-2.5l6.8-28.9c9.3-42-16.9-83.8-58.8-93.6l-42.2-10.9c-3.9-0.9-8 0-11.1 2.4-3.1 2.5-5 6.3-5 10.3v46.9c40.6 1.1 73.2 34.1 73.4 74.9zM854.7 406.5c3.7-24.5-8-49.6-31.2-61.6l-25.9-13.4c-3.6-1.9-7.8-2-11.4-0.3-2.4 1.1-4.2 3-5.5 5.3l14.2 3.7c32.8 7.6 55.7 34.7 59.8 66.3zM710 616.5v78.6l26.7-52V509.3z" fill="#F9D5B4" p-id="2692"></path><path d="M198.7 244.4c-41.4 0.1-74.9 33.7-75.1 75.1v3.4c0.1-43.4 35.3-78.4 78.7-78.4h-3.6zM710 485.9V330.2c-0.2-40.8-32.8-73.7-73.3-74.8-0.6 0-1.1-0.2-1.7-0.2H483v6.7c0 96-77.8 173.8-173.9 173.8-47 0-91.3-19.3-123.6-52.4l-0.7-0.7c-2.5-2.6-4.9-5.2-7.2-7.9-3.7-4.2-7.2-8.5-10.5-13.1v467.8c-0.1 41.5 33.5 75.2 75 75.4h392.8c41.4-0.1 75-33.7 75.1-75.1V485.9zM510.4 692.4c0 7.3-4.3 13.8-11.1 16.6-6.7 2.8-14.5 1.2-19.6-3.9L438.6 664l-41.2 41c-1.6 1.6-3.5 2.9-5.7 3.8-2.2 0.9-4.6 1.4-7 1.4-4.6-0.1-9.1-1.9-12.4-5.2-1.6-1.6-2.9-3.6-3.8-5.7v-0.1c-0.9-2.2-1.4-4.5-1.4-6.9v-59c21.5 15 46.5 22.5 71.5 22.6 25 0 50-7.4 71.5-22.3 0.1-0.1 0.3-0.2 0.4-0.3l-0.1 59.1z m35.9-161.6c0 1.2-0.1 2.3-0.2 3.5-0.1 2.5-0.1 5-0.4 7.4-0.1 1.4-0.4 2.7-0.6 4-0.3 2.2-0.6 4.4-1 6.5-0.3 1.5-0.7 2.9-1.1 4.3-0.5 2-0.9 4-1.5 6-0.4 1.3-0.9 2.5-1.4 3.8-0.7 2.1-1.4 4.2-2.3 6.2-0.4 0.9-0.8 1.7-1.2 2.6-1.1 2.4-2.2 4.8-3.4 7-0.1 0.2-0.3 0.5-0.4 0.7-2.2 4-4.7 7.8-7.4 11.5-2.7 3.6-5.6 7.1-8.8 10.5-0.2 0.3-0.4 0.5-0.7 0.8-0.4 0.4-0.7 0.9-1.2 1.4-6.2 6.2-13.1 11.5-20.5 16-0.2 0.1-0.4 0.3-0.7 0.4-12.2 7.3-25.8 12.1-40 14.1h-0.3c-4.9 0.7-9.8 1.2-14.8 1.2v-0.5c-40.7 0-76.1-22.6-94.4-56-0.1-0.2-0.2-0.5-0.4-0.7-1.4-2.5-2.6-5.2-3.8-7.8-0.4-0.9-0.7-1.7-1.1-2.6-0.8-2-1.6-4.1-2.3-6.2-0.5-1.5-1-3-1.4-4.6l-1.2-4.5c-0.5-2.1-1-4.3-1.4-6.5-0.2-0.9-0.3-1.8-0.4-2.8-0.4-2.8-0.7-5.6-0.9-8.4-0.2-2.5-0.4-5-0.4-7.6 0-2.9 0.2-5.7 0.4-8.5 0.5-5.9 1.4-11.6 2.8-17.2 11.5-47 53.8-81.9 104.3-81.9 1.4 0 2.9 0.2 4.3 0.2 57.4 2.3 103.3 49.4 103.3 107.3 0.5 0.2 0.5 0.3 0.5 0.4zM923.6 478.3l-25.9-13.4c-3.6-1.9-7.8-2-11.4-0.3-3.6 1.7-6.3 4.9-7.3 8.8l-96.3 385.9h1.2c6.6-2.8 12.2-7.5 15.9-13.6 2.4-3.2 4.7-6.7 6.6-10.2l142.7-277.3c15-29.1 3.6-64.8-25.5-79.9zM854.7 406.5c-4.1-31.5-27-58.7-59.7-66.4l-14.2-3.7-28-7.2c-2-0.5-4-0.5-5.9 0-1.9 0.4-3.6 1.2-5.2 2.5-3.1 2.5-5 6.3-5 10.3v531h1c3.3-0.9 8.7-3.8 16.5-23.3 1.5-3.8 3.4-8.9 5.2-15l94.3-400.8c2.1-9.4 2.2-18.6 1-27.4z" fill="#FF7E00" p-id="2693"></path><path d="M245.7 254.8c-43.3 0.1-78.3 35.2-78.4 78.5v28.6c3.2 4.6 6.8 8.9 10.4 13.1 2.3 2.7 4.8 5.3 7.2 7.9l0.7 0.7c32.3 33.1 76.6 52.4 123.6 52.4 96 0 173.9-77.8 173.9-173.8V255.1H245.7z" fill="#FD973F" p-id="2694"></path></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,66 @@
// pages/candidate/form.js.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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/form.js.wxml-->
<text>pages/candidate/form.js.wxml</text>

View File

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

View File

@ -0,0 +1,69 @@
// pages/candidate/index.js
Page({
/**
* 页面的初始数据
*/
data: {
form:{
ID_number:null,
realname:null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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/index.wxml-->
<text>pages/candidate/index.wxml</text>

View File

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

View File

@ -13,9 +13,6 @@
<span class="txlabel">{{currentTm.type}}</span>
<span style="color:gray"> {{currentTm.questioncat_name}}</span>
</view>
<view style="text-align:center">
<span style="color:orange;font-weight:bold;font-size:14px">{{currentTm.dtime}}</span>
</view>
<view class="weui-article__title">{{currentTm.name}}</view>
<view wx:if="{{currentTm.img}}" style="text-align:center"><image src="{{currentTm.img}}" mode="aspectFit"></image></view>
</view>

View File

@ -14,7 +14,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function () {
if (getApp().globalData.userinfo.workscope) {
this.setData({
workscopeId: getApp().globalData.userinfo.workscope
@ -24,7 +23,6 @@ Page({
url: '/pages/main/main',
})
}
},
/**
@ -79,14 +77,30 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
var process = {}
try {
const res = wx.getStorageInfoSync()
const keys = res.keys
console.log(keys)
for(var i=0;i<keys.length;i++){
if(keys[i].indexOf('cat')!=-1){
try{
process[keys[i]] = wx.getStorageSync(keys[i])
}catch(e){}
}
}
} catch (e) {
// Do something when catch error
}
api.request('/crm/consumer/process/', 'put', { 'process': process }).then(res => {
})
},
/**

View File

@ -8,6 +8,7 @@ Page({
*/
data: {
questioncat: null,
tm_current:null,
tms: [],
ydtms: [],
ctms: [],
@ -44,7 +45,9 @@ Page({
if (value) {
that.data.ydtms = value
}
} catch (e) {}
} catch (e) {
}
try {
var value = wx.getStorageSync('ctms')
if (value) {
@ -137,15 +140,18 @@ Page({
showTm: function(index) {
var that = this
var tm_current = that.data.tms[index]
that.setData({
'tm_index': index,
'tm_current': tm_current
})
that.showOptions()
if (tm_current.user_answer) {
that.showAnswer()
if(index<that.data.tms.length){
var tm_current = that.data.tms[index]
that.setData({
'tm_index': index,
'tm_current': tm_current
})
that.showOptions()
if (tm_current.user_answer) {
that.showAnswer()
}
}
},
panTi: function() {
var that = this

View File

@ -8,6 +8,8 @@ Page({
*/
data: {
Hei:0,
wrongnum: 0,
collectnum: 0,
background: [app.globalData.mediahost + '/media/banner/1.jpg'],
indicatorDots: true,
vertical: false,
@ -63,6 +65,7 @@ Page({
// nowWork: wx.getStorageSync('nowWork')
// })
// }
this.getNum()
},
/**
@ -262,4 +265,12 @@ Page({
url: `/pages/question/detail?id=${e.detail.item.id}`,
})
},
getNum: function(){
try{
const ctms = wx.getStorageSync('ctms')
this.setData({
wrongnum:ctms.length
})
}catch(e){}
}
})

View File

@ -28,6 +28,15 @@
<!-- <span wx:if="{{to_read}}">{{to_read}}条未读</span> -->
</view>
</navigator>
<navigator url="/pages/candidate/index" 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">
<!-- <span wx:if="{{to_read}}">{{to_read}}条未读</span> -->
</view>
</navigator>
</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-grids">
@ -42,12 +51,14 @@
<image src="/images/cuoti.svg" alt></image>
</view>
<view class="weui-grid__label">错题集</view>
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{wrongnum!=0}}">{{wrongnum}}</view>
</navigator>
<navigator class="weui-grid" url="/pages/collect/main">
<view class="weui-grid__icon">
<image src="/images/shoucang.svg" alt></image>
</view>
<view class="weui-grid__label">收藏集</view>
<view class="weui-badge" style="position: absolute;top: 1em;right: 1em;" wx:if="{{collectnum!=0}}">{{collectnum}}</view>
</navigator>
<a class="weui-grid" bindtap="goMoni">

View File

@ -7,7 +7,8 @@ Page({
*/
data: {
tm_index:0,
results:[]
results:[],
tm_current:null
},
/**
@ -87,12 +88,15 @@ Page({
},
showTm: function (index) {
var that = this
var tm_current = that.data.results[index]
that.setData({
'tm_index': index,
'tm_current': tm_current
})
that.showOptions()
if(index<that.data.results.length){
var tm_current = that.data.results[index]
that.setData({
'tm_index': index,
'tm_current': tm_current
})
that.showOptions()
}
},
next: function () {
var that = this

View File

@ -1,4 +1,5 @@
// pages/examtest/result.js
var util = require('../../utils/util.js')
Page({
/**
@ -12,6 +13,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function () {
const data = getApp().globalData.testData
try{
data.took = util.formatSecond(data.took)
}catch(e){}
this.setData(getApp().globalData.testData)
},

View File

@ -16,7 +16,6 @@
用时:
<span style="color:green;font-weight:bold" wx:if="{{is_pass}}">{{took}}</span>
<span style="color:red;font-weight:bold" wx:else>{{took}}</span>
</view>
</view>
<view class="weui-msg__opr-area">

View File

@ -23,9 +23,9 @@
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"useIsolateContext": true
"useIsolateContext": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"libVersion": "2.10.3",

View File

@ -18,7 +18,10 @@ function request(url, method, data) {
})
}
else {
var msg = JSON.stringify(res.data.msg)
var msg = ''
if(res.data.msg){
msg = JSON.stringify(res.data.msg)
}
if (msg.indexOf('该操作的权限')!=-1){
msg = '权限不足,请注册登陆或联系课程顾问'
}

View File

@ -24,6 +24,12 @@ function formatmil(mil) {
s = toTow(s);
return h + ":" + m + ":" + s;
}
function formatSecond(val) {
var m = Math.floor(val/ 60)
var s = Math.floor(val - m * 60)
return m + '分' + s + '秒'
}
function toTow(num) {
if (num < 10) {
return "0" + num;
@ -34,5 +40,6 @@ function toTow(num) {
module.exports = {
formatTime: formatTime,
formatmil: formatmil
formatmil: formatmil,
formatSecond: formatSecond
}

View File

@ -68,7 +68,7 @@ class MaterialViewSet(ModelViewSet):
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
search_fields = ['name','description']
ordering_fields = ['update_time', 'down_count']
ordering = ['-update_time']
ordering = ['-down_count']
@action(methods=['get'], detail=True, url_name='down_material', perms_map=[{'*':'down_material'}])
def down(self, request, *args, **kwargs):

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2020-08-01 07:36
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0016_consumer_role'),
]
operations = [
migrations.AddField(
model_name='consumer',
name='process',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}, verbose_name='练习进度'),
),
]

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2020-08-01 07:37
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0017_consumer_process'),
]
operations = [
migrations.AlterField(
model_name='consumer',
name='process',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, verbose_name='练习进度'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.0.5 on 2020-08-02 01:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0018_auto_20200801_1537'),
]
operations = [
migrations.AddField(
model_name='consumer',
name='ID_number',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='身份证号'),
),
migrations.AddField(
model_name='consumer',
name='realname',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='真实姓名'),
),
]

View File

@ -3,6 +3,7 @@ import django.utils.timezone as timezone
from rbac.models import SoftCommonModel, CommonModel
from question.models import Questioncat, Question
from examtest.models_paper import WorkScope
from django.contrib.postgres.fields import JSONField
# Create your models here.
class Company(CommonModel):
@ -61,10 +62,15 @@ class Consumer(CommonModel):
nickname = models.CharField(max_length=200, verbose_name='昵称', null=True, blank=True)
subjects = models.ManyToManyField(Questioncat, verbose_name='付费学科', through='PaySubject')
workscope = models.ForeignKey(WorkScope, verbose_name='工作类别', on_delete=models.SET_NULL, null=True, blank=True)
collects = models.ManyToManyField(Question, verbose_name='收藏试题')
remain_count = models.IntegerField('体验次数', default=3)
role = models.ForeignKey(ConsumerRole, verbose_name='用户角色', default=1, on_delete=models.SET_NULL, null=True, blank=True)
collects = models.ManyToManyField(Question, verbose_name='收藏试题')
process = JSONField('练习进度', blank=True, default=dict)
ID_number = models.CharField('身份证号', max_length=100, null=True, blank=True)
realname = models.CharField('真实姓名', max_length=100, null=True, blank=True)
class Meta:
verbose_name = '客户'

View File

@ -37,7 +37,7 @@ class ConsumerSerializer(serializers.ModelSerializer):
role_name = serializers.StringRelatedField(source='role', read_only=True)
class Meta:
model = Consumer
exclude = ('avatar','collects')
exclude = ('avatar','collects', 'process')
@staticmethod
def setup_eager_loading(queryset):

View File

@ -209,6 +209,22 @@ class ConsumerViewSet(ModelViewSet):
else:
return Response({'error':'delete参数错误'})
@action(methods=['get', 'put'], detail=False,
url_path='process', url_name='exercise_process', perms_map=[{'*':'*'}])
def process(self, request):
'''
练习进度
'''
if request.method == 'GET':
process = {}
if hasattr(request.user, 'process'):
process = request.user.process
return Response({'process':process})
elif request.method == 'PUT':
if hasattr(request.user, 'process'):
request.user.process = request.data['process']
request.user.save()
return Response(status=status.HTTP_200_OK)
@action(methods=['post'], detail=False,
url_path='import', url_name='import_consumer')