diff --git a/test_client/package-lock.json b/test_client/package-lock.json index c843a54..51bdcc7 100644 --- a/test_client/package-lock.json +++ b/test_client/package-lock.json @@ -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" diff --git a/test_client/src/api/examtest.js b/test_client/src/api/examtest.js index c106f9c..1b58d07 100644 --- a/test_client/src/api/examtest.js +++ b/test_client/src/api/examtest.js @@ -111,4 +111,10 @@ export function updatePaper(id, data) { method: 'put', data }) +} +export function deletePaper(id) { + return request({ + url: `/examtest/paper/${id}/`, + method: 'delete', + }) } \ No newline at end of file diff --git a/test_client/src/views/dashboard/index.vue b/test_client/src/views/dashboard/index.vue index 28c544e..2da6dc6 100644 --- a/test_client/src/views/dashboard/index.vue +++ b/test_client/src/views/dashboard/index.vue @@ -39,7 +39,7 @@ export default { }, data() { return { - lineChartData: lineChartData.newVisitis + lineChartData: lineChartData.注册用户 } }, methods: { diff --git a/test_client/src/views/examtest/paper.vue b/test_client/src/views/examtest/paper.vue index 74240de..0d63e86 100644 --- a/test_client/src/views/examtest/paper.vue +++ b/test_client/src/views/examtest/paper.vue @@ -75,7 +75,7 @@ diff --git a/test_client/src/views/question/question.vue b/test_client/src/views/question/question.vue index e61c172..0bfa3f2 100644 --- a/test_client/src/views/question/question.vue +++ b/test_client/src/views/question/question.vue @@ -43,6 +43,7 @@ @click="resetFilter" >刷新重置
+ 新增 上传导入
- 新增 + Excel导入 diff --git a/test_mini/app.js b/test_mini/app.js index 97d8a49..d0a0567 100644 --- a/test_mini/app.js +++ b/test_mini/app.js @@ -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, } }) \ No newline at end of file diff --git a/test_mini/pages/collect/main.js b/test_mini/pages/collect/main.js index 2e89be4..92d5f97 100644 --- a/test_mini/pages/collect/main.js +++ b/test_mini/pages/collect/main.js @@ -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({ diff --git a/test_mini/pages/cuoti/index.js b/test_mini/pages/cuoti/index.js index 3f01ce3..9f3901a 100644 --- a/test_mini/pages/cuoti/index.js +++ b/test_mini/pages/cuoti/index.js @@ -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({ diff --git a/test_mini/pages/main/main.js b/test_mini/pages/main/main.js index 20f76ec..09d40e6 100644 --- a/test_mini/pages/main/main.js +++ b/test_mini/pages/main/main.js @@ -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', + }) + }) + + }, }) \ No newline at end of file diff --git a/test_mini/pages/moni/index.js b/test_mini/pages/moni/index.js index f0c855d..2aa2c22 100644 --- a/test_mini/pages/moni/index.js +++ b/test_mini/pages/moni/index.js @@ -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) diff --git a/test_mini/pages/moni/note.js b/test_mini/pages/moni/note.js index 0f7a41f..aa421da 100644 --- a/test_mini/pages/moni/note.js +++ b/test_mini/pages/moni/note.js @@ -70,7 +70,7 @@ Page({ }, startTest: function () { - wx.redirectTo({ + wx.reLaunch({ url: '/pages/test/test', }) }, diff --git a/test_mini/pages/test/test.js b/test_mini/pages/test/test.js index 127e6eb..97c542d 100644 --- a/test_mini/pages/test/test.js +++ b/test_mini/pages/test/test.js @@ -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', }) + }) } }) \ No newline at end of file diff --git a/test_mini/pages/yati/index.js b/test_mini/pages/yati/index.js index 1bc06b3..927b1b6 100644 --- a/test_mini/pages/yati/index.js +++ b/test_mini/pages/yati/index.js @@ -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', }) + }) }, }) \ No newline at end of file diff --git a/test_mini/project.config.json b/test_mini/project.config.json index 8b6c1e8..465536f 100644 --- a/test_mini/project.config.json +++ b/test_mini/project.config.json @@ -4,7 +4,7 @@ "ignore": [] }, "setting": { - "urlCheck": false, + "urlCheck": true, "es6": true, "postcss": true, "minified": true, diff --git a/test_mini/utils/request.js b/test_mini/utils/request.js index 8eefb46..724b149 100644 --- a/test_mini/utils/request.js +++ b/test_mini/utils/request.js @@ -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; diff --git a/test_server/examtest/views.py b/test_server/examtest/views.py index 1b82cd8..379e96d 100644 --- a/test_server/examtest/views.py +++ b/test_server/examtest/views.py @@ -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): ''' 生成押卷模拟考试 diff --git a/test_server/media/20200404/2fc12afa-761b-11ea-8aa0-1063c8f02116.xlsx b/test_server/media/20200404/2fc12afa-761b-11ea-8aa0-1063c8f02116.xlsx new file mode 100644 index 0000000..00acacf Binary files /dev/null and b/test_server/media/20200404/2fc12afa-761b-11ea-8aa0-1063c8f02116.xlsx differ diff --git a/test_server/media/20200404/4b03b64c-761b-11ea-a6ef-1063c8f02116.xlsx b/test_server/media/20200404/4b03b64c-761b-11ea-a6ef-1063c8f02116.xlsx new file mode 100644 index 0000000..6a08838 Binary files /dev/null and b/test_server/media/20200404/4b03b64c-761b-11ea-a6ef-1063c8f02116.xlsx differ