feat: merge develop

This commit is contained in:
luch1994 2024-09-27 19:27:15 +08:00
commit bcb41c68fb
16 changed files with 338 additions and 109 deletions

133
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,133 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[xiaojusurvey@gmail.com](mailto:xiaojusurvey@gmail.com).
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@ -19,4 +19,4 @@ XIAOJUSURVEY will never collect and/or report sensitive information, such as pri
## How do I opt-in to or opt-out of data sharing?
See [docs](https://xiaojusurvey.didi.cn/docs/next/community/%E6%95%B0%E6%8D%AE%E9%87%87%E9%9B%86%E5%A3%B0%E6%98%8E) for information on configuring this functionality.
See [docs](https://xiaojusurvey.didi.cn/docs/next/community/%E6%95%B0%E6%8D%AE%E4%B8%8A%E6%8A%A5%E5%A3%B0%E6%98%8E) for information on configuring this functionality.

149
README.md
View File

@ -33,29 +33,45 @@
  内部系统已沉淀 40+种题型,累积精选模板 100+,适用于市场调研、客户满意度调研、在线考试、投票、报道、测评等众多场景。数据能力上,经过上亿量级打磨,沉淀了分题统计、交叉分析、多渠道分析等在线报表能力,快速满足专业化分析。
# 功能简介
# 功能特性
- 问卷管理:创、编、投、收、数据分析
**🌈 好用**
- 多样化题型:单行输入框、多行输入框、单项选择、多项选择、判断题、评分、投票、...
- 多类型数据采集,轻松创建调研表单。
- 用户管理:登录、注册、权限管理
- 智能逻辑编排,设计多规则动态表单。
- 数据安全:传输加密、脱敏等
- 数据在线分析和导出,洞察调研结果。
> 更全的建设请查阅 [功能介绍](https://xiaojusurvey.didi.cn/docs/next/document/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C/%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D/%E5%9F%BA%E7%A1%80%E6%B5%81%E7%A8%8B)
**🎨 好看**
- 主题自由定制,适配您的品牌。
- 无缝嵌入各终端,满足不同场景需求。
**🚀 好扩展**
- 自定义 Hook 配置,轻松集成多方系统与各类工具。
<img src="https://github.com/didi/xiaoju-survey/assets/16012672/dd427471-368d-49d9-bc44-13c34d84e3be" width="700" />
_**(个人和企业用户均可快速构建特定领域的调研类解决方案。)**_
1、 **全部功能**请查看 [功能介绍](https://xiaojusurvey.didi.cn/docs/next/document/%E4%BA%A7%E5%93%81%E6%89%8B%E5%86%8C/%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D/%E5%9F%BA%E7%A1%80%E6%B5%81%E7%A8%8B)。
2、**企业**和**个人**均可快速构建特定领域的调研类解决方案。
# 技术
Web 端Vue3 + ElementPlusC 端多端渲染(规划中)
**1、Web 端Vue3 + ElementPlus**
Server 端Nestjs + MongoDBJava在建[欢迎加入共建](https://github.com/didi/xiaoju-survey/issues/306)
&ensp;&ensp;C 端多端渲染ReactNative SDK 建设中
智能化基座:(规划中)
**2、Server 端NestJS + MongoDB**
&ensp;&ensp;Java 版:建设中,[欢迎加入共建](https://github.com/didi/xiaoju-survey/issues/306)
**3、能力增强**
&ensp;&ensp;在线平台:建设中、智能化问卷:规划中
# 项目优势
@ -106,120 +122,51 @@ Server 端Nestjs + MongoDBJava在建[欢迎加入共建](https://git
前后端分离,提供 Docker 化方案,提供了完善的部署指导手册。
# 快速启动
# 快速使用
Node 版本 >= 18.x
[查看环境准备指导](https://xiaojusurvey.didi.cn/docs/next/document/%E6%A6%82%E8%BF%B0/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)
_在线平台建设中_
复制工程
# 本地开发
```shell
git clone git@github.com:didi/xiaoju-survey.git
```
请查看 [本地安装手册](https://xiaojusurvey.didi.cn/docs/next/document/%E6%A6%82%E8%BF%B0/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) 来启动项目。
## 服务端启动
# 快速部署
### 方案一、快速启动,无需安装数据库
### 服务部署
> _便于快速预览工程对于正式项目需要使用方案二。_
请查看 [快速部署指导](https://xiaojusurvey.didi.cn/docs/next/document/%E5%B7%A5%E7%A8%8B%E9%83%A8%E7%BD%B2/Docker%E9%83%A8%E7%BD%B2) 。
#### 1、安装依赖
### 一键部署
```shell
cd server
npm install
```
#### 2、启动
```shell
npm run local
```
> 服务运行依赖 [mongodb-memory-server](https://github.com/nodkz/mongodb-memory-server)
>
> 1、数据保存在内存中重启服务会更新数据。<br />2、启动内存服务器新实例时如果找不到 MongoDB 二进制文件会自动下载,因此首次可能需要一些时间。
### 方案二、(生产推荐)
#### 1、配置数据库
> 项目使用 MongoDB需要提前准备请查看[如何拥有 MongoDB 指南](https://xiaojusurvey.didi.cn/docs/next/document/%E6%A6%82%E8%BF%B0/%E6%95%B0%E6%8D%AE%E5%BA%93#%E5%AE%89%E8%A3%85)
配置数据库信息,查看[MongoDB 配置](https://xiaojusurvey.didi.cn/docs/next/document/%E6%A6%82%E8%BF%B0/%E6%95%B0%E6%8D%AE%E5%BA%93)。
#### 2、安装依赖
```shell
cd server
npm install
```
#### 3、启动
```shell
npm run dev
```
## 前端启动
### 安装依赖
```shell
cd web
npm install
```
### 启动
```shell
npm run serve
```
## 访问
### 问卷管理端
[http://localhost:8080/management](http://localhost:8080)
### 问卷投放端
创建并发布问卷。
[http://localhost:8080/render/:surveyPath](http://localhost:8080/render/:surveyPath)
_手册编写中_
<br /><br />
## 微信交流群(推荐)
官方群会发布项目最新消息、建设计划和社区活动,欢迎你的加入。任何问题和合作可以联系小助手:
<img src="https://img-hxy021.didistatic.com/static/starimg/img/KXKvc7sjHz1700061188156.png" width="200" />
## QQ 交流群
官方群会发布项目最新消息、建设计划和社区活动,欢迎你的加入:
[<img src="https://img-hxy021.didistatic.com/static/starimg/img/iJUmLIHKV21700192846057.png" width="210" />](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=P61UJI_q8AzizyBLGOm-bUvzNrUnSQq-&authKey=yZFtL9biGB5yiIME3%2Bi%2Bf6XMOdTNiuf0pCIaviEEAIryySNzVy6LJ4xl7uHdEcrM&noverify=0&group_code=920623419)
## Star
开源不易,如果该项目对你有帮助,请 star 一下 ❤️❤️❤️,你的支持是我们最大的动力。
[![Star History Chart](https://api.star-history.com/svg?repos=didi/xiaoju-survey&type=Date)](https://star-history.com/#didi/xiaoju-survey&Date)
## 记录
## 交流群
官方群会发布项目最新消息、建设计划和社区活动,欢迎你的加入。
<img src="https://img-hxy021.didistatic.com/static/starimg/img/KXKvc7sjHz1700061188156.png" width="200" />
_任何问题和合作可以联系小助手。_
## 案例
如果你使用了该项目,请记录反馈:[我在使用](https://github.com/didi/xiaoju-survey/issues/64),你的支持是我们最大的动力。
## Future Tasks
[欢迎了解项目发展和共建](https://github.com/didi/xiaoju-survey/issues/85),你的支持是我们最大的动力。
## 贡献
如果你想成为贡献者或者扩展技术栈,请查看:[贡献者指南](https://xiaojusurvey.didi.cn/docs/next/share/%E5%A6%82%E4%BD%95%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE),你的加入使我们最大的荣幸。
## Future Tasks
[欢迎共建](https://github.com/didi/xiaoju-survey/issues/85)
## CHANGELOG
关注重大变更:[MAJOR CHANGELOG](https://github.com/didi/xiaoju-survey/issues/48)
关注重大项目变更:[MAJOR CHANGELOG](https://github.com/didi/xiaoju-survey/issues/48)。

View File

@ -44,6 +44,8 @@ import { PluginManagerProvider } from './securityPlugin/pluginManager.provider';
import { LogRequestMiddleware } from './middlewares/logRequest.middleware';
import { PluginManager } from './securityPlugin/pluginManager';
import { Logger } from './logger';
import { DownloadTask } from './models/downloadTask.entity';
import { Session } from './models/session.entity';
@Module({
imports: [

View File

@ -88,10 +88,17 @@ export interface MsgContent {
msg_9004: string;
}
export interface JumpConfig {
type: string;
link: string;
buttonText?: string;
}
export interface SubmitConf {
submitTitle: string;
confirmAgain: ConfirmAgain;
msgContent: MsgContent;
jumpConfig?: JumpConfig;
}
// 白名单类型

View File

@ -12,7 +12,7 @@ export class LogRequestMiddleware implements NestMiddleware {
const userAgent = req.get('user-agent') || '';
const startTime = Date.now();
const traceId = genTraceId({ ip });
req['traceId'] = traceId;
this.logger.setTraceId(traceId);
const query = JSON.stringify(req.query);
const body = JSON.stringify(req.body);
this.logger.info(

View File

@ -275,6 +275,11 @@ describe('DataStatisticController', () => {
again_text: '确认要提交吗?',
},
link: '',
jumpConfig: {
type: 'link',
link: '',
buttonText: '',
},
},
logicConf: {
showLogicConf: [],

View File

@ -70,6 +70,11 @@ export const mockSensitiveResponseSchema: ResponseSchema = {
is_again: true,
again_text: '确认要提交吗?',
},
jumpConfig: {
type: 'link',
link: '',
buttonText: '',
},
},
dataConf: {
dataList: [
@ -362,6 +367,11 @@ export const mockResponseSchema: ResponseSchema = {
is_again: true,
again_text: '确认要提交吗?',
},
jumpConfig: {
type: 'link',
link: '',
buttonText: '',
},
},
dataConf: {
dataList: [

View File

@ -74,6 +74,11 @@ export const mockResponseSchema: ResponseSchema = {
is_again: true,
again_text: '确认要提交吗?',
},
jumpConfig: {
type: 'link',
link: '',
buttonText: '',
},
},
dataConf: {
dataList: [

View File

@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { MongoRepository } from 'typeorm';
import { SurveyResponse } from 'src/models/surveyResponse.entity';
import { RECORD_STATUS } from 'src/enums';
@Injectable()
export class SurveyResponseService {
constructor(

View File

@ -14,6 +14,7 @@
v-for="(content, contentIndex) in item.content"
:key="`${item.key}${contentIndex}`"
:form-config="content"
v-show="isShowFormItem(content)"
>
<Component
:is="components[content.type]"
@ -82,6 +83,14 @@ const formFieldData = ref<Array<any>>([])
const init = ref<boolean>(true)
const components = shallowRef<any>(props.customComponents || {})
const isShowFormItem = (content: any) => {
if (_isFunction(content.toggleShowFn)) {
return content.toggleShowFn(props.moduleConfig)
} else {
return true
}
}
const handleFormChange = (data: any, formConfig: any) => {
//
if (_isFunction(formConfig?.valueSetter)) {

View File

@ -5,7 +5,7 @@
</div>
<SetterField
class="question-config-form"
label-position="top"
label-position="left"
:form-config-list="formFields"
:module-config="moduleConfig"
@form-change="handleFormChange"
@ -71,4 +71,25 @@ const handleFormChange = ({ key, value }: any) => {
.question-config-form {
padding: 30px 20px 50px 20px;
}
:deep(.group-wrap) {
margin-bottom: 0;
&:not(:last-child) {
margin-bottom: 32px;
}
.group-title {
margin-bottom: 12px;
}
.el-form-item {
margin-bottom: 16px;
.el-radio {
height: initial;
line-height: initial;
margin-bottom: initial;
}
}
}
</style>

View File

@ -5,7 +5,9 @@
<img src="/imgs/icons/success.webp" class="success-img" />
<div class="title-msg" v-safe-html="successText"></div>
</div>
<div class="bottom-btn"></div>
<div v-if="jumpConfig.buttonText && jumpConfig.type === 'button'" class="jump-btn">
{{ jumpConfig.buttonText }}
</div>
</div>
</div>
</template>
@ -17,6 +19,7 @@ interface Props {
}
const props = defineProps<Props>()
const successText = computed(() => props.moduleConfig?.msgContent?.msg_200 || '')
const jumpConfig = computed(() => props.moduleConfig?.jumpConfig || {})
</script>
<style lang="scss" scoped>
/*成功页面跳转全屏展示浮层*/
@ -50,7 +53,18 @@ const successText = computed(() => props.moduleConfig?.msgContent?.msg_200 || ''
font-size: 0.36rem;
}
}
.bottom-btn {
height: 300px;
.jump-btn {
background: var(--primary-color);
width: 90%;
border-radius: 0.08rem;
padding: 0.25rem 0;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.25rem;
font-weight: 500;
margin: 0 auto;
border: none;
}
</style>

View File

@ -1,7 +1,7 @@
export default {
Success: [
{
label: '提示文案',
title: '提示文案',
type: 'RichText',
key: 'msgContent.msg_200',
placeholder: '提交成功',
@ -9,6 +9,46 @@ export default {
labelStyle: {
'font-weight': 'bold'
}
},
{
title: '交卷跳转',
type: 'Customed',
key: 'jumpConfig',
content: [
{
key: 'jumpConfig.type',
type: 'RadioGroup',
value: 'link',
options: [
{
label: '跳转网页',
value: 'link'
},
{
label: '跳转按钮',
value: 'button'
},
],
},
{
key: 'jumpConfig.buttonText',
label: '按钮文案',
type: 'InputSetter',
placeholder: '请输入按钮文案',
value: '',
toggleShowFn: (data) => {
return data?.jumpConfig?.type === 'button'
},
},
{
key: 'jumpConfig.link',
label: '跳转链接',
type: 'InputSetter',
placeholder: '请输入网址',
value: '',
},
]
}
],
OverTime: [

View File

@ -16,13 +16,17 @@
>
重新填写
</router-link>
<a v-if="showJumpButton" :href="jumpConfig.link" class="jump-btn">
{{ jumpConfig.buttonText }}
</a>
</div>
<LogoIcon :logo-conf="logoConf" :readonly="true" />
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { computed, ref, watchEffect } from 'vue'
import { useSurveyStore } from '../stores/survey'
// @ts-ignore
import communalLoader from '@materials/communals/communalLoader.js'
@ -37,6 +41,20 @@ const successMsg = computed(() => {
const msgContent = (surveyStore?.submitConf as any)?.msgContent || {}
return msgContent?.msg_200 || '提交成功'
})
const jumpConfig = computed(() => {
return (surveyStore?.submitConf as any)?.jumpConfig || {}
})
const showJumpButton = ref(false)
watchEffect(() => {
const { jumpConfig } = (surveyStore?.submitConf || {}) as any
if (jumpConfig?.type === 'link' && jumpConfig?.link) {
window.location.href = jumpConfig.link
}
showJumpButton.value = jumpConfig?.type === 'button' && jumpConfig?.buttonText
})
</script>
<style lang="scss" scoped>
@import '@/render/styles/variable.scss';
@ -87,5 +105,20 @@ const successMsg = computed(() => {
text-decoration: underline;
display: block;
}
.jump-btn {
background: var(--primary-color);
width: 90%;
border-radius: 0.08rem;
padding: 0.2rem 0;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.3rem;
font-weight: 500;
margin: 0.5rem auto 0;
border: none;
}
}
</style>

View File

@ -128,6 +128,7 @@ export const useSurveyStore = defineStore('survey', () => {
'pageConf'
])
)
questionStore.questionData = questionData
questionStore.questionSeq = questionSeq
@ -142,6 +143,7 @@ export const useSurveyStore = defineStore('survey', () => {
formValues.value = _formValues
whiteData.value = option.whiteData
pageConf.value = option.pageConf
// 获取已投票数据
questionStore.initVoteData()