From 4d88a33856f43064f33cc2ca22a1af9793106bc9 Mon Sep 17 00:00:00 2001 From: Realabiha <48506355+Realabiha@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:17:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=97=AE=E5=8D=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B1=BB=E5=9E=8B=E5=92=8C=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AD=9B=E9=80=89=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++ server/package.json | 2 - server/src/apps/surveyManage/index.ts | 2 +- server/src/apps/user/index.ts | 7 +- .../src/apps/user/service/captchaService.ts | 2 - server/src/apps/user/utils/index.ts | 1 - server/src/index.ts | 1 - .../pages/list/components/baseList.vue | 73 ++++++++++++++++--- .../pages/list/components/textButton.vue | 57 +++++++++++++++ .../pages/list/components/textSelect.vue | 59 +++++++++++++++ web/src/management/pages/list/config/index.js | 63 ++++++++++++++++ 11 files changed, 254 insertions(+), 20 deletions(-) create mode 100644 web/src/management/pages/list/components/textButton.vue create mode 100644 web/src/management/pages/list/components/textSelect.vue diff --git a/README.md b/README.md index 88e5f979..680f45e1 100644 --- a/README.md +++ b/README.md @@ -183,3 +183,10 @@ npm run serve ## QQ [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=P61UJI_q8AzizyBLGOm-bUvzNrUnSQq-&authKey=yZFtL9biGB5yiIME3%2Bi%2Bf6XMOdTNiuf0pCIaviEEAIryySNzVy6LJ4xl7uHdEcrM&noverify=0&group_code=920623419) + +# Feature +[官方Feature](https://github.com/didi/xiaoju-survey/issues/45) + +# CHANGELOG +[MAJOR CHANGELOG](https://github.com/didi/xiaoju-survey/issues/48) + diff --git a/server/package.json b/server/package.json index 50b166ee..d0b5c031 100644 --- a/server/package.json +++ b/server/package.json @@ -19,7 +19,6 @@ "@types/koa-bodyparser": "^4.3.10", "@types/koa-router": "^7.4.4", "@types/koa-static": "^4.0.4", - "@types/node": "^20.10.8", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", "cross-env": "^7.0.3", @@ -33,7 +32,6 @@ "dependencies": { "cheerio": "^1.0.0-rc.12", "crypto-js": "^4.2.0", - "dotenv": "^16.3.1", "glob": "^10.3.10", "joi": "^17.9.2", "jsonwebtoken": "^9.0.1", diff --git a/server/src/apps/surveyManage/index.ts b/server/src/apps/surveyManage/index.ts index 4ec3a54b..8fcd5fc2 100644 --- a/server/src/apps/surveyManage/index.ts +++ b/server/src/apps/surveyManage/index.ts @@ -141,7 +141,7 @@ export default class SurveyManage { } private getFilter(filterList: Array) { - const allowFilterField = ['title', 'remark', 'surveyType', 'curStatus.status']; + const allowFilterField = ['title', 'remark', 'questionType', 'curStatus.status']; return filterList.reduce((preItem, curItem) => { const condition = curItem.condition.filter(item => allowFilterField.includes(item.field)).reduce((pre, cur) => { switch(cur.comparator) { diff --git a/server/src/apps/user/index.ts b/server/src/apps/user/index.ts index 3a67e597..0c133b85 100644 --- a/server/src/apps/user/index.ts +++ b/server/src/apps/user/index.ts @@ -1,15 +1,16 @@ - import { SurveyApp, SurveyServer } from '../../decorator'; +import { Request, Response } from 'koa'; import * as Joi from 'joi'; import { userService } from './service/userService'; import { captchaService } from './service/captchaService'; import { getValidateValue } from './utils/index'; + import { CommonError } from '../../types/index'; @SurveyApp('/api/user') export default class User { @SurveyServer({ type: 'http', method: 'post', routerName: '/register' }) - async register({ req }) { + async register({ req }: { req: Request, res: Response }) { const userInfo = getValidateValue(Joi.object({ username: Joi.string().required(), password: Joi.string().required(), @@ -33,7 +34,7 @@ export default class User { } @SurveyServer({ type: 'http', method: 'post', routerName: '/login' }) - async login({ req }) { + async login({ req }: { req: Request, res: Response }) { const userInfo = getValidateValue(Joi.object({ username: Joi.string().required(), password: Joi.string().required(), diff --git a/server/src/apps/user/service/captchaService.ts b/server/src/apps/user/service/captchaService.ts index e7db4e96..75599fc5 100644 --- a/server/src/apps/user/service/captchaService.ts +++ b/server/src/apps/user/service/captchaService.ts @@ -1,6 +1,5 @@ import { mongo } from '../db/mongo'; import { create } from 'svg-captcha'; - class CaptchaService { createCaptcha() { @@ -39,4 +38,3 @@ class CaptchaService { } export const captchaService = new CaptchaService(); - diff --git a/server/src/apps/user/utils/index.ts b/server/src/apps/user/utils/index.ts index 4cf47b97..8233dbca 100644 --- a/server/src/apps/user/utils/index.ts +++ b/server/src/apps/user/utils/index.ts @@ -7,7 +7,6 @@ export function getStatusObject({ status }: { status: SURVEY_STATUS }) { date: Date.now(), }; } - export function getValidateValue(validationResult: Joi.ValidationResult): T { if (validationResult.error) { throw new CommonError(validationResult.error.details.map(e => e.message).join()); diff --git a/server/src/index.ts b/server/src/index.ts index a3c505ca..0331d2cc 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -1,4 +1,3 @@ -import 'dotenv/config'; import * as os from 'os'; import * as Koa from 'koa'; import * as KoaBodyparser from 'koa-bodyparser'; diff --git a/web/src/management/pages/list/components/baseList.vue b/web/src/management/pages/list/components/baseList.vue index eec22256..0786a2cf 100644 --- a/web/src/management/pages/list/components/baseList.vue +++ b/web/src/management/pages/list/components/baseList.vue @@ -1,11 +1,20 @@