Browse Source

feat: 省卫健委相关修改

carbasic
aBin 4 years ago
parent
commit
57ccd0b832
  1. 3
      CHANGELOG.md
  2. 2
      src/apis/tall.js
  3. 29
      src/components/Globals/Globals.vue
  4. 132
      src/components/Greenway/Greenway.vue
  5. 2
      src/manifest.json
  6. 13
      src/pages/project/project.vue
  7. 20
      src/store/messages/mutations.js
  8. 19
      src/store/messages/state.js
  9. 9
      src/store/project/mutations.js
  10. 1
      src/store/project/state.js
  11. 3
      src/store/socket/actions.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-10-18)
# 0.1.0 (2021-11-04)
### 🌟 新功能
范围|描述|commitId
@ -165,6 +165,7 @@
- | 修改定期任务状态0和4时不加载圆圈 | [30e352f](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/30e352f)
- | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/a54c601)
- | 修改接口路径 | [df6acf2](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/df6acf2)
- | 修改时间至无法正确滚动到第一个真实任务的问题 | [7522344](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7522344)
- | 修改时间轴定期任务加载逻辑 | [1977c00](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/1977c00)
- | 修改项目详情页返回首页bug | [e942887](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/e942887)
- | 修改小红点传参 | [87b20fd](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/87b20fd)

2
src/apis/tall.js

@ -32,7 +32,7 @@ export const getQueryButton = {
},
};
// 查询当前用户是否展示宣传页按钮
// 查询当前用户是否展示宣传页
export const queryIsShow = {
async index(params) {
try {

29
src/components/Globals/Globals.vue

@ -1,17 +1,24 @@
<template>
<view class="m-2" v-if="globals && globals.length">
<view :class="organData && organData.organizationType === 0 ? 'organ-box' : 'm-2'" v-if="globals && globals.length">
<!-- <u-card @click="openCard" :show-foot="false" :show-head="false" style="max-height: 218rpx" border-radius="25" margin="0"> -->
<!-- :style="{ 'max-height': isShrink ? '106rpx' : '340rpx' }" -->
<u-card
@click="openCard"
:show-foot="false"
:show-head="false"
:style="{ 'min-height': '42px', 'max-height': globalsHeight + 'px' }"
border-radius="25"
:style="{ 'min-height': '42px', 'max-height': organData && organData.organizationType === 0 ? '100vh' : globalsHeight + 'px' }"
:border-radius="organData && organData.organizationType === 0 ? 0 : 25"
margin="0"
:padding="organData && organData.organizationType === 0 ? 0 : 15"
>
<view slot="body">
<scroll-view :scrollY="true" :style="{ 'min-height': '24rpx', 'max-height': globalsHeight - 30 + 'px' }">
<scroll-view
:scrollY="true"
:style="{
'min-height': '24rpx',
'max-height': organData && organData.organizationType === 0 ? '100vh' : globalsHeight - 30 + 'px',
}"
>
<!-- <scroll-view :scrollY="true" style="max-height: 280rpx"> -->
<!-- <scroll-view :scrollY="true" :style="{ 'max-height': isShrink ? '50rpx' : '280rpx' }"> -->
<skeleton :banner="false" :loading="!globals.length" :row="4" animate class="u-line-2 skeleton"></skeleton>
@ -61,6 +68,7 @@ export default {
computed: {
...mapState('task', ['isShrink']),
...mapState('project', ['organData']),
...mapGetters('task', ['globals']),
globalsHeight: function () {
@ -83,6 +91,19 @@ export default {
</script>
<style scoped lang="scss">
.organ-box {
position: fixed;
height: 100vh;
width: 750rpx;
left: 0;
top: 0;
z-index: 999;
}
.u-card__body {
padding: 16px 0;
}
.u-card-wrap {
background-color: $u-bg-color;
padding: 1px;

132
src/components/Greenway/Greenway.vue

@ -0,0 +1,132 @@
<template>
<div class="flex green-way-box">
<div class="w-full flex justify-center" v-if="greenMsg && greenMsg.content">
<div class="ml-1">{{ greenMsg.content }}</div>
</div>
<div class="w-full flex justify-center" v-if="greenMsg && greenMsg.realCountdown && countDown">{{ countDown }}</div>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'Greenway',
data() {
return {
countDown: '',
duration: 0,
showIndex: 0,
timer: null,
changeTimer: null,
greenMsg: null,
allMsg: [],
};
},
computed: mapState('messages', ['greenMsgs']),
watch: {
greenMsgs(val) {
this.allMsg = val;
this.getMsg();
this.changeMsg();
},
},
created() {
this.allMsg = this.greenMsgs;
this.getMsg();
this.changeMsg();
},
destroyed() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
this.countDown = '';
}
if (this.changeTimer) {
clearInterval(this.changeTimer);
this.changeTimer = null;
}
},
methods: {
// msg
changeMsg() {
if (this.changeTimer) {
clearInterval(this.changeTimer);
this.changeTimer = null;
}
const that = this;
this.changeTimer = setInterval(() => {
if (that.showIndex < that.greenMsgs.length - 1) {
that.showIndex += 1;
} else {
that.showIndex = 0;
}
that.getMsg();
}, 5000);
},
// msg
getMsg() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
this.countDown = '';
}
this.greenMsg = this.allMsg[this.showIndex];
const that = this;
this.duration = that.greenMsg.totalCountdown - (Date.parse(new Date()) - that.greenMsg.time);
that.getCount(this.duration);
this.timer = setInterval(() => {
this.duration = that.greenMsg.totalCountdown - (Date.parse(new Date()) - that.greenMsg.time);
that.getCount(this.duration);
}, 1000);
},
// msg
getCount(duration) {
if (this.duration > 0) {
var timeMoment = uni.$moment.duration((duration - 0) / 1000, 'second');
var hour = '';
var min = '';
var second = '';
if (timeMoment.hours() - 0 < 10 && timeMoment.hours() - 0 >= 0) {
hour = '0' + timeMoment.hours();
} else {
hour = timeMoment.hours();
}
if (timeMoment.minutes() - 0 < 10 && timeMoment.minutes() - 0 >= 0) {
min = '0' + timeMoment.minutes();
} else {
min = timeMoment.minutes();
}
if (timeMoment.seconds() - 0 < 10 && timeMoment.seconds() - 0 >= 0) {
second = '0' + timeMoment.seconds();
} else {
second = timeMoment.seconds();
}
if ((duration - 0) / 1000 < 60) {
this.countDown = ['00', second].join(':');
} else if ((duration - 0) / 1000 >= 60 && (duration - 0) / 1000 < 3600) {
this.countDown = [min, second].join(':');
} else {
this.countDown = [hour, min, second].join(':');
}
}
if (this.duration < 1) {
clearInterval(this.timer);
this.timer = null;
this.countDown = '';
}
},
},
};
</script>
<style scoped>
.green-way-box {
position: relative;
height: 62px;
background-color: #000;
color: red;
font-size: 20px;
align-items: center;
justify-content: center;
padding: 2px 8px;
flex-wrap: wrap;
}
</style>

2
src/manifest.json

@ -9,7 +9,7 @@
"router": {
"base": "/carBasicTall"
},
"title": "时物链条",
"title": "暴风眼Typhoneye",
"sdkConfigs": {
"maps": {}
},

13
src/pages/project/project.vue

@ -10,6 +10,7 @@
<Roles />
<!-- 体验项目切换角色 -->
<Experience v-if="showEXP" />
<Greenway v-if="greenMsgs.length" />
<!-- 日常任务面板 -->
<Globals />
@ -76,6 +77,7 @@ export default {
...mapState('user', ['user', 'token']),
...mapState('role', ['visibleRoles', 'roleId']),
...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'regularTask', 'newProjectInfo', 'showSkeleton', 'showScrollTo']),
...mapState('messages', ['greenMsgs']),
...mapState('project', ['project']),
...mapGetters('task', ['timeGranularity']),
...mapGetters('project', ['projectId']),
@ -138,6 +140,7 @@ export default {
this.setRoleId('');
const options = this.$route.query;
this.init(options);
this.getByProject(val.projectId);
}
},
@ -168,7 +171,7 @@ export default {
...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
...mapMutations('user', ['setToken']),
...mapMutations('project', ['setProject', 'setProjectName']),
...mapMutations('project', ['setProject', 'setProjectName', 'setOrganData']),
...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']),
...mapMutations('task', [
'setPermanents',
@ -520,9 +523,15 @@ export default {
const param = { projectId };
const data = await this.$u.api.getByProject(param);
console.log('data: ', data);
if (data.organizationType === 3) {
if (data && data.organizationType === 3) {
this.showEXP = true;
this.showGuide = true;
this.setOrganData(data);
} else if (data && data.organizationType === 0) {
this.setOrganData(data);
} else {
this.showEXP = false;
this.showGuide = false;
}
} catch (error) {
console.log('error: ', error);

20
src/store/messages/mutations.js

@ -80,6 +80,26 @@ const mutations = {
removeStorageSync(data.type);
}
},
/**
* 获取需要显示/删除的消息
* @param {any} state
* @param {object} data
*/
messagesGreenWay(state, data) {
if (!state.greenMsgs.length) {
state.greenMsgs = [...state.greenMsgs, data];
} else {
for (var i = 0; i < state.greenMsgs.length; i++) {
if (data.firstAidId === state.greenMsgs[i].firstAidId) {
state.greenMsgs.splice(i, 1);
return;
} else if (i === state.greenMsgs.length - 1) {
state.greenMsgs = [...state.greenMsgs, data];
}
}
}
},
};
export default mutations;

19
src/store/messages/state.js

@ -3,6 +3,25 @@ const state = {
faultMessages: [], // 新收到的未处理的 故障消息
faults: [], // 所有的故障消息
game: [], // 游戏的消息
greenMsgs: [
// {
// name: '传小控', //患者姓名
// content: '传小控3', //显示内容
// totalCountdown: '510000', //总倒计时时间
// realCountdown: '500000', //真实倒计时时间
// time: '1634780847000', //一键启动时间
// firstAidId: '123456', //急救id
// }, // 绿道提示消息
// {
// name: '传小控1111', //患者姓名
// content: '传小控111', //显示内容
// totalCountdown: '410000', //总倒计时时间
// realCountdown: '500000', //真实倒计时时间
// time: '1634780098000', //一键启动时间
// firstAidId: '111111', //急救id
// }, // 绿道提示消息
//
],
};
export default state;

9
src/store/project/mutations.js

@ -38,6 +38,15 @@ const mutations = {
setDotList(state, data) {
state.dotList = data;
},
/**
* 设置当前项目的配置信息
* @param { object } state
* @param { string } data
*/
setOrganData(state, data) {
state.organData = data;
},
};
export default mutations;

1
src/store/project/state.js

@ -3,6 +3,7 @@ const state = {
project: { name: '加载中...' }, // 当前项目信息
projects: [], // 项目列表
dotList: [], // 小红点
organData: null,
};
export default state;

3
src/store/socket/actions.js

@ -65,6 +65,9 @@ const actions = {
case 'switchoverProject': // 打开新项目消息
commit('task/setNewProjectInfo', data.data, { root: true });
break;
case 'buttonStart': // 绿道通知
commit('messages/messagesGreenWay', data.data, { root: true });
break;
// case 'Chrome': // !收到开始游戏的消息
// console.log('handleMessagesData', data);
// // @ts-ignore

Loading…
Cancel
Save