cyc
This commit is contained in:
parent
958282b84b
commit
5542e7f6bb
@ -162,7 +162,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="ant-result-title">404</div>-->
|
<!-- <div class="ant-result-title">404</div>-->
|
||||||
<div class="ant-result-subtitle" style="text-align: center;margin-top: 20px"><h2>无数据</h2></div>
|
<div class="ant-result-subtitle" style="text-align: center;margin-top: 20px"><h2>{{ msg }}</h2></div>
|
||||||
<!-- <div class="ant-result-extra"><a href="/">-->
|
<!-- <div class="ant-result-extra"><a href="/">-->
|
||||||
<!-- <button type="button" class="ant-btn ant-btn-primary"><span role="img" aria-label="home"-->
|
<!-- <button type="button" class="ant-btn ant-btn-primary"><span role="img" aria-label="home"-->
|
||||||
<!-- class="anticon anticon-home"><svg-->
|
<!-- class="anticon anticon-home"><svg-->
|
||||||
@ -183,7 +183,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
props: [],
|
props: ['msg'],
|
||||||
|
|
||||||
// computed: mapState([
|
// computed: mapState([
|
||||||
// 'itemNum', //第几题
|
// 'itemNum', //第几题
|
||||||
|
|||||||
12
src/main.js
12
src/main.js
@ -25,7 +25,7 @@ router.beforeEach((to,from,next)=>{
|
|||||||
|
|
||||||
var apikey = to.query.apikey
|
var apikey = to.query.apikey
|
||||||
var userId = to.query.userId
|
var userId = to.query.userId
|
||||||
|
var userType = to.query.userType
|
||||||
|
|
||||||
if (apikey){
|
if (apikey){
|
||||||
setStore('apikey',apikey)
|
setStore('apikey',apikey)
|
||||||
@ -37,6 +37,12 @@ router.beforeEach((to,from,next)=>{
|
|||||||
console.log(userId)
|
console.log(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (userType){
|
||||||
|
setStore('userType',userType)
|
||||||
|
console.log(userType)
|
||||||
|
}
|
||||||
|
|
||||||
if (apikey){
|
if (apikey){
|
||||||
|
|
||||||
|
|
||||||
@ -44,6 +50,10 @@ router.beforeEach((to,from,next)=>{
|
|||||||
if (userId){
|
if (userId){
|
||||||
delete to.query.userId
|
delete to.query.userId
|
||||||
}
|
}
|
||||||
|
if (userType){
|
||||||
|
delete to.query.userType
|
||||||
|
}
|
||||||
|
|
||||||
next({
|
next({
|
||||||
path:to.path,
|
path:to.path,
|
||||||
query:{...to.query}
|
query:{...to.query}
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
import Md5 from "crypto-js/md5";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存储localStorage
|
* 存储localStorage
|
||||||
*/
|
*/
|
||||||
@ -274,3 +277,61 @@ export const animate = (element, target, duration = 400, mode = 'ease-out', call
|
|||||||
})
|
})
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const processReuestData =(data)=>{
|
||||||
|
|
||||||
|
// 发请求前 业务处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 设置公共报文逻辑
|
||||||
|
|
||||||
|
let time = Date.parse(new Date());
|
||||||
|
let keys = ["apikey", "sign", "time"];
|
||||||
|
|
||||||
|
for (const keysKey in data) {
|
||||||
|
keys.push(keysKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.isTest = 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
let key1 = keys.sort();
|
||||||
|
let key2 = key1.join("&");
|
||||||
|
let key3 = key2 + "&" + time + "&" + "HuaTeng987!@#";
|
||||||
|
// console.log(key3)
|
||||||
|
|
||||||
|
// console.log(data)
|
||||||
|
|
||||||
|
let sign = Md5(key3).toString();
|
||||||
|
|
||||||
|
//
|
||||||
|
let apikey = getStore("apikey");
|
||||||
|
|
||||||
|
if (apikey !== null) {
|
||||||
|
data.apikey = apikey;
|
||||||
|
} else {
|
||||||
|
data.apikey = "HT_6d671a62c1d668161552616453";
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('apikey=='+data.apikey)
|
||||||
|
|
||||||
|
// userId
|
||||||
|
let userId = getStore("userId");
|
||||||
|
|
||||||
|
if (userId !== null) {
|
||||||
|
data.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 参数
|
||||||
|
data.sign = sign;
|
||||||
|
data.time = time;
|
||||||
|
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
}
|
||||||
@ -123,6 +123,11 @@ export default async (options = { method: "GET" }) => {
|
|||||||
headers: myheaders,
|
headers: myheaders,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// code ==! 200 报错
|
||||||
|
if(res.data.code !== 200){
|
||||||
|
return new Promise((resolve,reject)=>reject(res.data.msg));
|
||||||
|
}
|
||||||
return new Promise((resolve,reject)=>resolve(res.data.data))
|
return new Promise((resolve,reject)=>resolve(res.data.data))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
@settingChange="settingChange"
|
@settingChange="settingChange"
|
||||||
:action = "action"
|
:action = "action"
|
||||||
:headers = "headers"
|
:headers = "headers"
|
||||||
|
:data = "extradata"
|
||||||
:isShowTeacherResource="true"
|
:isShowTeacherResource="true"
|
||||||
:continueReading="true"
|
:continueReading="true"
|
||||||
:basisPath="basisPath"
|
:basisPath="basisPath"
|
||||||
@ -43,7 +44,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="showError">
|
<div v-show="showError">
|
||||||
<no-data></no-data>
|
<no-data :msg="errormsg"></no-data>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -52,6 +53,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {LOCAL_VIEW_DETAIL,LOCAL_VIEW_CATALOG,LOCAL_VIEW_DATA} from "../seed/mock"
|
import {LOCAL_VIEW_DETAIL,LOCAL_VIEW_CATALOG,LOCAL_VIEW_DATA} from "../seed/mock"
|
||||||
import NoData from "../components/noData.vue"
|
import NoData from "../components/noData.vue"
|
||||||
|
import {getStore,processReuestData} from '../utils/mUtils'
|
||||||
import {bookApi} from "../service/getData"
|
import {bookApi} from "../service/getData"
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
@ -71,12 +73,14 @@ export default {
|
|||||||
bookId: '',
|
bookId: '',
|
||||||
show:false,
|
show:false,
|
||||||
showError:false,
|
showError:false,
|
||||||
|
errormsg:'无数据',
|
||||||
location: '',
|
location: '',
|
||||||
basisPath: 'https://smile-ebook.oss-cn-qingdao.aliyuncs.com/newjc/',
|
basisPath: 'https://smile-ebook.oss-cn-qingdao.aliyuncs.com/newjc/',
|
||||||
pageType: 'pc',
|
pageType: 'pc',
|
||||||
isTrial: false,
|
isTrial: false,
|
||||||
isTrialIndex: 10,
|
isTrialIndex: 10,
|
||||||
userType: 'teacher',
|
userType: 'teacher',
|
||||||
|
extradata :{},
|
||||||
data: {
|
data: {
|
||||||
notes: {
|
notes: {
|
||||||
list: []
|
list: []
|
||||||
@ -97,7 +101,20 @@ export default {
|
|||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.bookId = this.$route.query.bookId
|
this.bookId = this.$route.query.bookId
|
||||||
this.userType = this.$route.query.userType || 'student'
|
// this.userType = this.$route.query.userType || 'student'
|
||||||
|
|
||||||
|
var userType = getStore("userType")
|
||||||
|
|
||||||
|
this.extradata = processReuestData({})
|
||||||
|
|
||||||
|
// var uploadUrl = "https://local.xinsiketang.com"
|
||||||
|
var uploadUrl = ""
|
||||||
|
uploadUrl = uploadUrl+'/api/smile/uploadResources'
|
||||||
|
this.action = uploadUrl
|
||||||
|
if (userType){
|
||||||
|
this.userType = userType
|
||||||
|
}
|
||||||
|
|
||||||
if (this.$route.query.type) {
|
if (this.$route.query.type) {
|
||||||
this.pageType = this.$route.query.type
|
this.pageType = this.$route.query.type
|
||||||
// this.isTrialIndex = Number(this.$route.query.isTrialIndex)
|
// this.isTrialIndex = Number(this.$route.query.isTrialIndex)
|
||||||
@ -125,7 +142,15 @@ export default {
|
|||||||
// var locationData = await bookApi.userAction.getReadLocation({bookId:this.bookId})
|
// var locationData = await bookApi.userAction.getReadLocation({bookId:this.bookId})
|
||||||
// this.location = locationData.location
|
// this.location = locationData.location
|
||||||
|
|
||||||
this.textBookData = await bookApi.bookinfo.detail({bookId:this.bookId})
|
try {
|
||||||
|
this.textBookData = await bookApi.bookinfo.detail({bookId:this.bookId})
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
this.show= false
|
||||||
|
this.showError = true
|
||||||
|
this.errormsg = error
|
||||||
|
this.$message.error(error);
|
||||||
|
}
|
||||||
this.basisPath = this.textBookData.basisPath
|
this.basisPath = this.textBookData.basisPath
|
||||||
this.catalogList = await bookApi.bookinfo.category({bookId:this.bookId})
|
this.catalogList = await bookApi.bookinfo.category({bookId:this.bookId})
|
||||||
this.looseLeafData = await bookApi.bookinfo.data({bookId:this.bookId})
|
this.looseLeafData = await bookApi.bookinfo.data({bookId:this.bookId})
|
||||||
@ -336,14 +361,26 @@ export default {
|
|||||||
|
|
||||||
// 添加教师资源
|
// 添加教师资源
|
||||||
addResources(e) {
|
addResources(e) {
|
||||||
|
bookApi.resource.add({
|
||||||
|
bookId:this.bookId,
|
||||||
|
data:JSON.stringify(e)
|
||||||
|
})
|
||||||
this.addData('resources', e)
|
this.addData('resources', e)
|
||||||
},
|
},
|
||||||
// 删除教师资源
|
// 删除教师资源
|
||||||
deleteResource(e) {
|
deleteResource(e) {
|
||||||
|
bookApi.resource.delete({
|
||||||
|
bookId:this.bookId,
|
||||||
|
data:JSON.stringify(e)
|
||||||
|
})
|
||||||
this.deleteData('resources', e)
|
this.deleteData('resources', e)
|
||||||
},
|
},
|
||||||
// 编辑教师资源
|
// 编辑教师资源
|
||||||
editResources(e) {
|
editResources(e) {
|
||||||
|
bookApi.resource.edit({
|
||||||
|
bookId:this.bookId,
|
||||||
|
data:JSON.stringify(e)
|
||||||
|
})
|
||||||
this.updateData('resources', e)
|
this.updateData('resources', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user