Browse Source

feat: 添加医院项目下的问卷悬浮按钮

wrr
song 4 years ago
parent
commit
e68e633568
  1. 3
      CHANGELOG.md
  2. 3
      src/apis/project.js
  3. 76
      src/pages/project/project.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-09-16)
# 0.1.0 (2021-09-24)
### 🌟 新功能
范围|描述|commitId
@ -155,6 +155,7 @@
- | 时间轴插件 | [225d3cc](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/225d3cc)
- | 时间轴无任务时时间刻度加载修改 | [4921672](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/4921672)
- | 时间轴滚动位置修改 | [551da63](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/551da63)
- | 时间轴自动滚动到对应位置修改 | [e5a13c8](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/e5a13c8)
- | 时间轴自动滚动到对应位置修改 | [1c23019](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/1c23019)
- | 时间轴骨架屏修改 | [ca78d02](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/ca78d02)
- | 检查交付物传参修改 | [ebe0031](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/ebe0031)

3
src/apis/project.js

@ -8,6 +8,9 @@ const install = (Vue, vm) => {
//点击分享连接
vm.$u.api.clickShare = param => vm.$u.post(`${uni.$t.domain}/share/click`, param);
//查询医院是否填写了调查问卷
vm.$u.api.queryNotWrite = param => vm.$u.post(`${uni.$t.domain}/questionnaire/queryNotWrite`, param);
};
export default { install };

76
src/pages/project/project.vue

@ -12,6 +12,35 @@
<!-- 定期任务面板 -->
<TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="timeLine" />
<!-- 医院项目的问卷悬浮按钮 -->
<view class="absolute bottom-10 right-5" v-if="showQuestion">
<view
@click="openQuestionnaire(false)"
class="relative text-white bg-blue-400 flex justify-center items-center w-12 h-12 rounded-full shadow-2xl"
>
问卷
<u-badge type="error" :count="count" :offset="[-8, -8]"></u-badge>
</view>
<u-popup v-model="showQuestionList" mode="bottom" border-radius="14">
<view class="h-64">
<view class="text-center font-bold fixed bg-white py-3 top-0 w-full">请选择</view>
<view class="flex flex-col mx-3 pt-10 pb-6 h-full overflow-y-auto" :class="questionnaires.length < 5 ? 'justify-center' : ''">
<view
v-for="(item, index) in questionnaires"
:key="item.id"
class="p-2 text-center"
@click="openQuestionnaire(true)"
:class="index === questionnaires.length - 1 ? '' : 'border-b'"
>
<view class="text-gray-500">{{ item.questionnaireName }}</view>
</view>
</view>
<view class="fixed bottom-0 bg-white h-6 w-full"></view>
</view>
</u-popup>
</view>
</view>
</view>
</template>
@ -23,7 +52,7 @@ import { flatten } from 'lodash';
export default {
data() {
return { height: '', show: false };
return { height: '', show: false, showQuestion: false, questionnaires: [], count: 0, showQuestionList: false, chooseItem: false };
},
computed: {
@ -84,6 +113,18 @@ export default {
this.init(options);
}
},
//
questionnaires(val) {
if (val && val.length) {
this.showQuestion = true;
val.forEach(item => {
if (!item.isWrite) {
this.count += 1;
}
});
}
},
},
mounted() {
@ -318,6 +359,8 @@ export default {
}
// TODO
this.getProjectById({ projectId: options.p, num: 0 }); // id
//
this.handleQueryNotWrite(options.p);
}
},
@ -418,6 +461,37 @@ export default {
//
this.clearEndFlag();
},
/**
* 查询医院是否填写了调查问卷
* @param {string} projectId 项目id
*/
async handleQueryNotWrite(projectId) {
try {
const param = { projectId };
const data = await this.$u.api.queryNotWrite(param);
console.log('data: ', data);
this.questionnaires = data;
} catch (error) {
console.error('error: ', error);
}
},
//
openQuestionnaire(value) {
this.chooseItem = value;
if (this.count === 1 || this.chooseItem) {
window.location.href = 'https://www.baidu.com/';
} else {
this.showQuestionList = true;
}
},
},
};
</script>
<style lang="scss" scoped>
.border-b {
border-bottom: 1px solid #e4e7ed;
}
</style>

Loading…
Cancel
Save