monitest jianquan

This commit is contained in:
caoqianming 2020-04-04 13:46:53 +08:00
parent 9faf6cbd90
commit 0a9bc85fb3
18 changed files with 78 additions and 32 deletions

View File

@ -4974,7 +4974,7 @@
},
"echarts": {
"version": "4.7.0",
"resolved": "https://registry.npm.taobao.org/echarts/download/echarts-4.7.0.tgz?cache=0&sync_timestamp=1584522755461&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fecharts%2Fdownload%2Fecharts-4.7.0.tgz",
"resolved": "https://registry.npm.taobao.org/echarts/download/echarts-4.7.0.tgz",
"integrity": "sha1-Wzh1pML5HjkpQl+rq56s5+QJiz8=",
"requires": {
"zrender": "4.3.0"

View File

@ -111,4 +111,10 @@ export function updatePaper(id, data) {
method: 'put',
data
})
}
export function deletePaper(id) {
return request({
url: `/examtest/paper/${id}/`,
method: 'delete',
})
}

View File

@ -39,7 +39,7 @@ export default {
},
data() {
return {
lineChartData: lineChartData.newVisitis
lineChartData: lineChartData.注册用户
}
},
methods: {

View File

@ -75,7 +75,7 @@
</template>
<script>
import { getPaperList } from "@/api/examtest";
import { getPaperList, deletePaper } from "@/api/examtest";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination";
@ -129,6 +129,23 @@ export default {
handleEdit(scope) {
this.$router.push({path:"/sjmanage/paper/update",query:{id:scope.row.id}})
},
handleDelete(scope) {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePaper(scope.row.id).then(response => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList()
});
}).catch(() => {
});
},
}
};
</script>

View File

@ -43,6 +43,7 @@
@click="resetFilter"
>刷新重置</el-button>
<div style="margin-top:10px">
<el-button type="primary" slot="reference" @click="handleAdd()">新增</el-button>
<el-popover
placement="top"
width="160"
@ -62,7 +63,7 @@
<el-button size="small" type="primary" @click="popovervisible = false">上传导入</el-button>
</el-upload>
</div>
<el-button type="primary" slot="reference" @click="handleAdd()">新增</el-button>
<el-button slot="reference">Excel导入</el-button>
</el-popover>
</div>

View File

@ -8,10 +8,15 @@ App({
wx.setStorageSync('logs', logs)
// 登录
wx.showLoading({
title: '',
mask:true
})
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
api.request('/crm/consumer/mplogin/','POST', {code:res.code}).then(res=>{
wx.hideLoading()
if(res.code==200){
this.globalData.token = res.data.token
this.globalData.userinfo = res.data.userinfo
@ -48,11 +53,10 @@ App({
globalData: {
userInfo: null,
userinfo: null, // 服务器传回的消费者信息
// host: 'https://apitest.ctcshe.com',
host: 'https://apitest.ctcshe.com',
mediahost: 'https://apitest.ctcshe.com',
host: 'http://127.0.0.1:8000',
// host: 'http://127.0.0.1:8000',
// mediahost: 'http://127.0.0.1:8000',
token : '',
subject:null,
}
})

View File

@ -29,7 +29,6 @@ Page({
*/
onLoad: function () {
var that = this
wx.showLoading({})
api.request('/crm/consumer/collects/', 'GET').then(res => {
that.data.sctms = res.data
that.setData({

View File

@ -29,7 +29,6 @@ Page({
*/
onLoad: function () {
var that = this
wx.showLoading({})
try {
var value = wx.getStorageSync('ctms')
if (value) {
@ -38,8 +37,7 @@ Page({
tmtotal: value.length
})
}
wx.hideLoading()
} catch (e) { wx.hideLoading()}
} catch (e) { }
try {
const res = wx.getSystemInfoSync()
that.setData({

View File

@ -113,10 +113,9 @@ Page({
}
},
goMoni: function () {
if (getApp().globalData.userinfo.workscope) {
wx.navigateTo({
url: '/pages/moni/index',
})
const workscope = getApp().globalData.userinfo.workscope
if (workscope) {
this.genPaper(workscope)
} else {
wx.showToast({
title: '未开通权限\r\n请联系课程顾问',
@ -142,5 +141,21 @@ Page({
wx.navigateTo({
url: '/pages/test/list',
})
}
},
genPaper: function (workId) {
wx.showLoading({
title: '正在生成试卷',
mask:true
})
api.request('/examtest/workscope/' + workId + '/monitest', 'GET').then(res => {
wx.hideLoading()
try {
wx.setStorageSync('examtest', res.data)
} catch (e) { }
wx.navigateTo({
url: '/pages/moni/note',
})
})
},
})

View File

@ -74,9 +74,6 @@ Page({
},
genPaper: function () {
wx.showLoading({
title: '正在生成试卷',
})
api.request('/examtest/workscope/' + this.data.workId + '/monitest', 'GET').then(res => {
try {
wx.setStorageSync('examtest', res.data)

View File

@ -70,7 +70,7 @@ Page({
},
startTest: function () {
wx.redirectTo({
wx.reLaunch({
url: '/pages/test/test',
})
},

View File

@ -256,6 +256,7 @@ Page({
that.data.examtest.end_time = util.formatTime(new Date())
that.data.examtest.took = Math.floor(((new Date()).getTime() - this.data.starttimes) / 1000)
api.request('/examtest/examtest/', 'POST', that.data.examtest).then(res => {
wx.hideLoading()
getApp().globalData.testData = res.data
try {
wx.removeStorageSync('examtest')
@ -264,6 +265,7 @@ Page({
wx.redirectTo({
url: 'result',
})
})
}
})

View File

@ -111,14 +111,17 @@ Page({
startYati: function (e) {
wx.showLoading({
title: '正在准备考试',
mask:true
})
api.request('/examtest/paper/' + e.currentTarget.id +'/monitest/', 'GET').then(res => {
wx.hideLoading()
try {
wx.setStorageSync('examtest', res.data)
} catch (e) { }
wx.redirectTo({
wx.navigateTo({
url: '/pages/moni/note',
})
})
},
})

View File

@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": false,
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,

View File

@ -1,9 +1,6 @@
function request(url, method, data) {
let promise = new Promise((resolve, reject) => {
wx.showLoading({
title: '加载中',
mask:true
})
wx.showNavigationBarLoading();
wx.request({
url: getApp().globalData.host + url,
method: method,
@ -12,7 +9,6 @@ function request(url, method, data) {
'Authorization': 'JWT ' + getApp().globalData.token
},
success: (res => {
wx.hideLoading();
if (res.data.code >= 200 && res.data.code < 400) {
resolve(res.data);
}else if(res.data.code == 401){
@ -28,14 +24,18 @@ function request(url, method, data) {
}),
fail: (res => {
wx.hideLoading();
wx.showToast({
title: '网络出错',
title: '请求出错',
icon: 'none',
duration: 1500
})
console.log(res)
reject('网络出错');
})
}),
complete: function () {
wx.hideNavigationBarLoading();
}
})
})
return promise;

View File

@ -56,7 +56,9 @@ class WorkScopeViewSet(ModelViewSet):
filterset_fields = ['subject']
search_fields = ('^name',)
@action(methods=['get'], detail=True,url_path='monitest', url_name='gen_monitest', perms_map=[{'get':'gen_monitest'}])
@action(methods=['get'], detail=True,url_path='monitest', url_name='gen_monitest',
authentication_classes=[],permission_classes=[],
perms_map=[{'get':'gen_monitest'}])
def monitest(self, request, pk=None):
'''
生成自助模拟考试
@ -280,7 +282,9 @@ class PaperViewSet(ModelViewSet):
else:
return Response({'error':'不存在题库'})
@action(methods=['get'], detail=True, url_path='monitest', url_name='gen_monitest', perms_map=[{'get':'gen_monitest'}])
@action(methods=['get'], detail=True, url_path='monitest', url_name='gen_monitest',
authentication_classes=[],permission_classes=[],
perms_map=[{'get':'gen_monitest'}])
def monitest(self, request, pk=None):
'''
生成押卷模拟考试