diff --git a/admin/src/addon/zhjw/api/feedback.ts b/admin/src/addon/zhjw/api/feedback.ts new file mode 100644 index 00000000..2493a72c --- /dev/null +++ b/admin/src/addon/zhjw/api/feedback.ts @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// USER_CODE_BEGIN -- feedback +/** + * 获取意见反馈列表 + * @param params + * @returns + */ +export function getFeedbackList(params: Record) { + return request.get(`zhjw/feedback`, {params}) +} + +/** + * 获取意见反馈详情 + * @param id 意见反馈id + * @returns + */ +export function getFeedbackInfo(id: number) { + return request.get(`zhjw/feedback/${id}`); +} + +/** + * 添加意见反馈 + * @param params + * @returns + */ +export function addFeedback(params: Record) { + return request.post('zhjw/feedback', params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 编辑意见反馈 + * @param id + * @param params + * @returns + */ +export function editFeedback(params: Record) { + return request.put(`zhjw/feedback/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 删除意见反馈 + * @param id + * @returns + */ +export function deleteFeedback(id: number) { + return request.delete(`zhjw/feedback/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithStudentsList(params: Record){ + return request.get('zhjw/students_all', {params}) +} + +// USER_CODE_END -- feedback diff --git a/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback.json b/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback.json new file mode 100644 index 00000000..ac6fb243 --- /dev/null +++ b/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback.json @@ -0,0 +1,11 @@ +{ + "studentsId":"学员", + "studentsIdPlaceholder":"全部", + "content":"反馈内容", + "mailbox":"邮箱", + "addFeedback":"添加意见反馈", + "updateFeedback":"编辑意见反馈", + "feedbackDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback_edit.json b/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback_edit.json new file mode 100644 index 00000000..d81f284f --- /dev/null +++ b/admin/src/addon/zhjw/lang/zh-cn/feedback.feedback_edit.json @@ -0,0 +1,13 @@ +{ + "studentsId":"学员", + "content":"反馈内容", + "images":"图片", + "mailbox":"邮箱", + "studentsIdPlaceholder":"请输入学员", + "contentPlaceholder":"请输入反馈内容", + "imagesPlaceholder":"请上传图片", + "mailboxPlaceholder":"请输入邮箱", + "addFeedback":"添加意见反馈", + "updateFeedback":"编辑意见反馈", + "feedbackDeleteTips":"确定要删除该意见反馈吗?" +} \ No newline at end of file diff --git a/admin/src/addon/zhjw/views/feedback/feedback.vue b/admin/src/addon/zhjw/views/feedback/feedback.vue new file mode 100644 index 00000000..86f08122 --- /dev/null +++ b/admin/src/addon/zhjw/views/feedback/feedback.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/admin/src/addon/zhjw/views/feedback/feedback_edit.vue b/admin/src/addon/zhjw/views/feedback/feedback_edit.vue new file mode 100644 index 00000000..0afbc931 --- /dev/null +++ b/admin/src/addon/zhjw/views/feedback/feedback_edit.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/niucloud/addon/zhjw/admin/api/feedback.ts b/niucloud/addon/zhjw/admin/api/feedback.ts new file mode 100644 index 00000000..2493a72c --- /dev/null +++ b/niucloud/addon/zhjw/admin/api/feedback.ts @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// USER_CODE_BEGIN -- feedback +/** + * 获取意见反馈列表 + * @param params + * @returns + */ +export function getFeedbackList(params: Record) { + return request.get(`zhjw/feedback`, {params}) +} + +/** + * 获取意见反馈详情 + * @param id 意见反馈id + * @returns + */ +export function getFeedbackInfo(id: number) { + return request.get(`zhjw/feedback/${id}`); +} + +/** + * 添加意见反馈 + * @param params + * @returns + */ +export function addFeedback(params: Record) { + return request.post('zhjw/feedback', params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 编辑意见反馈 + * @param id + * @param params + * @returns + */ +export function editFeedback(params: Record) { + return request.put(`zhjw/feedback/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) +} + +/** + * 删除意见反馈 + * @param id + * @returns + */ +export function deleteFeedback(id: number) { + return request.delete(`zhjw/feedback/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +} + +export function getWithStudentsList(params: Record){ + return request.get('zhjw/students_all', {params}) +} + +// USER_CODE_END -- feedback diff --git a/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback.json b/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback.json new file mode 100644 index 00000000..ac6fb243 --- /dev/null +++ b/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback.json @@ -0,0 +1,11 @@ +{ + "studentsId":"学员", + "studentsIdPlaceholder":"全部", + "content":"反馈内容", + "mailbox":"邮箱", + "addFeedback":"添加意见反馈", + "updateFeedback":"编辑意见反馈", + "feedbackDeleteTips":"确定要删除该数据吗?", + "startDate":"请选择开始时间", + "endDate":"请选择结束时间" +} \ No newline at end of file diff --git a/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback_edit.json b/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback_edit.json new file mode 100644 index 00000000..d81f284f --- /dev/null +++ b/niucloud/addon/zhjw/admin/lang/zh-cn/feedback.feedback_edit.json @@ -0,0 +1,13 @@ +{ + "studentsId":"学员", + "content":"反馈内容", + "images":"图片", + "mailbox":"邮箱", + "studentsIdPlaceholder":"请输入学员", + "contentPlaceholder":"请输入反馈内容", + "imagesPlaceholder":"请上传图片", + "mailboxPlaceholder":"请输入邮箱", + "addFeedback":"添加意见反馈", + "updateFeedback":"编辑意见反馈", + "feedbackDeleteTips":"确定要删除该意见反馈吗?" +} \ No newline at end of file diff --git a/niucloud/addon/zhjw/admin/views/feedback/feedback.vue b/niucloud/addon/zhjw/admin/views/feedback/feedback.vue new file mode 100644 index 00000000..86f08122 --- /dev/null +++ b/niucloud/addon/zhjw/admin/views/feedback/feedback.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/niucloud/addon/zhjw/admin/views/feedback/feedback_edit.vue b/niucloud/addon/zhjw/admin/views/feedback/feedback_edit.vue new file mode 100644 index 00000000..e2876633 --- /dev/null +++ b/niucloud/addon/zhjw/admin/views/feedback/feedback_edit.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/niucloud/addon/zhjw/app/adminapi/controller/feedback/Feedback.php b/niucloud/addon/zhjw/app/adminapi/controller/feedback/Feedback.php new file mode 100644 index 00000000..dcb6ac22 --- /dev/null +++ b/niucloud/addon/zhjw/app/adminapi/controller/feedback/Feedback.php @@ -0,0 +1,95 @@ +request->params([ + ["students_id",""] + ]); + return success((new FeedbackService())->getPage($data)); + } + + /** + * 意见反馈详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id){ + return success((new FeedbackService())->getInfo($id)); + } + + /** + * 添加意见反馈 + * @return \think\Response + */ + public function add(){ + $data = $this->request->params([ + ["students_id",0], + ["content",""], + ["images",""], + ["mailbox",""], + + ]); + $this->validate($data, 'addon\zhjw\app\validate\feedback\Feedback.add'); + $id = (new FeedbackService())->add($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 意见反馈编辑 + * @param $id 意见反馈id + * @return \think\Response + */ + public function edit(int $id){ + $data = $this->request->params([ + ["students_id",0], + ["content",""], + ["images",""], + ["mailbox",""], + + ]); + $this->validate($data, 'addon\zhjw\app\validate\feedback\Feedback.edit'); + (new FeedbackService())->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 意见反馈删除 + * @param $id 意见反馈id + * @return \think\Response + */ + public function del(int $id){ + (new FeedbackService())->del($id); + return success('DELETE_SUCCESS'); + } + + + public function getStudentsAll(){ + return success(( new FeedbackService())->getStudentsAll()); + } + +} diff --git a/niucloud/addon/zhjw/app/model/feedback/Feedback.php b/niucloud/addon/zhjw/app/model/feedback/Feedback.php new file mode 100644 index 00000000..47d41719 --- /dev/null +++ b/niucloud/addon/zhjw/app/model/feedback/Feedback.php @@ -0,0 +1,76 @@ +where("students_id", $value); + } + } + + + + + + + public function students(){ + return $this->hasOne(Students::class, 'id', 'students_id')->joinType('left')->withField('name,id')->bind(['students_id_name'=>'name']); + } + +} diff --git a/niucloud/addon/zhjw/app/service/admin/feedback/FeedbackService.php b/niucloud/addon/zhjw/app/service/admin/feedback/FeedbackService.php new file mode 100644 index 00000000..dcaea97c --- /dev/null +++ b/niucloud/addon/zhjw/app/service/admin/feedback/FeedbackService.php @@ -0,0 +1,105 @@ +model = new Feedback(); + } + + /** + * 获取意见反馈列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 'id,students_id,content,images,mailbox,create_time,is_deleted'; + $order = 'id desc'; + + $search_model = $this->model->withSearch(["students_id"], $where)->with(['students'])->field($field)->order($order); + $list = $this->pageQuery($search_model); + return $list; + } + + /** + * 获取意见反馈信息 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $field = 'id,students_id,content,images,mailbox,create_time,is_deleted'; + + $info = $this->model->field($field)->where([['id', "=", $id]])->with(['students'])->findOrEmpty()->toArray(); + return $info; + } + + /** + * 添加意见反馈 + * @param array $data + * @return mixed + */ + public function add(array $data) + { + $res = $this->model->create($data); + return $res->id; + + } + + /** + * 意见反馈编辑 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + + $this->model->where([['id', '=', $id]])->update($data); + return true; + } + + /** + * 删除意见反馈 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $model = $this->model->where([['id', '=', $id]])->find(); + $res = $model->delete(); + return $res; + } + + + public function getStudentsAll(){ + $studentsModel = new Students(); + return $studentsModel->select()->toArray(); + } + + +} diff --git a/niucloud/addon/zhjw/app/validate/feedback/Feedback.php b/niucloud/addon/zhjw/app/validate/feedback/Feedback.php new file mode 100644 index 00000000..537415ed --- /dev/null +++ b/niucloud/addon/zhjw/app/validate/feedback/Feedback.php @@ -0,0 +1,37 @@ + 'require', + 'content' => 'require', + ]; + + protected $message = [ + 'students_id.require' => ['common_validate.require', ['students_id']], + 'content.require' => ['common_validate.require', ['content']], + ]; + + protected $scene = [ + "add" => ['students_id', 'content', 'images', 'mailbox'], + "edit" => ['students_id', 'content', 'images', 'mailbox'] + ]; + +}