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": { "echarts": {
"version": "4.7.0", "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=", "integrity": "sha1-Wzh1pML5HjkpQl+rq56s5+QJiz8=",
"requires": { "requires": {
"zrender": "4.3.0" "zrender": "4.3.0"

View File

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

View File

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

View File

@ -75,7 +75,7 @@
</template> </template>
<script> <script>
import { getPaperList } from "@/api/examtest"; import { getPaperList, deletePaper } from "@/api/examtest";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
@ -129,6 +129,23 @@ export default {
handleEdit(scope) { handleEdit(scope) {
this.$router.push({path:"/sjmanage/paper/update",query:{id:scope.row.id}}) 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> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,7 +56,9 @@ class WorkScopeViewSet(ModelViewSet):
filterset_fields = ['subject'] filterset_fields = ['subject']
search_fields = ('^name',) 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): def monitest(self, request, pk=None):
''' '''
生成自助模拟考试 生成自助模拟考试
@ -280,7 +282,9 @@ class PaperViewSet(ModelViewSet):
else: else:
return Response({'error':'不存在题库'}) 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): def monitest(self, request, pk=None):
''' '''
生成押卷模拟考试 生成押卷模拟考试