提交 0e0bc636 authored 作者: 王鹏飞's avatar 王鹏飞

merge...

.DS_Store
node_modules
npm-debug.log
upload_tmp
build-dist
vue-dist
dist
dist.zip
client-dist
# code protect - prevent submit code below
.vscode
module.exports = {
demain: 'dev.ezijing.com',
domain: 'dev.ezijing.com',
url: 'https://bluestar-learning2.ezijing.com/api',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
url: '/app/learn/course',
loginUrl: 'https://login2.ezijing.com/bluestar/login/index'
},
webpack: {
externals: {
......
......@@ -3,7 +3,8 @@ module.exports = {
DesDir: '../client-dist',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
url: '/app/learn/course',
loginUrl: 'https://login.ezijing.com/bluestar/login/index'
},
webpack: {
externals: {
......
......@@ -3,7 +3,8 @@ module.exports = {
DesDir: '../client-dist',
apiBaseURL: '/',
others: {
url: '/app/learn/course'
url: '/app/learn/course',
loginUrl: 'https://login2.ezijing.com/bluestar/login/index'
},
isUploadStatic: false,
webpack: {
......
.DS_Store
node_modules
npm-debug.log
build-dist
vue-dist
dist
dist.zip
# code protect - prevent submit code below
.vscode
# 根据项目框架 - 记录新增模块 与 修改
* bootstrap - npm 模块安装
* js-md5 - npm 模块安装
* `'VideoJs': 'window.swfobject'` - webpack externals 引入
* `'Base64': 'window.Base64'` - webpack externals 引入
* `'sentNotify': 'window.sentNotify'` - webpack externals 引入
* `'Aliplayer': 'window.Aliplayer'` - webpack externals 引入
* `'AliPlayerComponent': 'window.AliPlayerComponent'` - webpack externals 引入
* `'@services': path.resolve(__dirname, '../client/components/services')` - webpack alias 引入
* `'@tools': path.resolve(__dirname, '../client/components/tools')` - webpack alias 引入
* `'@actions': path.resolve(__dirname, '../client/project/actions')` - webpack alias 引入
* build/config.js 文件中 配置 可修改
* 代理请求 /api 继续使用
* 打包 到对应的 server目录下
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.12.0</center>
</body>
</html>
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.12.0</center>
</body>
</html>
var semver = require('semver')
var requiredVersion = require('../package.json').engines.node
function checkNodeVersion (wanted, id) {
if (!semver.satisfies(process.version, wanted)) {
console.log('\x1b[91m%s\x1B[0m',
'You are using Node ' + process.version + ', but this version of ' + id +
' requires Node ' + wanted + '.\nPlease upgrade your Node version.'
)
process.exit(1)
}
}
checkNodeVersion(requiredVersion, '`node uploadAliyunCDN.js`')
const isDev = process.env.NODE_ENV
const RegStrs = require('./regExpStr.js')
let config = {
isDev: isDev,
......@@ -12,6 +13,8 @@ let config = {
isHttps: true,
isEnableToIphoneDebugger: false,
CDN_BASE: 'https://zws-imgs-pub.ezijing.com/',
CDN_DIR: 'static/build/learn-bluestar/',
isUploadStatic: false,
......@@ -19,10 +22,12 @@ let config = {
webpack: {}
}
config.RegStrs = RegStrs
let vueClientConfig = {}
config.domain = 'dev.ezijing.com'
config.domain = ''
if (config.isDev === 'development') {
config.url = 'http://dev.ezijing.com:12002'
config.url = 'http://' + config.domain + ':12002'
try {
vueClientConfig = require('../.config.dev.js')
} catch (error) {
......
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAgddAmdjWL+4JUXvmiR/lr9cbdoctEGLwdLpnIrRlL/oVKubZ
TrASed5pA2kHKUbbV9i64iNIzn668ziytivudRiuGL4wBTPdtlpkSty9ij0ZHZXe
23oWQ73fV3FNROp3ekLmIYHqo2ep5hhfq1A4Sey7IM1Z0A9OF6MV7Tgqm+8a6Fy4
eNbgx99f0n7nquGjYZ3RcnU0j6xzfQhOqOYmhk4flQqSx6Mb6sSmWM7V4/h/554L
QyJNV3ngNfT3ZFmAmhIZt7n+o3svzIqwghiZSj0K9jyE7zbSZjVUBEQztFUcfYgP
ZQfZFFsdgIkFSvR3cXIpIiN8oPf8xK6naApOXwIDAQABAoIBAHKlKKJvZvgdO1ca
ir1rT7jKu7IVu4GritvWtzhahrotHEGsYhZru3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2lDZXJ0R2xvYmFsUm9vdENBLmNybDBMBgNVHSAERTBDMDcGCWCGSAGG
/WwBAjAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BT
MAgGBmeBDAECATANBgkqhkiG9w0BAQsFAAOCAQEAK3Gp6/aGq7aBZsxf/oQ+TD/B
SwW3AU4ETK+GQf2kFzYZkby5SFrHdPomunx2HBzViUchGoofGgg7gHW0W3MlQAXW
M0r5LUvStcr82QDWYNPaUy4taCQmyaJ+VB+6wxHstSigOlSNF2a6vg4rgexixeiV
4YSB03Yqp2t3TeZHM9ESfkus74nQyW7pRGezj+TC44xCagCQQOzzNmzEAP2SnCrJ
sNE2DpRVMnL8J6xBRdjmOsC3N6cQuKuRXbzByVBjCqAA8t1L0I+9wXJerLPyErjy
rMKWaBFLmfK/AHNF4ZihwPGOc7w6UHczBZXH5RFzJNnww+WnKuTPI0HfnVH8lg==
-----END CERTIFICATE-----
const fs = require('fs')
const path = require('path')
const request = require('request')
const _conf = require('./config')
fs.writeFileSync(path.join(__dirname, _conf.domain + '.key'), '', { encoding: 'utf8', mode: 0o755 })
fs.writeFileSync(path.join(__dirname, _conf.domain + '.pem'), '', { encoding: 'utf8', mode: 0o755 })
request('https://ssl.godzyx.com/' + _conf.domain + '/' + _conf.domain + '.key?get=allow').pipe(fs.createWriteStream(path.join(__dirname, _conf.domain + '.key')))
request('https://ssl.godzyx.com/' + _conf.domain + '/' + _conf.domain + '.pem?get=allow').pipe(fs.createWriteStream(path.join(__dirname, _conf.domain + '.pem')))
/* 由于正则表达式,不能进行跟 gulpfile 中 去注释 在一起 */
module.exports = {
regExp_static: /('|"|`)[\.|\/]*?static\/(.*?\.(png|jpe?g|gif|svg|ico)(\?.*)?)\1/g
}
const _conf = require('./config')
module.exports = function (source) {
if (_conf.isDev !== 'development') {
return source
.replace(_conf.RegStrs.regExp_static, '$1' + _conf.CDN_BASE + _conf.CDN_DIR + 'static/$2$1')
} else {
return source
}
}
/**
* 本文件执行,需要 node -v >= v8.11.3
* 原因:其中使用很多es6新特性,需要高版本才能直接识别并运行
* 放服务器上 上传慢,而且经常报错(没找到原因),最后改为打包完成后自动上传不在服务器上deploy时再上传了
*/
const fs = require('fs')
const path = require('path')
// 这个包本身也是用es6语法写的,低版本node编译解析不了
const OSS = require('ali-oss')
const conf = require('./config')
......@@ -18,23 +13,22 @@ const client = new OSS({
bucket: 'zws-imgs-pub'
})
/* 定位到对应 public目录下 */
const headers = {
'x-oss-traffic-limit': 8 * 1024 * 100 * 100
}
const DIR_PATH = path.join(__dirname, '../' + conf.DesDir)
/* 上传对应目录 */
const PREFIX_PATH = conf.CDN_DIR
/* 是否上传static目录 */
const isUploadStatic = conf.isUploadStatic
let fileCount = 1
/**
* 调用接口,单个文件上传
* @param {string} dirPath 传入对应需要遍历的路径
* @param {function} callback 加入一个回调方法,执行文件上传
*/
async function uploadFile (prefixPath, dirFileName) {
try {
const upFilePath = prefixPath.replace(new RegExp(DIR_PATH, 'gi'), '') + path.basename(dirFileName)
let result = await client.put(prefixPath + path.basename(dirFileName), dirFileName)
const result = await client.put(prefixPath + path.basename(dirFileName), dirFileName, {
headers,
timeout: 600000
})
if (result.res.status === 200) {
console.log('第' + fileCount++ + '个文件,已上传:' + conf.CDN_BASE + upFilePath)
return { status: 200 }
......@@ -45,24 +39,14 @@ async function uploadFile (prefixPath, dirFileName) {
}
}
/**
* 循环遍历文件,准备上传文件
* 原生js 遍历方法
* @param {string} dirPath 传入对应需要遍历的路径
* @param {function} callback 加入一个回调方法,执行文件上传
*/
function uploadfiles (dirPath, callback) {
/* 根据文件路径读取文件 */
const files = fs.readdirSync(dirPath)
files.forEach(function (filename, i) {
const filedir = path.join(dirPath, filename)
const info = fs.statSync(filedir)
if (info.isDirectory()) {
/* 确定是否上传 */
if (!(isUploadStatic ? true : filename !== 'static')) { return }
/* 得到对应目录结构 */
const morePath = filedir.replace(new RegExp(DIR_PATH, 'gi'), '') + '/'
/* 递归,如果是文件夹,就继续遍历该文件夹下面的文件 */
uploadfiles(filedir, function (filedir) {
uploadFile(path.join(PREFIX_PATH, morePath), filedir)
})
......@@ -77,5 +61,4 @@ function uploadfiles (dirPath, callback) {
return true
}
/* 批量上传文件 */
uploadfiles(DIR_PATH, null)
......@@ -7,6 +7,7 @@ const _conf = require('./config')
const $GLOBAL = {
isDev: _conf.isDev,
ResDir: _conf.ResDir,
'isEnableToIphoneDebugger': _conf.isEnableToIphoneDebugger,
templatePath: path.resolve(__dirname, '../' + _conf.HtmlPath),
icoPath: _conf.IcoPath,
......@@ -21,9 +22,12 @@ const $GLOBAL = {
EntryStaticPath: path.resolve(__dirname, '../' + 'static'),
OutputStaticPath: path.resolve(__dirname, '../' + _conf.DesDir + '/static'),
RegStrs: _conf.RegStrs,
webConf: {
'isDev': _conf.isDev,
'serverPort': process.env.SERVER_PORT || 8000,
'isEnableToIphoneDebugger': _conf.isEnableToIphoneDebugger,
'domain': _conf.domain,
'url': _conf.url,
'isHttps': _conf.isHttps,
......@@ -50,7 +54,8 @@ $GLOBAL.BaseConfig = {
'@api': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/api'),
'@action': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/action'),
'@tool': path.resolve(__dirname, '../' + $GLOBAL.ResDir + '/tool')
}
},
extensions: ['.js', '.json', '.jsx', '.vue']
},
module: {
rules: [
......@@ -60,6 +65,12 @@ $GLOBAL.BaseConfig = {
exclude: /node_modules/,
enforce: 'pre'
},
{
test: /\.(vue|js|jsx)|((sa|sc|c)ss)$/,
loader: './build/stringReplaceLoader.js',
exclude: /node_modules/,
enforce: 'pre'
},
{
test: /\.vue$/,
loader: 'vue-loader'
......@@ -69,10 +80,32 @@ $GLOBAL.BaseConfig = {
exclude: /(node_modules)|(dist)/,
loader: 'babel-loader',
options: {
presets: ['env', 'stage-2'],
presets: [[
'@babel/preset-env',
{
"targets": {
"browsers": [
"last 2 versions",
"ie >= 11"
],
},
corejs: '3.6.5',
useBuiltIns: 'usage'
}
]],
plugins: [
'transform-vue-jsx',
'syntax-dynamic-import'
'@babel/plugin-syntax-jsx',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
[
'@babel/plugin-transform-runtime',
{
corejs: 3,
helpers: true,
regenerator: true,
useESModules: false
}
]
]
}
},
......
......@@ -9,7 +9,9 @@ const VueLoaderPlugin = require('vue-loader/lib/plugin')
const AutoPrefixer = require('autoprefixer')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const VconsoleWebpackPlugin = require('vconsole-webpack-plugin')
const $GLOBAL = require('./webpack.base.conf')
......@@ -26,9 +28,10 @@ if ($GLOBAL.isDev === 'development') {
port: $GLOBAL.webConf.serverPort,
disableHostCheck: false,
host: $GLOBAL.webConf.domain || 'localhost',
http2: false,
https: $GLOBAL.webConf.isHttps && {
key: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.key')),
cert: fs.readFileSync(path.join(__dirname, '../static/cert/dev.ezijing.com.pem'))
key: fs.readFileSync(path.join(__dirname, $GLOBAL.webConf.domain + '.key')),
cert: fs.readFileSync(path.join(__dirname, $GLOBAL.webConf.domain + '.pem'))
},
overlay: {
errors: true
......@@ -77,7 +80,7 @@ if ($GLOBAL.isDev === 'development') {
}
},
{
loader: 'sass-loader', // 不再使用本身默认 node-sass,部分mac安装有问题。
loader: 'sass-loader',
options: {
implementation: require('dart-sass')
}
......@@ -92,6 +95,10 @@ if ($GLOBAL.isDev === 'development') {
template: $GLOBAL.templatePath,
inject: true,
favicon: $GLOBAL.icoPath
}),
new VconsoleWebpackPlugin({
filter: [],
enable: $GLOBAL.isEnableToIphoneDebugger
})
]
})
......@@ -100,7 +107,7 @@ if ($GLOBAL.isDev === 'development') {
mode: 'production',
entry: {
app: $GLOBAL.EntryPath,
vendor: ['vue', 'vue-router']
vendor: ['vue', 'vue-router', 'vue-i18n']
},
module: {
rules: [{
......@@ -128,7 +135,7 @@ if ($GLOBAL.isDev === 'development') {
}
},
{
loader: 'sass-loader', // 不再使用本身默认 node-sass,部分mac安装有问题。
loader: 'sass-loader',
options: {
implementation: require('dart-sass')
}
......@@ -152,6 +159,12 @@ if ($GLOBAL.isDev === 'development') {
collapseWhitespace: true
}
}),
new HtmlReplaceWebpackPlugin([
{
pattern: $GLOBAL.RegStrs.regExp_static,
replacement: '$1' + $GLOBAL.webConf.CDN_PATH + 'static/$2$1'
}
]),
new CopyWebpackPlugin([
{
from: $GLOBAL.EntryStaticPath,
......@@ -161,7 +174,11 @@ if ($GLOBAL.isDev === 'development') {
return content
}
}
])
]),
new VconsoleWebpackPlugin({
filter: [],
enable: $GLOBAL.isEnableToIphoneDebugger
})
],
optimization: {
runtimeChunk: {
......@@ -170,27 +187,19 @@ if ($GLOBAL.isDev === 'development') {
splitChunks: {
chunks: 'async',
minSize: 30000,
maxSize: 400000, // 大于400kb 会再进行拆分,可以进行优化时,添加
maxSize: 400000,
minChunks: 1,
maxAsyncRequests: 5, // 按需加载块时并行请求的最大数量
maxInitialRequests: 3, // 初始页面加载时并行请求的最大数量
maxAsyncRequests: 5,
maxInitialRequests: 3,
name: false,
cacheGroups: {
vendor: { // 将所有node_modules中模块 js打包到一起,并拆分
vendor: {
name: 'vendor',
chunks: 'initial',
priority: -10,
reuseExistingChunk: false,
test: /node_modules\/(.*)\.js/
},
// styles: { // 将所有node_modules中模块 css、scss打包到一起,并拆分,暂时没用,还在研究
// name: 'styles',
// test: /node_modules\/\.(sa|sc|c)ss$/,
// chunks: 'all',
// minChunks: 1,
// reuseExistingChunk: true,
// enforce: true
// }
}
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "@god/vue-client",
"version": "3.0.5",
"description": "bluestar - 学习系统",
"version": "3.0.14",
"description": "适应于公司全系统的纯客户端开发模型",
"main": "index.js",
"scripts": {
"lint": "eslint --ext .js --ext .jsx --ext .vue src/",
"lint:fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/",
"dev": "cross-env NODE_ENV=development SERVER_PORT=3001 webpack-dev-server --inline --progress --config build/webpack.client.conf.js",
"build:test": "cross-env NODE_ENV=test webpack --progress --config build/webpack.client.conf.js && cross-env NODE_ENV=test n use 8.11.3 ./build/uploadAliyunCDN.js",
"build:pro": "cross-env NODE_ENV=production webpack --progress --config build/webpack.client.conf.js && cross-env NODE_ENV=production n use 8.11.3 ./build/uploadAliyunCDN.js"
"dev": "npm run check:node && cross-env NODE_ENV=development node build/getSSL.js && cross-env NODE_ENV=development SERVER_PORT=3001 webpack-dev-server --inline --progress --config build/webpack.client.conf.js",
"build:test": "npm run check:node && cross-env NODE_ENV=test webpack --progress --config build/webpack.client.conf.js && cross-env NODE_ENV=test node ./build/uploadAliyunCDN.js",
"build:pro": "npm run check:node && cross-env NODE_ENV=production webpack --progress --config build/webpack.client.conf.js && cross-env NODE_ENV=production node ./build/uploadAliyunCDN.js",
"check:node": "node build/checkNodeVersion.js"
},
"repository": {
"type": "git",
......@@ -24,43 +25,51 @@
"node_modules/",
"assets/font-icons/"
],
"engines": {
"node": ">=8.9"
},
"devDependencies": {
"acorn": "^7.1.1",
"ali-oss": "^6.5.1",
"autoprefixer": "^9.7.5",
"babel-core": "^6.26.3",
"ali-oss": "^6.11.2",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.5",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^1.0.1",
"copy-webpack-plugin": "^5.1.2",
"css-loader": "^4.3.0",
"dart-sass": "^1.25.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-loader": "^3.0.4",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-html": "^6.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.2.2",
"file-loader": "^6.0.0",
"html-webpack-plugin": "^4.0.4",
"file-loader": "^6.1.1",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^0.9.0",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.3.1",
"style-loader": "^1.1.3",
"url-loader": "^4.0.0",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2"
"sass-loader": "^10.0.3",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2",
"html-replace-webpack-plugin": "^2.5.6",
"request": "^2.88.2",
"semver": "^1.1.4",
"vconsole-webpack-plugin": "^1.5.2",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-jsx": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@babel/runtime-corejs3": "^7.11.2"
},
"dependencies": {
"axios": "^0.19.2",
......@@ -68,15 +77,14 @@
"element-ui": "^2.13.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
"promise.prototype.finally": "^3.1.2",
"qs": "^6.9.4",
"regenerator": "^0.14.4",
"vue": "^2.6.11",
"vue-i18n": "^8.16.0",
"vue-loader": "^15.9.1",
"vue-meta-info": "^0.1.7",
"vue-router": "^3.1.6",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.1.3"
"vuex": "^3.1.3",
"core-js": "^3.6.5"
}
}
......@@ -139,13 +139,16 @@ export default class CourseAction extends BaseACTION {
__.live.live_status = parseInt(__.live.live_status)
let str = ''
switch (__.live.live_status) {
case 0: str = '直播未开始'; break
case 1: str = '正在直播'; break
case 2: str = '直播结束'; break
case 1: str = '直播未开始'; break
case 2: str = '正在直播'; break
case 3: str = '直播结束'; break
case 4: str = '即将开始'; break
case 5: str = '直播未开始'; break
case 11: str = '直播结束'; break
default: str = '直播未开始'
}
// 5分钟内显示“即将开始”,5~1小时内“N分钟后开始”,1~24小时内“N小时后开始”,1天以上“N天后开始”天就显示年月日
if (__.live.live_status === 0 && __.live.start_time) {
if (__.live.live_status === 1 && __.live.start_time) {
const time = (new Date(__.live.start_time).getTime() - new Date().getTime()) / 1000
if (time <= 5 * 60) {
str = '即将开始'
......@@ -157,7 +160,7 @@ export default class CourseAction extends BaseACTION {
str = parseInt(time / (24 * 60 * 60)) + '天后开始'
}
}
if (__.live.live_status === 2 && __.live.enable_record && __.live.record_url) {
if (__.live.live_status === 3 && __.live.enable_record && __.live.record_url) {
str = '观看回放'
}
__.live.statusStr = str
......
......@@ -32,32 +32,18 @@ export default class API {
/* 重新封装 请求时的执行函数 */
_request(_config = {}) {
/* 具体执行请求成功后业务逻辑前,先执行该方法 */
const beforeSuccess = _config.beforeSuccess
? _config.beforeSuccess
: this._reqSuccess
const beforeSuccess = _config.beforeSuccess ? _config.beforeSuccess : this._reqSuccess
/* 具体执行请求失败后业务逻辑前,先执行该方法 */
const beforeFail = _config.beforeFail ? _config.beforeFail : this._reqFail
const headers = {
tenant: 'sofia',
version: window.G.VERSION
version: window.G.VERSION,
'Content-Type': 'application/x-www-form-urlencoded'
}
_config.headers = _.assignIn(_config.headers, headers)
_config.headers = _.assignIn(headers, _config.headers)
/* 判别 传输方式 */
if (
_config.headers['Content-Type'] === 'application/x-www-form-urlencoded'
) {
let str = ''
const _obj = _config.data || _config.params
// for (const key in _obj) {
// str += key + '=' + _obj[key] + '&'
// }
// str = str.substr(0, str.length - 1)
str = qs.stringify(_obj)
if (_config.data) {
_config.data = str
} else {
_config.params = str
}
if (_config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
_config.data = qs.stringify(_config.data)
}
if (_config.headers['Content-Type'] === 'multipart/form-data') {
let fr = new FormData() // eslint-disable-line
......@@ -68,10 +54,7 @@ export default class API {
_config.data = fr
}
/* 创建并根据参数发起请求 */
return this._axios(_config).then(
beforeSuccess.bind(this),
beforeFail.bind(this)
)
return this._axios(_config).then(beforeSuccess.bind(this), beforeFail.bind(this))
}
setConfirm(titleStr, btnStr, msgStr) {
......@@ -90,11 +73,10 @@ export default class API {
if (/\/login\/index/gi.test(href)) {
_vIn.$router.go(0)
} else {
_vIn.$router.push({
path:
'/login/index?rd=' +
encodeURIComponent(href.replace(/.*?\/\/.*?\//gi, '/'))
})
// _vIn.$router.push({
// path: '/login/index?rd=' + encodeURIComponent(href.replace(/.*?\/\/.*?\//gi, '/'))
// })
window.location.href = `${webConf.others.loginUrl}'?rd=${encodeURIComponent(window.location.href)}`
}
}
......@@ -155,16 +137,12 @@ export default class API {
/* 重新实现 get请求 */
get(url, data, config) {
return this._request(
_.assignIn({ url, method: 'GET', params: data }, config)
)
return this._request(_.assignIn({ url, method: 'GET', params: data }, config))
}
/* 重新实现 post请求 */
post(url, data, config) {
return this._request(
_.assignIn({ url, method: 'POST', data: data }, config)
)
return this._request(_.assignIn({ url, method: 'POST', data: data }, config))
}
/* 重新实现 put请求 */
......@@ -174,8 +152,6 @@ export default class API {
/* 重新实现 delete请求 */
delete(url, data, config) {
return this._request(
_.assignIn({ url, method: 'DELETE', params: data }, config)
)
return this._request(_.assignIn({ url, method: 'DELETE', params: data }, config))
}
}
......@@ -5,13 +5,7 @@ export default class Before {
const UA = navigator.userAgent
this.opt = opt || {}
// 免登录列表
this.whiteList = [
'login-normal',
'login-code',
'login-forget',
'studentHelp',
'teacherHelp'
]
this.whiteList = ['login-normal', 'login-code', 'login-forget', 'studentHelp', 'teacherHelp']
this.isMobile = /android|iphone|ipad|ipod/i.test(UA)
}
......@@ -24,10 +18,11 @@ export default class Before {
// 检测登录状态
const isLogin = await this.isLogin()
if (!isLogin) {
next({
path: '/login/index',
query: { rd: encodeURIComponent(to.fullPath) }
})
// next({
// path: '/login/index',
// query: { rd: encodeURIComponent(to.fullPath) }
// })
window.location.href = `${webConf.others.loginUrl}?rd=${encodeURIComponent(window.location.href)}`
return
}
// 移动端
......@@ -42,7 +37,7 @@ export default class Before {
isLogin() {
if (window.G.UserInfo) return true
return cAction.Other.getInfo()
.then((res) => {
.then(res => {
if (res.id) {
window.G.UserInfo = res
return true
......
......@@ -126,7 +126,8 @@ export default {
cAction.Other.outLogin()
.then(str => {
window.G.UserInfo = {}
this.$router.push({ path: '/login/index' })
// this.$router.push({ path: '/login/index' })
window.location.href = webConf.others.loginUrl
})
.catch(e => {
this.$message.error(e.message)
......
<template>
<div class="upload">
<el-upload action :show-file-list="false" :http-request="httpRequest" v-bind="$attrs">
<slot></slot>
<el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button>
<template v-slot:tip>
<div class="el-upload__tips">
<slot name="tip"></slot>
</div>
</template>
</el-upload>
<div class="file-list" v-if="value">
<div class="file-list-item">
<a :href="value" target="_blank">
<i class="el-icon-document"></i>
{{ fileName }}
</a>
<a :href="value" :download="fileName" target="_blank">
<el-tooltip effect="dark" content="下载">
<i class="el-icon-download"></i>
</el-tooltip>
</a>
</div>
</div>
</div>
<el-upload
class="avatar-uploader"
action
:accept="accept"
:show-file-list="showFileList"
:http-request="httpRequest"
v-bind="$attrs"
>
<slot>
<img v-if="value" :src="value" class="avatar" />
<i v-else class="el-icon-plus uploader-icon"></i>
</slot>
</el-upload>
</template>
<script>
......@@ -31,7 +20,9 @@ import cAction from '@action'
export default {
name: 'VUpload',
props: {
value: { type: String }
value: { type: String },
accept: { type: String, default: 'image/*' },
showFileList: { type: Boolean, default: false }
},
data() {
return {}
......@@ -52,30 +43,34 @@ export default {
.catch(error => {
console.log(error)
})
},
handleRemove() {
this.$emit('input', '')
}
}
}
</script>
<style lang="scss" scoped>
.file-list-item {
display: flex;
margin-bottom: 10px;
padding: 0 10px;
justify-content: space-between;
line-height: 30px;
background-color: #fff;
border-radius: 4px;
a {
text-decoration: none;
color: #333;
&:hover {
color: #b49441;
}
}
<style lang="scss">
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #b80037;
}
.uploader-icon {
font-size: 28px;
color: #8c939d;
width: 220px;
height: 220px;
line-height: 220px;
text-align: center;
}
.avatar {
width: 220px;
height: 220px;
display: block;
object-fit: contain;
}
</style>
......@@ -14,10 +14,8 @@ import modules from './modules'
import createBefore from './components/beforeEnter'
import store from './store'
/* 兼容处理 start */
/* 处理低版本浏览器支持axios finally问题 */
require('promise.prototype.finally').shim()
/* 兼容处理 end */
import _ from 'lodash'
Vue.prototype.$_ = _
Vue.use(VueRouter)
Vue.use(UploadForm)
......@@ -35,6 +33,7 @@ Vue.use(modules, { i18n })
window.G = Vue.prototype.$GLOBAL = {
VERSION: 'PC-1.0.0'
}
// window.Promise = Promise
/**
* 定义全局变量 - 用作全局事件发布订阅
* 使用 vue自带事件 $emit 和 $on 进行发布订阅
......@@ -52,5 +51,5 @@ window.G.$instance_vue = new Vue({
router,
i18n,
store,
render: (h) => h(App)
render: h => h(App)
}).$mount('#app')
......@@ -66,12 +66,12 @@ export default {
},
methods: {
loadAjax () {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
api[this.params.request](this.params)
.then(json => {
this.discussList = json
})
.catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
.catch(e => { this.$message.error(e.message) }).finally(() => { /* loading.close() */ })
},
/**
* 跳转到对应 问题详情页
......
<template>
<ul class="chapter-list">
<li class="chapter-item" v-for="item in chapters" :key="item.id">
<h4>{{item.name}}</h4>
<h4>{{ item.name }}</h4>
<ul class="chapter-item-list">
<li
v-for="subItem in item.children"
:key="subItem.id"
@click="onClick(subItem)"
:class="{'is-active': subItem.id === (active ? active.id : '')}"
:class="{ 'is-active': subItem.id === (active ? active.id : '') }"
>
<span class="chapter-item-list__name">{{subItem.name | showName(subItem)}}</span>
<span class="chapter-item-list__name">{{ subItem.name | showName(subItem) }}</span>
<i class="el-icon" :class="genIconClass(subItem.type)"></i>
</li>
</ul>
......@@ -60,6 +60,11 @@ export default {
if (data.type === 1) {
return
}
// zoom直播
if (data.type === 8) {
window.open(data.live.record_url || data.live.join_url)
return
}
// 课程大作业
if (data.id === 'course_work' && !this.data.survey) {
this.$message('请先填写教学评估,然后完成大作业。')
......@@ -71,10 +76,7 @@ export default {
this.$router.push({ name: 'survey', params: { sid, cid } })
return
}
this.$router.push({
name: 'viewerCourseChapter',
params: { id: data.id }
})
this.$router.push({ name: 'viewerCourseChapter', params: { id: data.id } })
}
}
}
......
<template>
<component
:is="currentCompoent"
:chapter="chapter"
v-bind="$attrs"
v-on="$listeners"
v-if="chapter"
:key="pid"
/>
<component :is="currentCompoent" :chapter="chapter" v-bind="$attrs" v-on="$listeners" v-if="chapter" :key="pid" />
</template>
<script>
......@@ -46,7 +39,8 @@ export default {
2: 'ChapterPlayer', // 视频
3: 'ChapterWork', // 作业
4: 'ChapterRead', // 资料
5: 'ChapterLive', // 直播
5: 'ChapterLive', // CC直播
8: 'ChapterLive', // CC直播
9: 'ChapterExam', // 考试
99: 'CourseWork', // 课程大作业
100: 'CourseRead', // 课程资料
......
<template>
<div style="width:100%;height:100%;">
<div style="width: 100%; height: 100%">
<div class="course-viewer-content" v-if="isLiveEnd && !hasRecord">
<div class="empty">直播已结束</div>
</div>
......@@ -42,7 +42,7 @@ export default {
return this.user.personal_name || '匿名'
},
live() {
const live = this.chapter.live
const live = this.chapter.live || {}
live.live_status = parseInt(live.live_status)
return live
},
......@@ -56,15 +56,28 @@ export default {
return this.live.enable_record === 1 && this.live.record_url
},
iframeUrl() {
if (this.live.type === 5) {
return this.ccUrl
}
if (this.live.type === 8) {
return this.zoomUrl
}
},
// cc直播
ccUrl() {
const live = this.live
if (this.isLiveEnd && this.hasRecord) {
// 查看回放
return live.record_url
} else {
// 直播
live.viewer_name = live.viewer_name || this.nickName
return `https://view.csslcloud.net/api/view/index?roomid=${live.room_id}&userid=${live.user_id}&autoLogin=true&viewername=${live.viewer_name}&viewertoken=${live.viewer_token}`
live.user_name = live.user_name || this.nickName
return `https://view.csslcloud.net/api/view/index?roomid=${live.room_id}&userid=${live.account_id}&autoLogin=true&viewername=${live.user_name}&viewertoken=${live.play_pass}`
}
},
// zoom直播
zoomUrl() {
return this.live.record_url || this.live.join_url
}
}
}
......
......@@ -152,9 +152,7 @@ export default {
onTimeupdate(time) {
time = Math.floor(time)
const ppts = this.chatperResources.ppts || []
let index = this.chatperResources.ppts.findIndex(
item => item.ppt_point > time
)
let index = this.chatperResources.ppts.findIndex(item => item.ppt_point > time)
index = index !== -1 ? index - 1 : ppts.length - 1
this.$emit('change-ppt', index)
const durations = this.player.getDuration()
......@@ -172,10 +170,7 @@ export default {
if (this.throttled) {
this.throttled(time, durations)
} else {
this.throttled = throttle(
this.updateChapterVideoProgress,
this.throttleWait * 1000
)
this.throttled = throttle(this.updateChapterVideoProgress, this.throttleWait * 1000, { leading: false })
}
},
// 更新视频当前播放时间
......
......@@ -8,7 +8,7 @@ export default {
props: {
isSkip: Boolean,
video: Object,
autoplay: { type: Boolean, default: true }
autoplay: { type: Boolean, default: false }
},
data() {
return { player: null }
......
......@@ -132,7 +132,7 @@ export default {
},
// 直播
isLive() {
return this.activeChapter ? this.activeChapter.type === 5 : false
return this.activeChapter ? [5, 8].includes(this.activeChapter.type) : false
},
// 课程考试
isCourseExam() {
......
import BaseAPI from '@/api/base_api'
const httpRequest = new BaseAPI(webConf)
// 获取事务类型列表
export function getAffairType() {
return httpRequest.get('/api/lms/v2/lobby/affairs')
}
// 获取事务列表
export function getAffairList() {
return httpRequest.get('/api/lms/v2/lobby/processes')
}
// 获取事务详情
export function getAffair(id) {
return httpRequest.get(`/api/lms/v2/lobby/processes/${id}`)
}
// 创建事务
export function createAffair(data) {
return httpRequest.post('/api/lms/v2/lobby/processes', data)
}
// 更新事务
export function updateAffair(id, data) {
return httpRequest.post(`/api/lms/v2/lobby/processes/${id}`, data)
}
// 删除事务
export function deleteAffair(id) {
return httpRequest({
url: `/api/lms/v2/lobby/processes/${id}`,
method: 'delete'
})
}
// 上传文件
export function upload(data) {
return httpRequest({
url: '/api/lms/v2/lobby/tools/upload',
method: 'post',
headers: { 'Content-Type': 'multipart/form-data' },
data
})
}
// 获取学期
export function getSemesters(params) {
return httpRequest.get('/api/lms/v2/lobby/semesters')
}
// 获取课程
export function getCourses(sid) {
return httpRequest.get(`/api/lms/v2/lobby/semesters/${sid}/courses`)
}
// 获取成绩单
export function getReport() {
return httpRequest.get('/api/lms/v2/lobby/havereport')
}
// 获取学生
export function getStudent() {
return httpRequest.get('/api/lms/v2/lobby/student')
}
<template>
<div class="hall-form">
<el-radio v-model="schoolReport" @change="changeReport" label="elreport" border size="small">电子成绩单</el-radio>
<el-radio v-model="schoolReport" @change="changeReport" label="pareport" border size="small">纸质成绩单</el-radio>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" size="small" label-position="top" class="hall-form-body">
<el-form-item label="姓名" prop="personal_name" >
<el-input v-model.trim="ruleForm.personal_name" :disabled="Number(ruleForm.submit) === 1"></el-input>
<el-radio
v-model="schoolReport"
@change="changeReport"
label="elreport"
border
size="small"
>电子成绩单</el-radio>
<el-radio
v-model="schoolReport"
@change="changeReport"
label="pareport"
border
size="small"
>纸质成绩单</el-radio>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
:disabled="Number(ruleForm.submit) === 1"
label-width="100px"
size="small"
label-position="top"
class="hall-form-body"
>
<!-- <el-form-item label="姓名" prop="personal_name">
<el-input v-model.trim="ruleForm.personal_name"></el-input>
</el-form-item>
<el-form-item label="班级" prop="class_name">
<el-input v-model.trim="ruleForm.class_name" :disabled="Number(ruleForm.submit) === 1"></el-input>
</el-form-item>
<el-input v-model.trim="ruleForm.class_name"></el-input>
</el-form-item>-->
<el-form-item label="Sofia ID" prop="sofia_id" key="sofia_id">
<el-input v-model.trim="ruleForm.sofia_id" :disabled="Number(ruleForm.submit) === 1"></el-input>
<el-input v-model.trim="ruleForm.sofia_id"></el-input>
</el-form-item>
<el-form-item label="电话" prop="telephone" key="telephone" v-if="schoolReport === 'pareport'">
<el-input v-model.trim="ruleForm.telephone" :disabled="Number(ruleForm.submit) === 1"></el-input>
<el-input v-model.trim="ruleForm.telephone"></el-input>
</el-form-item>
<el-form-item :label="schoolReport === 'elreport' ? '邮箱':'邮寄地址'" prop="email">
<el-input v-model.trim="ruleForm.email" :disabled="Number(ruleForm.submit) === 1"></el-input>
<el-input v-model.trim="ruleForm.email"></el-input>
</el-form-item>
<el-form-item label="需打印的份数" prop="number" key="number" v-if="schoolReport === 'pareport'">
<el-input v-model.trim="ruleForm.number" :disabled="Number(ruleForm.submit) === 1"></el-input>
<el-input v-model.trim="ruleForm.number"></el-input>
</el-form-item>
<el-form-item class="ts-width">
<span class="red" v-if="schoolReport === 'elreport'">毕业生可申请成绩单。<br />请仔细核查您填写的信息后提交,提交后不可修改。电子成绩单将发送至您填写的邮箱。</span>
<span class="red" v-else>毕业生可申请成绩单。<br />请仔细核查您填写的信息后提交,提交后不可修改。纸质成绩单将按您填写的地址邮寄给您。</span>
<span class="red" v-if="schoolReport === 'elreport'">
毕业生可申请成绩单。
<br />请仔细核查您填写的信息后提交,提交后不可修改。电子成绩单将发送至您填写的邮箱。
</span>
<span class="red" v-else>
毕业生可申请成绩单。
<br />请仔细核查您填写的信息后提交,提交后不可修改。纸质成绩单将按您填写的地址邮寄给您。
</span>
</el-form-item>
<el-form-item class="ts-width">
<el-button type="primary" :disabled="Number(ruleForm.submit) === 1" @click="submitForm('ruleForm')">{{Number(ruleForm.submit) === 1 ? '已提交' : '提交'}}</el-button>
<el-button
type="primary"
@click="submitForm('ruleForm')"
>{{Number(ruleForm.submit) === 1 ? '已提交' : '提交'}}</el-button>
</el-form-item>
</el-form>
</div>
......@@ -60,7 +90,7 @@ export default {
callback()
}
}
var blurText = async(rule, value, callback) => {
var blurText = async (rule, value, callback) => {
var boolean = new RegExp('^[1-9][0-9]*$').test(value)
if (!boolean) {
callback(new Error('请输入正整数!'))
......@@ -68,7 +98,7 @@ export default {
callback()
}
}
var checkEmail = async(rule, value, callback) => {
var checkEmail = async (rule, value, callback) => {
if (!value) {
if (this.schoolReport === 'pareport') {
callback(new Error('请输入邮寄地址!'))
......@@ -91,8 +121,6 @@ export default {
}
return {
ruleForm: {
personal_name: '',
class_name: '',
sofia_id: '',
telephone: '',
email: '',
......@@ -100,31 +128,23 @@ export default {
submit: 0
},
rules: {
personal_name: [
{ required: true, message: '请输入姓名', trigger: 'blur' }
],
class_name: [
{ required: true, message: '请输入班级', trigger: 'blur' }
],
sofia_id: [
{ required: true, validator: checksofiaId, trigger: 'blur' }
],
telephone: [
{ required: true, validator: checkPhone, trigger: 'blur' }
],
email: [
{ required: true, validator: checkEmail, trigger: 'blur' }
],
number: [
{ required: true, validator: blurText, trigger: 'blur' }
]
// personal_name: [
// { required: true, message: '请输入姓名', trigger: 'blur' }
// ],
// class_name: [
// { required: true, message: '请输入班级', trigger: 'blur' }
// ],
sofia_id: [{ required: true, validator: checksofiaId, trigger: 'blur' }],
telephone: [{ required: true, validator: checkPhone, trigger: 'blur' }],
email: [{ required: true, validator: checkEmail, trigger: 'blur' }],
number: [{ required: true, validator: blurText, trigger: 'blur' }]
},
schoolReport: 'elreport'
}
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
this.$refs[formName].validate(valid => {
if (valid) {
this.$emit('submit', this.ruleForm, this.schoolReport)
} else {
......@@ -135,6 +155,9 @@ export default {
changeReport() {
this.$emit('submitType', this.schoolReport)
}
},
mounted() {
this.changeReport()
}
}
</script>
......@@ -150,8 +173,8 @@ export default {
}
}
.hall-form .red:before {
content: "*";
color: #F56C6C;
content: '*';
color: #f56c6c;
margin-right: 4px;
}
::v-deep .el-form-item__label {
......
<template>
<div class="pay">
<template v-for="(item, index) in datalist">
<div class="pay-box" :key="index">
<i class="el-icon-error" @click="handleRemove(index)" v-if="index && canEditable(item)"></i>
<pay-item :data="item" :index="index" :disabled="!canEditable(item)"></pay-item>
</div>
</template>
<el-button
icon="el-icon-plus"
@click="handleAdd"
style="margin-bottom:20px"
size="medium"
v-if="!disabled"
>新增缴费凭证</el-button>
</div>
</template>
<script>
import PayItem from './payItem'
export default {
props: {
datalist: { type: Array, default: () => [] },
disabled: { type: Boolean, default: false }
},
components: { PayItem },
methods: {
canEditable(data) {
if (this.disabled) {
return false
}
return !['1', '2'].includes(data.status)
},
// 添加
handleAdd() {
this.datalist.push({ pay_date: '', type: '', money: '', url: '' })
},
// 删除
handleRemove(index) {
this.datalist.splice(index, 1)
}
},
beforeMount() {
// 默认创建一条
!this.datalist.length && this.handleAdd()
}
}
</script>
<style lang="scss" scoped>
.pay-box {
position: relative;
border: 1px solid #b80037;
padding: 20px;
.el-icon-error {
position: absolute;
right: -14px;
top: -14px;
font-size: 28px;
color: #b80037;
cursor: pointer;
}
}
.pay-box {
margin-bottom: 20px;
}
</style>
<template>
<div class="pay-item">
<el-form-item
label="支付时间"
:prop="'payment_instrument.' + index + '.pay_date'"
:rules="{ required: true, message: '请选择日期' }"
>
<el-date-picker
v-model="data.pay_date"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
:disabled="disabled"
></el-date-picker>
</el-form-item>
<el-form-item
label="支付方式"
:prop="'payment_instrument.' + index + '.type'"
:rules="{ required: true, message: '请选择支付方式' }"
>
<el-popover placement="top-start" trigger="hover">
<p>银行账户名称:清控紫荆(北京)教育科技股份有限公司</p>
<p>银行帐号:694485289</p>
<p>开户行:中国民生银行股份有限公司北京魏公村支行</p>
<el-radio slot="reference" label="1" v-model="data.type" :disabled="disabled">银行卡转账</el-radio>
</el-popover>
<el-popover placement="top-start" trigger="hover">
<p>支付宝户名:清控紫荆(北京)教育科技股份有限公司</p>
<el-radio
slot="reference"
label="2"
v-model="data.type"
:disabled="disabled"
style="margin-left:40px;"
>支付宝转账</el-radio>
</el-popover>
</el-form-item>
<el-form-item
label="支付金额"
:prop="'payment_instrument.' + index + '.money'"
:rules="{ required: true, message: '请输入支付金额' }"
>
<el-input v-model="data.money" placeholder="输入支付金额" :disabled="disabled" style="width:220px">
<template slot="append">¥</template>
</el-input>
</el-form-item>
<el-form-item
label="上传缴费凭证"
:prop="'payment_instrument.' + index + '.url'"
:rules="{ required: true, message: '请上传缴费凭证' }"
>
<app-upload v-model="data.url" :disabled="disabled"></app-upload>
</el-form-item>
<el-form-item label="审核状态" v-if="statusText">
<el-tag>{{statusText}}</el-tag>
</el-form-item>
</div>
</template>
<script>
import AppUpload from '@/components/upload'
export default {
props: {
data: { type: Object, required: true },
index: { type: Number },
disabled: { type: Boolean, default: false }
},
components: { AppUpload },
computed: {
statusText() {
const status = {
'-1': '待审核',
0: '未通过',
1: '通过'
}
return status[this.data.status] || ''
}
}
}
</script>
......@@ -5,24 +5,28 @@
</div>
<Tap :tapParam="tapParam" @tapParam="tapIndexs"></Tap>
<div class="con-box">
<el-button
type="primary"
v-if="tapIndex==0"
@click="golearningAdd('/app/affairs-hall/learning-add/-1')"
>申请新的活动</el-button>
<el-button
type="primary"
v-if="tapIndex==1"
@click="golearningAdd('/app/affairs-hall/share-add/-1')"
>申请新乐分享</el-button>
<el-button
type="primary"
v-if="tapIndex==2"
@click="golearningAdd('/app/affairs-hall/again-add/-1')"
>申请重修</el-button>
<div style="width: 100%; height: 0.2rem;"></div>
<table-list :key="affairId" v-bind="tableOption" v-if="affairId && resultName !== '成绩单'" ref="tableList"></table-list>
<hall-form v-if="resultName === '成绩单'" :formData="formData" @submit="submit" @submitType="obtainReport"></hall-form>
<el-button type="primary" v-if="tapIndex == 0" @click="golearningAdd('/app/affairs-hall/learning-add/-1')"
>申请新的活动</el-button
>
<el-button type="primary" v-if="tapIndex == 1" @click="golearningAdd('/app/affairs-hall/share-add/-1')"
>申请新乐分享</el-button
>
<el-button type="primary" v-if="tapIndex == 2" @click="golearningAdd('/app/affairs-hall/again-add/-1')"
>申请重修</el-button
>
<div style="width: 100%; height: 0.2rem"></div>
<table-list
:key="affairId"
v-bind="tableOption"
v-if="affairId && resultName !== '成绩单'"
ref="tableList"
></table-list>
<hall-form
v-if="resultName === '成绩单'"
:formData="formData"
@submit="submit"
@submitType="obtainReport"
></hall-form>
</div>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<span>确定删除?</span>
......@@ -38,7 +42,7 @@
import Tap from '../../components/comTable/tap.vue'
import mPage from '../../components/comTable/mPage.vue'
import TableList from '../../components/comTable/tableList.vue'
import HallForm from '../../components/hall-form.vue'
import HallForm from './components/hall-form.vue'
import cAction from '@action'
const status = {
'-1': '待审核',
......@@ -243,10 +247,13 @@ export default {
},
methods: {
submit(row, type) {
const params = Object.assign({
type: type,
affair_id: this.affairList.find(k => k.form_name === type).id
}, row)
const params = Object.assign(
{
type: type,
affair_id: this.affairList.find(k => k.form_name === type).id
},
row
)
cAction.Affairs.submitLearning(params)
.then(() => {
this.$message({ type: 'success', message: '已提交成功!' })
......@@ -298,12 +305,14 @@ export default {
getTapData() {
cAction.Affairs.getAffairsType()
.then(data => {
this.tapParam[0].arrItem = data.map(item => {
if (item.form_name === 'elreport') {
item.affair_name = '成绩单'
}
return { val: item.id, name: item.affair_name, form_name: item.form_name }
}).filter(k => k.form_name !== 'pareport')
this.tapParam[0].arrItem = data
.map(item => {
if (item.form_name === 'elreport') {
item.affair_name = '成绩单'
}
return { val: item.id, name: item.affair_name, form_name: item.form_name }
})
.filter(k => k.form_name !== 'pareport')
const [first] = data
const datas = data[this.$route.query.index] || first
this.affairId = datas.id
......@@ -326,7 +335,6 @@ export default {
}
},
created() {
this.obtainReport()
this.getTapData()
}
}
......
<template>
<div>
<div class="con-title">重修申请</div>
<div class="con-box">
<el-button type="text">
<router-link :to="{ path: '/app/affairs-hall/hall', query: { index: 2 } }">返回列表</router-link>
</el-button>
<el-row type="flex" justify="center">
<el-col :lg="12">
<el-form
ref="form"
:model="ruleForm"
:rules="rules"
:disabled="isView"
label-width="110px"
>
<el-form-item label="姓名" prop="personal_name" required>
<el-input
v-model="ruleForm.personal_name"
readonly
:disabled="disabledInfo"
placeholder="请输入您的姓名"
/>
</el-form-item>
<el-form-item label="班级" prop="class_name" required>
<el-input
v-model="ruleForm.class_name"
readonly
:disabled="disabledInfo"
placeholder="请输入您的班级"
/>
</el-form-item>
<el-form-item label="Sofia ID" prop="sofia_id" required>
<el-input
v-model="ruleForm.sofia_id"
readonly
:disabled="disabledInfo"
placeholder="请输入您的Sofia ID"
/>
</el-form-item>
<el-form-item label="重修学期" prop="semester_name">
<el-select
v-model="ruleForm.semester_name"
placeholder="请选择"
@change="onSemesterChange"
:disabled="disabledInfo"
>
<el-option v-for="item in semesterList" :key="item.id" :value="item.semester_name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="重修课程" prop="course_id">
<el-checkbox-group v-model="ruleForm.course_id">
<el-checkbox
v-for="item in courseList"
:label="item.id"
:key="item.id"
:disabled="disabledInfo"
>{{item.course_name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<div style="padding-left:110px" v-if="hasPay">
<div class="score" v-if="detail.form">{{detail.form.score_sum_str}}</div>
<pay :datalist="ruleForm.payment_instrument" :disabled="disabledPay || isView"></pay>
</div>
<template v-if="isView && detail.status !== -1">
<el-form-item label="审核时间">
<el-input :value="detail.approve_time1" readonly />
</el-form-item>
<el-form-item label="备注" prop="content">
<el-input
type="textarea"
:autosize="{ minRows: 5 }"
:value="detail.remark"
readonly
/>
</el-form-item>
</template>
<el-form-item>
<el-button type="primary" @click="onSubmit" v-if="!isView">保存并提交</el-button>
<el-button type="info" @click="onAbort" v-if="hasAbort">撤回申请</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import * as api from '../api'
import Pay from '../components/pay'
export default {
props: {
isAdd: { type: Boolean, default: false },
isEdit: { type: Boolean, default: false },
isView: { type: Boolean, default: false }
},
components: { Pay },
data() {
return {
detail: {},
ruleForm: {
personal_name: '',
class_name: '',
sofia_id: '123',
semester_name: '',
course_id: [],
payment_instrument: []
},
rules: {
personal_name: [{ required: true, message: '请输入您的姓名', trigger: 'blur' }],
class_name: [{ required: true, message: '请输入您的班级', trigger: 'blur' }],
semester_name: [{ required: true, message: '请输入您的挂科学期', trigger: 'blur' }],
course_name: [{ required: true, message: '请选择您的重修课程名称', trigger: 'blur' }],
course_id: [{ required: true, message: '请选择您的重修课程名称', trigger: 'blur' }]
},
semesterList: [], // 学期列表
courseList: [] // 课程列表
}
},
watch: {
semesterId(value) {
value && this.getCourses()
}
},
computed: {
pid() {
return this.$route.params.id
},
// 事务ID
affairId() {
return this.$route.query.id
},
// 学期ID
semesterId() {
const found = this.semesterList.find(item => item.semester_name === this.ruleForm.semester_name)
return found ? found.id : ''
},
// 撤回
hasAbort() {
return this.isEdit && this.detail.status === -1
},
// 支付凭证
hasPay() {
return !this.isAdd && this.detail.file_put !== 0
},
// 禁用信息部分
disabledInfo() {
return this.isView || (this.isEdit && this.detail.status !== -1)
},
// 禁用支付凭证模块
disabledPay() {
return this.isView || (this.isEdit && this.detail.file_put === 2)
}
},
methods: {
init() {
// 获取学期
this.getSemesters()
if (this.isEdit || this.isView) {
this.getDetail()
} else {
// 获取学生信息
this.getStudent()
}
},
// 获取学生信息
getStudent() {
api.getStudent().then(response => {
const data = this.$_.pick(response, ['personal_name', 'class_name', 'sofia_id'])
Object.assign(this.ruleForm, data)
})
},
// 获取学期
getSemesters() {
api.getSemesters().then(response => {
this.semesterList = response.data
const [first] = this.semesterList
// 设置默认值
if (first && !this.isEdit) {
this.ruleForm.semester_name = first.semester_name
}
})
},
onSemesterChange() {
this.ruleForm.course_id = []
},
// 获取课程
getCourses() {
api.getCourses(this.semesterId).then(response => {
this.courseList = response.data
})
},
// 获取详情
getDetail() {
api.getAffair(this.pid).then(response => {
const form = response.form
if (form.course_name_arr) {
form.course_id = form.course_name_arr.map(item => item.course_id)
}
// 设置表单数据
const ruleForm = this.$_.pick(response.form, [
'personal_name',
'class_name',
'sofia_id',
'semester_name',
'course_id',
'payment_instrument'
])
Object.assign(this.ruleForm, ruleForm)
// 设置接口返回的数据
this.detail = response
})
},
// 添加
addRequest(data) {
api.createAffair(data).then(response => {
this.$message.success(response.message)
this.$router.push({ path: '/app/affairs-hall/hall', query: { index: 2 } })
})
},
// 修改
updateRequest(data) {
api.updateAffair(this.pid, data).then(response => {
this.$message.success(response.message)
this.$router.push({ path: '/app/affairs-hall/hall', query: { index: 2 } })
})
},
// 提交
onSubmit() {
this.$refs.form
.validate()
.then(response => {
const data = Object.assign({ affair_id: this.affairId }, this.ruleForm)
data.course_id = this.ruleForm.course_id.join(',')
data.payment_instrument = JSON.stringify(this.ruleForm.payment_instrument)
this.isEdit ? this.updateRequest(data) : this.addRequest(data)
})
.catch(() => {
this.$message.error('请完善表单信息')
})
},
// 撤回
onAbort() {
this.$confirm('你确定要撤回重修申请吗?撤回后,需要重新提交申请并由教务审批。', {
confirmButtonText: '确定',
cancelButtonText: '取消'
})
.then(() => {})
.catch(() => {})
}
},
mounted() {
this.init()
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-form--label-top .el-form-item__label {
line-height: 1;
}
.score {
margin-bottom: 20px;
color: #b80037;
}
</style>
<template>
</template>
<script>
export default {
}
</script>
......@@ -190,7 +190,11 @@ export default {
},
/* 直接进直播 */
goLive () {
this.$router.push({ name: 'viewerCourseChapter', params: { sid: this.newLiveMsg.semester_id, cid: this.newLiveMsg.course_id, id: this.newLiveMsg.chapter_id } })
if (this.newLiveMsg.live.type === 8) {
window.open(this.newLiveMsg.live.record_url || this.newLiveMsg.live.join_url)
} else {
this.$router.push({ name: 'viewerCourseChapter', params: { sid: this.newLiveMsg.semester_id, cid: this.newLiveMsg.course_id, id: this.newLiveMsg.chapter_id } })
}
},
// 获取最新直播
getLatestLive() {
......
......@@ -50,7 +50,7 @@
<div v-bind:key="index1" :class='["body", (item1.id === tabs[1].chapterList.currentChapterId && "on")]'>
<div class='name' :data-vid='item1.vid' :data-cid='item1.cid' :data-sid='item1.sid' :data-hasVA='item1.time' :data-type="item1.video_provider" :data-name='item1.name' :data-index='index' :data-count='index1' @click='jumpToOtherVA(item1)'>
{{item1.name}}
<template v-if='item1.type === 5'>
<template v-if='[5,8].includes(item1.type)'>
<div class='time'>{{ item1.live.start_time }} {{ item1.live.statusStr }}</div>
</template>
<template v-else>
......@@ -238,31 +238,7 @@ export default {
isShow: false,
chapterList: {
currentChapterId: '11', // 当前章节id
course: [{
title: '第一章:测试章节',
isUp: true,
chapters: [
// { id: '11', time: '28:18', name: '1.1 现值(PV)和终值(FV)' },
{ id: '12', time: '19:09', name: '1.2 测试课程' }
]
}, {
title: '第二章:证券估值',
isUp: true,
chapters: [
// { id: '21', time: '27:49', name: '2.1 债券和股票的现金流贴现估值方法' },
// { id: '22', time: '16:04', name: '2.2 债券评级及债券协议' },
// { id: '23', time: '', name: '公司金融第二周测验' },
// { id: '24', time: '', name: '公司金融第二周作业' }
]
}, {
title: '课程大作业',
isUp: true,
chapters: []
}, {
title: '课程资料',
isUp: true,
chapters: []
}]
course: []
}
}, {
title: '课程讨论',
......@@ -533,7 +509,7 @@ export default {
if (type === 1) {
return
}
// 直播
// cc直播
if (type === 5) {
const live = data.live
const status = live.live_status
......@@ -555,6 +531,11 @@ export default {
return
}
}
// zoom直播
if (type === 8) {
window.open(data.live.record_url || data.live.join_url)
return
}
this.$router.push({ name: 'viewerCourseChapter', params: { sid, cid, id: data.id } })
},
/**
......
......@@ -4,36 +4,29 @@
<img class="logo" src="../../assets/images/logo-header.png" />
<div class="user">
<div class="nickname">{{ nickName }}</div>
<div class="logout" @click="logout">{{$t('components.learnSysLayout.sideBar.outLogin')}}</div>
<div class="logout" @click="logout">{{ $t('components.learnSysLayout.sideBar.outLogin') }}</div>
</div>
</div>
<div class="hint" v-if="latest" @click="onClick(latest.live)">
<div class="left">
<div class="left-1">{{$t('live.liveReminder')}}</div>
<div
class="left-2"
>{{latest.course_name}}{{$t('live.startTime', { time: latest.live.start_time })}}</div>
<div class="left-1">{{ $t('live.liveReminder') }}</div>
<div class="left-2">
{{ latest.course_name }}{{ $t('live.startTime', { time: latest.live.start_time }) }}
</div>
</div>
<div class="right">{{$t('live.goLive')}}</div>
<div class="right">{{ $t('live.goLive') }}</div>
</div>
<div class="tips">{{$t('live.replayTips')}}</div>
<div class="tips">{{ $t('live.replayTips') }}</div>
<div class="live-list">
<template v-for="item in dataList">
<div
class="live-item"
:key="subitem.id"
v-for="subitem in item.live"
@click="onClick(subitem)"
>
<h4 class="live-item-name">{{item.course_name}}</h4>
<div class="live-item" :key="subitem.id" v-for="subitem in item.live" @click="onClick(subitem)">
<h4 class="live-item-name">{{ item.course_name }}</h4>
<div class="live-item-main">
<img class="live-item-pic" :src="item.curriculum.curriculum_picture" />
<div class="live-item-content">
<div class="live-item-content__title">{{subitem.chapter_name}}</div>
<div class="live-item-content__time">{{subitem.start_time}}</div>
<div
class="live-item-content__status"
>{{calcTimeText(subitem.start_time, subitem.live_status)}}</div>
<div class="live-item-content__title">{{ subitem.topic }}</div>
<div class="live-item-content__time">{{ subitem.start_time }}</div>
<div class="live-item-content__status">{{ calcTimeText(subitem.start_time, subitem.live_status) }}</div>
</div>
</div>
</div>
......@@ -67,7 +60,8 @@ export default {
cAction.Other.outLogin()
.then(str => {
window.G.UserInfo = {}
this.$router.push({ path: '/login/index' })
// this.$router.push({ path: '/login/index' })
window.location.href = webConf.others.loginUrl
})
.catch(e => {
this.$message.error(e.message)
......@@ -127,11 +121,7 @@ export default {
},
onClick(data) {
data.live_status = parseInt(data.live_status)
const {
live_status: liveStatus,
live_type: liveType = 'live',
start_time: liveTime
} = data
const { live_status: liveStatus, type: liveType = 5, start_time: liveTime } = data
let message = this.calcTimeText(liveTime, liveStatus)
if (liveStatus === 2 && !data.enable_record) {
message = this.$t('live.noPlayback')
......@@ -144,7 +134,7 @@ export default {
this.openCloudClass(data, message)
return
}
if (liveType === 'live') {
if (liveType === 5) {
// 打开云直播
this.openCloudLive(data, message)
return
......@@ -154,24 +144,16 @@ export default {
this.openMeeting(data, message)
return
}
// 其他直播类型直接打开
if (liveStatus === 1) {
// 进行中
this.openNewWindow(data.join_url)
} else if (liveStatus === 2) {
// 查看回放
this.openNewWindow(data.record_url)
}
this.openNewWindow(data.record_url || data.join_url)
},
// 打开云课堂
openCloudClass(data, message) {
// https://doc.bokecc.com/class/developer/api/login.html
const liveStatus = data.live_status
data.viewer_name =
data.viewer_name || window.G.UserInfo.student_info.personal_name
data.user_name = data.user_name || window.G.UserInfo.student_info.personal_name
if (liveStatus === 1) {
// 进行中
const url = `http://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.user_id}&autoLogin=true&viewername=${data.username}&viewertoken=${data.password}`
const url = `http://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.username}&viewertoken=${data.password}`
this.openNewWindow(url)
} else if (liveStatus === 2) {
// 查看回放
......@@ -189,15 +171,15 @@ export default {
openCloudLive(data, message) {
// https://doc.bokecc.com/live/Appendix_1.html
const liveStatus = data.live_status
data.viewer_name = data.viewer_name || this.nickName
data.user_name = data.user_name || this.nickName
if (liveStatus === 2 && data.enable_record === 1) {
// enable_record 0:不启用回放 1:开启回放
// 查看回放
// const url = `https://view.csslcloud.net/api/view/callback?recordid=${data.record_id}&roomid=${data.room_id}&userid=${data.user_id}&autoLogin=true&viewername=${data.viewer_name}&viewertoken=${data.viewer_token}`
// const url = `https://view.csslcloud.net/api/view/callback?recordid=${data.record_id}&roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.user_name}&viewertoken=${data.play_pass}`
this.openNewWindow(data.record_url)
} else {
// 查看直播
const url = `https://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.user_id}&autoLogin=true&viewername=${data.viewer_name}&viewertoken=${data.viewer_token}`
const url = `https://view.csslcloud.net/api/view/index?roomid=${data.room_id}&userid=${data.account_id}&autoLogin=true&viewername=${data.user_name}&viewertoken=${data.play_pass}`
this.openNewWindow(url)
}
},
......@@ -217,16 +199,18 @@ export default {
// 计算日期
calcTimeText(liveTime, liveStatus) {
const map = {
0: this.$t('live.notStarted'),
1: this.$t('live.liveStreaming'),
2: this.$t('live.liveEnd')
1: this.$t('live.notStarted'),
2: this.$t('live.liveStreaming'),
3: this.$t('live.liveEnd'),
4: this.$t('live.start'),
5: this.$t('live.notStarted'),
11: this.$t('live.liveEnd')
}
let result = map[liveStatus] || liveTime
if (liveStatus === 0 && liveTime) {
if (liveStatus === 1 && liveTime) {
liveTime = liveTime.replace(/-/g, '/')
const time =
(new Date(liveTime).getTime() - new Date().getTime()) / 1000 || 0
const time = (new Date(liveTime).getTime() - new Date().getTime()) / 1000 || 0
if (time <= 5 * 60) {
result = this.$t('live.start')
} else if (time <= 1 * 60 * 60) {
......
......@@ -6,19 +6,19 @@ export default [
path: '/login/index',
name: 'login-normal',
component: () => import('@/pages/login/index.vue'),
props: (route) => ({ query: route.query, params: route.params })
props: route => ({ query: route.query, params: route.params })
},
{
path: '/login/code',
name: 'login-code',
component: () => import('@/pages/login/code.vue'),
props: (route) => ({ query: route.query, params: route.params })
props: route => ({ query: route.query, params: route.params })
},
{
path: '/login/forget',
name: 'login-forget',
component: () => import('@/pages/login/forget.vue'),
props: (route) => ({ query: route.query, params: route.params })
props: route => ({ query: route.query, params: route.params })
},
/* App 内登录页面未找到时 - 指向 */
{ path: '/login/*', redirect: '/login/index' },
......@@ -173,6 +173,24 @@ export default [
path: 'view-report/:rid',
component: () => import('../pages/affairsHall/viewReport.vue'),
props: true
},
{
name: 'ehallRetakeAdd',
path: 'retake/add',
component: () => import(/* webpackChunkName: "ehall" */ '../pages/affairsHall/retake/edit.vue'),
props: { isAdd: true }
},
{
name: 'ehallRetakeEdit',
path: 'retake/edit/:id',
component: () => import(/* webpackChunkName: "ehall" */ '../pages/affairsHall/retake/edit.vue'),
props: { isEdit: true }
},
{
name: 'ehallRetakeView',
path: 'retake/view/:id',
component: () => import(/* webpackChunkName: "ehall" */ '../pages/affairsHall/retake/edit.vue'),
props: { isView: true }
}
]
}
......
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state = {
myMsg: 0
}
const getters = {
myMsg (state) {
return state.myMsg
}
}
const mutations = {
myMsg(state, sum) {
state.myMsg = sum
}
}
const store = new Vuex.Store({
state,
getters,
mutations
})
export default store
export default new Vuex.Store({
state: {
myMsg: 0
},
getters: {
myMsg(state) {
return state.myMsg
}
},
mutations: {
myMsg(state, sum) {
state.myMsg = sum
}
},
actions: {}
})
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论