提交 301d389f 编写于 作者: 张磊's avatar 张磊

fix eslint

NODE_ENV=production NODE_ENV=production
# 自定义 VUE_APP_ENV # 自定义 VUE_APP_ENV
VUE_APP_ENV ='test' VUE_APP_ENV ='testing'
VUE_APP_SERVICE_URL=https://test1-sc.yunqueyi.com VUE_APP_SERVICE_URL=https://test1-sc.yunqueyi.com
# 阿里云OSS对象存储地址 # 阿里云OSS对象存储地址
......
...@@ -302,3 +302,18 @@ export const departmentAll = async () => { ...@@ -302,3 +302,18 @@ export const departmentAll = async () => {
method: 'get', method: 'get',
}); });
}; };
//
export const updateDepartmentId = async (data) => {
return request({
url: '/diagnose/admin/diagnose/diagnoseId/fresh/departmentId',
data: data,
method: 'post',
});
};
export const savePCDayCount = async (data) => {
return request({
url: '/diagnose/doctor/work/savePCDayCount',
data: data,
method: 'post',
});
};
...@@ -67,7 +67,7 @@ export const previewWork = async (data) => { ...@@ -67,7 +67,7 @@ export const previewWork = async (data) => {
}; };
export const setPlatformUpper = async (data) => { export const setPlatformUpper = async (data) => {
return request({ return request({
url: `/diagnose/doctor/work/setPlatformUpper/${data.num}`, url: '/diagnose/doctor/work/setPlatformUpper',
data: data, data: data,
method: 'post', method: 'post',
}); });
...@@ -92,3 +92,10 @@ export const getLevelAndDayCount = async (data) => { ...@@ -92,3 +92,10 @@ export const getLevelAndDayCount = async (data) => {
method: 'post', method: 'post',
}); });
}; };
// 暂时添加刷新问诊接口
export const getOrderNoFresh = async (diagnoseLogId) => {
return request({
url: `/diagnose/admin/diagnose/diagnoseOrderNo/fresh/${diagnoseLogId}`,
method: 'get',
});
};
...@@ -614,8 +614,35 @@ ...@@ -614,8 +614,35 @@
const that = this; const that = this;
this.timerOfStatus = setInterval(function () { this.timerOfStatus = setInterval(function () {
getOnlineStatus(roomId).then((res) => { getOnlineStatus(roomId).then((res) => {
const l = res.data; if (!res.data) {
console.log('res==', res, that.memberList); return false;
}
const l = res.data.map((i) => {
return i.userId;
});
// l = [1089725294, 1089728785];
// that.memberList = [
// {
// accId: 'd_3651506947_uat',
// avatarImageUrl: 'https://test-file.yunqueyi.com/File/doctor_default.png',
// id: 1089725294,
// liveUserId: 'd_3651506947_uat_1089725294',
// name: '顾超',
// role: 2,
// status: 3,
// type: 1
// },
// {
// accId: 'd_1909506947_uat',
// avatarImageUrl: 'https://test-file.yunqueyi.com/File/doctor_default.png',
// id: 1089728785,
// liveUserId: 'd_1909506947_uat_1089728785',
// name: '陈影',
// role: 1,
// status: 3,
// type: 1,
// }
// ];
if ( if (
l && l &&
l.length > 0 && l.length > 0 &&
...@@ -623,20 +650,27 @@ ...@@ -623,20 +650,27 @@
that.memberList.length > 0 that.memberList.length > 0
) { ) {
that.memberList.map((i) => { that.memberList.map((i) => {
if (l.includes[i]) { console.log('res==---', l, i.id, l.includes(i.id));
if (l.includes(i.id)) {
// 在线 更新状态 // 在线 更新状态
that.addNewMember(i.liveUserId); that.addNewMember(i.liveUserId);
} else { } else {
// 不在线 更新状态 // 不在线 更新状态
if (i.role == 1 && that.doctorTrtcEntryStatus != 3) { if (i.role == 1 && that.doctorTrtcEntryStatus != 3) {
that.addNewMember(i.liveUserId); that.removeMember(i.liveUserId);
} }
if (i.role == 2 && that.userTrtcEntryStatus != 3) { if (i.role == 2 && that.userTrtcEntryStatus != 3) {
that.addNewMember(i.liveUserId); that.removeMember(i.liveUserId);
} }
} }
}); });
} else {
if (that.memberList && that.memberList.length > 0) {
that.memberList.map((i) => {
that.removeMember(i.liveUserId);
});
}
} }
}); });
}, 2000); }, 2000);
......
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
</div> </div>
<div class="doctor-info"> <div class="doctor-info">
<div class="name-floor"> <div class="name-floor">
<span class="name-info-detail">{{ userName }}</span>
<span class="doctor-info-name">基层医生</span> <span class="doctor-info-name">基层医生</span>
<p class="info-phone"> <span class="name-info-detail">{{ userName }}</span>
<span class="info-phone">
{{ userNamePhone }} {{ userNamePhone }}
</p> </span>
</div> </div>
<div class="daignose-info"> <div class="daignose-info">
<span>分诊科室:{{ triageDepartment }}</span> <span>分诊科室:{{ triageDepartment }}</span>
...@@ -276,15 +276,17 @@ ...@@ -276,15 +276,17 @@
border-radius: 8px; border-radius: 8px;
height: 68px; height: 68px;
display: flex; display: flex;
padding: 20px 30px 20px 0;
.name-floor { .name-floor {
width: 50%; width: 50%;
padding: 10px 26px; padding: 10px 26px;
display: flex;
align-items: center;
.name-info-detail { .name-info-detail {
font-size: 18px; font-size: 18px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #02120f; color: #02120f;
margin-bottom: 8px;
margin-right: 5px; margin-right: 5px;
} }
.doctor-info-name { .doctor-info-name {
...@@ -292,7 +294,9 @@ ...@@ -292,7 +294,9 @@
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
margin-bottom: 8px; border-radius: 9px;
border: 1px solid #d9d9d9;
margin-right: 8px;
} }
.info-phone { .info-phone {
font-size: 18px; font-size: 18px;
...@@ -306,7 +310,10 @@ ...@@ -306,7 +310,10 @@
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
padding-top: 40px; display: flex;
align-items: center;
width: 50%;
justify-content: flex-end;
} }
} }
.work-info-Num { .work-info-Num {
......
<template>
<div class="update-departId">
<el-dialog
:title="title"
:visible.sync="diaUpdateDeIdVisible"
@close="cancel"
>
<div class="update-shownamephone">
<div class="update-namephone">
<div class="update-name">
<span class="doctor-name">基层医生</span>
<span class="namephone-show">{{ userName }}</span>
<span class="namephone-show">{{ userNamePhone }}</span>
</div>
<div class="depart-show">
原分诊科室:{{ triageDepartment }}
</div>
</div>
<div class="deparment-show">
<p class="update-dename">
修改新分诊科室
</p>
<el-cascader
ref="cascader"
v-model="triageDepartmentId"
filterable
clearable
class="serviceSchedule-cascader"
:options="allTilst"
placeholder="选择科室"
:show-all-levels="false"
@change="changeDepartment"
>
<template slot-scope="{ data }">
<span :style="{ fontSize: '15px', color: '#606266' }">{{
data.label
}}</span>
<span
:style="{
fontSize: '10px',
color: '#606266',
marginLeft: '10px',
opacity: '0.7',
}"
>{{ data.text }}</span>
</template>
</el-cascader>
</div>
<div class="work-info-botton">
<span
slot="footer"
class="dialog-footer"
style="text-align: center"
>
<el-button
class="contest"
type="primary"
:disabled="isClick"
@click="confirm"
>确定</el-button>
<el-button
class="cancel-submit"
@click="cancel"
>取 消</el-button>
</span>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { updateDepartmentId, departmentAll } from '@/api/diagnosis';
let vm = null;
export default {
props: {
diaUpdateDeIdVisible: {
type: Boolean,
default: false,
},
diagnoseLogId: {
type: Number,
default: 0,
},
triageDepartment: {
type: String,
default: '',
},
userName: {
type: String,
default: '',
},
userNamePhone: {
type: String,
default: '',
},
},
data() {
return {
show: false,
title: '',
confirmTxt: '确定',
cancleTxt: '',
triageDepartmentId: '',
newTriageDepartment: '',
allTilst: [],
allList: {},
};
},
created() {
vm = this;
this.departmentAll();
},
methods: {
departmentAll() {
departmentAll().then((res) => {
if (res.code == '000000') {
this.allList = res.data || {};
this.showListALL();
}
});
},
showListALL() {
const arr = [];
const { departmentMapList, parentDepartmentList } = this.allList;
parentDepartmentList.map((item) => {
const obj = {
label: item.departmentName,
value: item.departmentId,
children: [],
};
departmentMapList.map((info) => {
if (info.parentDepartmentId === obj.value) {
const children = [];
info.diagnoseDepartmentRespList.map((detail) => {
const secondObj = {
label: detail.departmentName,
value: detail.departmentId,
text: '',
};
let secondChildren = '';
(detail.departmentDeseaseRespList || []).map((res) => {
secondChildren += res.deseaseName + ' ';
});
secondObj.text = secondChildren ? `(${secondChildren})` : '';
children.push(secondObj);
});
obj.children = children;
}
});
arr.push(obj);
});
console.log(arr);
this.allTilst = arr;
},
confirm() {
if (this.newTriageDepartment == '') {
this.$message({
message: '请选择修改科室',
type: 'warning',
duration: 1000,
});
return false;
}
const params = {
diagnoseLogId: this.diagnoseLogId,
triageDepartmentId: this.triageDepartmentId,
triageDepartment: this.newTriageDepartment,
};
vm.isClick = true;
updateDepartmentId(params)
.then((res) => {
vm.isClick = false;
if (res.code == '000000') {
vm.cancel();
vm.$emit('search');
} else {
vm.$message.error(res.message);
}
})
.catch(function () {
vm.isClick = false;
// vm.$message.error(err.message);
});
},
cancel() {
this.$emit('update:diaUpdateDeIdVisible', false);
},
// 获取选择的值
changeDepartment() {
const checkedNodes = this.$refs['cascader'].getCheckedNodes();
console.log(checkedNodes);
if (checkedNodes.length > 0) {
this.triageDepartmentId = checkedNodes[0].value;
this.newTriageDepartment = checkedNodes[0].label;
} else {
this.triageDepartmentId = '';
this.newTriageDepartment = '';
}
},
},
};
</script>
<style lang="scss" scoped>
.update-departId {
.update-shownamephone {
padding: 20px 30px;
.update-namephone {
padding: 20px 30px;
background: rgba(240, 242, 245, 0.6);
border-radius: 8px;
display: flex;
width: 100%;
.update-name {
width: 50%;
display: flex;
justify-content: flex-start;
align-items: center;
.doctor-name {
padding: 2px 3px;
border-radius: 10px;
border: 1px solid #d9d9d9;
margin-right: 8px;
}
.namephone-show {
font-size: 18px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #02120f;
margin-right: 8px;
}
}
.depart-show {
width: 50%;
display: flex;
justify-content: flex-end;
}
}
.deparment-show {
margin-top: 28px;
.update-dename {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #02120f;
margin-bottom: 9px;
}
/deep/.serviceSchedule-cascader {
.el-input {
.el-input__inner {
width: 180px;
height: 32px;
background: #ffffff;
border-radius: 16px;
border: 1px solid rgba(0, 0, 0, 0.15);
}
.el-input__suffix {
display: flex;
align-items: center;
}
}
input::-webkit-input-placeholder {
color: #89888b;
}
}
}
.work-info-botton {
padding: 35px 0;
.dialog-footer {
.contest {
width: 180px;
height: 40px;
background: #0d9078;
border-radius: 20px;
}
.cancel-submit {
width: 180px;
height: 40px;
border-radius: 20px;
border: 1px solid #0d9078;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
}
}
}
}
}
</style>
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
}, },
watch: { watch: {
musicList(newv) { musicList(newv) {
console.log(newv);
this.musicArr = newv || []; this.musicArr = newv || [];
}, },
}, },
...@@ -87,10 +88,11 @@ ...@@ -87,10 +88,11 @@
}, },
methods: { methods: {
musicUrl(item) { musicUrl(item) {
console.log(item);
if (item.url) { if (item.url) {
return item.url; return item.url;
} }
return item.response.data.domainPath + item.response.data.path; return item.data.domainPath + item.data.path;
}, },
beforeRemove() { beforeRemove() {
this.loading = true; this.loading = true;
...@@ -104,7 +106,8 @@ ...@@ -104,7 +106,8 @@
}, 1000); }, 1000);
}, },
sucess(fileList) { sucess(fileList) {
this.musicArr = fileList; console.log(fileList);
this.musicArr.push(fileList);
this.loading = false; this.loading = false;
}, },
errfn() { errfn() {
...@@ -116,10 +119,8 @@ ...@@ -116,10 +119,8 @@
const newArr = []; const newArr = [];
if (this.musicArr && this.musicArr.length) { if (this.musicArr && this.musicArr.length) {
this.musicArr.forEach((item) => { this.musicArr.forEach((item) => {
if (item.response) { if (item.data) {
newArr.push( newArr.push(item.data.domainPath + item.data.path);
item.response.data.domainPath + item.response.data.path
);
} else if (item.url && item.from) { } else if (item.url && item.from) {
newArr.push(item.url); newArr.push(item.url);
} }
......
...@@ -68,6 +68,12 @@ ...@@ -68,6 +68,12 @@
:filters="createList" :filters="createList"
:filter-method="getLevel" :filter-method="getLevel"
/> />
<el-table-column
prop="preNum"
label="接诊上限/小时"
width="150"
align="center"
/>
<el-table-column <el-table-column
prop="workStatus" prop="workStatus"
label="排班状态" label="排班状态"
...@@ -121,7 +127,7 @@ ...@@ -121,7 +127,7 @@
label="操作" label="操作"
fixed="right" fixed="right"
align="center" align="center"
min-width="200" min-width="270"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
...@@ -148,6 +154,12 @@ ...@@ -148,6 +154,12 @@
> >
查看 查看
</div> </div>
<div
class="download-btn"
@click="setMaxNumValue(scope.row)"
>
接诊上限
</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -225,6 +237,7 @@ ...@@ -225,6 +237,7 @@
text: '未开通', text: '未开通',
}, },
], ],
// maxNumValue: '',
}; };
}, },
computed: {}, computed: {},
...@@ -254,6 +267,10 @@ ...@@ -254,6 +267,10 @@
addSchedule(value, val) { addSchedule(value, val) {
this.$emit('addSchedule', value, val); this.$emit('addSchedule', value, val);
}, },
// 点击接诊上限按钮弹框打开
setMaxNumValue(value) {
this.$emit('setMaxNumValue', value);
},
// 分页 // 分页
handleSizeChange(value) { handleSizeChange(value) {
this.$emit('handleSizeChange', value); this.$emit('handleSizeChange', value);
......
...@@ -118,6 +118,15 @@ ...@@ -118,6 +118,15 @@
> >
设为待匹配医生 设为待匹配医生
</el-button> </el-button>
<el-button
v-if="showBtn(scope.row, 22, 21)"
type="primary"
size="small"
class="btn"
@click="updateDepartId(scope.row)"
>
修改科室
</el-button>
<el-button <el-button
v-if="showBtn(scope.row, 3, 4, 5, 6, 21, 22, 23, 24, 25, 26)" v-if="showBtn(scope.row, 3, 4, 5, 6, 21, 22, 23, 24, 25, 26)"
type="primary" type="primary"
...@@ -356,6 +365,10 @@ ...@@ -356,6 +365,10 @@
waitMatchDot(row) { waitMatchDot(row) {
this.$emit('waitMatchDot', row); this.$emit('waitMatchDot', row);
}, },
// 修改科室
updateDepartId(row) {
this.$emit('updateDepartId', row);
},
// 发送消息 // 发送消息
sendMessage(row) { sendMessage(row) {
this.$emit('sendMessage', row); this.$emit('sendMessage', row);
......
...@@ -80,12 +80,25 @@ const overviewScheduling = (r) => ...@@ -80,12 +80,25 @@ const overviewScheduling = (r) =>
() => r(require('@/views/IM/diagnosis-admin/overviewScheduling.vue')), () => r(require('@/views/IM/diagnosis-admin/overviewScheduling.vue')),
'overviewScheduling' 'overviewScheduling'
); );
const schedReminder = (r) =>
require.ensure(
[],
() => r(require('@/views/IM/diagnosis-admin/schedReminder.vue')),
'overviewScheduling'
);
const administrators = (r) => const administrators = (r) =>
require.ensure( require.ensure(
[], [],
() => r(require('@/views/IM/diagnosis-admin/administrators.vue')), () => r(require('@/views/IM/diagnosis-admin/administrators.vue')),
'administrators' 'administrators'
); );
const orderStatusUpdate = (r) =>
require.ensure(
[],
() => r(require('@/views/IM/diagnosis-admin/orderStatusUpdate.vue')),
'orderStatusUpdate'
);
const Layout = (r) => const Layout = (r) =>
require.ensure([], () => r(require('@/views/layout/Layout.vue')), 'Layout'); require.ensure([], () => r(require('@/views/layout/Layout.vue')), 'Layout');
...@@ -154,10 +167,18 @@ const routerConfig = [ ...@@ -154,10 +167,18 @@ const routerConfig = [
path: '/overviewScheduling', path: '/overviewScheduling',
component: overviewScheduling, component: overviewScheduling,
}, },
{
path: '/schedReminder',
component: schedReminder,
},
{ {
path: '/administrators', path: '/administrators',
component: administrators, component: administrators,
}, },
{
path: '/orderStatusUpdate',
component: orderStatusUpdate,
},
], ],
}, },
]; ];
......
...@@ -14,12 +14,23 @@ export const DIAGNOS_LIST_NEW = [ ...@@ -14,12 +14,23 @@ export const DIAGNOS_LIST_NEW = [
label: '订单金额', label: '订单金额',
showtooltip: false, showtooltip: false,
}, },
{
prop: 'consultRoad',
label: '订单业务类型',
showtooltip: false,
},
{ {
prop: 'diagnoseTypeStr', prop: 'diagnoseTypeStr',
label: '预约类型', label: '预约类型',
showtooltip: false, showtooltip: false,
with: '200', with: '200',
}, },
{
prop: 'type',
label: '问诊类型',
showtooltip: false,
with: '200',
},
{ {
prop: 'refundRemark', prop: 'refundRemark',
label: '外呼状态', label: '外呼状态',
......
/* eslint-disable */
class RtcClient { class RtcClient {
constructor(options) { constructor(options) {
this.sdkAppId_ = options.sdkAppId; this.sdkAppId_ = options.sdkAppId;
...@@ -25,7 +26,7 @@ class RtcClient { ...@@ -25,7 +26,7 @@ class RtcClient {
mode: 'live', mode: 'live',
sdkAppId: this.sdkAppId_, sdkAppId: this.sdkAppId_,
userId: this.userId_, userId: this.userId_,
userSig: this.userSig_ userSig: this.userSig_,
}); });
this.handleEvents(); this.handleEvents();
} catch (error) { } catch (error) {
...@@ -43,7 +44,7 @@ class RtcClient { ...@@ -43,7 +44,7 @@ class RtcClient {
try { try {
await this.client_.join({ await this.client_.join({
roomId: this.roomId_, roomId: this.roomId_,
role: this.role role: this.role,
}); });
console.log('加入房间trtc成功'); console.log('加入房间trtc成功');
this.isJoined_ = true; this.isJoined_ = true;
...@@ -52,7 +53,7 @@ class RtcClient { ...@@ -52,7 +53,7 @@ class RtcClient {
audio: true, audio: true,
video: false, video: false,
userId: this.userId_, userId: this.userId_,
mirror: true mirror: true,
}); });
this.startRTC(); this.startRTC();
} catch (e) { } catch (e) {
...@@ -69,7 +70,7 @@ class RtcClient { ...@@ -69,7 +70,7 @@ class RtcClient {
width: this.vueInstance.viedoParams.webVideoWidth, width: this.vueInstance.viedoParams.webVideoWidth,
height: this.vueInstance.viedoParams.webVideoHeight, height: this.vueInstance.viedoParams.webVideoHeight,
frameRate: this.vueInstance.viedoParams.webVideoFramerate, frameRate: this.vueInstance.viedoParams.webVideoFramerate,
bitrate: this.vueInstance.viedoParams.webVideoBitrate /* kpbs */ bitrate: this.vueInstance.viedoParams.webVideoBitrate /* kpbs */,
}); });
// 避免重复开摄像头 // 避免重复开摄像头
this.stopPush(); this.stopPush();
...@@ -86,29 +87,32 @@ class RtcClient { ...@@ -86,29 +87,32 @@ class RtcClient {
return; return;
} }
try { try {
this.localStream_.initialize().catch(error => { this.localStream_
this.vueInstance.$message({ .initialize()
message: '打开设备失败,请检查您的设备!', .catch((error) => {
type: 'error' this.vueInstance.$message({
}); message: '打开设备失败,请检查您的设备!',
console.error('failed initialize localStream ' + error); type: 'error',
}).then(() => { });
console.error('failed initialize localStream ' + error);
// 本地流在主播放器上播放,并且插入到一个关联的box中 })
var localVideoWrapEl = document.getElementById('ask'); .then(() => {
this.localStream_.play(localVideoWrapEl, { // 本地流在主播放器上播放,并且插入到一个关联的box中
muted: true var localVideoWrapEl = document.getElementById('ask');
}); this.localStream_.play(localVideoWrapEl, {
// 主播直接推流 muted: true,
if (this.role == 'anchor') { });
this.publish(); // 主播直接推流
} if (this.role == 'anchor') {
}).catch(() => { this.publish();
this.vueInstance.$message({ }
message: '麦克风打开失败!', })
type: 'error' .catch(() => {
this.vueInstance.$message({
message: '麦克风打开失败!',
type: 'error',
});
}); });
});
} catch (e) { } catch (e) {
this.isPublished_ = false; this.isPublished_ = false;
} }
...@@ -117,16 +121,20 @@ class RtcClient { ...@@ -117,16 +121,20 @@ class RtcClient {
// 发布本地流 // 发布本地流
async publish() { async publish() {
this.client_ && this.client_.publish(this.localStream_).then(() => { this.client_ &&
console.log('本地流发布成功'); this.client_
this.isPublished_ = true; .publish(this.localStream_)
// 手动将麦克风打开 .then(() => {
this.unmuteLocalAudio(); console.log('本地流发布成功');
}).catch(error => { this.isPublished_ = true;
console.log('本地流发布失败'); // 手动将麦克风打开
this.isPublished_ = false; this.unmuteLocalAudio();
this.vueInstance.reloadfn(); })
}); .catch((error) => {
console.log('本地流发布失败');
this.isPublished_ = false;
this.vueInstance.reloadfn();
});
} }
/** /**
...@@ -134,11 +142,11 @@ class RtcClient { ...@@ -134,11 +142,11 @@ class RtcClient {
*/ */
async stopPush() { async stopPush() {
if (this.localStream_ && this.isPublished_ && this.isJoined_) { if (this.localStream_ && this.isPublished_ && this.isJoined_) {
this.client_.unpublish(this.localStream_).then(() => { this.client_.unpublish(this.localStream_).then(() => {
this.isPublished_ = false; this.isPublished_ = false;
this.localStream_.stop(); this.localStream_.stop();
this.setLocalVideo(); this.setLocalVideo();
}); });
} else { } else {
this.setLocalVideo(); this.setLocalVideo();
} }
...@@ -189,12 +197,12 @@ class RtcClient { ...@@ -189,12 +197,12 @@ class RtcClient {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
TRTCType: 'mute', // trtc 实时通讯状态数据类型 1. error , 2.network-quality 3. AudioStats TRTCType: 'mute', // trtc 实时通讯状态数据类型 1. error , 2.network-quality 3. AudioStats
TRTCData: {muteLocalAudio: '静音' }, // trtc 实时通讯状态数据 TRTCData: { muteLocalAudio: '静音' }, // trtc 实时通讯状态数据
}; };
_VM.$sendBuriedData({ _VM.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
this.localStream_.muteAudio(); this.localStream_.muteAudio();
} }
...@@ -207,12 +215,12 @@ class RtcClient { ...@@ -207,12 +215,12 @@ class RtcClient {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
TRTCType: 'unmute', // trtc 实时通讯状态数据类型 1. error , 2.network-quality 3. AudioStats TRTCType: 'unmute', // trtc 实时通讯状态数据类型 1. error , 2.network-quality 3. AudioStats
TRTCData: {muteLocalAudio: '取消静音' }, // trtc 实时通讯状态数据 TRTCData: { muteLocalAudio: '取消静音' }, // trtc 实时通讯状态数据
}; };
_VM.$sendBuriedData({ _VM.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
this.localStream_.unmuteAudio(); this.localStream_.unmuteAudio();
} }
...@@ -239,15 +247,17 @@ class RtcClient { ...@@ -239,15 +247,17 @@ class RtcClient {
// client的一些事件监听 // client的一些事件监听
handleEvents() { handleEvents() {
// 报错 // 报错
this.client_.on('error', err => { this.client_.on('error', (err) => {
console.log('client 报错了--------------------------------------------------------------'); console.log(
'client 报错了--------------------------------------------------------------'
);
console.log(err); console.log(err);
// alert(err); // alert(err);
window.onbeforeunload = null; window.onbeforeunload = null;
location.reload(); location.reload();
}); });
this.client_.on('network-quality', event => { this.client_.on('network-quality', (event) => {
console.log('--network-quality', event); console.log('--network-quality', event);
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
...@@ -258,9 +268,9 @@ class RtcClient { ...@@ -258,9 +268,9 @@ class RtcClient {
_VM.$sendBuriedData({ _VM.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
this.client_.getLocalAudioStats().then(stats => { this.client_.getLocalAudioStats().then((stats) => {
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
...@@ -270,10 +280,10 @@ class RtcClient { ...@@ -270,10 +280,10 @@ class RtcClient {
_VM.$sendBuriedData({ _VM.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
}); });
this.client_.getRemoteAudioStats().then(stats => { this.client_.getRemoteAudioStats().then((stats) => {
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
...@@ -284,10 +294,9 @@ class RtcClient { ...@@ -284,10 +294,9 @@ class RtcClient {
_VM.$sendBuriedData({ _VM.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
}); });
}); });
// 房间被解散了 // 房间被解散了
...@@ -296,20 +305,20 @@ class RtcClient { ...@@ -296,20 +305,20 @@ class RtcClient {
}); });
// 当一个远程同伴(必须推流)进入房间时触发 // 当一个远程同伴(必须推流)进入房间时触发
this.client_.on('peer-join', evt => { this.client_.on('peer-join', (evt) => {
const userId = evt.userId; const userId = evt.userId;
console.log('有远程同伴进入房间:', userId); console.log('有远程同伴进入房间:', userId);
}); });
// 当远处的同伴离开房间时触发(删减好友列表) // 当远处的同伴离开房间时触发(删减好友列表)
this.client_.on('peer-leave', evt => { this.client_.on('peer-leave', (evt) => {
const userId = evt.userId; const userId = evt.userId;
console.log('有远程同伴离开房间:' + userId); console.log('有远程同伴离开房间:' + userId);
this.removeUserList(userId); this.removeUserList(userId);
}); });
// 在添加远程流时触发 // 在添加远程流时触发
this.client_.on('stream-added', evt => { this.client_.on('stream-added', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
// 获取流的StreamId // 获取流的StreamId
const id = remoteStream.getId(); const id = remoteStream.getId();
...@@ -317,19 +326,21 @@ class RtcClient { ...@@ -317,19 +326,21 @@ class RtcClient {
const userId = remoteStream.getUserId(); const userId = remoteStream.getUserId();
this.members_.set(userId, remoteStream); this.members_.set(userId, remoteStream);
this.inmembers_.set(userId, remoteStream); this.inmembers_.set(userId, remoteStream);
console.log(`remote stream added: [${userId}] ID: ${id} type: ${remoteStream.getType()}`); console.log(
`remote stream added: [${userId}] ID: ${id} type: ${remoteStream.getType()}`
);
// 我们订阅远端的流 // 我们订阅远端的流
console.log('subscribe to this remote stream'); console.log('subscribe to this remote stream');
this.client_.subscribe(remoteStream); this.client_.subscribe(remoteStream);
}); });
// 在订阅远程流时触发 // 在订阅远程流时触发
this.client_.on('stream-subscribed', evt => { this.client_.on('stream-subscribed', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
const id = remoteStream.getId(); const id = remoteStream.getId();
const uid = remoteStream.userId_; const uid = remoteStream.userId_;
this.remoteStreams_.push(remoteStream); this.remoteStreams_.push(remoteStream);
remoteStream.on('player-state-changed', event => { remoteStream.on('player-state-changed', (event) => {
console.log(`${event.type} player is ${event.state}`); console.log(`${event.type} player is ${event.state}`);
// 远端流是播放还是暂停状态(显示按钮等画面不同) // 远端流是播放还是暂停状态(显示按钮等画面不同)
if (event.type == 'video' && event.state == 'STOPPED') { if (event.type == 'video' && event.state == 'STOPPED') {
...@@ -346,46 +357,44 @@ class RtcClient { ...@@ -346,46 +357,44 @@ class RtcClient {
} }
}); });
// 避免重复加载 // 避免重复加载
for (let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && uid == this.viewslist[i].userId) { if (this.viewslist[i] && uid == this.viewslist[i].userId) {
return; return;
}
} }
const isMask = false; }
const isMask = false;
// this.viewslist.push({ id: id, userId: uid, nick: uid, mask: isMask, vioce: true })
this.add(id, uid, isMask); // this.viewslist.push({ id: id, userId: uid, nick: uid, mask: isMask, vioce: true })
this.vueInstance.addNewMember(uid); this.add(id, uid, isMask);
this.vueInstance.addNewMember(uid);
setTimeout(() => {
// 避免其他乱入视频 setTimeout(() => {
const index = this.viewslist.findIndex((item => { // 避免其他乱入视频
if (item && item.userId) { const index = this.viewslist.findIndex((item) => {
return item.userId == uid; if (item && item.userId) {
} else { return item.userId == uid;
return -1; } else {
} return -1;
}));
if (index < 0) {
return;
}
// 播放视频
remoteStream.play(id);
if (!remoteStream.hasVideo()) {
this.changeView(id, 'mask', true);
}
if (!remoteStream.hasAudio()) {
this.changeView(id, 'vioce', false);
} }
}, 1000); });
if (index < 0) {
return;
}
// 播放视频
remoteStream.play(id);
if (!remoteStream.hasVideo()) {
this.changeView(id, 'mask', true);
}
if (!remoteStream.hasAudio()) {
this.changeView(id, 'vioce', false);
}
}, 1000);
}); });
// 当远程流被移除时触发 // 当远程流被移除时触发
this.client_.on('stream-removed', evt => { this.client_.on('stream-removed', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
const id = remoteStream.getId(); const id = remoteStream.getId();
const uid = remoteStream.userId_; const uid = remoteStream.userId_;
...@@ -393,14 +402,14 @@ class RtcClient { ...@@ -393,14 +402,14 @@ class RtcClient {
// 停止播放并删除相应<video>标签 // 停止播放并删除相应<video>标签
remoteStream.stop(); remoteStream.stop();
this.inmembers_.delete(uid); this.inmembers_.delete(uid);
this.remoteStreams_ = this.remoteStreams_.filter(stream => { this.remoteStreams_ = this.remoteStreams_.filter((stream) => {
return stream.getId() !== id; return stream.getId() !== id;
}); });
this.removeUserList(uid); this.removeUserList(uid);
}); });
// 流更新 // 流更新
this.client_.on('stream-updated', evt => { this.client_.on('stream-updated', (evt) => {
console.log('=========流更新========stream-updated==================='); console.log('=========流更新========stream-updated===================');
console.log(evt); console.log(evt);
const remoteStream = evt.stream; const remoteStream = evt.stream;
...@@ -408,37 +417,52 @@ class RtcClient { ...@@ -408,37 +417,52 @@ class RtcClient {
// remoteStream.hasVideo() // 是否有视频轨道 // remoteStream.hasVideo() // 是否有视频轨道
// remoteStream.hasAudio() //是否有音轨道 // remoteStream.hasAudio() //是否有音轨道
// remoteStream.getType() // 主要用于判断一个远端流是主音视频流还是辅路视频流,辅路视频流通常是一个屏幕分享流。 // remoteStream.getType() // 主要用于判断一个远端流是主音视频流还是辅路视频流,辅路视频流通常是一个屏幕分享流。
console.log('remoteStream ID: ' + remoteStream.getId() + ' was updated hasAudio: ' + console.log(
remoteStream.hasAudio() + ' hasVideo: ' + remoteStream.hasVideo()); 'remoteStream ID: ' +
remoteStream.getId() +
' was updated hasAudio: ' +
remoteStream.hasAudio() +
' hasVideo: ' +
remoteStream.hasVideo()
);
}); });
// 关闭音轨道 // 关闭音轨道
this.client_.on('mute-audio', evt => { this.client_.on('mute-audio', (evt) => {
this.changeView(evt.userId, 'vioce', false); this.changeView(evt.userId, 'vioce', false);
console.log(evt.userId + '关闭麦克风============================================'); console.log(
evt.userId + '关闭麦克风============================================'
);
}); });
// 打开音轨道 // 打开音轨道
this.client_.on('unmute-audio', evt => { this.client_.on('unmute-audio', (evt) => {
this.changeView(evt.userId, 'vioce', true); this.changeView(evt.userId, 'vioce', true);
if (evt.type == 'audio' && evt.state == 'PLAYING' && this.vueInstance.type == 1) { if (
evt.type == 'audio' &&
evt.state == 'PLAYING' &&
this.vueInstance.type == 1
) {
this.changeView(evt.userId, 'mask', true); this.changeView(evt.userId, 'mask', true);
} }
}); });
// 关闭视频轨道 // 关闭视频轨道
this.client_.on('mute-video', evt => { this.client_.on('mute-video', (evt) => {
console.log(evt.userId + '关闭 video=============================================='); console.log(
evt.userId + '关闭 video=============================================='
);
this.changeView(evt.userId, 'mask', true); this.changeView(evt.userId, 'mask', true);
}); });
// 打开视频轨道 // 打开视频轨道
this.client_.on('unmute-video', evt => { this.client_.on('unmute-video', (evt) => {
console.log(evt.userId + '打开 video============================================='); console.log(
evt.userId + '打开 video============================================='
);
if (this.members_.get(evt.userId)) { if (this.members_.get(evt.userId)) {
this.changeView(evt.userId, 'mask', false); this.changeView(evt.userId, 'mask', false);
} }
}); });
} }
...@@ -452,7 +476,7 @@ class RtcClient { ...@@ -452,7 +476,7 @@ class RtcClient {
// 移除视频数组 // 移除视频数组
removeUserList(userId) { removeUserList(userId) {
for(let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && this.viewslist[i].userId == userId) { if (this.viewslist[i] && this.viewslist[i].userId == userId) {
this.viewslist[i] = null; this.viewslist[i] = null;
} }
...@@ -462,7 +486,10 @@ class RtcClient { ...@@ -462,7 +486,10 @@ class RtcClient {
// 改变视频数组属性 // 改变视频数组属性
changeView(id, attr, val) { changeView(id, attr, val) {
for (let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && (this.viewslist[i].userId == id || this.viewslist[i].id == id)) { if (
this.viewslist[i] &&
(this.viewslist[i].userId == id || this.viewslist[i].id == id)
) {
this.viewslist[i][attr] = val; this.viewslist[i][attr] = val;
} }
} }
...@@ -471,7 +498,13 @@ class RtcClient { ...@@ -471,7 +498,13 @@ class RtcClient {
add(id, uid, isMask) { add(id, uid, isMask) {
this.vueInstance.memberList.forEach((ele, index) => { this.vueInstance.memberList.forEach((ele, index) => {
if (ele.liveUserId == uid) { if (ele.liveUserId == uid) {
this.viewslist[index] = { id: id, userId: uid, nick: uid, mask: isMask, vioce: true }; this.viewslist[index] = {
id: id,
userId: uid,
nick: uid,
mask: isMask,
vioce: true,
};
} }
}); });
} }
......
...@@ -119,7 +119,7 @@ export const STATUS_LIST = [ ...@@ -119,7 +119,7 @@ export const STATUS_LIST = [
value: 6, value: 6,
}, },
{ {
label: '已匹配', label: '待联系',
value: 21, value: 21,
}, },
{ {
...@@ -289,21 +289,21 @@ export const ALL_TAB_LIST = [ ...@@ -289,21 +289,21 @@ export const ALL_TAB_LIST = [
active: '99', active: '99',
}, },
{ {
label: '待匹配', label: '待分诊',
active: '2', active: '2',
}, },
{ {
label: '已匹配', label: '待联系',
active: '102', active: '102',
}, },
{ {
label: '稍后跟进', label: '稍后跟进',
active: '101', active: '101',
}, },
{ // {
label: '待分诊', // label: '待分诊',
active: '22', // active: '22',
}, // },
{ {
label: '待匹配医生', label: '待匹配医生',
active: '23', active: '23',
...@@ -389,7 +389,7 @@ export const TRIAGE_TAB_LIST = [ ...@@ -389,7 +389,7 @@ export const TRIAGE_TAB_LIST = [
// active: '22' // active: '22'
// }, // },
{ {
label: '待匹配', label: '待分诊',
active: '2', active: '2',
}, },
]; ];
...@@ -421,7 +421,7 @@ export const MATCH_TAB_LIST = [ ...@@ -421,7 +421,7 @@ export const MATCH_TAB_LIST = [
active: '99', active: '99',
}, },
{ {
label: '已匹配', label: '待联系',
active: '102', active: '102',
}, },
{ {
......
...@@ -15,7 +15,8 @@ export const envConfig = { ...@@ -15,7 +15,8 @@ export const envConfig = {
qiniuImgUrl: 'https://test1-file.yunqueyi.com', qiniuImgUrl: 'https://test1-file.yunqueyi.com',
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html', loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
// innerLoginUrl: 'http://localhost:8090/PICA_SSO_FE/html/pica_index.html', // innerLoginUrl: 'http://localhost:8090/PICA_SSO_FE/html/pica_index.html',
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html', innerLoginUrl:
'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html',
phomeDemain: 'https://dev-phome.yunqueyi.com', phomeDemain: 'https://dev-phome.yunqueyi.com',
picakfAccId: 'picaop_dev', picakfAccId: 'picaop_dev',
...@@ -27,18 +28,20 @@ export const envConfig = { ...@@ -27,18 +28,20 @@ export const envConfig = {
qiniuResourceUrl: 'https://test1-videos.yunqueyi.com', qiniuResourceUrl: 'https://test1-videos.yunqueyi.com',
qiniuImgUrl: 'https://test1-file.yunqueyi.com', qiniuImgUrl: 'https://test1-file.yunqueyi.com',
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html', loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html', innerLoginUrl:
'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html',
yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://dev-saas.yunqueyi.com/pica_index.html',
phomeDemain: 'https://dev-phome.yunqueyi.com', phomeDemain: 'https://dev-phome.yunqueyi.com',
picakfAccId: 'picaop_dev', picakfAccId: 'picaop_dev',
}, },
test: { testing: {
baseUrl: 'https://test1-sc.yunqueyi.com', baseUrl: 'https://test1-sc.yunqueyi.com',
qiniuFileUrl: 'https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1', qiniuFileUrl: 'https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1',
qiniuResourceUrl: 'https://test1-videos.yunqueyi.com', qiniuResourceUrl: 'https://test1-videos.yunqueyi.com',
qiniuImgUrl: 'https://test1-file.yunqueyi.com', qiniuImgUrl: 'https://test1-file.yunqueyi.com',
loginUrl: 'https://test1.yunqueyi.com/pica-login/work_station.html', loginUrl: 'https://test1.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html', innerLoginUrl:
'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html',
yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://test1.yunqueyi.com/pica_index.html',
phomeDemain: 'https://test1-phome.yunqueyi.com', phomeDemain: 'https://test1-phome.yunqueyi.com',
picakfAccId: 'picaop_test', picakfAccId: 'picaop_test',
...@@ -51,7 +54,8 @@ export const envConfig = { ...@@ -51,7 +54,8 @@ export const envConfig = {
qiniuImgUrl: 'https://test1-file.yunqueyi.com', qiniuImgUrl: 'https://test1-file.yunqueyi.com',
qiniuResourceUrl: 'https://test1-videos.yunqueyi.com', qiniuResourceUrl: 'https://test1-videos.yunqueyi.com',
loginUrl: 'https://uat.yunqueyi.com/pica-login/work_station.html', loginUrl: 'https://uat.yunqueyi.com/pica-login/work_station.html',
innerLoginUrl: 'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html', innerLoginUrl:
'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_login.html',
yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://uat.yunqueyi.com/pica_index.html',
phomeDemain: 'https://uat-phome.yunqueyi.com', phomeDemain: 'https://uat-phome.yunqueyi.com',
picakfAccId: 'picaop_uat', picakfAccId: 'picaop_uat',
...@@ -66,5 +70,5 @@ export const envConfig = { ...@@ -66,5 +70,5 @@ export const envConfig = {
yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html', yuequeyiIndexUrl: 'https://www.yunqueyi.com/pica_index.html',
phomeDemain: 'https://phome.yunqueyi.com', phomeDemain: 'https://phome.yunqueyi.com',
picakfAccId: 'picaop', picakfAccId: 'picaop',
} },
}; };
// api路径 /* eslint-disable */
import {isNotEmptyUtils} from './utils'; import { isNotEmptyUtils } from './utils';
export default async(url = '', data = {}, type = 'POST', method = 'fetch') => { export default async (url = '', data = {}, type = 'POST', method = 'fetch') => {
type = type.toUpperCase(); type = type.toUpperCase();
// url = (server==='WECHAT'?wechatUrl:baseUrl) + url; // url = (server==='WECHAT'?wechatUrl:baseUrl) + url;
if (url.match('^http') == null) { if (url.match('^http') == null) {
url = localStorage.getItem('Url') + url; url = localStorage.getItem('Url') + url;
} }
console.log('完整url:', url); console.log('完整url:', url);
if (type == 'GET' && data) { if (type == 'GET' && data) {
let dataStr = ''; // 数据拼接字符串 let dataStr = ''; // 数据拼接字符串
Object.keys(data).forEach(key => { Object.keys(data).forEach((key) => {
dataStr += key + '=' + data[key] + '&'; dataStr += key + '=' + data[key] + '&';
}); });
if (dataStr !== '') { if (dataStr !== '') {
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
url = url + '?' + dataStr; url = url + '?' + dataStr;
// url = encodeURI(url + '?' + dataStr, true); // url = encodeURI(url + '?' + dataStr, true);
} }
} }
if (window.fetch && method == 'fetch') { if (window.fetch && method == 'fetch') {
const requestConfig = { const requestConfig = {
credentials: 'include', credentials: 'include',
method: type, method: type,
// mode: "cors", // mode: "cors",
headers: { headers: {
// 'Access-Control-Allow-Origin': '*', // 'Access-Control-Allow-Origin': '*',
'Accept': '*', Accept: '*',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'sysCode':'2' sysCode: '2',
// 'token': localStorage.getItem('token') || null, //固定传header: // 'token': localStorage.getItem('token') || null, //固定传header:
// 'system_code': 'todo' //固定传header:系统编号 // 'system_code': 'todo' //固定传header:系统编号
}, },
}; };
if (type == 'POST' || type === 'PUT' || type === 'PATCH' || type === 'DELETE' && data) { if (
Object.defineProperty(requestConfig, 'body', { type == 'POST' ||
value: JSON.stringify(data) type === 'PUT' ||
}); type === 'PATCH' ||
} (type === 'DELETE' && data)
try { ) {
const response = await fetch(url, requestConfig); Object.defineProperty(requestConfig, 'body', {
const responseJson = await response.json(); value: JSON.stringify(data),
});
}
try {
const response = await fetch(url, requestConfig);
const responseJson = await response.json();
return responseJson; return responseJson;
} catch (error) { } catch (error) {
throw new Error(error); throw new Error(error);
} }
} else { } else {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let requestObj; let requestObj;
if (window.XMLHttpRequest) { if (window.XMLHttpRequest) {
requestObj = new XMLHttpRequest(); requestObj = new XMLHttpRequest();
} else { } else {
requestObj = new ActiveXObject(); requestObj = new ActiveXObject();
} }
let sendData = ''; let sendData = '';
if (type == 'POST' || type == 'DELETE' || type == 'PUT') { if (type == 'POST' || type == 'DELETE' || type == 'PUT') {
sendData = JSON.stringify(data); sendData = JSON.stringify(data);
} }
requestObj.open(type, url, true); requestObj.open(type, url, true);
requestObj.setRequestHeader('Content-Type', 'application/json'); requestObj.setRequestHeader('Content-Type', 'application/json');
requestObj.send(sendData); requestObj.send(sendData);
requestObj.onreadystatechange = () => { requestObj.onreadystatechange = () => {
if (requestObj.readyState == 4) { if (requestObj.readyState == 4) {
if (requestObj.status == 200) { if (requestObj.status == 200) {
let obj = requestObj.response; let obj = requestObj.response;
if (typeof obj !== 'object' && isNotEmptyUtils(obj)) { if (typeof obj !== 'object' && isNotEmptyUtils(obj)) {
obj = JSON.parse(obj); obj = JSON.parse(obj);
} }
resolve(obj); resolve(obj);
} else { } else {
reject(requestObj); reject(requestObj);
} }
} }
}; };
}); });
} }
}; };
import axios from 'axios'; import axios from 'axios';
import store from '../store';
// import { getHostnameAndPort } from '../utils' // import { getHostnameAndPort } from '../utils'
// axios.defaults.withCredentials = true // axios.defaults.withCredentials = true
...@@ -7,48 +6,45 @@ import store from '../store'; ...@@ -7,48 +6,45 @@ import store from '../store';
const service = axios.create({ const service = axios.create({
// baseURL: process.env.BASE_API // baseURL: process.env.BASE_API
timeout: 600000, timeout: 600000,
withCredentials: false withCredentials: false,
}); });
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(
config.headers['sysCode'] = 26; (config) => {
config.headers['token'] = localStorage.getItem('token'); config.headers['sysCode'] = 26;
config.headers['deviceInfo'] = JSON.stringify({ 'app_channel': '', 'app_mac': '', 'app_uuid': '', 'app_version': '', 'device_brand': '', 'device_ip': '', 'device_model': '', 'device_net': '', 'device_ops': '', 'resolution_wh': '', 'system_level': '', 'device_type': '10' }); config.headers['token'] = localStorage.getItem('token');
Object.assign(config.headers, config.changeHeader); config.headers['deviceInfo'] = JSON.stringify({
if (config.fileHeader) { app_channel: '',
config.headers['Content-Type'] = 'application/x-www-form-urlencoded'; app_mac: '',
app_uuid: '',
app_version: '',
device_brand: '',
device_ip: '',
device_model: '',
device_net: '',
device_ops: '',
resolution_wh: '',
system_level: '',
device_type: '10',
});
Object.assign(config.headers, config.changeHeader);
if (config.fileHeader) {
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
}
return config;
},
(error) => {
Promise.reject(error);
} }
);
// if (config.data && config.data.setEntry) {
// config.headers['sysCode'] = config.data.sysCode || 10
// if(config.data.token){
// config.headers['token'] = config.data.token || '63C3FA92AF8A45A48B31EB7FD97B95EB'
// }
// config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
// }
return config;
}, error => {
Promise.reject(error);
});
// respone拦截器 // respone拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { (response) => {
const res = response.data; return response.data;
/*
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
*/
// if (res.code !== '000000') {
// return Promise.reject(response.data)
// } else {
return response.data;
// }
}, },
error => { (error) => {
return Promise.reject(error); return Promise.reject(error);
} }
); );
......
/** /* eslint-disable */
* Created by Anndy Yang on 18/09/18.
*/
import { envConfig } from '@/utils/env-config'; import { envConfig } from '@/utils/env-config';
export function setEventByModuleCode(itemData) { export function setEventByModuleCode(itemData) {
const modeCode = itemData.appModuleInfo.code || ''; const modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''; let paramList = itemData.appModuleInfo.paramList
if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') { ? itemData.appModuleInfo.paramList
paramList = ''; : '';
} else if (modeCode === 'M100' || modeCode === 'M300') { if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = '';
const urlPara = getUrlParmByCode(paramList); } else if (modeCode === 'M100' || modeCode === 'M300') {
paramList[0] && (paramList[0].value += urlPara); const urlPara = getUrlParmByCode(paramList);
paramList[0] && (paramList[0].value += urlPara);
} else if (modeCode === 'M400') { } else if (modeCode === 'M400') {
}
} if (typeof paramList === 'string' && !paramList) {
if (typeof paramList === 'string' && !paramList) { paramList = [];
paramList = []; }
}
return paramList;
return paramList;
} }
function getUrlParmByCode(paramList) { function getUrlParmByCode(paramList) {
if (paramList.length <= 1) { if (paramList.length <= 1) {
return '';
}
let dataStr = '';
const list = [];
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value);
}
dataStr = list.join('&');
if (dataStr !== '') {
return '?' + dataStr;
}
return ''; return '';
}
let dataStr = '';
const list = [];
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value);
}
dataStr = list.join('&');
if (dataStr !== '') {
return '?' + dataStr;
}
return '';
} }
export function p_getElm(elmId) { export function p_getElm(elmId) {
return document.getElementById(elmId); return document.getElementById(elmId);
} }
export function deepCopy(obj) { export function deepCopy(obj) {
var result = Array.isArray(obj) ? [] : {}; var result = Array.isArray(obj) ? [] : {};
for (var key in obj) { for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) { if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (typeof obj[key] === 'object') { if (typeof obj[key] === 'object') {
result[key] = deepCopy(obj[key]); // 递归复制 result[key] = deepCopy(obj[key]); // 递归复制
} else { } else {
result[key] = obj[key]; result[key] = obj[key];
} }
}
} }
return result; }
return result;
} }
/** /**
* *
* @param {Array} originData 初始数据 * @param {Array} originData 初始数据
* @param {Boolean} isUp true: 升序 false: 降序 * @param {Boolean} isUp true: 升序 false: 降序
* @param {String} sortField 排序字段,如果没有,则直接排序 * @param {String} sortField 排序字段,如果没有,则直接排序
* @param {Function} converFun 字段对应的数值转换函数 * @param {Function} converFun 字段对应的数值转换函数
*/ */
export function arraySort(originData, isUp = true, sortedField, converFun) { export function arraySort(originData, isUp = true, sortedField, converFun) {
// debugger // debugger
const sortedData = originData.slice(); const sortedData = originData.slice();
let swap, sourceA, sourceB; let swap, sourceA, sourceB;
for (let i = 0; i < sortedData.length - 1; i++) { for (let i = 0; i < sortedData.length - 1; i++) {
for (let j = 0; j < sortedData.length - i - 1; j++) { for (let j = 0; j < sortedData.length - i - 1; j++) {
sourceA = sortedData[j]; sourceA = sortedData[j];
sourceB = sortedData[j + 1]; sourceB = sortedData[j + 1];
if (sortedField && !converFun) { if (sortedField && !converFun) {
sourceA = sourceA[sortedField]; sourceA = sourceA[sortedField];
sourceB = sourceB[sortedField]; sourceB = sourceB[sortedField];
} else if (sortedField && converFun && typeof converFun === 'function') { } else if (sortedField && converFun && typeof converFun === 'function') {
if (!sourceA[sortedField] || !sourceB[sortedField]) { if (!sourceA[sortedField] || !sourceB[sortedField]) {
sourceA = 0; sourceA = 0;
sourceB = 0; sourceB = 0;
} else { } else {
sourceA = converFun(sourceA[sortedField]); sourceA = converFun(sourceA[sortedField]);
sourceB = converFun(sourceB[sortedField]); sourceB = converFun(sourceB[sortedField]);
}
}
// if(!sourceA || !sourceB) {
// sourceA = 0
// sourceB = 0
// }
if (isUp) {
if ((sourceA - 0) > (sourceB - 0)) {
swap = sortedData[j];
sortedData[j] = sortedData[j + 1];
sortedData[j + 1] = swap;
}
} else {
if ((sourceA - 0) < (sourceB - 0)) {
swap = sortedData[j];
sortedData[j] = sortedData[j + 1];
sortedData[j + 1] = swap;
}
}
} }
}
if (isUp) {
if (sourceA - 0 > sourceB - 0) {
swap = sortedData[j];
sortedData[j] = sortedData[j + 1];
sortedData[j + 1] = swap;
}
} else {
if (sourceA - 0 < sourceB - 0) {
swap = sortedData[j];
sortedData[j] = sortedData[j + 1];
sortedData[j + 1] = swap;
}
}
} }
return sortedData; }
return sortedData;
} }
export function sortParmData(originData, orderCol) { export function sortParmData(originData, orderCol) {
return originData.sort((a, b) => { return originData.sort((a, b) => {
return (a[orderCol] - b[orderCol]) * -1; return (a[orderCol] - b[orderCol]) * -1;
}); });
} }
// 获取SC服务器域名地址 // 获取SC服务器域名地址
export function getBaseUrl(url) { export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url; return getConfigByEnvType('baseUrl') + url;
} }
// 获取七牛token // 获取七牛token
export function getQiniuToken1() { export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl'); return getConfigByEnvType('qiniuFileUrl');
} }
// 登录URL // 登录URL
export function getLoginUrl() { export function getLoginUrl() {
return getConfigByEnvType('loginUrl'); return getConfigByEnvType('loginUrl');
} }
export function getInnerLoginUrl() { export function getInnerLoginUrl() {
return getConfigByEnvType('innerLoginUrl'); return getConfigByEnvType('innerLoginUrl');
} }
// 云鹊医首页 // 云鹊医首页
export function getYunQueYiUrl() { export function getYunQueYiUrl() {
return getConfigByEnvType('yuequeyiIndexUrl'); return getConfigByEnvType('yuequeyiIndexUrl');
} }
// 七牛上传视频和图片 // 七牛上传视频和图片
export function uploadVideo() { export function uploadVideo() {
return getConfigByEnvType('qiniuResourceUrl'); return getConfigByEnvType('qiniuResourceUrl');
} }
export function uploadImg() { export function uploadImg() {
return getConfigByEnvType('qiniuImgUrl'); return getConfigByEnvType('qiniuImgUrl');
} }
// 根据不同环境,生成URL // 根据不同环境,生成URL
function getConfigByEnvType(urlType) { function getConfigByEnvType(urlType) {
return envConfig[process.env.VUE_APP_ENV][urlType]; return envConfig[process.env.VUE_APP_ENV][urlType];
} }
// 获取客服的云信ID // 获取客服的云信ID
export function getPicaKFAccid() { export function getPicaKFAccid() {
return getConfigByEnvType('picakfAccId'); return getConfigByEnvType('picakfAccId');
} }
// 获取客服的云信ID // 获取客服的云信ID
export function getPhomeDemain() { export function getPhomeDemain() {
return getConfigByEnvType('phomeDemain'); return getConfigByEnvType('phomeDemain');
} }
// 根据身份证获取生日 // 根据身份证获取生日
export function getBirth(idCard) { export function getBirth(idCard) {
let birthday = ''; let birthday = '';
if (idCard != null && idCard != '') { if (idCard != null && idCard != '') {
if (idCard.length == 15) { if (idCard.length == 15) {
birthday = '19' + idCard.slice(6, 12); birthday = '19' + idCard.slice(6, 12);
} else if (idCard.length == 18) { } else if (idCard.length == 18) {
birthday = idCard.slice(6, 14); birthday = idCard.slice(6, 14);
}
birthday = birthday.replace(/(.{4})(.{2})/, '$1-$2-');
// 通过正则表达式来指定输出格式为:1990-01-01
} }
return birthday; birthday = birthday.replace(/(.{4})(.{2})/, '$1-$2-');
} // 通过正则表达式来指定输出格式为:1990-01-01
\ No newline at end of file }
return birthday;
}
/* eslint-disable */
class RtcClient { class RtcClient {
constructor(options) { constructor(options) {
this.sdkAppId_ = options.sdkAppId; this.sdkAppId_ = options.sdkAppId;
...@@ -25,7 +26,7 @@ class RtcClient { ...@@ -25,7 +26,7 @@ class RtcClient {
mode: 'live', mode: 'live',
sdkAppId: this.sdkAppId_, sdkAppId: this.sdkAppId_,
userId: this.userId_, userId: this.userId_,
userSig: this.userSig_ userSig: this.userSig_,
}); });
this.handleEvents(); this.handleEvents();
} catch (error) { } catch (error) {
...@@ -43,7 +44,7 @@ class RtcClient { ...@@ -43,7 +44,7 @@ class RtcClient {
try { try {
await this.client_.join({ await this.client_.join({
roomId: this.roomId_, roomId: this.roomId_,
role: this.role role: this.role,
}); });
console.log('加入房间trtc成功'); console.log('加入房间trtc成功');
this.isJoined_ = true; this.isJoined_ = true;
...@@ -52,7 +53,7 @@ class RtcClient { ...@@ -52,7 +53,7 @@ class RtcClient {
audio: true, audio: true,
video: false, video: false,
userId: this.userId_, userId: this.userId_,
mirror: true mirror: true,
}); });
this.startRTC(); this.startRTC();
} catch (e) { } catch (e) {
...@@ -69,7 +70,7 @@ class RtcClient { ...@@ -69,7 +70,7 @@ class RtcClient {
width: this.vueInstance.viedoParams.webVideoWidth, width: this.vueInstance.viedoParams.webVideoWidth,
height: this.vueInstance.viedoParams.webVideoHeight, height: this.vueInstance.viedoParams.webVideoHeight,
frameRate: this.vueInstance.viedoParams.webVideoFramerate, frameRate: this.vueInstance.viedoParams.webVideoFramerate,
bitrate: this.vueInstance.viedoParams.webVideoBitrate /* kpbs */ bitrate: this.vueInstance.viedoParams.webVideoBitrate /* kpbs */,
}); });
// 避免重复开摄像头 // 避免重复开摄像头
this.stopPush(); this.stopPush();
...@@ -86,29 +87,32 @@ class RtcClient { ...@@ -86,29 +87,32 @@ class RtcClient {
return; return;
} }
try { try {
this.localStream_.initialize().catch(error => { this.localStream_
this.vueInstance.$message({ .initialize()
message: '打开设备失败,请检查您的设备!', .catch((error) => {
type: 'error' this.vueInstance.$message({
}); message: '打开设备失败,请检查您的设备!',
console.error('failed initialize localStream ' + error); type: 'error',
}).then(() => { });
console.error('failed initialize localStream ' + error);
// 本地流在主播放器上播放,并且插入到一个关联的box中 })
// var localVideoWrapEl = document.getElementById('ask'); .then(() => {
// this.localStream_.play(localVideoWrapEl, { // 本地流在主播放器上播放,并且插入到一个关联的box中
// muted: true // var localVideoWrapEl = document.getElementById('ask');
// }); // this.localStream_.play(localVideoWrapEl, {
// 主播直接推流 // muted: true
if (this.role == 'anchor') { // });
this.publish(); // 主播直接推流
} if (this.role == 'anchor') {
}).catch(error => { this.publish();
this.vueInstance.$message({ }
message: '麦克风打开失败!', })
type: 'error' .catch((error) => {
this.vueInstance.$message({
message: '麦克风打开失败!',
type: 'error',
});
}); });
});
} catch (e) { } catch (e) {
this.isPublished_ = false; this.isPublished_ = false;
} }
...@@ -117,17 +121,21 @@ class RtcClient { ...@@ -117,17 +121,21 @@ class RtcClient {
// 发布本地流 // 发布本地流
async publish() { async publish() {
this.client_ && this.client_.publish(this.localStream_).then(() => { this.client_ &&
console.log('本地流发布成功'); this.client_
this.isPublished_ = true; .publish(this.localStream_)
// 手动将麦克风打开 .then(() => {
this.unmuteLocalAudio(); console.log('本地流发布成功');
this.vueInstance.isMicOn = true; this.isPublished_ = true;
}).catch(error => { // 手动将麦克风打开
console.log('本地流发布失败'); this.unmuteLocalAudio();
this.isPublished_ = false; this.vueInstance.isMicOn = true;
this.vueInstance.reloadfn(); })
}); .catch((error) => {
console.log('本地流发布失败');
this.isPublished_ = false;
this.vueInstance.reloadfn();
});
} }
/** /**
...@@ -135,11 +143,11 @@ class RtcClient { ...@@ -135,11 +143,11 @@ class RtcClient {
*/ */
async stopPush() { async stopPush() {
if (this.localStream_ && this.isPublished_ && this.isJoined_) { if (this.localStream_ && this.isPublished_ && this.isJoined_) {
this.client_.unpublish(this.localStream_).then(() => { this.client_.unpublish(this.localStream_).then(() => {
this.isPublished_ = false; this.isPublished_ = false;
this.localStream_.stop(); this.localStream_.stop();
this.setLocalVideo(); this.setLocalVideo();
}); });
} else { } else {
this.setLocalVideo(); this.setLocalVideo();
} }
...@@ -217,8 +225,10 @@ class RtcClient { ...@@ -217,8 +225,10 @@ class RtcClient {
// client的一些事件监听 // client的一些事件监听
handleEvents() { handleEvents() {
// 报错 // 报错
this.client_.on('error', err => { this.client_.on('error', (err) => {
console.log('client 报错了--------------------------------------------------------------'); console.log(
'client 报错了--------------------------------------------------------------'
);
console.log(err); console.log(err);
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
...@@ -229,14 +239,14 @@ class RtcClient { ...@@ -229,14 +239,14 @@ class RtcClient {
this.$sendBuriedData({ this.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
// alert(err); // alert(err);
window.onbeforeunload = null; window.onbeforeunload = null;
location.reload(); location.reload();
}); });
this.client_.on('network-quality', event => { this.client_.on('network-quality', (event) => {
console.log('--network-quality', event); console.log('--network-quality', event);
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
...@@ -247,9 +257,9 @@ class RtcClient { ...@@ -247,9 +257,9 @@ class RtcClient {
this.$sendBuriedData({ this.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
this.client_.getLocalAudioStats().then(stats => { this.client_.getLocalAudioStats().then((stats) => {
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
...@@ -259,10 +269,10 @@ class RtcClient { ...@@ -259,10 +269,10 @@ class RtcClient {
this.$sendBuriedData({ this.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
}); });
this.client_.getRemoteAudioStats().then(stats => { this.client_.getRemoteAudioStats().then((stats) => {
const params = { const params = {
roomID: this.roomId_, // 房间id roomID: this.roomId_, // 房间id
viewslist: this.viewslist, // 当前房间用户列表 viewslist: this.viewslist, // 当前房间用户列表
...@@ -272,32 +282,31 @@ class RtcClient { ...@@ -272,32 +282,31 @@ class RtcClient {
this.$sendBuriedData({ this.$sendBuriedData({
action: 'TRTC', action: 'TRTC',
component_tag: 'TRTC#0', component_tag: 'TRTC#0',
web_data: params web_data: params,
}); });
}); });
}); });
// 房间被解散了 // 房间被解散了
this.client_.on('client-banned', err => { this.client_.on('client-banned', (err) => {
console.log('房间被解散了'); console.log('房间被解散了');
}); });
// 当一个远程同伴(必须推流)进入房间时触发 // 当一个远程同伴(必须推流)进入房间时触发
this.client_.on('peer-join', evt => { this.client_.on('peer-join', (evt) => {
const userId = evt.userId; const userId = evt.userId;
console.log('有远程同伴进入房间:', userId); console.log('有远程同伴进入房间:', userId);
}); });
// 当远处的同伴离开房间时触发(删减好友列表) // 当远处的同伴离开房间时触发(删减好友列表)
this.client_.on('peer-leave', evt => { this.client_.on('peer-leave', (evt) => {
const userId = evt.userId; const userId = evt.userId;
console.log('有远程同伴离开房间:' + userId); console.log('有远程同伴离开房间:' + userId);
this.remove(userId); this.remove(userId);
}); });
// 在添加远程流时触发 // 在添加远程流时触发
this.client_.on('stream-added', evt => { this.client_.on('stream-added', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
// 获取流的StreamId // 获取流的StreamId
const id = remoteStream.getId(); const id = remoteStream.getId();
...@@ -305,19 +314,21 @@ class RtcClient { ...@@ -305,19 +314,21 @@ class RtcClient {
const userId = remoteStream.getUserId(); const userId = remoteStream.getUserId();
this.members_.set(userId, remoteStream); this.members_.set(userId, remoteStream);
this.inmembers_.set(userId, remoteStream); this.inmembers_.set(userId, remoteStream);
console.log(`remote stream added: [${userId}] ID: ${id} type: ${remoteStream.getType()}`); console.log(
`remote stream added: [${userId}] ID: ${id} type: ${remoteStream.getType()}`
);
// 我们订阅远端的流 // 我们订阅远端的流
console.log('subscribe to this remote stream'); console.log('subscribe to this remote stream');
this.client_.subscribe(remoteStream); this.client_.subscribe(remoteStream);
}); });
// 在订阅远程流时触发 // 在订阅远程流时触发
this.client_.on('stream-subscribed', evt => { this.client_.on('stream-subscribed', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
const id = remoteStream.getId(); const id = remoteStream.getId();
const uid = remoteStream.userId_; const uid = remoteStream.userId_;
this.remoteStreams_.push(remoteStream); this.remoteStreams_.push(remoteStream);
remoteStream.on('player-state-changed', event => { remoteStream.on('player-state-changed', (event) => {
console.log(`${event.type} player is ${event.state}`); console.log(`${event.type} player is ${event.state}`);
// 远端流是播放还是暂停状态(显示按钮等画面不同) // 远端流是播放还是暂停状态(显示按钮等画面不同)
if (event.type == 'video' && event.state == 'STOPPED') { if (event.type == 'video' && event.state == 'STOPPED') {
...@@ -334,46 +345,44 @@ class RtcClient { ...@@ -334,46 +345,44 @@ class RtcClient {
} }
}); });
// 避免重复加载 // 避免重复加载
for (let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && uid == this.viewslist[i].userId) { if (this.viewslist[i] && uid == this.viewslist[i].userId) {
return; return;
}
} }
const isMask = false; }
const isMask = false;
// this.viewslist.push({ id: id, userId: uid, nick: uid, mask: isMask, vioce: true })
this.add(id, uid, isMask); // this.viewslist.push({ id: id, userId: uid, nick: uid, mask: isMask, vioce: true })
this.vueInstance.addNewMember(uid); this.add(id, uid, isMask);
this.vueInstance.addNewMember(uid);
setTimeout(() => {
// 避免其他乱入视频 setTimeout(() => {
const index = this.viewslist.findIndex((item => { // 避免其他乱入视频
if (item && item.userId) { const index = this.viewslist.findIndex((item) => {
return item.userId == uid; if (item && item.userId) {
} else { return item.userId == uid;
return -1; } else {
} return -1;
}));
if (index < 0) {
return;
}
// 播放视频
remoteStream.play(id);
if (!remoteStream.hasVideo()) {
this.changeView(id, 'mask', true);
}
if (!remoteStream.hasAudio()) {
this.changeView(id, 'vioce', false);
} }
}, 1000); });
if (index < 0) {
return;
}
// 播放视频
remoteStream.play(id);
if (!remoteStream.hasVideo()) {
this.changeView(id, 'mask', true);
}
if (!remoteStream.hasAudio()) {
this.changeView(id, 'vioce', false);
}
}, 1000);
}); });
// 当远程流被移除时触发 // 当远程流被移除时触发
this.client_.on('stream-removed', evt => { this.client_.on('stream-removed', (evt) => {
const remoteStream = evt.stream; const remoteStream = evt.stream;
const id = remoteStream.getId(); const id = remoteStream.getId();
const uid = remoteStream.userId_; const uid = remoteStream.userId_;
...@@ -381,14 +390,14 @@ class RtcClient { ...@@ -381,14 +390,14 @@ class RtcClient {
// 停止播放并删除相应<video>标签 // 停止播放并删除相应<video>标签
remoteStream.stop(); remoteStream.stop();
this.inmembers_.delete(uid); this.inmembers_.delete(uid);
this.remoteStreams_ = this.remoteStreams_.filter(stream => { this.remoteStreams_ = this.remoteStreams_.filter((stream) => {
return stream.getId() !== id; return stream.getId() !== id;
}); });
this.remove(uid); this.remove(uid);
}); });
// 流更新 // 流更新
this.client_.on('stream-updated', evt => { this.client_.on('stream-updated', (evt) => {
console.log('=========流更新========stream-updated==================='); console.log('=========流更新========stream-updated===================');
console.log(evt); console.log(evt);
const remoteStream = evt.stream; const remoteStream = evt.stream;
...@@ -396,37 +405,52 @@ class RtcClient { ...@@ -396,37 +405,52 @@ class RtcClient {
// remoteStream.hasVideo() // 是否有视频轨道 // remoteStream.hasVideo() // 是否有视频轨道
// remoteStream.hasAudio() //是否有音轨道 // remoteStream.hasAudio() //是否有音轨道
// remoteStream.getType() // 主要用于判断一个远端流是主音视频流还是辅路视频流,辅路视频流通常是一个屏幕分享流。 // remoteStream.getType() // 主要用于判断一个远端流是主音视频流还是辅路视频流,辅路视频流通常是一个屏幕分享流。
console.log('remoteStream ID: ' + remoteStream.getId() + ' was updated hasAudio: ' + console.log(
remoteStream.hasAudio() + ' hasVideo: ' + remoteStream.hasVideo()); 'remoteStream ID: ' +
remoteStream.getId() +
' was updated hasAudio: ' +
remoteStream.hasAudio() +
' hasVideo: ' +
remoteStream.hasVideo()
);
}); });
// 关闭音轨道 // 关闭音轨道
this.client_.on('mute-audio', evt => { this.client_.on('mute-audio', (evt) => {
this.changeView(evt.userId, 'vioce', false); this.changeView(evt.userId, 'vioce', false);
console.log(evt.userId + '关闭麦克风============================================'); console.log(
evt.userId + '关闭麦克风============================================'
);
}); });
// 打开音轨道 // 打开音轨道
this.client_.on('unmute-audio', evt => { this.client_.on('unmute-audio', (evt) => {
this.changeView(evt.userId, 'vioce', true); this.changeView(evt.userId, 'vioce', true);
if (evt.type == 'audio' && evt.state == 'PLAYING' && this.vueInstance.type == 1) { if (
evt.type == 'audio' &&
evt.state == 'PLAYING' &&
this.vueInstance.type == 1
) {
this.changeView(evt.userId, 'mask', true); this.changeView(evt.userId, 'mask', true);
} }
}); });
// 关闭视频轨道 // 关闭视频轨道
this.client_.on('mute-video', evt => { this.client_.on('mute-video', (evt) => {
console.log(evt.userId + '关闭 video=============================================='); console.log(
evt.userId + '关闭 video=============================================='
);
this.changeView(evt.userId, 'mask', true); this.changeView(evt.userId, 'mask', true);
}); });
// 打开视频轨道 // 打开视频轨道
this.client_.on('unmute-video', evt => { this.client_.on('unmute-video', (evt) => {
console.log(evt.userId + '打开 video============================================='); console.log(
evt.userId + '打开 video============================================='
);
if (this.members_.get(evt.userId)) { if (this.members_.get(evt.userId)) {
this.changeView(evt.userId, 'mask', false); this.changeView(evt.userId, 'mask', false);
} }
}); });
} }
...@@ -440,7 +464,7 @@ class RtcClient { ...@@ -440,7 +464,7 @@ class RtcClient {
// 移除视频数组 // 移除视频数组
remove(userId) { remove(userId) {
for(let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && this.viewslist[i].userId == userId) { if (this.viewslist[i] && this.viewslist[i].userId == userId) {
this.viewslist[i] = null; this.viewslist[i] = null;
} }
...@@ -450,7 +474,10 @@ class RtcClient { ...@@ -450,7 +474,10 @@ class RtcClient {
// 改变视频数组属性 // 改变视频数组属性
changeView(id, attr, val) { changeView(id, attr, val) {
for (let i = 0; i < this.viewslist.length; i++) { for (let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && (this.viewslist[i].userId == id || this.viewslist[i].id == id)) { if (
this.viewslist[i] &&
(this.viewslist[i].userId == id || this.viewslist[i].id == id)
) {
this.viewslist[i][attr] = val; this.viewslist[i][attr] = val;
} }
} }
...@@ -459,7 +486,13 @@ class RtcClient { ...@@ -459,7 +486,13 @@ class RtcClient {
add(id, uid, isMask) { add(id, uid, isMask) {
this.vueInstance.memberList.forEach((ele, index) => { this.vueInstance.memberList.forEach((ele, index) => {
if (ele.liveUserId == uid) { if (ele.liveUserId == uid) {
this.viewslist[index] = { id: id, userId: uid, nick: uid, mask: isMask, vioce: true }; this.viewslist[index] = {
id: id,
userId: uid,
nick: uid,
mask: isMask,
vioce: true,
};
} }
}); });
} }
......
/* eslint-disable */
/* 浏览器兼容提示 */ /* 浏览器兼容提示 */
export const CHECK_BROWSER_TIPS = { export const CHECK_BROWSER_TIPS = {
BROWSER_NOT_COMPATIBLE: '您的浏览器不支持直播功能!', BROWSER_NOT_COMPATIBLE: '您的浏览器不支持直播功能!',
BROWSER_NOT_SUPPORT_SCREEN_SHARE: '您的浏览器不支持直播功能!' BROWSER_NOT_SUPPORT_SCREEN_SHARE: '您的浏览器不支持直播功能!',
}; };
export const setLgTenText = time => { export const setLgTenText = (time) => {
return time < 10 ? `0${time}` : time; return time < 10 ? `0${time}` : time;
}; };
...@@ -21,11 +22,13 @@ export const countDown = (endtime) => { ...@@ -21,11 +22,13 @@ export const countDown = (endtime) => {
const nowtime = new Date(); // 获取当前时间 const nowtime = new Date(); // 获取当前时间
const time = endtime - nowtime.getTime(); // 距离结束时间的毫秒数 const time = endtime - nowtime.getTime(); // 距离结束时间的毫秒数
if (time > 0) { if (time > 0) {
const lefth = Math.floor(time / (1000 * 60 * 60) % 24); // 计算小时数 const lefth = Math.floor((time / (1000 * 60 * 60)) % 24); // 计算小时数
const leftm = Math.floor(time / (1000 * 60) % 60); // 计算分钟数 const leftm = Math.floor((time / (1000 * 60)) % 60); // 计算分钟数
const lefts = Math.floor(time / 1000 % 60); // 计算秒数 const lefts = Math.floor((time / 1000) % 60); // 计算秒数
// 返回倒计时的字符串 // 返回倒计时的字符串
return `${setLgTenText(lefth)}:${setLgTenText(leftm)}:${setLgTenText(lefts)}`; return `${setLgTenText(lefth)}:${setLgTenText(leftm)}:${setLgTenText(
lefts
)}`;
} else { } else {
return '时间已到'; return '时间已到';
} }
...@@ -34,20 +37,20 @@ export const countDown = (endtime) => { ...@@ -34,20 +37,20 @@ export const countDown = (endtime) => {
export const laseTime = (endtime) => { export const laseTime = (endtime) => {
const nowtime = new Date(); // 获取当前时间 const nowtime = new Date(); // 获取当前时间
const time = endtime - nowtime.getTime(); // 距离结束时间的毫秒数 const time = endtime - nowtime.getTime(); // 距离结束时间的毫秒数
const lefth = Math.floor(time / (1000 * 60 * 60) % 24); // 计算小时数 const lefth = Math.floor((time / (1000 * 60 * 60)) % 24); // 计算小时数
const leftm = Math.floor(time / (1000 * 60) % 60); // 计算分钟数 const leftm = Math.floor((time / (1000 * 60)) % 60); // 计算分钟数
const lefts = Math.floor(time / 1000 % 60); // 计算秒数 const lefts = Math.floor((time / 1000) % 60); // 计算秒数
return { return {
lefth, lefth,
leftm, leftm,
lefts lefts,
}; };
}; };
export const lastm = (startTime, endTime) => { export const lastm = (startTime, endTime) => {
const time = endTime - startTime; // 距离结束时间的毫秒数 const time = endTime - startTime; // 距离结束时间的毫秒数
const lefth = Math.floor(time / (1000 * 60 * 60) % 24); // 计算小时数 const lefth = Math.floor((time / (1000 * 60 * 60)) % 24); // 计算小时数
const leftm = Math.floor(time / (1000 * 60) % 60); // 计算分钟数 const leftm = Math.floor((time / (1000 * 60)) % 60); // 计算分钟数
return lefth * 60 + leftm; return lefth * 60 + leftm;
}; };
...@@ -69,10 +72,10 @@ export const listSort = (one, two, three, four, arr) => { ...@@ -69,10 +72,10 @@ export const listSort = (one, two, three, four, arr) => {
const a = h.sort(listCompare(three)); const a = h.sort(listCompare(three));
const b = a.sort(listCompare(two)); const b = a.sort(listCompare(two));
newList = b.sort(listCompare(one, 1)); newList = b.sort(listCompare(one, 1));
newList.forEach(item => { newList.forEach((item) => {
if (item.isCalling) { if (item.isCalling) {
callArr.push(item); callArr.push(item);
} }
if (item.inviteCall) { if (item.inviteCall) {
inviteArr.push(item); inviteArr.push(item);
} }
...@@ -80,7 +83,7 @@ export const listSort = (one, two, three, four, arr) => { ...@@ -80,7 +83,7 @@ export const listSort = (one, two, three, four, arr) => {
return { return {
newList, newList,
callArr, callArr,
inviteArr inviteArr,
}; };
}; };
...@@ -93,13 +96,21 @@ export const getBroswer = () => { ...@@ -93,13 +96,21 @@ export const getBroswer = () => {
const sys = {}; const sys = {};
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
let s; let s;
(s = ua.match(/edge\/([\d.]+)/)) ? sys.edge = s[1] : (s = ua.match(/edge\/([\d.]+)/))
(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? sys.ie = s[1] : ? (sys.edge = s[1])
(s = ua.match(/msie ([\d.]+)/)) ? sys.ie = s[1] : : (s = ua.match(/rv:([\d.]+)\) like gecko/))
(s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] : ? (sys.ie = s[1])
(s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] : : (s = ua.match(/msie ([\d.]+)/))
(s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] : ? (sys.ie = s[1])
(s = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0; : (s = ua.match(/firefox\/([\d.]+)/))
? (sys.firefox = s[1])
: (s = ua.match(/chrome\/([\d.]+)/))
? (sys.chrome = s[1])
: (s = ua.match(/opera.([\d.]+)/))
? (sys.opera = s[1])
: (s = ua.match(/version\/([\d.]+).*safari/))
? (sys.safari = s[1])
: 0;
if (sys.edge) return { broswer: 'Edge', version: sys.edge }; if (sys.edge) return { broswer: 'Edge', version: sys.edge };
if (sys.ie) return { broswer: 'IE', version: sys.ie }; if (sys.ie) return { broswer: 'IE', version: sys.ie };
...@@ -109,4 +120,4 @@ export const getBroswer = () => { ...@@ -109,4 +120,4 @@ export const getBroswer = () => {
if (sys.safari) return { broswer: 'Safari', version: sys.safari }; if (sys.safari) return { broswer: 'Safari', version: sys.safari };
return { broswer: '', version: '0' }; return { broswer: '', version: '0' };
}; };
\ No newline at end of file
import {isEmptyUtils, isNotEmptyUtils, subString} from './utils'; /* eslint-disable */
import { isEmptyUtils, isNotEmptyUtils, subString } from './utils';
import fetchQiniu from './fetch-qiniu.js'; import fetchQiniu from './fetch-qiniu.js';
import { getQiniuToken1, uploadVideo, uploadImg } from './index'; import { getQiniuToken1, uploadVideo, uploadImg } from './index';
const qiniu = require('qiniu-js'); const qiniu = require('qiniu-js');
...@@ -9,12 +10,12 @@ let subscription = null; ...@@ -9,12 +10,12 @@ let subscription = null;
// 上传返回结果 // 上传返回结果
const result = { const result = {
key: null, // 文件保存在空间中的资源名 key: null, // 文件保存在空间中的资源名
path: null, // 保存到db的路径(不带域名) path: null, // 保存到db的路径(不带域名)
fullPath: null, // 文件网络路径(文件url) fullPath: null, // 文件网络路径(文件url)
size: null, // 资源尺寸,单位为字节 size: null, // 资源尺寸,单位为字节
name: null, // 原始文件名 name: null, // 原始文件名
ext: null// 上传资源的后缀名,通过自动检测的mimeType 或者原文件的后缀来获取 ext: null, // 上传资源的后缀名,通过自动检测的mimeType 或者原文件的后缀来获取
}; };
// 上传状态 // 上传状态
...@@ -26,57 +27,58 @@ const domain = uploadVideo(); // 视频 ...@@ -26,57 +27,58 @@ const domain = uploadVideo(); // 视频
const domain1 = uploadImg(); // 图片 const domain1 = uploadImg(); // 图片
const errorCode = new Map([ const errorCode = new Map([
[298, '部分操作执行成功'], [298, '部分操作执行成功'],
[400, '请求报文格式错误'], [400, '请求报文格式错误'],
[401, '认证授权失败'], [401, '认证授权失败'],
[403, '权限不足,拒绝访问。'], [403, '权限不足,拒绝访问。'],
[404, '资源不存在'], [404, '资源不存在'],
[405, '请求方式错误'], [405, '请求方式错误'],
[406, '上传的数据 CRC32 校验错误'], [406, '上传的数据 CRC32 校验错误'],
[413, '请求资源大小大于指定的最大值'], [413, '请求资源大小大于指定的最大值'],
[419, '用户账号被冻结'], [419, '用户账号被冻结'],
[478, '镜像回源失败'], [478, '镜像回源失败'],
[502, '错误网关'], [502, '错误网关'],
[503, '服务端不可用'], [503, '服务端不可用'],
[504, '服务端操作超时'], [504, '服务端操作超时'],
[573, '单个资源访问频率过高'], [573, '单个资源访问频率过高'],
[579, '上传成功但是回调失败'], [579, '上传成功但是回调失败'],
[599, '服务端操作失败'], [599, '服务端操作失败'],
[608, '资源内容被修改'], [608, '资源内容被修改'],
[612, '指定资源不存在或已被删除'], [612, '指定资源不存在或已被删除'],
[614, '目标资源已存在'], [614, '目标资源已存在'],
[630, '已创建的空间数量达到上限,无法创建新空间。'], [630, '已创建的空间数量达到上限,无法创建新空间。'],
[631, '指定空间不存在'], [631, '指定空间不存在'],
[640, '调用列举资源(list)接口时,指定非法的marker参数。'], [640, '调用列举资源(list)接口时,指定非法的marker参数。'],
[701, '在断点续上传过程中,后续上传接收地址不正确或ctx信息已过期。'] [701, '在断点续上传过程中,后续上传接收地址不正确或ctx信息已过期。'],
]); ]);
const qiniuErrorCheck = function (code) { const qiniuErrorCheck = function (code) {
errorCode.forEach(function (value, key, map) { errorCode.forEach(function (value, key, map) {
if (code === key) { if (code === key) {
console.error(key + ':' + value); console.error(key + ':' + value);
} }
}); });
}; };
// 用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"] // 用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
const mimeTypeArray = null; const mimeTypeArray = null;
export const createFilePath = (file, fileName) => { export const createFilePath = (file, fileName) => {
if (isEmptyUtils(file)) { if (isEmptyUtils(file)) {
return null; return null;
} }
const arr = fileName.split('_'); const arr = fileName.split('_');
if(arr.length != 4) { if (arr.length != 4) {
alert('上传视频文件名格式不正确'); alert('上传视频文件名格式不正确');
return null; return null;
} }
const arr4 = arr[3].split('.'); const arr4 = arr[3].split('.');
// 文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/ // 文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/
const filePath = arr[0] + '/' + arr[1] + '/' + arr[2] + '_' + arr4[0] + '.' + arr4[1]; const filePath =
console.log(filePath); arr[0] + '/' + arr[1] + '/' + arr[2] + '_' + arr4[0] + '.' + arr4[1];
return filePath; console.log(filePath);
return filePath;
}; };
/** /**
...@@ -85,29 +87,31 @@ export const createFilePath = (file, fileName) => { ...@@ -85,29 +87,31 @@ export const createFilePath = (file, fileName) => {
* @return {Promise} token 七牛上传凭证 * @return {Promise} token 七牛上传凭证
* */ * */
const doQiniuAction1 = (fileType) => { const doQiniuAction1 = (fileType) => {
console.log('send---' + fileApiUrl); console.log('send---' + fileApiUrl);
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// if(isEmptyUtils(localStorage.getItem('qiniuToken'))){ // if(isEmptyUtils(localStorage.getItem('qiniuToken'))){
fetchQiniu(fileApiUrl, {'fileType': fileType}, 'GET').then(function (result) { fetchQiniu(fileApiUrl, { fileType: fileType }, 'GET')
let token = null; .then(function (result) {
if (isNotEmptyUtils(result) && result.code == '000000') { let token = null;
token = result.data.qiniuToken; if (isNotEmptyUtils(result) && result.code == '000000') {
resolve(token); token = result.data.qiniuToken;
console.log('七牛临时授权成功'); resolve(token);
localStorage.setItem('qiniuToken', token); console.log('七牛临时授权成功');
} else { localStorage.setItem('qiniuToken', token);
reject(result); } else {
console.error('七牛临时授权失败:', result); reject(result);
} console.error('七牛临时授权失败:', result);
}).catch(function (error) { }
reject(); })
console.error('七牛临时授权失败:', error); .catch(function (error) {
}); reject();
// }else{ console.error('七牛临时授权失败:', error);
// console.log('从localStorage获取token:'+localStorage.getItem('qiniuToken')) });
// resolve(localStorage.getItem('qiniuToken')); // }else{
// } // console.log('从localStorage获取token:'+localStorage.getItem('qiniuToken'))
}); // resolve(localStorage.getItem('qiniuToken'));
// }
});
}; };
/** /**
...@@ -120,124 +124,121 @@ const doQiniuAction1 = (fileType) => { ...@@ -120,124 +124,121 @@ const doQiniuAction1 = (fileType) => {
* @returns {Promise} * @returns {Promise}
*/ */
export const qiniuUpload = (self, file, filePath, previewId, progressId) => { export const qiniuUpload = (self, file, filePath, previewId, progressId) => {
// var deferred = $q.defer();
// var deferred = $q.defer(); return new Promise(function (resolve, reject) {
if (isEmptyUtils(file) || isEmptyUtils(filePath)) {
return new Promise(function (resolve, reject) { console.error('七牛上传失败:非法参数');
reject();
}
if (isEmptyUtils(file) || isEmptyUtils(filePath)) { const key = filePath ? filePath : getFilePath(file);
console.error('七牛上传失败:非法参数');
reject(); // 修改状态为上传
self.qiniuUploadStatus = true;
// let token = "BRVB4TpxVFA5Wo6lIpfltmWKOltzGar46tvC3BlR:UHn0LDElwjP4jEZTXdq_1qV6_hw=:eyJzY29wZSI6InBpY2EtdGVzdCIsInJldHVybkJvZHkiOiJ7XCJrZXlcIjpcIiQoa2V5KVwiLFwiaGFzaFwiOlwiJChldGFnKVwiLFwiYnVja2V0XCI6XCIkKGJ1Y2tldClcIixcImZzaXplXCI6JChmc2l6ZSksXCJmbmFtZVwiOiQoZm5hbWUpLFwiZXh0XCI6JChleHQpfSIsImRlYWRsaW5lIjoxNTI5NDk0MTc1fQ==";
doQiniuAction().then(function (token) {
const putExtra = {
fname: file.name, // 原文件名
params: {}, // 用来放置自定义变量
mimeType: mimeTypeArray || null, // null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
};
const config = {
useCdnDomain: true, // 表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。
region: null, // 选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域
};
/*
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅,
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
* */
const observable = qiniu.upload(file, key, token, putExtra, config);
/**
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进
* total.loaded: number,已上传大小,单位为字节。
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。
* total.percent: number,当前上传进度,范围:0~100
* */
const next = function (res) {
// res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}}
// 获取百分比进度
const progress = res.total.percent.toFixed(2);
self.uploadProgress = Number(progress);
console.log('Progress1: ' + progress);
};
/**
* 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息
* ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy)
* */
const complete = function (res) {
console.log('七牛上传完成');
setTimeout(function () {
result.key = res.key;
result.path = '/' + res.key;
result.fullPath =
domain + '/' + res.key + '?v=' + new Date().getTime();
result.size = res.fsize;
result.name = res.fname;
result.ext = res.ext;
resolve(result);
self.qiniuUploadStatus = false;
if (isNotEmptyUtils(previewId)) {
const address = domain + result.path;
console.log('文件路径: ' + address);
// 显示图片
const $img = $('<img>').attr('src', address);
const obj = $('#' + previewId);
obj.empty().append($img);
obj.css('max-width', '100%');
}
}, 2000);
};
/**
* 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
* err.reqId: string,xhr请求错误的 X-Reqid。
* err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
* err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
* */
const error = function (err) {
// 修改状态为非上传
// status = false;
self.qiniuUploadStatus = false;
localStorage.removeItem('qiniuToken');
console.log(
'七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses'
);
// 输出简略错误信息
if (err.isRequestError) {
qiniuErrorCheck(err.code);
} else {
console.error(err);
} }
const key = filePath ? filePath : getFilePath(file); /* modalClick("提示", "上传失败!", "确定", function () {
// 修改状态为上传
self.qiniuUploadStatus = true;
// let token = "BRVB4TpxVFA5Wo6lIpfltmWKOltzGar46tvC3BlR:UHn0LDElwjP4jEZTXdq_1qV6_hw=:eyJzY29wZSI6InBpY2EtdGVzdCIsInJldHVybkJvZHkiOiJ7XCJrZXlcIjpcIiQoa2V5KVwiLFwiaGFzaFwiOlwiJChldGFnKVwiLFwiYnVja2V0XCI6XCIkKGJ1Y2tldClcIixcImZzaXplXCI6JChmc2l6ZSksXCJmbmFtZVwiOiQoZm5hbWUpLFwiZXh0XCI6JChleHQpfSIsImRlYWRsaW5lIjoxNTI5NDk0MTc1fQ==";
doQiniuAction().then(function (token) {
const putExtra = {
fname: file.name, // 原文件名
params: {}, // 用来放置自定义变量
mimeType: mimeTypeArray || null // null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
};
const config = {
useCdnDomain: true, // 表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。
region: null // 选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域
};
/*
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅,
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
* */
const observable = qiniu.upload(file, key, token, putExtra, config);
/**
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进
* total.loaded: number,已上传大小,单位为字节。
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。
* total.percent: number,当前上传进度,范围:0~100
* */
const next = function (res) {
// res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}}
// 获取百分比进度
const progress = res.total.percent.toFixed(2);
self.uploadProgress = Number(progress);
console.log('Progress1: ' + progress);
};
/**
* 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息
* ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy)
* */
const complete = function (res) {
console.log('七牛上传完成');
setTimeout(function() {
result.key = res.key;
result.path = '/' + res.key;
result.fullPath = domain + '/' + res.key + '?v=' + new Date().getTime();
result.size = res.fsize;
result.name = res.fname;
result.ext = res.ext;
resolve(result);
self.qiniuUploadStatus = false;
if (isNotEmptyUtils(previewId)) {
const address = domain + result.path;
console.log('文件路径: ' + address);
// 显示图片
const $img = $('<img>').attr('src', address);
const obj = $('#' + previewId);
obj.empty().append($img);
obj.css('max-width', '100%');
}
}, 2000);
};
/**
* 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
* err.reqId: string,xhr请求错误的 X-Reqid。
* err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
* err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
* */
const error = function (err) {
// 修改状态为非上传
// status = false;
self.qiniuUploadStatus = false;
localStorage.removeItem('qiniuToken');
console.log('七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses');
// 输出简略错误信息
if (err.isRequestError) {
qiniuErrorCheck(err.code);
}else {
console.error(err);
}
/* modalClick("提示", "上传失败!", "确定", function () {
$('#model-modify').modal('hide'); $('#model-modify').modal('hide');
}, "", null);*/ }, "", null);*/
// deferred.reject(new Error('七牛上传失败')); // deferred.reject(new Error('七牛上传失败'));
// return deferred.promise;
return reject(new Error('七牛上传失败'));
};
// 上传开始
subscription = observable.subscribe(next, error, complete);
});
// return deferred.promise; // return deferred.promise;
return reject(new Error('七牛上传失败'));
};
// 上传开始
subscription = observable.subscribe(next, error, complete);
}); });
// return deferred.promise;
});
}; };
/** /**
...@@ -246,25 +247,38 @@ export const qiniuUpload = (self, file, filePath, previewId, progressId) => { ...@@ -246,25 +247,38 @@ export const qiniuUpload = (self, file, filePath, previewId, progressId) => {
* @return {String} timeStamp时间戳 格式:yyyyMMddhhmmssS * @return {String} timeStamp时间戳 格式:yyyyMMddhhmmssS
*/ */
const timeStamp = (date) => { const timeStamp = (date) => {
if (isEmptyUtils(date)) { if (isEmptyUtils(date)) {
return new Date().format('yyyyMMddhhmmssS'); return new Date().format('yyyyMMddhhmmssS');
} }
return date.format('yyyyMMddhhmmssS'); return date.format('yyyyMMddhhmmssS');
}; };
/** /**
* 获取全局唯一标识符(GUID,Globally Unique Identifier) * 获取全局唯一标识符(GUID,Globally Unique Identifier)
* @return {String} guid * @return {String} guid
*/ */
const guid = () => { const guid = () => {
/** /**
* @return {String} * @return {String}
*/ */
function S4() { function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
} }
return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4()); return (
S4() +
S4() +
'-' +
S4() +
'-' +
S4() +
'-' +
S4() +
'-' +
S4() +
S4() +
S4()
);
}; };
/** /**
* 文件重命名--七牛图片 2018 11 * 文件重命名--七牛图片 2018 11
...@@ -274,31 +288,30 @@ const guid = () => { ...@@ -274,31 +288,30 @@ const guid = () => {
* @return {String} fileName * @return {String} fileName
*/ */
export const getFilePath = (file, fileName, folder) => { export const getFilePath = (file, fileName, folder) => {
if (isEmptyUtils(file)) { if (isEmptyUtils(file)) {
return null; return null;
} }
// 文件类型 // 文件类型
var ext = file.type; var ext = file.type;
// 后缀名 // 后缀名
var suffix = file.name.substring(file.name.lastIndexOf('.') + 1); var suffix = file.name.substring(file.name.lastIndexOf('.') + 1);
// 若为空则从name中获取---对wps格式的文件获取不到file.type // 若为空则从name中获取---对wps格式的文件获取不到file.type
if (isEmptyUtils(ext)) { if (isEmptyUtils(ext)) {
ext = suffix; ext = suffix;
} }
// 获取当前日期对象 // 获取当前日期对象
var date = new Date(); var date = new Date();
if (isEmptyUtils(fileName)) { if (isEmptyUtils(fileName)) {
// 重命名后的文件名 // 重命名后的文件名
fileName = timeStamp(date) + '-' + subString(guid(), 8) + '.' + suffix; fileName = timeStamp(date) + '-' + subString(guid(), 8) + '.' + suffix;
} }
// 文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/ // 文件全路径(文件路径 + 文件名) 扩展名​/年/月/日/
// var filePath = ext + "/" + date.format('yyyy/MM/dd') + "/" + (isEmptyUtils(folder) ? "" : (folder + "/")) + fileName; // var filePath = ext + "/" + date.format('yyyy/MM/dd') + "/" + (isEmptyUtils(folder) ? "" : (folder + "/")) + fileName;
// var filePath = ext + "/" + "common/" + file.name.split('.')[0] + '-' + timeStamp(date) + "." + suffix; // var filePath = ext + "/" + "common/" + file.name.split('.')[0] + '-' + timeStamp(date) + "." + suffix;
var filePath = ext + '/' + 'admin/im/' + timeStamp(date) + '.' + suffix; var filePath = ext + '/' + 'admin/im/' + timeStamp(date) + '.' + suffix;
console.log('filePath==============', filePath); console.log('filePath==============', filePath);
return filePath; return filePath;
}; };
/** /**
...@@ -311,109 +324,119 @@ export const getFilePath = (file, fileName, folder) => { ...@@ -311,109 +324,119 @@ export const getFilePath = (file, fileName, folder) => {
* @param fileType 1--图片和文件 空为视频 * @param fileType 1--图片和文件 空为视频
* @returns {Promise} * @returns {Promise}
*/ */
export const doUpload = (self, file, filePath, previewId, progressId, fileType) => { export const doUpload = (
return new Promise(function (resolve, reject) { self,
if (isEmptyUtils(file) || isEmptyUtils(filePath)) { file,
console.error('七牛上传失败:非法参数'); filePath,
reject(); previewId,
progressId,
fileType
) => {
return new Promise(function (resolve, reject) {
if (isEmptyUtils(file) || isEmptyUtils(filePath)) {
console.error('七牛上传失败:非法参数');
reject();
}
const key = filePath ? filePath : getFilePath(file);
// 修改状态为上传
self.qiniuUploadStatus = true;
doQiniuAction1(fileType).then(function (token) {
const putExtra = {
fname: file.name, // 原文件名
params: {}, // 用来放置自定义变量
mimeType: mimeTypeArray || null, // null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"]
};
const config = {
useCdnDomain: true, // 表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。
region: null, // 选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域
};
/*
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅,
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
* */
const observable = qiniu.upload(file, key, token, putExtra, config);
/**
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进
* total.loaded: number,已上传大小,单位为字节。
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。
* total.percent: number,当前上传进度,范围:0~100
* */
const next = function (res) {
// res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}}
// 获取百分比进度
const progress = res.total.percent.toFixed(2);
self.uploadProgress = Number(progress);
if (progressId == 'uploadProgress1') {
self.uploadProgress1 = Number(progress);
} }
const key = filePath ? filePath : getFilePath(file); if (progressId == 'uploadProgress2') {
self.uploadProgress2 = Number(progress);
// 修改状态为上传 }
self.qiniuUploadStatus = true; console.log('Progress2: ' + progress);
doQiniuAction1(fileType).then(function (token) { };
const putExtra = {
fname: file.name, // 原文件名 /**
params: {}, // 用来放置自定义变量 * 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息
mimeType: mimeTypeArray || null // null || array,用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"] * ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy)
}; * */
const complete = function (res) {
const config = { console.log('七牛上传完成');
useCdnDomain: true, // 表示是否使用 cdn 加速域名,为布尔值,true 表示使用,默认为 false。 setTimeout(function () {
region: null // 选择上传域名区域;当为 null 或 undefined 时,自动分析上传域名区域 result.key = res.key;
}; result.path = '/' + res.key;
if (!fileType) {
/* // 图片 文件
* qiniu.upload 返回一个 observable 对象用来控制上传行为,observable 对像通过 subscribe 方法可以被 observer 所订阅, console.log('---domain-------', domain);
* 订阅同时会开始触发上传,同时返回一个 subscription 对象,该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。 result.fullPath = domain + '/' + res.key;
* */ } else {
const observable = qiniu.upload(file, key, token, putExtra, config); // 视频
console.log('----domain1------', domain1);
/** result.fullPath = domain1 + '/' + res.key;
* 接收上传进度信息,res 参数是一个带有 total 字段的 object,包含loaded、total、percent三个属性,提供上传进 }
* total.loaded: number,已上传大小,单位为字节。 result.size = res.fsize;
* total.total: number,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。 result.name = res.fname;
* total.percent: number,当前上传进度,范围:0~100 result.ext = res.ext;
* */ resolve(result);
const next = function (res) { self.qiniuUploadStatus = false;
// res值{"total":{"loaded":18184,"size":18185,"percent":99.99450096233159}} }, 500);
};
// 获取百分比进度
const progress = res.total.percent.toFixed(2); /**
self.uploadProgress = Number(progress); * 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
if(progressId == 'uploadProgress1') { * err.reqId: string,xhr请求错误的 X-Reqid。
self.uploadProgress1 = Number(progress); * err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
} * err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
if(progressId == 'uploadProgress2') { * */
self.uploadProgress2 = Number(progress); const error = function (err) {
} // 修改状态为非上传
console.log('Progress2: ' + progress); // status = false;
}; self.qiniuUploadStatus = false;
localStorage.removeItem('qiniuToken');
/** console.log(
* 接收上传完成后的后端返回信息,res 参数为一个 object, 为上传成功后后端返回的信息 '七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses'
* ,具体返回结构取决于后端sdk的配置,可参考上传策略(https://developer.qiniu.com/kodo/manual/1206/put-policy) );
* */ // 输出简略错误信息
const complete = function (res) { if (err.isRequestError) {
console.log('七牛上传完成'); qiniuErrorCheck(err.code);
setTimeout(function() { } else {
result.key = res.key; console.error(err);
result.path = '/' + res.key; }
if(!fileType) { // 图片 文件 return reject(new Error('七牛上传失败'));
console.log('---domain-------', domain); };
result.fullPath = domain + '/' + res.key;
}else{ // 视频 // 上传开始
console.log('----domain1------', domain1); subscription = observable.subscribe(next, error, complete);
result.fullPath = domain1 + '/' + res.key;
}
result.size = res.fsize;
result.name = res.fname;
result.ext = res.ext;
resolve(result);
self.qiniuUploadStatus = false;
}, 500);
};
/**
* 上传错误后触发,当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object:
* err.isRequestError: 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。
* err.reqId: string,xhr请求错误的 X-Reqid。
* err.code: number,请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效,可查阅码值对应说明。
* err.message: string,错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。
* */
const error = function (err) {
// 修改状态为非上传
// status = false;
self.qiniuUploadStatus = false;
localStorage.removeItem('qiniuToken');
console.log('七牛上传失败,详细信息请参考:https://developer.qiniu.com/kodo/api/3928/error-responses');
// 输出简略错误信息
if (err.isRequestError) {
qiniuErrorCheck(err.code);
}else {
console.error(err);
}
return reject(new Error('七牛上传失败'));
};
// 上传开始
subscription = observable.subscribe(next, error, complete);
});
// 保存到全局对象
window.QNSubscription = subscription;
}); });
// 保存到全局对象
window.QNSubscription = subscription;
});
}; };
// 取消上传 // 取消上传
export const unsubscribe = () => { export const unsubscribe = () => {
......
/* eslint-disable */
import axios from 'axios'; import axios from 'axios';
// 对象的合并 // 对象的合并
export const containObject = function(...obj1) { export const containObject = function (...obj1) {
const obj = Object.assign(...obj1); const obj = Object.assign(...obj1);
return obj; return obj;
}; };
// 获取页面自适应高度 // 获取页面自适应高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'slidebar-container', export function resizeHeight(
containerHeightId = 'screenSet') { cMinusHeight = 152,
// let containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 15; iMinuxHeight = 210,
let containerHeight = document.body.clientHeight - 80; refHeightId = 'slidebar-container',
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'; containerHeightId = 'screenSet'
window.onresize = function() { ) {
if(p_getElm(refHeightId) && p_getElm(containerHeightId)) { // let containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 15;
containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 15; let containerHeight = document.body.clientHeight - 80;
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'; p_getElm(containerHeightId).style.height =
} containerHeight - cMinusHeight + 'px';
}; window.onresize = function () {
if (p_getElm(refHeightId) && p_getElm(containerHeightId)) {
containerHeight =
p_getElm(refHeightId).getBoundingClientRect().height - 15;
p_getElm(containerHeightId).style.height =
containerHeight - cMinusHeight + 'px';
}
};
} }
function p_getElm(elmId) { function p_getElm(elmId) {
return document.getElementById(elmId); return document.getElementById(elmId);
} }
// 共通函数 // 共通函数
Array.prototype.contains = function (obj) { Array.prototype.contains = function (obj) {
if (this.length > 0) { if (this.length > 0) {
for (let i = 0; i < this.length; i++) { for (let i = 0; i < this.length; i++) {
if (obj === this[i]) { if (obj === this[i]) {
return true; return true;
} }
}
} }
return false; }
return false;
}; };
Array.prototype.remove = function (obj) { Array.prototype.remove = function (obj) {
if (this.contains(obj)) { if (this.contains(obj)) {
for (let i = 0; i < this.length; i++) { for (let i = 0; i < this.length; i++) {
if (obj === this[i]) { if (obj === this[i]) {
this.splice(i, 1); this.splice(i, 1);
break; break;
} }
}
} }
return this; }
return this;
}; };
// 时间处理 // 时间处理
Date.prototype.format = function (fmt) { // author: meizz Date.prototype.format = function (fmt) {
const o = { // author: meizz
'M+': this.getMonth() + 1, // 月份 const o = {
'd+': this.getDate(), // 日 'M+': this.getMonth() + 1, // 月份
'h+': this.getHours(), // 小时 'd+': this.getDate(), // 日
'm+': this.getMinutes(), // 分 'h+': this.getHours(), // 小时
's+': this.getSeconds(), // 秒 'm+': this.getMinutes(), // 分
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 's+': this.getSeconds(), // 秒
'S': this.getMilliseconds() 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
// 毫秒 S: this.getMilliseconds(),
}; // 毫秒
if (/(y+)/.test(fmt)) };
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '') if (/(y+)/.test(fmt))
.substr(4 - RegExp.$1.length)); fmt = fmt.replace(
for (const k in o) RegExp.$1,
if (new RegExp('(' + k + ')').test(fmt)) (this.getFullYear() + '').substr(4 - RegExp.$1.length)
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))); );
return fmt; for (const k in o)
if (new RegExp('(' + k + ')').test(fmt))
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
);
return fmt;
}; };
/** /**
...@@ -71,87 +85,207 @@ Date.prototype.format = function (fmt) { // author: meizz ...@@ -71,87 +85,207 @@ Date.prototype.format = function (fmt) { // author: meizz
* @param {Object} str * @param {Object} str
*/ */
export const base64encode = (str) => { export const base64encode = (str) => {
const base64EncodeChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; const base64EncodeChars =
let out, i, len; 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
let c1, c2, c3; let out, i, len;
len = str.length; let c1, c2, c3;
i = 0; len = str.length;
out = ''; i = 0;
while (i < len) { out = '';
c1 = str.charCodeAt(i++) & 0xff; while (i < len) {
if (i == len) { c1 = str.charCodeAt(i++) & 0xff;
out += base64EncodeChars.charAt(c1 >> 2); if (i == len) {
out += base64EncodeChars.charAt((c1 & 0x3) << 4); out += base64EncodeChars.charAt(c1 >> 2);
out += '=='; out += base64EncodeChars.charAt((c1 & 0x3) << 4);
break; out += '==';
} break;
c2 = str.charCodeAt(i++);
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += '=';
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += base64EncodeChars.charAt(c3 & 0x3F);
} }
return out; c2 = str.charCodeAt(i++);
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xf) << 2);
out += '=';
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xf) << 2) | ((c3 & 0xc0) >> 6));
out += base64EncodeChars.charAt(c3 & 0x3f);
}
return out;
}; };
/** /**
* base64解码 * base64解码
* @param {Object} str * @param {Object} str
*/ */
export const base64decode = (str) => { export const base64decode = (str) => {
const base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); const base64DecodeChars = new Array(
let c1, c2, c3, c4; -1,
let i, len, out; -1,
len = str.length; -1,
i = 0; -1,
out = ''; -1,
while (i < len) { -1,
/* c1 */ -1,
do { -1,
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; -1,
} -1,
while (i < len && c1 == -1); -1,
if (c1 == -1) -1,
break; -1,
/* c2 */ -1,
do { -1,
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; -1,
} -1,
while (i < len && c2 == -1); -1,
if (c2 == -1) -1,
break; -1,
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); -1,
/* c3 */ -1,
do { -1,
c3 = str.charCodeAt(i++) & 0xff; -1,
if (c3 == 61) -1,
return out; -1,
c3 = base64DecodeChars[c3]; -1,
} -1,
while (i < len && c3 == -1); -1,
if (c3 == -1) -1,
break; -1,
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); -1,
/* c4 */ -1,
do { -1,
c4 = str.charCodeAt(i++) & 0xff; -1,
if (c4 == 61) -1,
return out; -1,
c4 = base64DecodeChars[c4]; -1,
} -1,
while (i < len && c4 == -1); -1,
if (c4 == -1) -1,
break; -1,
out += String.fromCharCode(((c3 & 0x03) << 6) | c4); -1,
} 62,
return out; -1,
-1,
-1,
63,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
-1,
-1,
-1,
-1,
-1,
-1,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
-1,
-1,
-1,
-1,
-1
);
let c1, c2, c3, c4;
let i, len, out;
len = str.length;
i = 0;
out = '';
while (i < len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c1 == -1);
if (c1 == -1) break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c2 == -1);
if (c2 == -1) break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if (c3 == 61) return out;
c3 = base64DecodeChars[c3];
} while (i < len && c3 == -1);
if (c3 == -1) break;
out += String.fromCharCode(((c2 & 0xf) << 4) | ((c3 & 0x3c) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if (c4 == 61) return out;
c4 = base64DecodeChars[c4];
} while (i < len && c4 == -1);
if (c4 == -1) break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}; };
/** /**
...@@ -160,58 +294,58 @@ export const base64decode = (str) => { ...@@ -160,58 +294,58 @@ export const base64decode = (str) => {
* @returns {*} 格式化后的时分秒 * @returns {*} 格式化后的时分秒
*/ */
export const secToTime = (s) => { export const secToTime = (s) => {
let t = ''; let t = '';
if (s > -1) { if (s > -1) {
// let hour = Math.floor(s/3600); // let hour = Math.floor(s/3600);
const min = Math.floor(s / 60) % 60; const min = Math.floor(s / 60) % 60;
const sec = s % 60; const sec = s % 60;
// if(hour < 10) { // if(hour < 10) {
// t = '0'+ hour + ":"; // t = '0'+ hour + ":";
// } else { // } else {
// t = hour + ":"; // t = hour + ":";
// } // }
if (min < 10) { if (min < 10) {
t += '0'; t += '0';
} }
t += min + ':'; t += min + ':';
if (sec < 10) { if (sec < 10) {
t += '0'; t += '0';
}
t += sec.toFixed(0);
} }
return t; t += sec.toFixed(0);
}
return t;
}; };
/** /**
* 校验对象是否为空 * 校验对象是否为空
* */ * */
export const isNotEmptyUtils = (obj) => { export const isNotEmptyUtils = (obj) => {
if ('' == obj || null == obj || undefined == obj || 'null' == obj) { if ('' == obj || null == obj || undefined == obj || 'null' == obj) {
return false; return false;
} }
return true; return true;
}; };
/** /**
* 校验对象是否为空 * 校验对象是否为空
* */ * */
export const isEmptyUtils = (obj) => { export const isEmptyUtils = (obj) => {
return !isNotEmptyUtils(obj); return !isNotEmptyUtils(obj);
}; };
/** /**
* 校验数组是否为空 * 校验数组是否为空
* */ * */
export const isEmptyList = (list) => { export const isEmptyList = (list) => {
return (isEmptyUtils(list) || !(list instanceof Array) || list.length === 0); return isEmptyUtils(list) || !(list instanceof Array) || list.length === 0;
}; };
/** /**
* 校验数组是否为空 * 校验数组是否为空
* */ * */
export const isNotEmptyList = (list) => { export const isNotEmptyList = (list) => {
return !isEmptyList(list); return !isEmptyList(list);
}; };
/** /**
...@@ -219,153 +353,157 @@ export const isNotEmptyList = (list) => { ...@@ -219,153 +353,157 @@ export const isNotEmptyList = (list) => {
* * @param {String} [obj] 校验对象 * * @param {String} [obj] 校验对象
* */ * */
export const isNumber = (obj) => { export const isNumber = (obj) => {
return (obj != null && obj.toString().match('^[0-9]*$') != null); return obj != null && obj.toString().match('^[0-9]*$') != null;
}; };
// 获取用户系统信息start // 获取用户系统信息start
const detectOS = () => { const detectOS = () => {
const sUserAgent = navigator.userAgent; const sUserAgent = navigator.userAgent;
const isWin = (navigator.platform == 'Win32') const isWin =
|| (navigator.platform == 'Windows'); navigator.platform == 'Win32' || navigator.platform == 'Windows';
const isMac = (navigator.platform == 'Mac68K') const isMac =
|| (navigator.platform == 'MacPPC') navigator.platform == 'Mac68K' ||
|| (navigator.platform == 'Macintosh') navigator.platform == 'MacPPC' ||
|| (navigator.platform == 'MacIntel'); navigator.platform == 'Macintosh' ||
if (isMac) navigator.platform == 'MacIntel';
return 'Mac'; if (isMac) return 'Mac';
const isUnix = (navigator.platform == 'X11') && !isWin && !isMac; const isUnix = navigator.platform == 'X11' && !isWin && !isMac;
if (isUnix) if (isUnix) return 'Unix';
return 'Unix'; const isLinux = String(navigator.platform).indexOf('Linux') > -1;
const isLinux = (String(navigator.platform).indexOf('Linux') > -1); if (isLinux) return 'Linux';
if (isLinux) const isIos = sUserAgent.indexOf('Mac OS X') > -1;
return 'Linux'; if (isIos) return 'Mac';
const isIos = (sUserAgent.indexOf('Mac OS X') > -1); if (isWin) {
if (isIos) const isWinXP =
return 'Mac'; sUserAgent.indexOf('Windows NT 5.1') > -1 ||
if (isWin) { sUserAgent.indexOf('Windows XP') > -1;
const isWinXP = sUserAgent.indexOf('Windows NT 5.1') > -1 if (isWinXP) return 'WinXP';
|| sUserAgent.indexOf('Windows XP') > -1; const isWinVista =
if (isWinXP) sUserAgent.indexOf('Windows NT 6.0') > -1 ||
return 'WinXP'; sUserAgent.indexOf('Windows Vista') > -1;
const isWinVista = sUserAgent.indexOf('Windows NT 6.0') > -1 if (isWinVista) return 'WinVista';
|| sUserAgent.indexOf('Windows Vista') > -1; const isWin7 =
if (isWinVista) sUserAgent.indexOf('Windows NT 6.1') > -1 ||
return 'WinVista'; sUserAgent.indexOf('Windows 7') > -1;
const isWin7 = sUserAgent.indexOf('Windows NT 6.1') > -1 if (isWin7) return 'Win7';
|| sUserAgent.indexOf('Windows 7') > -1; const isWin8_1 =
if (isWin7) sUserAgent.indexOf('Windows NT 6.2') > -1 ||
return 'Win7'; sUserAgent.indexOf('Windows 8') > -1;
const isWin8_1 = sUserAgent.indexOf('Windows NT 6.2') > -1 const isWin8_2 =
|| sUserAgent.indexOf('Windows 8') > -1; sUserAgent.indexOf('Windows NT 6.3') > -1 ||
const isWin8_2 = sUserAgent.indexOf('Windows NT 6.3') > -1 sUserAgent.indexOf('Windows 8.1') > -1;
|| sUserAgent.indexOf('Windows 8.1') > -1; if (isWin8_1 || isWin8_2) return 'Win8';
if (isWin8_1 || isWin8_2) const isWin10_1 =
return 'Win8'; sUserAgent.indexOf('Windows NT 6.4') > -1 ||
const isWin10_1 = sUserAgent.indexOf('Windows NT 6.4') > -1 sUserAgent.indexOf('Windows 10') > -1;
|| sUserAgent.indexOf('Windows 10') > -1; const isWin10_2 =
const isWin10_2 = sUserAgent.indexOf('Windows NT 10.0') > -1 sUserAgent.indexOf('Windows NT 10.0') > -1 ||
|| sUserAgent.indexOf('Windows 10') > -1; sUserAgent.indexOf('Windows 10') > -1;
if (isWin10_1 || isWin10_2) if (isWin10_1 || isWin10_2) return 'Win10';
return 'Win10'; }
} return 'other';
return 'other';
}; };
// 获取用户浏览器信息 // 获取用户浏览器信息
const getBrowser = () => { const getBrowser = () => {
// let OsObject = "未知"; // let OsObject = "未知";
// if (navigator.userAgent.indexOf("MSIE") > 0) { // if (navigator.userAgent.indexOf("MSIE") > 0) {
// return "IE"; // return "IE";
// } // }
// if (navigator.userAgent.indexOf("Firefox") > 0) { // if (navigator.userAgent.indexOf("Firefox") > 0) {
// return "Firefox"; // return "Firefox";
// } // }
// if (navigator.userAgent.indexOf("Chrome") > 0) { // if (navigator.userAgent.indexOf("Chrome") > 0) {
// return "Chrome"; // return "Chrome";
// } // }
// if (navigator.userAgent.indexOf("Safari") > 0) { // if (navigator.userAgent.indexOf("Safari") > 0) {
// return "Safari"; // return "Safari";
// } // }
// if (navigator.userAgent.indexOf("Gecko") > 0) { // if (navigator.userAgent.indexOf("Gecko") > 0) {
// return "Gecko"; // return "Gecko";
// } // }
return navigator.userAgent; return navigator.userAgent;
}; };
const GetLocalIPAddress = () => { const GetLocalIPAddress = () => {
// let url ='http://counter.sina.com.cn/ip/'; // let url ='http://counter.sina.com.cn/ip/';
// let url ='http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random(); // let url ='http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random();
// let ip = ""; // let ip = "";
// $.getJSON(url, function(data){ // $.getJSON(url, function(data){
// localStorage.setItem("ipAddress",data.Ip); // localStorage.setItem("ipAddress",data.Ip);
// // check(); // // check();
// }); // });
// $.getScript('http://pv.sohu.com/cityjson?ie=utf-8', function () { // $.getScript('http://pv.sohu.com/cityjson?ie=utf-8', function () {
return returnCitySN['cip']; return returnCitySN['cip'];
// }); // });
// return ip; // return ip;
}; };
// 获取用户终端信息 // 获取用户终端信息
const getTerminalType = () => { const getTerminalType = () => {
let brow = '未知'; let brow = '未知';
// alert(navigator.userAgent); // alert(navigator.userAgent);
if (navigator.userAgent.indexOf('iPad') > -1) { if (navigator.userAgent.indexOf('iPad') > -1) {
// alert("iPad"); // alert("iPad");
return brow = 'iPad'; return (brow = 'iPad');
} }
if (navigator.userAgent.indexOf('Android') > -1 if (
|| navigator.userAgent.indexOf('Linux') > -1) { navigator.userAgent.indexOf('Android') > -1 ||
// alert("Android"); navigator.userAgent.indexOf('Linux') > -1
return brow = 'android手机'; ) {
} // alert("Android");
if (navigator.userAgent.indexOf('iPhone') > -1 return (brow = 'android手机');
}
if (
navigator.userAgent.indexOf('iPhone') > -1
// || navigator.userAgent.indexOf('Mac') > -1 // || navigator.userAgent.indexOf('Mac') > -1
) { ) {
// alert("iPhone"); // alert("iPhone");
return brow = 'iPhone手机'; return (brow = 'iPhone手机');
} }
if (navigator.userAgent.indexOf('Trident') > -1) { if (navigator.userAgent.indexOf('Trident') > -1) {
// alert("Trident"); // alert("Trident");
return brow = '电脑'; return (brow = '电脑');
} }
if (navigator.userAgent.indexOf('Presto') > -1) { if (navigator.userAgent.indexOf('Presto') > -1) {
// alert("Presto"); // alert("Presto");
return brow = '电脑'; return (brow = '电脑');
} }
if (navigator.userAgent.indexOf('Chrome') > -1) { if (navigator.userAgent.indexOf('Chrome') > -1) {
// alert("Chrome"); // alert("Chrome");
return brow = '电脑'; return (brow = '电脑');
} }
if (navigator.userAgent.indexOf('AppleWebKit') > -1) { if (navigator.userAgent.indexOf('AppleWebKit') > -1) {
// alert("AppleWebKit"); // alert("AppleWebKit");
return brow = 'iPad'; return (brow = 'iPad');
} }
if (navigator.userAgent.indexOf('Gecko') > -1 if (
&& navigator.userAgent.indexOf('KHTML') == -1) { navigator.userAgent.indexOf('Gecko') > -1 &&
// alert("Gecko"); navigator.userAgent.indexOf('KHTML') == -1
return brow = '电脑'; ) {
} // alert("Gecko");
if (navigator.userAgent.indexOf('Mac OS X') > -1) { return (brow = '电脑');
// alert("ios"); }
return brow = 'ios'; if (navigator.userAgent.indexOf('Mac OS X') > -1) {
} // alert("ios");
if (navigator.userAgent.indexOf('Safari') == -1) { return (brow = 'ios');
// alert("Safari"); }
return brow = '电脑'; if (navigator.userAgent.indexOf('Safari') == -1) {
} // alert("Safari");
return brow; return (brow = '电脑');
}
return brow;
}; };
const initEnvironment = () => { const initEnvironment = () => {
const OS = detectOS(); const OS = detectOS();
const browser = getBrowser(); const browser = getBrowser();
const ip = GetLocalIPAddress(); const ip = GetLocalIPAddress();
const terminalType = getTerminalType(); const terminalType = getTerminalType();
localStorage.setItem('OS', OS); localStorage.setItem('OS', OS);
localStorage.setItem('browser', browser); localStorage.setItem('browser', browser);
localStorage.setItem('ipAddress', ip); localStorage.setItem('ipAddress', ip);
localStorage.setItem('terminalType', terminalType); localStorage.setItem('terminalType', terminalType);
}; };
/** /**
...@@ -375,11 +513,11 @@ const initEnvironment = () => { ...@@ -375,11 +513,11 @@ const initEnvironment = () => {
* @return{Array} [array] * @return{Array} [array]
* */ * */
export const stringToArr = (str, split) => { export const stringToArr = (str, split) => {
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) { if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return [str]; return [str];
} else { } else {
return str.split(split); return str.split(split);
} }
}; };
// 单点登录--start // 单点登录--start
...@@ -390,23 +528,23 @@ export const stringToArr = (str, split) => { ...@@ -390,23 +528,23 @@ export const stringToArr = (str, split) => {
* @return{Array} [parArr] 返回键值对list * @return{Array} [parArr] 返回键值对list
* */ * */
const getUrlParams = (str, split) => { const getUrlParams = (str, split) => {
const parArr = []; const parArr = [];
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) { if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return parArr; return parArr;
} else { } else {
const parMapArray = str.split(split); const parMapArray = str.split(split);
if (parMapArray.length > 0) { if (parMapArray.length > 0) {
for (let i = 0; i < parMapArray.length; i++) { for (let i = 0; i < parMapArray.length; i++) {
if (parMapArray[i].indexOf('=') > -1) { if (parMapArray[i].indexOf('=') > -1) {
const item = parMapArray[i].split('='); const item = parMapArray[i].split('=');
const par = {}; const par = {};
par[item[0]] = item[1]; par[item[0]] = item[1];
parArr.push(par); parArr.push(par);
}
}
} }
return parArr; }
} }
return parArr;
}
}; };
/** /**
...@@ -416,65 +554,65 @@ const getUrlParams = (str, split) => { ...@@ -416,65 +554,65 @@ const getUrlParams = (str, split) => {
* @return{Map} [parMap] 返回键值对Map * @return{Map} [parMap] 返回键值对Map
* */ * */
export const getUrlParamsMap = (str, split) => { export const getUrlParamsMap = (str, split) => {
const parMap = new Map(); const parMap = new Map();
if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) { if (isEmptyUtils(str) || isEmptyUtils(split) || str.indexOf(split) === -1) {
return parMap; return parMap;
} else { } else {
const parMapArray = str.split(split); const parMapArray = str.split(split);
if (parMapArray.length > 0) { if (parMapArray.length > 0) {
for (let i = 0; i < parMapArray.length; i++) { for (let i = 0; i < parMapArray.length; i++) {
if (parMapArray[i].indexOf('=') > -1) { if (parMapArray[i].indexOf('=') > -1) {
const item = parMapArray[i].split('='); const item = parMapArray[i].split('=');
parMap[item[0]] = item[1]; parMap[item[0]] = item[1];
}
}
} }
return parMap; }
} }
return parMap;
}
}; };
export const ssoLogin = (href, paramMap) => { export const ssoLogin = (href, paramMap) => {
console.log('ssoLogin开始'); console.log('ssoLogin开始');
if (isNotEmptyUtils(paramMap)) {
if (isNotEmptyUtils(paramMap)) { if (isNotEmptyUtils(paramMap)) {
if (isNotEmptyUtils(paramMap)) { for (var param in paramMap) {
for (var param in paramMap) { localStorage.setItem(param, paramMap[param]);
localStorage.setItem(param, paramMap[param]); }
}
}
// 获取用户系统信息
// initEnvironment();
} }
// 获取用户系统信息
// initEnvironment();
}
}; };
// 单点登录--end // 单点登录--end
// 退出登录,跳转到登录页面 // 退出登录,跳转到登录页面
export const logout = () => { export const logout = () => {
const url = localStorage.getItem('Url'); const url = localStorage.getItem('Url');
const logoutUrl = localStorage.getItem('logoutUrl'); const logoutUrl = localStorage.getItem('logoutUrl');
const ssoLoginUrl = localStorage.getItem('ssoLogin'); const ssoLoginUrl = localStorage.getItem('ssoLogin');
const ssoOriginUrl = localStorage.getItem('ssoOrigin'); const ssoOriginUrl = localStorage.getItem('ssoOrigin');
console.log('logoutUrl:' + logoutUrl); console.log('logoutUrl:' + logoutUrl);
/* alert("ssoLogin Url:"+ ssoLoginUrl) /* alert("ssoLogin Url:"+ ssoLoginUrl)
alert("logOut url:" + logoutUrl) alert("logOut url:" + logoutUrl)
alert("ssoOrigin url:" + ssoOriginUrl);*/ alert("ssoOrigin url:" + ssoOriginUrl);*/
localStorage.clear(); localStorage.clear();
localStorage.setItem('Url', url); localStorage.setItem('Url', url);
localStorage.setItem('logoutUrl', logoutUrl); localStorage.setItem('logoutUrl', logoutUrl);
localStorage.setItem('ssoLogin', ssoLoginUrl); localStorage.setItem('ssoLogin', ssoLoginUrl);
localStorage.setItem('ssoOrigin', ssoOriginUrl); localStorage.setItem('ssoOrigin', ssoOriginUrl);
if (isEmptyUtils(logoutUrl)) { if (isEmptyUtils(logoutUrl)) {
if(isEmptyUtils(ssoLoginUrl)) { if (isEmptyUtils(ssoLoginUrl)) {
window.location.href = localStorage.getItem('ssoOrigin') window.location.href =
+ '/PICA_SSO_FE/html/pica_login.html'; localStorage.getItem('ssoOrigin') + '/PICA_SSO_FE/html/pica_login.html';
}else{
window.location.href = localStorage.getItem('ssoLogin');
}
} else { } else {
// window.location.href = logoutUrl; window.location.href = localStorage.getItem('ssoLogin');
window.location.href = localStorage.getItem('ssoOrigin')
+ '/PICA_SSO_FE/html/pica_login.html';
} }
} else {
// window.location.href = logoutUrl;
window.location.href =
localStorage.getItem('ssoOrigin') + '/PICA_SSO_FE/html/pica_login.html';
}
}; };
/** /**
...@@ -488,53 +626,65 @@ export const logout = () => { ...@@ -488,53 +626,65 @@ export const logout = () => {
* @param {Function} [cancelFunction] 按取消按钮认时,执行的函数 * @param {Function} [cancelFunction] 按取消按钮认时,执行的函数
* @param {String} [messageType] 消息类型 success,info,warning,error * @param {String} [messageType] 消息类型 success,info,warning,error
* */ * */
export const messageBox = (self, title, content, confirmButton, confirmFunction, cancelButton, cancelFunction, messageType) => { export const messageBox = (
const titleText = title ? title : '提示'; self,
const contentText = content ? content : ''; title,
const confirmButtonText = confirmButton ? confirmButton : '确定'; content,
let type = messageType ? messageType : 'info'; confirmButton,
const typeArray = ['error', 'warning', 'info', 'success']; confirmFunction,
if (!typeArray.contains(type)) { cancelButton,
type = 'info'; cancelFunction,
} messageType
) => {
const titleText = title ? title : '提示';
const contentText = content ? content : '';
const confirmButtonText = confirmButton ? confirmButton : '确定';
let type = messageType ? messageType : 'info';
const typeArray = ['error', 'warning', 'info', 'success'];
if (!typeArray.contains(type)) {
type = 'info';
}
if (isNotEmptyUtils(cancelButton)) { if (isNotEmptyUtils(cancelButton)) {
self.$confirm(contentText, titleText, { self
confirmButtonText: confirmButtonText, .$confirm(contentText, titleText, {
cancelButtonText: cancelButton, confirmButtonText: confirmButtonText,
type: type cancelButtonText: cancelButton,
}).then(() => { type: type,
// self.$message({ })
// type: 'success', .then(() => {
// message: '删除成功!' // self.$message({
// }); // type: 'success',
if (confirmFunction instanceof Function) { // message: '删除成功!'
confirmFunction(); // });
} if (confirmFunction instanceof Function) {
}).catch(() => { confirmFunction();
// self.$message({ }
// type: 'info', })
// message: '已取消删除' .catch(() => {
// }); // self.$message({
if (cancelFunction instanceof Function) { // type: 'info',
cancelFunction(); // message: '已取消删除'
} // });
}); if (cancelFunction instanceof Function) {
} else { cancelFunction();
self.$alert(contentText, titleText, { }
confirmButtonText: confirmButtonText, });
type: type, } else {
callback: action => { self.$alert(contentText, titleText, {
// self.$message({ confirmButtonText: confirmButtonText,
// type: 'info', type: type,
// message: `action: ${ action }` callback: (action) => {
// }); // self.$message({
if (confirmFunction instanceof Function) { // type: 'info',
confirmFunction(); // message: `action: ${ action }`
} // });
} if (confirmFunction instanceof Function) {
}); confirmFunction();
} }
},
});
}
}; };
/** /**
...@@ -548,48 +698,60 @@ export const messageBox = (self, title, content, confirmButton, confirmFunction, ...@@ -548,48 +698,60 @@ export const messageBox = (self, title, content, confirmButton, confirmFunction,
* @param {Function} [cancelFunction] 按取消按钮认时,执行的函数 * @param {Function} [cancelFunction] 按取消按钮认时,执行的函数
* @param {String} [messageType] 消息类型 success,info,warning,error * @param {String} [messageType] 消息类型 success,info,warning,error
* */ * */
export const htmlMessageBox = (self, title, content, confirmButton, confirmFunction, cancelButton, cancelFunction, messageType) => { export const htmlMessageBox = (
const titleText = title ? title : '提示'; self,
const contentText = content ? content : ''; title,
const confirmButtonText = confirmButton ? confirmButton : '确定'; content,
let type = messageType ? messageType : 'info'; confirmButton,
const typeArray = ['error', 'warning', 'info', 'success']; confirmFunction,
if (!typeArray.contains(type)) { cancelButton,
type = 'info'; cancelFunction,
} messageType
) => {
const titleText = title ? title : '提示';
const contentText = content ? content : '';
const confirmButtonText = confirmButton ? confirmButton : '确定';
let type = messageType ? messageType : 'info';
const typeArray = ['error', 'warning', 'info', 'success'];
if (!typeArray.contains(type)) {
type = 'info';
}
// debugger // debugger
if (isNotEmptyUtils(cancelButton)) { if (isNotEmptyUtils(cancelButton)) {
self.$confirm(contentText, titleText, { self
confirmButtonText: confirmButtonText, .$confirm(contentText, titleText, {
cancelButtonText: cancelButton, confirmButtonText: confirmButtonText,
dangerouslyUseHTMLString: true, // 是否将 message 属性作为 HTML 片段处理 cancelButtonText: cancelButton,
type: type dangerouslyUseHTMLString: true, // 是否将 message 属性作为 HTML 片段处理
}).then(() => { type: type,
if (confirmFunction instanceof Function) { })
confirmFunction(); .then(() => {
} if (confirmFunction instanceof Function) {
}).catch(() => { confirmFunction();
if (cancelFunction instanceof Function) { }
cancelFunction(); })
} .catch(() => {
}); if (cancelFunction instanceof Function) {
} else { cancelFunction();
self.$alert(contentText, titleText, { }
confirmButtonText: confirmButtonText, });
dangerouslyUseHTMLString: true, // 是否将 message 属性作为 HTML 片段处理 } else {
type: type, self.$alert(contentText, titleText, {
callback: action => { confirmButtonText: confirmButtonText,
// self.$message({ dangerouslyUseHTMLString: true, // 是否将 message 属性作为 HTML 片段处理
// type: 'info', type: type,
// message: `action: ${ action }` callback: (action) => {
// }); // self.$message({
if (confirmFunction instanceof Function) { // type: 'info',
confirmFunction(); // message: `action: ${ action }`
} // });
} if (confirmFunction instanceof Function) {
}); confirmFunction();
} }
},
});
}
}; };
/** /**
...@@ -599,48 +761,61 @@ export const htmlMessageBox = (self, title, content, confirmButton, confirmFunct ...@@ -599,48 +761,61 @@ export const htmlMessageBox = (self, title, content, confirmButton, confirmFunct
* @param {Object} [self] 当前vue对象 * @param {Object} [self] 当前vue对象
* */ * */
export const errorResponseCheck = (error, self) => { export const errorResponseCheck = (error, self) => {
closeLoading(self); closeLoading(self);
console.log(error); console.log(error);
setTimeout(function () { setTimeout(function () {
const code = error ? (error.response ? error.response.data : 0) : 0; const code = error ? (error.response ? error.response.data : 0) : 0;
// console.log("请求失败:%s", code); // console.log("请求失败:%s", code);
if (code == '40011') { if (code == '40011') {
messageBox(self, '登录', '登录失效,请重新登录!', '是', function () { messageBox(
logout(); self,
}, '', null); '登录',
setTimeout(function () { '登录失效,请重新登录!',
logout(); '是',
}, 2000); function () {
} else if (code == '40013') { logout();
messageBox(self, '提示', '刷新太过频繁,休息一下!', '是', function () { },
'',
}, '', null); null
// setTimeout(function () { );
// setTimeout(function () {
// }, 2000); logout();
} else { }, 2000);
// sendErrorReport(code); } else if (code == '40013') {
// messageBox(self, "提示", "操作失败!", "确定", function () { messageBox(
// self,
// }, "", null, "error"); '提示',
self.$message.error('操作失败'); '刷新太过频繁,休息一下!',
} '是',
}, 100); function () {},
'',
null
);
// setTimeout(function () {
//
// }, 2000);
} else {
// sendErrorReport(code);
// messageBox(self, "提示", "操作失败!", "确定", function () {
//
// }, "", null, "error");
self.$message.error('操作失败');
}
}, 100);
}; };
// 截位 // 截位
export const subString = (obj, int) => { export const subString = (obj, int) => {
if (isEmptyUtils(obj) || isEmptyUtils(int)) { if (isEmptyUtils(obj) || isEmptyUtils(int)) {
return ''; return '';
} }
if (obj.length <= int) { if (obj.length <= int) {
return obj;
} else {
obj = obj.substring(0, int);
}
return obj; return obj;
} else {
obj = obj.substring(0, int);
}
return obj;
}; };
/** /**
...@@ -649,15 +824,15 @@ export const subString = (obj, int) => { ...@@ -649,15 +824,15 @@ export const subString = (obj, int) => {
* @return 当前loading对象 * @return 当前loading对象
* */ * */
export const openLoading = (self) => { export const openLoading = (self) => {
const options = { const options = {
lock: true, lock: true,
text: 'Loading', text: 'Loading',
// target:'#bodyContent', // target:'#bodyContent',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)',
}; };
self.elLoadingId = self.$loading(options); self.elLoadingId = self.$loading(options);
return self.elLoadingId; return self.elLoadingId;
}; };
/** /**
...@@ -666,9 +841,9 @@ export const openLoading = (self) => { ...@@ -666,9 +841,9 @@ export const openLoading = (self) => {
* @return 当前loading对象 * @return 当前loading对象
* */ * */
export const closeLoading = (self) => { export const closeLoading = (self) => {
if (self.elLoadingId) { if (self.elLoadingId) {
self.elLoadingId.close(); self.elLoadingId.close();
} }
}; };
/** /**
...@@ -679,136 +854,160 @@ export const closeLoading = (self) => { ...@@ -679,136 +854,160 @@ export const closeLoading = (self) => {
* @param {Object} [codeObject] 例如:codeObject={list1:"P097",list2:"P097"} * @param {Object} [codeObject] 例如:codeObject={list1:"P097",list2:"P097"}
* */ * */
export const getConstantList = (self, codeObject) => { export const getConstantList = (self, codeObject) => {
if (!codeObject instanceof Object) { if (!codeObject instanceof Object) {
return; return;
} }
const req = { const req = {
params: { params: {
numMap: JSON.stringify(codeObject) numMap: JSON.stringify(codeObject),
} },
}; };
self.$axios.get( self.$axios
localStorage.getItem('msUrl') + 'constants' .get(localStorage.getItem('msUrl') + 'constants', req)
, req .then(function (res) {
).then(function (res) { const map = JSON.parse(JSON.stringify(res.data.data)); // 通过这个实现深拷贝
const map = JSON.parse(JSON.stringify(res.data.data));// 通过这个实现深拷贝 for (const key in map) {
for (const key in map) { self[key] = map[key];
self[key] = map[key]; }
}
}); });
}; };
export const initDepartment = (self, obj, type) => { export const initDepartment = (self, obj, type) => {
if (!obj instanceof Object) { if (!obj instanceof Object) {
return; return;
} }
var num = { var num = {
id: obj, id: obj,
type: type type: type,
}; };
axios.create().post( axios
localStorage.getItem('kfUrl') + 'PICAAddressHospitalServiceImpl/postDepartmentList', .create()
num .post(
).then(function (res) { localStorage.getItem('kfUrl') +
const list = JSON.parse(JSON.stringify(res.data.departmentList));// 通过这个实现深拷贝 'PICAAddressHospitalServiceImpl/postDepartmentList',
if (obj == -1) { num
self.departmentListP = list; )
} else { .then(function (res) {
self.departmentList = list; const list = JSON.parse(JSON.stringify(res.data.departmentList)); // 通过这个实现深拷贝
} if (obj == -1) {
self.departmentListP = list;
} else {
self.departmentList = list;
}
if (type == 'childGetChildList') { if (type == 'childGetChildList') {
self.departmentPid = getPdepartmentId(self, 'model', 'departmentId'); self.departmentPid = getPdepartmentId(self, 'model', 'departmentId');
} }
}); });
}; };
export const getPdepartmentId = (self) => { export const getPdepartmentId = (self) => {
if(isNotEmptyList(self.model.departmentId) if (
|| !self.departmentList instanceof Array) { isNotEmptyList(self.model.departmentId) ||
return null; !self.departmentList instanceof Array
} ) {
if(self.departmentList.length > 0) { return null;
return self.departmentList[0].parent_id; }
}else{ if (self.departmentList.length > 0) {
return -1; return self.departmentList[0].parent_id;
} } else {
return -1;
}
}; };
export const getObjectIdsStr = (list, key) => { export const getObjectIdsStr = (list, key) => {
if (isEmptyUtils(list)) { if (isEmptyUtils(list)) {
return ''; return '';
} }
let strRet = ''; let strRet = '';
for (const temp of list) { for (const temp of list) {
strRet = strRet + temp[key] + ','; strRet = strRet + temp[key] + ',';
} }
return strRet; return strRet;
}; };
export const getPositionList = (provinceId, cityId, countyId, townId) => { export const getPositionList = (provinceId, cityId, countyId, townId) => {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var num = { var num = {
provinceId, provinceId,
cityId, cityId,
countyId, countyId,
townId townId,
}; };
axios.create().post( axios
localStorage.getItem('kfUrl') + 'combineHospital/getPositionList', .create()
num .post(
).then(function (res) { localStorage.getItem('kfUrl') + 'combineHospital/getPositionList',
resolve(res); num
}).then(function (res) { )
reject(res); .then(function (res) {
}); resolve(res);
}); })
.then(function (res) {
reject(res);
});
});
}; };
export const setOptionLabel = (self, selfModel, selfEId, selfEName, list, listEId, listEName) => { export const setOptionLabel = (
if (isEmptyList(list) || isEmptyUtils(listEId) || isEmptyUtils(listEName)) { self,
return; selfModel,
} selfEId,
for (let i = 0; i < list.length; i++) { selfEName,
if(list[i][listEId] == self[selfModel][selfEId]) { list,
self[selfModel][selfEName] = list[i][listEName]; listEId,
break; listEName
} ) => {
} if (isEmptyList(list) || isEmptyUtils(listEId) || isEmptyUtils(listEName)) {
return; return;
}
for (let i = 0; i < list.length; i++) {
if (list[i][listEId] == self[selfModel][selfEId]) {
self[selfModel][selfEName] = list[i][listEName];
break;
}
}
return;
}; };
// 将文件大小B转为MB // 将文件大小B转为MB
export const betaHandle = (limit) => { export const betaHandle = (limit) => {
var size = ''; var size = '';
if(limit < 1024) { // 小于0.1KB,则转化成B if (limit < 1024) {
size = limit + 'B'; // 小于0.1KB,则转化成B
}else if(limit < (1024 * 1024)) { // 小于0.1MB,则转化成KB size = limit + 'B';
size = (limit / 1024).toFixed(0) + 'KB'; } else if (limit < 1024 * 1024) {
}else if(limit < (1024 * 1024 * 1024)) { // 小于0.1GB,则转化成MB // 小于0.1MB,则转化成KB
size = (limit / (1024 * 1024)).toFixed(1) + 'MB'; size = (limit / 1024).toFixed(0) + 'KB';
}else{ // 其他转化成GB } else if (limit < 1024 * 1024 * 1024) {
size = (limit / (1024 * 1024 * 1024)).toFixed(1) + 'GB'; // 小于0.1GB,则转化成MB
} size = (limit / (1024 * 1024)).toFixed(1) + 'MB';
return size; } else {
// 其他转化成GB
size = (limit / (1024 * 1024 * 1024)).toFixed(1) + 'GB';
}
return size;
}; };
// 转换年月日方法 // 转换年月日方法
export const timeHandle = (str) => { export const timeHandle = (str) => {
const date = new Date(str * 1); const date = new Date(str * 1);
const Y = date.getFullYear() + '-'; const Y = date.getFullYear() + '-';
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; const M =
const D = change(date.getDate()) + ' '; (date.getMonth() + 1 < 10
const h = change(date.getHours()) + ':'; ? '0' + (date.getMonth() + 1)
const m = change(date.getMinutes()); : date.getMonth() + 1) + '-';
return Y + M + D + h + m; const D = change(date.getDate()) + ' ';
const h = change(date.getHours()) + ':';
const m = change(date.getMinutes());
return Y + M + D + h + m;
}; };
// 补0操作 // 补0操作
const change = (num) => { const change = (num) => {
if(parseInt(num) < 10) { if (parseInt(num) < 10) {
num = '0' + num; num = '0' + num;
} }
return num; return num;
}; };
// 拖拽 // 拖拽
export const bindDragHeader = (classname, content) => { export const bindDragHeader = (classname, content) => {
...@@ -829,12 +1028,12 @@ export const bindDragHeader = (classname, content) => { ...@@ -829,12 +1028,12 @@ export const bindDragHeader = (classname, content) => {
const t = e.clientY - disY; const t = e.clientY - disY;
let x, y, tran; let x, y, tran;
if(contranslate.length > 1) { if (contranslate.length > 1) {
x = (l + Number(contranslate[0])) + 'px'; x = l + Number(contranslate[0]) + 'px';
y = (t + Number(contranslate[1])) + 'px'; y = t + Number(contranslate[1]) + 'px';
}else{ } else {
x = (l) + 'px'; x = l + 'px';
y = (t ) + 'px'; y = t + 'px';
} }
tran = `translate(${x},${y})`; tran = `translate(${x},${y})`;
......
...@@ -31,6 +31,25 @@ ...@@ -31,6 +31,25 @@
/> />
</el-form-item> </el-form-item>
</div> </div>
<div>
<el-form-item
label="问诊类型"
class="t-b"
>
<el-select
v-model="searchParam.type"
placeholder="请选择问诊类型"
style="width: 220px"
>
<el-option
v-for="item of consultationTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</div>
<div> <div>
<el-form-item <el-form-item
label="分诊科室" label="分诊科室"
...@@ -57,6 +76,7 @@ ...@@ -57,6 +76,7 @@
:options="allTilst" :options="allTilst"
placeholder="选择科室" placeholder="选择科室"
:show-all-levels="false" :show-all-levels="false"
style="width: 220px"
@change="changeDepart" @change="changeDepart"
> >
<template slot-scope="{ data }"> <template slot-scope="{ data }">
...@@ -310,6 +330,26 @@ ...@@ -310,6 +330,26 @@
/> />
</el-form-item> </el-form-item>
</div> </div>
<div>
<el-form-item
label="订单业务类型"
class="t-b"
>
<el-select
v-model="searchParam.consultRoad"
placeholder="请选择订单业务类型"
clearable
style="width: 220px"
>
<el-option
v-for="item of orderBusinessList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</div>
</div> </div>
<div class="form-btn"> <div class="form-btn">
<div class="form-btn-li"> <div class="form-btn-li">
...@@ -402,6 +442,7 @@ ...@@ -402,6 +442,7 @@
@cancelRefund="cancelRefund" @cancelRefund="cancelRefund"
@witeGo="witeGo" @witeGo="witeGo"
@waitMatchDot="waitMatchDot" @waitMatchDot="waitMatchDot"
@updateDepartId="updateDepartId"
@applyCancel="applyCancel" @applyCancel="applyCancel"
@sendMessage="sendMessage" @sendMessage="sendMessage"
@joinDiagnose="joinDiagnose" @joinDiagnose="joinDiagnose"
...@@ -486,6 +527,16 @@ ...@@ -486,6 +527,16 @@
:department-id="departmentId" :department-id="departmentId"
@search="search" @search="search"
/> />
<!-- 修改科室 -->
<updateDeparId
v-if="diaUpdateDeIdVisible"
:dia-update-de-id-visible.sync="diaUpdateDeIdVisible"
:user-name="userName"
:user-name-phone="userNamePhone"
:diagnose-log-id="diagnoseLogId"
:triage-department="triageDepartment"
@search="search"
/>
<rematching-doctor <rematching-doctor
:rematching-options="rematchingOptions" :rematching-options="rematchingOptions"
:rematching-visible.sync="rematchingVisible" :rematching-visible.sync="rematchingVisible"
...@@ -547,6 +598,7 @@ ...@@ -547,6 +598,7 @@
import RematchingDoctor from '../../../components/common/rematching-doctor'; import RematchingDoctor from '../../../components/common/rematching-doctor';
import TableSetComponent from '@/components/list/table-set-component'; import TableSetComponent from '@/components/list/table-set-component';
import applyCancelComponent from '../../../components/common/applyCancel'; import applyCancelComponent from '../../../components/common/applyCancel';
import updateDeparId from '../../../components/common/updateDepartId';
export default { export default {
components: { components: {
TableSetComponent, TableSetComponent,
...@@ -561,6 +613,7 @@ ...@@ -561,6 +613,7 @@
DiagnosisTime, DiagnosisTime,
RematchingDoctor, RematchingDoctor,
applyCancelComponent, applyCancelComponent,
updateDeparId,
}, },
data() { data() {
return { return {
...@@ -579,6 +632,7 @@ ...@@ -579,6 +632,7 @@
tabrefresh: true, tabrefresh: true,
searchParam: { searchParam: {
id: '', id: '',
type: '',
operateName: '', operateName: '',
assistantVal: '', assistantVal: '',
receptionVal: '', receptionVal: '',
...@@ -602,6 +656,7 @@ ...@@ -602,6 +656,7 @@
price: '', price: '',
refundRemark: '', refundRemark: '',
matchingWay: null, matchingWay: null,
consultRoad: null,
}, },
noteList: [], noteList: [],
alltabslist: [], alltabslist: [],
...@@ -610,6 +665,16 @@ ...@@ -610,6 +665,16 @@
sourceList: SOURCE_LIST, sourceList: SOURCE_LIST,
priceList: ORDER_PRICE, priceList: ORDER_PRICE,
matchingWayList: MATCHING_LIST, matchingWayList: MATCHING_LIST,
orderBusinessList: [
{
label: '中医实践',
value: 1,
},
{
label: '向上问诊',
value: 0,
},
],
tabpaneList: [], tabpaneList: [],
rematchingOptions: [], // 备注信息 rematchingOptions: [], // 备注信息
Raw_tabpaneList: [], Raw_tabpaneList: [],
...@@ -624,6 +689,7 @@ ...@@ -624,6 +689,7 @@
followupVisible: false, followupVisible: false,
doctorVisible: false, doctorVisible: false,
diagnosisVisible: false, diagnosisVisible: false,
diaUpdateDeIdVisible: false,
coordinatingVisible: false, coordinatingVisible: false,
diagnosisDoctorVisible: false, diagnosisDoctorVisible: false,
diagnoseFlag: false, diagnoseFlag: false,
...@@ -659,6 +725,24 @@ ...@@ -659,6 +725,24 @@
departmentId: '', departmentId: '',
allTilst: [], allTilst: [],
allList: {}, allList: {},
consultationTypeList: [
{
label: '全部',
value: '',
},
{
label: '名医问诊',
value: 2,
},
{
label: '极速问诊',
value: 1,
},
{
label: '-',
value: 0,
},
],
}; };
}, },
watch: { watch: {
...@@ -690,7 +774,6 @@ ...@@ -690,7 +774,6 @@
departmentAll() { departmentAll() {
departmentAll().then((res) => { departmentAll().then((res) => {
if (res.code == '000000') { if (res.code == '000000') {
console.log(res, 'res111');
this.allList = res.data || {}; this.allList = res.data || {};
this.showListALL(); this.showListALL();
} }
...@@ -727,7 +810,6 @@ ...@@ -727,7 +810,6 @@
arr.push(obj); arr.push(obj);
}); });
console.log(arr);
this.allTilst = arr; this.allTilst = arr;
}, },
changeDepart() { changeDepart() {
...@@ -737,10 +819,6 @@ ...@@ -737,10 +819,6 @@
} else { } else {
this.searchParam.triageDepartmentId = ''; this.searchParam.triageDepartmentId = '';
} }
console.log(
this.searchParam.triageDepartmentId,
'this.searchParam.triageDepartmentId'
);
}, },
changeStartTime(time) { changeStartTime(time) {
this.rangeTimeData = time this.rangeTimeData = time
...@@ -748,7 +826,6 @@ ...@@ -748,7 +826,6 @@
? new Date(time.time).format('yyyy-MM-dd hh:mm:ss') ? new Date(time.time).format('yyyy-MM-dd hh:mm:ss')
: '' : ''
: ''; : '';
console.log(this.rangeTimeData, 'this.rangeTimeData');
}, },
getTableData(val) { getTableData(val) {
this.saveTableData = val || []; this.saveTableData = val || [];
...@@ -1038,6 +1115,7 @@ ...@@ -1038,6 +1115,7 @@
this.assistantTime = ''; this.assistantTime = '';
this.searchParam = Object.assign(this.searchParam, { this.searchParam = Object.assign(this.searchParam, {
id: '', id: '',
type: '',
operateName: '', operateName: '',
assistantVal: '', assistantVal: '',
receptionVal: '', receptionVal: '',
...@@ -1058,6 +1136,7 @@ ...@@ -1058,6 +1136,7 @@
assistantBeginTime: '', assistantBeginTime: '',
assistantEndTime: '', assistantEndTime: '',
inNewTimeObj: {}, inNewTimeObj: {},
consultRoad: null,
}); });
}, },
// 导出 // 导出
...@@ -1118,21 +1197,28 @@ ...@@ -1118,21 +1197,28 @@
applyCancel(row) { applyCancel(row) {
this.diagnoseLogId = row.diagnoseLogId; this.diagnoseLogId = row.diagnoseLogId;
this.dialogFormVisible = true; this.dialogFormVisible = true;
console.log(row);
}, },
// 设为待匹配医生 // 设为待匹配医生
waitMatchDot(row) { waitMatchDot(row) {
console.log(row, 'doctorData111');
this.doctorData = row; this.doctorData = row;
this.diagnoseLogId = row.diagnoseLogId; this.diagnoseLogId = row.diagnoseLogId;
this.userName = row.userName; this.userName = row.userName;
this.userNamePhone = row.userMobile; this.userNamePhone = row.userMobile;
this.triageDepartment = row.triageDepartment; this.triageDepartment = row.triageDepartment;
this.departmentId = row.departmentId; this.departmentId = row.triageDepartmentId;
this.diagnosisTimeVisible = true; this.diagnosisTimeVisible = true;
this.bizType = 5; this.bizType = 5;
// } // }
}, },
// 修改科室
updateDepartId(row) {
console.log(row);
this.diagnoseLogId = row.diagnoseLogId;
this.userName = row.userName;
this.userNamePhone = row.userMobile;
this.triageDepartment = row.triageDepartment;
this.diaUpdateDeIdVisible = true;
},
// 发送消息 // 发送消息
sendMessage(row) { sendMessage(row) {
this.$router.push({ this.$router.push({
...@@ -1199,7 +1285,6 @@ ...@@ -1199,7 +1285,6 @@
}, },
// 设为待确认时间 // 设为待确认时间
waitMatchTime(row) { waitMatchTime(row) {
console.log(row, 'row');
this.doctorInfo = row; this.doctorInfo = row;
this.rangeTimeData = row.assistantBeginTime; this.rangeTimeData = row.assistantBeginTime;
this.diagnoseFlag = true; this.diagnoseFlag = true;
......
...@@ -124,6 +124,12 @@ ...@@ -124,6 +124,12 @@
.show-work-set { .show-work-set {
margin-top: 100px; margin-top: 100px;
} }
.maxNum-first-show {
margin-top: 20px;
.show-sep-num {
color: red;
}
}
.agment-left-con { .agment-left-con {
padding: 15px; padding: 15px;
text-align: center; text-align: center;
......
<template>
<div class="diagnosis-list-content">
<div class="select-content screenSet">
<div class="title">
咨询订单管理后台
</div>
</div>
<div class="component-content screenSet">
<el-form
ref="form"
:inline="true"
:model="form"
label-width="180px"
>
<el-form-item label="订单变化(待问诊>问诊中)">
<el-input v-model="form.orderName" />
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="submitConfirm"
>
刷新
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
// 这个页面只是暂时的,等自动排班版本修改
import { getOrderNoFresh } from '@/api/serviceSchedule';
export default {
name: 'OrderStatusUpdate',
data() {
return {
form: {
orderName: '',
},
submitFlag: true,
};
},
mounted() {},
methods: {
submitConfirm() {
this.$confirm('是否要跟新订单状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.onSubmit();
});
},
onSubmit() {
if (this.form.orderName && this.submitFlag) {
this.submitFlag = false;
getOrderNoFresh(this.form.orderName).then((res) => {
let tipText = '';
if (res.code === '000000') {
tipText = '更新订单成功';
} else {
tipText = res.message;
}
this.form.orderName = '';
this.submitFlag = true;
this.$message({
message: tipText,
type: 'warning',
duration: 1000,
});
});
} else {
this.$message({
message: '请先输入订单id',
type: 'warning',
duration: 1000,
});
}
console.log(this.form);
},
init() {
console.log(11);
},
},
};
</script>
<style lang="scss" scoped>
.diagnosis-list-content {
.select-content {
margin-bottom: 10px;
padding: 10px;
background: #fff;
overflow: hidden !important;
.title {
height: 50px;
display: flex;
justify-content: flex-start;
align-items: center;
}
.form-container {
display: flex;
justify-content: space-between;
.form-li {
display: flex;
flex-direction: column;
// justify-content: space-between;
}
.form-btn {
display: flex;
flex-direction: column;
justify-content: flex-start;
.form-btn-li {
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
}
}
}
.select-bottom {
height: 50px;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
color: #0d9078;
}
.btn-wrap {
text-align: right;
}
.t-b {
margin-bottom: 10px;
}
}
.component-content {
height: 400px;
padding: 10px;
background: #fff;
overflow: hidden !important;
}
}
</style>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="header"> <div class="header">
<el-breadcrumb separator="/"> <el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item> <el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item> 服务排班表 </el-breadcrumb-item> <el-breadcrumb-item> 医生排班总览 </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
<div class="agment-box"> <div class="agment-box">
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
查询 查询
</el-button> </el-button>
</div> </div>
<div class="agmentSelect-select-right"> <!-- <div class="agmentSelect-select-right">
设置系统每小时接诊上限 设置系统每小时接诊上限
<el-input-number <el-input-number
v-model="maxDiaNum" v-model="maxDiaNum"
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
> >
保存 保存
</el-button> </el-button>
</div> </div> -->
</div> </div>
<div <div
class="fullCalendar-show" class="fullCalendar-show"
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
watch: {}, watch: {},
created() { created() {
this.departmentAll(); this.departmentAll();
this.getPlatformUpper(); // this.getPlatformUpper();
}, },
mounted() {}, mounted() {},
methods: { methods: {
......
<template>
<div
v-loading="loading"
style="width: 100%; position: relative; justifycontent: space-between"
>
<div class="header">
<el-breadcrumb separator="/">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item> 服务排班表 </el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="agment-box">
<div class="setagment">
<div class="choose_around">
<span>选择要排班提醒的上级医生范围:</span>
<div class="showLevel">
<el-checkbox-group
v-model="checkList"
@change="handlecheckedProps"
>
<el-checkbox
v-for="item in levelList"
:key="item.id"
:label="item.id"
class="select-checkbox"
>
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="agmentSelect-select-right">
设置系统每小时接诊上限:
<el-input-number
v-model="maxDiaNum"
:step="1"
:min="0"
:max="10000000"
step-strictly
@change="getInputNumber"
/>
<el-button
type="primary"
class="submit-btn"
@click="setPlatformUpper"
>
保存
</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import { setPlatformUpper, getPlatformUpper } from '@/api/serviceSchedule';
export default {
data() {
return {
levelList: [
{
id: 1,
name: '运营等级1',
},
{
id: 2,
name: '运营等级2',
},
{
id: 3,
name: '运营等级3',
},
{
id: 4,
name: '运营等级4',
},
{
id: 5,
name: '运营等级5',
},
],
checkList: [],
maxDiaNum: 0,
};
},
watch: {},
created() {
this.getPlatformUpper();
},
mounted() {},
methods: {
getPlatformUpper() {
getPlatformUpper().then((res) => {
if (res.code === '000000') {
this.maxDiaNum = res.data.count;
this.checkList = res.data.levelList;
}
});
},
setPlatformUpper() {
const param = {
count: this.maxDiaNum,
levelList: this.checkList,
};
setPlatformUpper(param).then((res) => {
if (res.code === '000000') {
this.$message.success('保存成功');
this.getPlatformUpper();
}
});
},
handlecheckedProps(val) {
console.log(val);
this.checkList = val || [];
},
},
};
</script>
<style lang="scss" scoped>
.header {
padding: 30px;
width: 100%;
}
.agment-box {
padding: 0 25px 25px 25px;
border-radius: 6px;
min-height: 700px;
// flex: 3.8;
width: 100%;
overflow: hidden;
.setagment {
min-height: 500px;
background: #fff;
padding: 30px 25px 50px 25px;
.choose_around {
display: flex;
span {
font-size: 16px;
}
.showLevel {
padding: 20px 20px 50px 20px;
.el-checkbox-group {
display: flex;
flex-direction: column;
.el-checkbox {
padding: 10px;
color: black;
}
}
}
}
.agmentSelect-select-right {
position: relative;
padding-top: 10px;
.el-input-number {
margin: 0 10px;
}
.submit-btn {
position: absolute;
left: 280px;
top: 100px;
padding: 10px 30px;
height: 32px;
background: #0d9078;
border-radius: 16px;
display: flex;
align-items: center;
}
}
}
}
</style>
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
:total-rows="searchParam.totalRows" :total-rows="searchParam.totalRows"
:loading="loading" :loading="loading"
:create-list="newCreateList" :create-list="newCreateList"
:center-dialog-visible="centerDialogVisible"
@sortfunc="sortfunc" @sortfunc="sortfunc"
@getServiceOpen="getServiceOpen" @getServiceOpen="getServiceOpen"
@getWorkStatus="getWorkStatus" @getWorkStatus="getWorkStatus"
...@@ -145,6 +146,7 @@ ...@@ -145,6 +146,7 @@
@handleSizeChange="handleSizeChange" @handleSizeChange="handleSizeChange"
@handleCurrentChange="handleCurrentChange" @handleCurrentChange="handleCurrentChange"
@addSchedule="addSchedule" @addSchedule="addSchedule"
@setMaxNumValue="setMaxNumValue"
/> />
</div> </div>
</div> </div>
...@@ -155,6 +157,36 @@ ...@@ -155,6 +157,36 @@
href="" href=""
target="_blank" target="_blank"
/> />
<el-dialog
:visible.sync="centerDialogVisible"
width="30%"
center
class="el-dialog-show"
>
<div class="set-agment-maxNum">
<div class="num-max">
<span class="hour-num-title">每小时接诊上限人数</span>
<div class="num-input-show">
<el-input-number
v-model="maxNumValue"
:min="0"
:max="20"
@change="getMaxNumValue"
/>
</div>
</div>
</div>
<span
slot="footer"
class="dialog-footer"
>
<el-button @click="centerDialogVisible = false">取 消</el-button>
<el-button
type="primary"
@click="submitSetData"
>确 定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
...@@ -165,7 +197,7 @@ ...@@ -165,7 +197,7 @@
workInStep, workInStep,
getLevel, getLevel,
} from '@/api/serviceSchedule'; } from '@/api/serviceSchedule';
import { departmentAll } from '@/api/diagnosis'; import { departmentAll, savePCDayCount } from '@/api/diagnosis';
import TableServiceSchedule from '@/components/list/table-serviceSchedule'; import TableServiceSchedule from '@/components/list/table-serviceSchedule';
export default { export default {
components: { components: {
...@@ -227,6 +259,9 @@ ...@@ -227,6 +259,9 @@
newCreateList: [], newCreateList: [],
allTilst: [], allTilst: [],
allList: {}, allList: {},
centerDialogVisible: false,
doctorInfo: {},
maxNumValue: '',
}; };
}, },
watch: {}, watch: {},
...@@ -403,20 +438,33 @@ ...@@ -403,20 +438,33 @@
this.search(); this.search();
}, },
addSchedule(value, val) { addSchedule(value, val) {
// this.ScheduleListShow = false;
// this.schedulingType = val;
const target = this.$refs.target; const target = this.$refs.target;
const { origin } = window.location; const { origin } = window.location;
const u = `${origin}/consultation/pica-admin-consultation/addEditSchedule?type=${val}&doctorId=${value.doctorId}&id=${value.id}`; const u = `${origin}/consultation/pica-admin-consultation/addEditSchedule?type=${val}&doctorId=${value.doctorId}&id=${value.id}`;
target.setAttribute('href', u); target.setAttribute('href', u);
target.click(); target.click();
}, },
// goBack(flag) { setMaxNumValue(value) {
// this.ScheduleListShow = true; this.doctorInfo = value;
// if (flag) { this.maxNumValue = value.preNum;
// this.search(); this.centerDialogVisible = true;
// } },
// }, // 每小时接诊上限人数
getMaxNumValue(value) {
this.maxNumValue = value;
},
submitSetData() {
const params = {
doctorId: this.doctorInfo.doctorId,
preNum: this.maxNumValue,
};
savePCDayCount(params).then((res) => {
if (res.code == '000000') {
this.centerDialogVisible = false;
this.search();
}
});
},
}, },
}; };
</script> </script>
...@@ -541,6 +589,29 @@ ...@@ -541,6 +589,29 @@
} }
} }
} }
.el-dialog-show {
.set-agment-maxNum {
.num-max {
text-align: center;
.hour-num-title {
font-size: 16px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #02120f;
}
.num-input-show {
padding-top: 10px;
.el-input {
width: 50%;
/deep/.el-input__inner {
border-radius: 20px;
text-align: center;
}
}
}
}
}
}
} }
</style> </style>
<style lang="scss"> <style lang="scss">
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
case 'development': case 'development':
url = 'https://dev-sockets.yunqueyi.com'; url = 'https://dev-sockets.yunqueyi.com';
break; break;
case 'test': case 'testing':
url = 'https://test1-sockets.yunqueyi.com'; url = 'https://test1-sockets.yunqueyi.com';
break; break;
case 'uat': case 'uat':
...@@ -181,8 +181,6 @@ ...@@ -181,8 +181,6 @@
color: #fff; color: #fff;
background: #06232c; background: #06232c;
} }
} }
} }
</style> </style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册