提交 1d993e9a 编写于 作者: xiaoping.di's avatar xiaoping.di

刷新页面

上级 ff59bca6
import request from 'mn-template/plugins/http';
// 校验token
export const checkToken = async () => {
return request({
url: 'campaign/admin/task/checkToken',
withCredentials: true,
method: 'get',
});
};
...@@ -99,12 +99,44 @@ ...@@ -99,12 +99,44 @@
var obj = { var obj = {
points_id: this.courses.points_id points_id: this.courses.points_id
}; };
// configurationModule.getMoreCourses(obj); this.intoCourseMore(obj);
}, },
// 进入相关课程 // 进入相关课程
enterCourse(obj) { enterCourse(obj) {
// configurationModule.intoCourse(obj); this.intoCourse(obj);
}, },
intoCourseMore(obj){
let appModuleModel=[
{
'key':'className',
'value':'value=com.picahealth.yunque.activitys.famousteacherschool.AllDiseaseActivity###MicroProfessionTableController'
},
{
key:'pointsId',
value:obj.points_id
}
];
this.$rocNative.dispatchEventByModuleCode({
modeCode: 'M200',
jsonString: appModuleModel,
});
},
intoCourse(obj){
let appModuleModel=[
{
'key':'className',
'value':'value=com.picahealth.yunque.activitys.courseplaynew.CourseIntroduceActivity###WeexCourseIntroViewController'
},
{
key:'courseId',
value:obj.course_id
}
];
this.$rocNative.dispatchEventByModuleCode({
modeCode: 'M200',
jsonString: appModuleModel,
});
}
}, },
}; };
......
...@@ -250,7 +250,6 @@ ...@@ -250,7 +250,6 @@
if(sendObj.user_role_list=="R004"){ if(sendObj.user_role_list=="R004"){
this.dataOkForExam(); this.dataOkForExam();
} }
alert(123)
//configurationModule.checkIDCardAndEducation(sendObj); 111 //configurationModule.checkIDCardAndEducation(sendObj); 111
}else { }else {
this.$toast("网络异常,请稍后再试"); this.$toast("网络异常,请稍后再试");
...@@ -278,7 +277,8 @@ ...@@ -278,7 +277,8 @@
this.addLogicForExam(); this.addLogicForExam();
}, },
goExam(index, obj) { goExam(index, obj) {
localStorage.setItem('keyIndex', this.keyIndex) this.$storejs.set('keyIndex',this.keyIndex)
//localStorage.setItem('keyIndex', this.keyIndex)
if (this.examContent.allowFlag == 1) {// 加入项目(项目考试组件有权限) if (this.examContent.allowFlag == 1) {// 加入项目(项目考试组件有权限)
this.currentIndex = index; this.currentIndex = index;
this.currentObj = obj; this.currentObj = obj;
...@@ -457,13 +457,16 @@ ...@@ -457,13 +457,16 @@
} }
} }
}else {// 课程项 }else {// 课程项
console.log(obj,"iiiiiiiiiii")
if (this.examContent.exam_order == 5 || index == 0) { // 顺序并列, 或者顺序贯序但为第一项 if (this.examContent.exam_order == 5 || index == 0) { // 顺序并列, 或者顺序贯序但为第一项
// modal.alert({message:'999'}) // modal.alert({message:'999'})
configurationModule.intoCourse(obj); //configurationModule.intoCourse(obj);
this.goStudyNative(obj)
}else { }else {
const lastItem = this.examContent.allLists[index - 1]; const lastItem = this.examContent.allLists[index - 1];
if ((lastItem.testNumFlag > 0 && lastItem.answerResultModel.pass_flag == 5) || lastItem.progress >= 0) { if ((lastItem.testNumFlag > 0 && lastItem.answerResultModel.pass_flag == 5) || lastItem.progress >= 0) {
configurationModule.intoCourse(obj); //configurationModule.intoCourse(obj);
this.goStudyNative(obj)
}else { }else {
this.$toast('请按顺序完成学习及考试') this.$toast('请按顺序完成学习及考试')
} }
...@@ -471,15 +474,19 @@ ...@@ -471,15 +474,19 @@
} }
}, },
goStudyNative(obj){ goStudyNative(obj){
this.appModuleModel=[{ let appModuleModel=[
{
}] 'key':'className',
const paramList = setEventByModuleCode( 'value':'value=com.picahealth.yunque.activitys.courseplaynew.CourseIntroduceActivity###WeexCourseIntroViewController'
JSON.parse(JSON.stringify(this.appModuleModel)) },
); {
key:'courseId',
value:obj.course_id
}
];
this.$rocNative.dispatchEventByModuleCode({ this.$rocNative.dispatchEventByModuleCode({
modeCode: 'M200', modeCode: 'M200',
jsonString: paramList, jsonString: appModuleModel,
}); });
}, },
diaLogConfirm(){ diaLogConfirm(){
......
import { router, store, vueApp } from '@pica-cli/vue-cli-plugin-pica-cli-plugin/auto'; import { router, store, vueApp } from '@pica-cli/vue-cli-plugin-pica-cli-plugin/auto';
import '@/router'; import '@/router';
console.log('router, store, vueApp: ', router, store, vueApp); console.log('router, store, vueApp: ', router, store, vueApp);
import Vue from 'vue';
import rocNative from '@/utils/jsbridge';
import '@/utils/wxShare';
import storejs from 'storejs';
// import PicaGuideApp from 'pica-guide-app';
import WebBuriedPoint, {sendBuriedData} from '@pica-core/web-buried-point';
const {name} = require('../../package.json');
Vue.prototype.$rocNative = new rocNative();
Vue.prototype.$sendBuriedData = sendBuriedData;
Vue.prototype.$storejs = storejs;
Vue.use(WebBuriedPoint, {
class_name: name,
url: `${process.env.VUE_APP_SERVICE_URL}/file/log/trace1`,
});
// 助诊方式
export const diagnoseTypeList = [
{
label: '语音助诊',
value: 1,
},
{
label: '图文助诊',
value: 2,
},
];
export const placeholderText =
'为了更好地为您服务,请尽量完善以下信息: \n1、本次问诊想解决什么问题? \n2、之前做过什么检查及结果? \n3、线下医生的诊断结果是什么? \n4、已使用过的药品和疗效?';
export const ENV_CONFIG = {
development: {
baseUrl: 'https://dev-sc.yunqueyi.com',
shareUrl: 'https://dev-phome.yunqueyi.com',
appId: 'wxf4e66242d31c81c2', // 用于微信授权登录(张平)
// appId: 'wxcf79dbdc24cb684b',
phomeUrl: 'https://dev-phome.yunqueyi.com',
type: 1,
colseUrl: 'https://dev-phome.yunqueyi.com/pica_circle_ssr/middle',
kfaccid: 'picakf_dev',
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com',
shareUrl: 'https://dev-phome.yunqueyi.com',
appId: 'wxf4e66242d31c81c2', // 用于微信授权登录(张平)
// appId: 'wxcf79dbdc24cb684b',
type: 1,
colseUrl: 'https://dev-phome.yunqueyi.com/pica_circle_ssr/middle',
kfaccid: 'picakf_dev',
},
testing: {
baseUrl: 'https://test1-sc.yunqueyi.com',
shareUrl: 'https://test1-phome.yunqueyi.com',
appId: 'wxcaad75b7fff5659c', // 用于微信授权登录()
// appId: 'wx2c577552a2d28550',
type: 15,
colseUrl: 'https://test1-phome.yunqueyi.com/pica_circle_ssr/middle',
kfaccid: 'picakf_test',
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com',
shareUrl: 'https://uat-phome.yunqueyi.com',
appId: 'wx342ef0e5afee54a7', // 用于微信授权登录(于蛟)
// appId: 'wx85f38ae09d22b12e',
type: 30,
colseUrl: 'https://uat-phome.yunqueyi.com/pica_circle_ssr/middle',
kfaccid: 'picakf_uat',
},
production: {
baseUrl: 'https://sc.yunqueyi.com',
shareUrl: 'https://phome.yunqueyi.com',
appId: 'wx2c577552a2d28550', // 用于微信授权登录
type: 5,
colseUrl: 'https://phome.yunqueyi.com/pica_circle_ssr/middle',
kfaccid: 'picakf',
},
};
// miniprogramType 小程序类型,0 正式版,1,测试版,2预览版
export const MINIPROGRAMTYPE = {
dev: 2,
testing: 2,
uat: 2,
production: 0,
};
export const miniprogramType = MINIPROGRAMTYPE[process.env.VUE_APP_ENV];
export const PHOME_URL = {
dev: 'https://dev-phome.yunqueyi.com',
testing: 'https://test1-phome.yunqueyi.com',
uat: 'https://uat-phome.yunqueyi.com',
production: 'https://phome.yunqueyi.com'
};
export const phomeUrl = PHOME_URL[process.env.VUE_APP_ENV];
import { ENV_CONFIG } from './enumerate';
const { VUE_APP_ENV } = process.env;
export const setCookie = ( export const setCookie = (
cname, cname,
cvalue, cvalue,
...@@ -8,7 +12,9 @@ export const setCookie = ( ...@@ -8,7 +12,9 @@ export const setCookie = (
// yunqueyi.com // yunqueyi.com
const d = new Date(); const d = new Date();
let expires = ''; let expires = '';
if ( VUE_APP_ENV === 'development') {
domain = window.location.hostname;
}
if (validMsec) { if (validMsec) {
d.setTime(d.getTime() + validMsec); d.setTime(d.getTime() + validMsec);
} else { } else {
...@@ -157,21 +163,202 @@ export function toDecimal2(x) { ...@@ -157,21 +163,202 @@ export function toDecimal2(x) {
* 通过身份证获取出生日期及性别 * 通过身份证获取出生日期及性别
* @param idCard 15/18位身份证号码 * @param idCard 15/18位身份证号码
* @return JSON对象 * @return JSON对象
* sex:0-女、1-男; * sex:2-女、1-男;
* birthDay:yyyy-MM-dd * birthDay:yyyy-MM-dd
*/ */
export function getBirthdayAndSex(idCard) { export function getBirthdayAndSex(idCard) {
const info = {}; const info = {};
const birth = (idCard.length === 18) ? idCard.slice(6, 14) : idCard.slice(6, 12); const birth =
idCard.length === 18 ? idCard.slice(6, 14) : idCard.slice(6, 12);
// 18位:提取第17位数字;15位:提取最后一位数字 // 18位:提取第17位数字;15位:提取最后一位数字
const order = (idCard.length === 18) ? idCard.slice(-2, -1) : idCard.slice(-1); const order = idCard.length == 18 ? idCard.slice(-2, -1) : idCard.slice(-1);
info.birthDay = (idCard.length === 18) ? ([birth.slice(0, 4), info.birthDay =
birth.slice(4, 6), birth.slice(-2) idCard.length === 18
]).join('-') : ([ ? [birth.slice(0, 4), birth.slice(4, 6), birth.slice(-2)].join('-')
'19' + birth.slice(0, 2), birth.slice(2, 4), : ['19' + birth.slice(0, 2), birth.slice(2, 4), birth.slice(-2)].join(
birth.slice(-2) '-'
]).join('-'); );
// 余数为0代表女性,不为0代表男性 // 余数为0代表女性,不为0代表男性
info.sex = (order % 2 === 0 ? 0 : 1); info.sex = order % 2 === 0 ? 2 : 1;
return info; return info;
} }
/*
*
* */
export const getSearchByName = (name) => {
const match = RegExp(`[?&]${name}=([^&]*)`).exec(window.location.href);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
};
export const getItem = (name) => {
if (!name) return;
const v = sessionStorage.getItem(name);
let val = null;
try {
val = JSON.parse(v);
} catch (e) {
// JSON.parse 失败 后 直接赋v给val;
val = v;
}
return val;
};
export const setItem = (name, value) => {
if (!name) return;
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
sessionStorage.setItem(name, value);
};
export const removeItem = (name) => {
if (!name) return;
sessionStorage.removeItem(name);
};
export const getConfigByEvtType = (key) => {
return ENV_CONFIG[VUE_APP_ENV][key];
};
// 获取SC服务器域名地址
export const getBaseUrl = (url) => {
return `${getConfigByEvtType('baseUrl')}${url}`;
};
export const getShareUrl = (url = '') => {
return `${getConfigByEvtType('shareUrl')}${url}`;
};
export const getClosePageUrl = () => {
return `${getConfigByEvtType('colseUrl')}`;
};
export const getKFAccid = () => {
return `${getConfigByEvtType('kfaccid')}`;
};
/**
* iPhone X、iPhone XS
*/
export const isIPhoneX = () => {
return (
/iphone/gi.test(window.navigator.userAgent) &&
window.devicePixelRatio &&
window.devicePixelRatio === 3 &&
window.screen.width === 375 &&
window.screen.height === 812
);
};
/**
* iPhone XS Max
*/
export const isIPhoneXSMax = () => {
return (
/iphone/gi.test(window.navigator.userAgent) &&
window.devicePixelRatio &&
window.devicePixelRatio === 3 &&
window.screen.width === 414 &&
window.screen.height === 896
);
};
/**
* iPhone XR
*/
export const isIPhoneXR = () => {
return (
/iphone/gi.test(window.navigator.userAgent) &&
window.devicePixelRatio &&
window.devicePixelRatio === 2 &&
window.screen.width === 414 &&
window.screen.height === 896
);
};
// 获取APP版本号(数值型)
export function getAppVersion(appVersion) {
if (!appVersion) return 200;
return appVersion.split('.').join('');
}
// 通用(原生)跳转(到H5页面)
export function gotoPageByNative(vm, pageUrl) {
const paramList = [
{
key: 'pageUrl',
value: pageUrl,
},
];
vm.$rocNative.dispatchEventByModuleCode({
modeCode: 'M300',
jsonString: paramList,
});
}
// 通用(原生)跳转(到原生页面)
export function gotoNativePage(vm, className) {
const paramList = [
{
key: 'className',
value: className,
},
];
vm.$rocNative.dispatchEventByModuleCode({
modeCode: 'M200',
jsonString: paramList,
});
}
// 获取头部高度
export const getHeaderHeight = () => {
return 38 + 36;
};
// 获取状态栏高度(单位:px)
export const getStatusHeight = () => {
this.$rocNative.getStatusBarHeight().then((res) => {
console.log(res, 'getStatusBarHeightgetStatusBarHeight');
return res;
});
};
export const setEventByModuleCode = (itemData, token) => {
const modeCode = itemData.code || '';
let paramList = itemData.paramList ? itemData.paramList : '';
if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = '';
} else if (
modeCode === 'M100' ||
modeCode === 'M300' ||
modeCode === 'M500' ||
modeCode === 'M301'
) {
const urlPara = getUrlParmByCode(paramList, token);
paramList[0] && (paramList[0].value += urlPara);
// 前端拼接了数据,原生不用再拼接
paramList = paramList.slice(0, 1);
}
if (typeof paramList === 'string' && !paramList) {
paramList = [];
}
return paramList;
};
function getUrlParmByCode(paramList, token) {
if (paramList.length <= 1) return `?token=${token}`;
let dataStr = '';
const list = [];
const str =
paramList.length > 0 && paramList[0].value.indexOf('?') > -1 ? '&' : '?';
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + encodeURI(paramList[i].value));
}
dataStr = list.join('&');
if (dataStr !== '') return `${str}${dataStr}&token=${token}`;
return `${str}token=${token}`;
}
/*
* @Author: souse
* @Date: 2019-08-12 18:08:07
* @Last Modified by: souse
* @Last Modified time: 2019-08-13 19:17:00
* @Descript 和app交互的接口调用 单例模式
*/
const ARRAY_CLASS = '[object Array]';
const _toString = Object.prototype.toString;
/**
* set default options
*/
export const JsBridgeOptions = {
GLOBAL_NAME: 'rocNative',
NATIVE_IOS_NAME: 'rociOS',
NATIVE_ANDROID_NAME: '__rocAndroid',
initMethodsWithCallBack: [
'getToken',
'getAppVersionCode',
'upGradeVersion',
'getUserInfo',
'getLocalData',
'getStatusBarHeight',
'checkPermissions',
'getRecentContacts',
'openMiniProgram',
], // value is string
initMethodsWithoutCallBack: [
'gotoLogin',
'appInit',
'goBack',
'shareWechat',
'showNativeToast',
'dispatchEventByModuleCode',
'appBuryingPointEntrust',
'webLoadSuccess',
'sendBuriedPoint',
'openErrorDebug',
'showProgress',
'closeWebViewPath',
'uploadVideo',
'openVideo',
'openImSession',
'openImTeamSession',
], // value is string
};
/**
* @description
* @author souse
* @date 2019-08-12
* @export
* @class PicaJsBridge
*/
export default class PicaJsBridge {
constructor(options = JsBridgeOptions) {
const initMethodsWithCallBack = options.initMethodsWithCallBack;
const initMethodsWithoutCallBack = options.initMethodsWithoutCallBack;
this._callbakFns = {};
this._callbackId = 0;
this._GLOBAL_NAME = options.GLOBAL_NAME;
this._NATIVE_IOS_NAME = options.NATIVE_IOS_NAME;
this._NATIVE_ANDROID_NAME = options.NATIVE_ANDROID_NAME;
this.isIOS = this._isIos();
this.isAndroid = this._isAndroid();
this.isWeb = this._isWeb();
if (
_toString.call(initMethodsWithCallBack) === ARRAY_CLASS &&
initMethodsWithCallBack.length !== 0
) {
this.registerMethods(initMethodsWithCallBack, true);
}
if (
_toString.call(initMethodsWithoutCallBack) === ARRAY_CLASS &&
initMethodsWithoutCallBack.length !== 0
) {
this.registerMethods(initMethodsWithoutCallBack, false);
}
this.mountToWindow();
}
// is ios flag
_isIos() {
return !!(
window.webkit &&
window.webkit.messageHandlers &&
window.webkit.messageHandlers[this._NATIVE_IOS_NAME]
);
}
// is android flag
_isAndroid() {
return !!window[this._NATIVE_ANDROID_NAME];
}
// is web flag
_isWeb() {
return !this.isIOS && !this.isAndroid;
}
// register method width callback in window
_registerMethod(method) {
const _this = this;
_this[method] = (param) => {
return new Promise((response, reject) => {
_this._callNative(method, param, function (result) {
response(result);
})
? void 0
: reject(`${method} not handled.`);
});
};
}
// register method widthout callback in window
_registerMethodWithoutMethod(method) {
const _this = this;
_this[method] = (param) => {
return new Promise((response, reject) => {
_this._callNative(method, param, null)
? response('success')
: reject(`${method} not handled.`);
});
};
}
// window call app method
_callNative(name, param, callbackFn) {
let callbackId = 0;
let pm = '';
if (typeof callbackFn === 'function') {
this._callbackId++;
callbackId = this._callbackId;
this._callbakFns[callbackId] = callbackFn;
}
pm = JSON.stringify({
name,
callbackId: callbackId ? callbackId.toString() : '',
param: param || {},
});
if (this.isAndroid) {
window[this._NATIVE_ANDROID_NAME].postMessage(pm);
return true;
}
if (this.isIOS) {
window.webkit.messageHandlers[this._NATIVE_IOS_NAME].postMessage(pm);
return true;
}
return false;
}
// app call window method
__nativeCall(name, callbackId, result) {
const wFun = window[callbackId];
const fun = callbackId && this._callbakFns[callbackId];
if (wFun && typeof wFun === 'function') {
wFun(result);
return;
}
delete this._callbakFns[callbackId];
if (fun && typeof fun === 'function') fun(result);
}
// batch register methods
registerMethods(methods = [], widthCallback) {
if (undefined === widthCallback)
throw Error(
'widthCallback flag not defined, registerMethods should take second param value(true/false) for is not has callback.'
);
methods.forEach((m) => {
widthCallback === true
? this._registerMethod(m)
: this._registerMethodWithoutMethod(m);
});
}
// async call app method do not need register
asyncCallNative(method, param) {
const _this = this;
return new Promise((resolve) => {
_this._callNative(method, param, function (result) {
resolve(result);
});
});
}
// call app method direct without register and callback
callNative(method, param) {
return this._callNative(method, param, null);
}
// register jsbridge to window
mountToWindow() {
window[this._GLOBAL_NAME] = this;
}
}
export const getPhoneParameters = () => {
};
export const ifLYStartSpeechToText = () => {
};
export const ifLYStopSpeechToText = () => {
};
// export const appInterface = (callName, params, functionName) => {
// const rocNative = new PicaJsBridge();
// return rocNative.getAppVersionCode().then(res => {
// if (res.versionCode < '3.7.8') {
// Promise.reject();
// } else {
// window.prompt(callName, parmas)
// }
// });
// };
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
</style> </style>
<script> <script>
import storejs from 'storejs';
import picaHeader from '@/components/stroke/picaHeader' import picaHeader from '@/components/stroke/picaHeader'
import examHistory from '@/components/stroke/examHistory' import examHistory from '@/components/stroke/examHistory'
import { getCoopExamResultNews ,getCoopResultNewsLocal} from '@/api/exam.js'; import { getCoopExamResultNews ,getCoopResultNewsLocal} from '@/api/exam.js';
...@@ -31,16 +32,17 @@ ...@@ -31,16 +32,17 @@
isPassExam: false, isPassExam: false,
showHeaderH:false, showHeaderH:false,
historyList:[], historyList:[],
examType: '' examType: '',
token:""
}), }),
computed: { computed: {
}, },
components:{picaHeader,examHistory}, components:{picaHeader,examHistory},
created () { created () {
// this.historyList = this.$route.query.historyList // this.historyList = this.$route.query.historyList
this.id = this.$route.query.examId this.id = this.$route.query.examId;
this.token=storejs.get('token');
this.init() this.init()
}, },
methods: { methods: {
init(){ init(){
...@@ -48,7 +50,7 @@ ...@@ -48,7 +50,7 @@
if(this.$route.query.examType == 'local'){ if(this.$route.query.examType == 'local'){
funCoop=getCoopResultNewsLocal funCoop=getCoopResultNewsLocal
} }
funCoop({examId:this.id}).catch(res=>{ funCoop({examId:this.id,token:this.token}).catch(res=>{
this.historyList = res.data.examRecordList this.historyList = res.data.examRecordList
this.historyList.map(res=>{ this.historyList.map(res=>{
res.createdTime = res.createdTime.substring(0,10) res.createdTime = res.createdTime.substring(0,10)
......
...@@ -116,7 +116,6 @@ ...@@ -116,7 +116,6 @@
// import WxcLoading from '../../components/wxc-loading' // import WxcLoading from '../../components/wxc-loading'
//let modal = weex.requireModule('modal') //let modal = weex.requireModule('modal')
//import WxcLoading from '../../components/wxc-loading' //import WxcLoading from '../../components/wxc-loading'
import storejs from 'storejs';
import { getCoopExamWrongRecords} from '@/api/exam.js'; import { getCoopExamWrongRecords} from '@/api/exam.js';
export default { export default {
//components: { WxcLoading }, //components: { WxcLoading },
...@@ -127,13 +126,13 @@ ...@@ -127,13 +126,13 @@
wrongNum: '', wrongNum: '',
headBg: '#ffffff', headBg: '#ffffff',
headHeight: 0, headHeight: 0,
token:"FFA8F78823F44BEC86E5BD816BDA73D5" token:""
}), }),
computed: { computed: {
}, },
created () { created () {
this.token=storejs.get('token'); this.token=this.$storejs.get('token');
this.init() this.init();
}, },
methods: { methods: {
init() { init() {
......
...@@ -215,7 +215,6 @@ ...@@ -215,7 +215,6 @@
</style> </style>
<script> <script>
import storejs from 'storejs';
//import { WxcButton, WxcMinibar, WxcCountdown } from 'weex-ui' //import { WxcButton, WxcMinibar, WxcCountdown } from 'weex-ui'
// import WxcLoading from '../../components/wxc-loading' // import WxcLoading from '../../components/wxc-loading'
import PicaRadio from '@/components/pica-radio' import PicaRadio from '@/components/pica-radio'
...@@ -257,13 +256,13 @@ export default { ...@@ -257,13 +256,13 @@ export default {
borderRadius: 0, borderRadius: 0,
backgroundColor: '#58b5a8', backgroundColor: '#58b5a8',
}, },
token:"FFA8F78823F44BEC86E5BD816BDA73D5" token:""
} }
}, },
computed: { computed: {
}, },
created () { created () {
this.token= storejs.get('token'); this.token=this.$storejs.get('token');
this.startNum = this.$route.query.startNum || -1 this.startNum = this.$route.query.startNum || -1
this.init(); this.init();
// weex.requireModule('globalEvent').addEventListener("goPreviousPage", e=> {//监听物理返回上一页 // weex.requireModule('globalEvent').addEventListener("goPreviousPage", e=> {//监听物理返回上一页
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
</style> </style>
<script> <script>
import storejs from 'storejs';
import picaHeader from '@/components/stroke/picaHeader' import picaHeader from '@/components/stroke/picaHeader'
import livesExamHistory from "@/components/stroke/livesExamHistory"; import livesExamHistory from "@/components/stroke/livesExamHistory";
import { getCoopLiveExam } from '@/api/storke.js'; import { getCoopLiveExam } from '@/api/storke.js';
...@@ -42,8 +41,7 @@ ...@@ -42,8 +41,7 @@
livesExamHistory, livesExamHistory,
picaHeader}, picaHeader},
created () { created () {
this.token=storejs.get("token"); this.token=this.$storejs.get('token');
// this.historyList = this.$route.query.historyList
this.id = this.$route.query.projectId this.id = this.$route.query.projectId
this.init() this.init()
}, },
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
} }
</style> </style>
<script> <script>
import storejs from 'storejs';
import examInfo from '@/components/stroke/examInfo' import examInfo from '@/components/stroke/examInfo'
import examHistory from '@/components/stroke/examHistory' import examHistory from '@/components/stroke/examHistory'
import picaHeader from '@/components/stroke/picaHeader' import picaHeader from '@/components/stroke/picaHeader'
...@@ -55,7 +54,7 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex ...@@ -55,7 +54,7 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex
//WxcLoading //WxcLoading
}, },
created () { created () {
this.token=storejs.get('token'); this.token=this.$storejs.get('token');
this.examId = this.$route.query.examId this.examId = this.$route.query.examId
this.from = this.$route.query.from this.from = this.$route.query.from
this.showHeader = this.from != 'exam' this.showHeader = this.from != 'exam'
...@@ -75,9 +74,16 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex ...@@ -75,9 +74,16 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex
if (this.from !== "exam" && !(this.answerResultId > 0)){//开始页面 if (this.from !== "exam" && !(this.answerResultId > 0)){//开始页面
this.type = 2 this.type = 2
getCoopExam({"examId":this.examId, "type": 5,token:this.token}).catch(res=>{ getCoopExam({"examId":this.examId, "type": 5,token:this.token}).catch(res=>{
if (res.data && res.data.respCode == 200){ if(res.data){
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
};
if(res.data.respCode == 200){
this.exam = res.data.examBaseInfo this.exam = res.data.examBaseInfo
}else { }
}else{
this.hasWrong = true; this.hasWrong = true;
this.$toast(res.data.respMsg) this.$toast(res.data.respMsg)
} }
...@@ -85,44 +91,45 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex ...@@ -85,44 +91,45 @@ import { getCoopExam ,getCoopExamResultNew,getCoopExamResultNews} from '@/api/ex
}else{//结果页面 }else{//结果页面
this.hasWrong = false; this.hasWrong = false;
getCoopExamResultNew({answerResultId:this.answerResultId, type: 5,token:this.token}).catch(res=>{ getCoopExamResultNew({answerResultId:this.answerResultId, type: 5,token:this.token}).catch(res=>{
if (res.data && res.data.respCode == 200){ if(res.data){
if (res.data.respCode == 200){
// weex.requireModule('CourseModule').finishTest(res.data) // weex.requireModule('CourseModule').finishTest(res.data)
this.exam = res.data.answerResult this.exam = res.data.answerResult
this.type = this.exam.passFlag == 5 ? 1 : 0 this.type = this.exam.passFlag == 5 ? 1 : 0;
}else { }else if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
}else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
}else{
this.hasWrong = true;
this.$toast(res.data.respMsg)
}
}else{
this.hasWrong = true; this.hasWrong = true;
this.$toast(res.data.respMsg) this.$toast(res.data.respMsg)
} }
}); });
// this.GET('app/projectExam/result',{answerResultId:this.answerResultId, type: 5},res=>{
// if (res.data && res.data.respCode == 200){
// weex.requireModule('CourseModule').finishTest(res.data)
// this.exam = res.data.answerResult
// this.type = this.exam.passFlag == 5 ? 1 : 0
// }else {
// this.hasWrong = true;
// modal.toast({
// message: res.data.respMsg,
// duration: 1.0
// })
// }
// })
} }
this.hasWrong = false; this.hasWrong = false;
getCoopExamResultNews({examId:this.examId,pageNo:1,pageSize:3, type: 5,token:this.token}).catch(res=>{ getCoopExamResultNews({examId:this.examId,pageNo:1,pageSize:3, type: 5,token:this.token}).catch(res=>{
this.isShow = false this.isShow = false
if (res.data && res.data.respCode == 200){ if(res.data){
if (res.data.respCode == 200){
this.historyList = res.data.examRecordList this.historyList = res.data.examRecordList
this.historyList.map(res=>{ this.historyList.map(res=>{
res.createdTime = res.createdTime.substring(0,10) res.createdTime = res.createdTime.substring(0,10)
}) })
}else { }else if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
}else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
}else{
this.hasWrong = true;
this.$toast(res.data.respMsg)
}
}else{
this.hasWrong = true; this.hasWrong = true;
this.$toast(res.data.respMsg) this.$toast(res.data.respMsg)
// modal.toast({
// message: res.data.respMsg,
// duration: 1.0
// })
} }
}) })
// this.GET('app/projectExam/results',{examId:this.examId,pageNo:1,pageSize:3, type: 5},res=>{ // this.GET('app/projectExam/results',{examId:this.examId,pageNo:1,pageSize:3, type: 5},res=>{
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
// let storage = weex.requireModule('storage') // let storage = weex.requireModule('storage')
//import WxcDialog from '../components/wxc-dialog' //import WxcDialog from '../components/wxc-dialog'
import storejs from 'storejs';
import componentMain from '@/components/stroke/componentMain'; import componentMain from '@/components/stroke/componentMain';
import CommonHeader from '@/components/common/header'; import CommonHeader from '@/components/common/header';
import livesExamHistory from "@/components/stroke/livesExamHistory"; import livesExamHistory from "@/components/stroke/livesExamHistory";
...@@ -90,7 +88,7 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -90,7 +88,7 @@ import { getCoopExamResult } from '@/api/exam.js';
needMarginBottom: false, needMarginBottom: false,
marginBottom: '0px', marginBottom: '0px',
parms:{ parms:{
id: 4, token: "F693C3AF6D344B7B825D8CC39D495D8E" id: 4, token: "6A713648AB954CAEAE6B39265F624B52"
}, },
flagLoading:0, flagLoading:0,
title:"", title:"",
...@@ -115,11 +113,22 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -115,11 +113,22 @@ import { getCoopExamResult } from '@/api/exam.js';
this.allowFlag = this.$route.query.allowFlag || 1; this.allowFlag = this.$route.query.allowFlag || 1;
this.projectId = this.$route.query.projectId || 2; this.projectId = this.$route.query.projectId || 2;
this.parms.id = this.projectId; this.parms.id = this.projectId;
let _that = this;
//this.parms.token = this.$route.query.token || ''; this.$rocNative.getUserInfo()
.then((res) => {
storejs.set('token',this.parms.token); let token=""
if (res.userToken) {
token=res.userToken
} else {
token=_that.$route.query.token
}
_that.parms.token = token;
_that.$storejs.set('token', token);
this.init(); this.init();
})
.catch(() => {
this.init();
});
}, },
mounted() { mounted() {
// globalEvent.addEventListener("dataOkForExam",() => { // globalEvent.addEventListener("dataOkForExam",() => {
...@@ -133,9 +142,6 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -133,9 +142,6 @@ import { getCoopExamResult } from '@/api/exam.js';
window.addEventListener('scroll', this.scrollToTop) window.addEventListener('scroll', this.scrollToTop)
}, },
beforeDestroy() {
// modal.alert({message: 'i am in destroyed'})
},
methods: { methods: {
scrollToTop() { scrollToTop() {
var scrollTop = window.pageYOffset || document.documentElement. scrollTop || document.body.scrollTop; var scrollTop = window.pageYOffset || document.documentElement. scrollTop || document.body.scrollTop;
...@@ -305,6 +311,11 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -305,6 +311,11 @@ import { getCoopExamResult } from '@/api/exam.js';
if (this.flagLoading !=5) { if (this.flagLoading !=5) {
this.flagLoading=this.flagLoading + 1 this.flagLoading=this.flagLoading + 1
} }
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
};
this.infoLists = res.data.texts; // 简介(文案)组件 this.infoLists = res.data.texts; // 简介(文案)组件
this.sliderLists = res.data.carousels; // 轮播图组件 this.sliderLists = res.data.carousels; // 轮播图组件
this.projectName = res.data.projectName; // 项目名称 this.projectName = res.data.projectName; // 项目名称
...@@ -317,6 +328,11 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -317,6 +328,11 @@ import { getCoopExamResult } from '@/api/exam.js';
getBottom() { getBottom() {
getCoopBottom(this.parms).catch((res) => { getCoopBottom(this.parms).catch((res) => {
if (res && res.data) { if (res && res.data) {
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
};
if (this.flagLoading !=5) { if (this.flagLoading !=5) {
this.flagLoading=this.flagLoading + 1 this.flagLoading=this.flagLoading + 1
} }
...@@ -336,6 +352,11 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -336,6 +352,11 @@ import { getCoopExamResult } from '@/api/exam.js';
getCoopMiddle(this.parms).catch((res) => { getCoopMiddle(this.parms).catch((res) => {
this.isShow = false; this.isShow = false;
if (res && res.data) { if (res && res.data) {
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
};
if (this.flagLoading !=5) { if (this.flagLoading !=5) {
this.flagLoading=this.flagLoading + 1 this.flagLoading=this.flagLoading + 1
} }
...@@ -408,10 +429,14 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -408,10 +429,14 @@ import { getCoopExamResult } from '@/api/exam.js';
const _self = this; const _self = this;
getCoopLiveExam(this.parms).catch((res) => { getCoopLiveExam(this.parms).catch((res) => {
if (res && res.data) { if (res && res.data) {
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
}
if (this.flagLoading !=5) { if (this.flagLoading !=5) {
this.flagLoading=this.flagLoading + 1 this.flagLoading=this.flagLoading + 1
} }
console.log(111,res.data.pLiveMapping)
this.pLiveMapping = res.data.pLiveMapping; this.pLiveMapping = res.data.pLiveMapping;
if (res.data.pLiveExamList && res.data.pLiveExamList.length) { if (res.data.pLiveExamList && res.data.pLiveExamList.length) {
this.localHistoryList = res.data.pLiveExamList; this.localHistoryList = res.data.pLiveExamList;
...@@ -428,6 +453,11 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -428,6 +453,11 @@ import { getCoopExamResult } from '@/api/exam.js';
//const _self = this; //const _self = this;
getCoopOrder(this.parms).catch((res) => { getCoopOrder(this.parms).catch((res) => {
if (res && res.data) { if (res && res.data) {
if (res.data.respCode == 1000) {
return this.$toast(res.data.respMsg);
} else if (res.data.respCode == 401 || res.data.respCode == 404) {
return this.$rocNative.gotoLogin();
}
// 组件type // 组件type
// module_type:1、轮播图组件 5、文案组件 10、考试组件 15、关联课程组件 20、链接组件 25、现场考试组件 // module_type:1、轮播图组件 5、文案组件 10、考试组件 15、关联课程组件 20、链接组件 25、现场考试组件
if (this.flagLoading !=5) { if (this.flagLoading !=5) {
...@@ -558,6 +588,13 @@ import { getCoopExamResult } from '@/api/exam.js'; ...@@ -558,6 +588,13 @@ import { getCoopExamResult } from '@/api/exam.js';
wxcMaskSetHidden () { wxcMaskSetHidden () {
// 此处必须设置,组件为无状态组件,自己管理 // 此处必须设置,组件为无状态组件,自己管理
this.showCodeInputDialog = false; this.showCodeInputDialog = false;
},
consulOrder() {
try {
this.$rocNative.goBack();
} catch (error) {
this.$router.go(-1);
}
} }
}, },
......
...@@ -1212,7 +1212,7 @@ ...@@ -1212,7 +1212,7 @@
"cheerio" "^1.0.0-rc.10" "cheerio" "^1.0.0-rc.10"
"colors-console" "^1.0.3" "colors-console" "^1.0.3"
"@pica-core/web-buried-point@^1.0.15": "@pica-core/web-buried-point@^1.0.20":
"integrity" "sha512-wr/GZlpPWZr8U0Y+YIx4brzazGj1AKnBL0kH/lI3/CVX+8d4cGFrn/Pv6j56DyyZ58hbGbsdJmlbJ/4L+qz/Qw==" "integrity" "sha512-wr/GZlpPWZr8U0Y+YIx4brzazGj1AKnBL0kH/lI3/CVX+8d4cGFrn/Pv6j56DyyZ58hbGbsdJmlbJ/4L+qz/Qw=="
"resolved" "http://192.168.110.93:4873/@pica-core%2fweb-buried-point/-/web-buried-point-1.0.20.tgz" "resolved" "http://192.168.110.93:4873/@pica-core%2fweb-buried-point/-/web-buried-point-1.0.20.tgz"
"version" "1.0.20" "version" "1.0.20"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册