Browse Source

add store

KaysonCui 5 years ago
parent
commit
6667387061

+ 21 - 0
front/project/www/stores/common.js

@@ -0,0 +1,21 @@
+import BaseStore from '@src/stores/base';
+
+export default class CommonStore extends BaseStore {
+  /**
+   * 发送短信验证码
+   * @param {*} mobile 手机号
+   */
+  sendSms(mobile) {
+    return this.apiPost('/common/sms/valid', { mobile });
+  }
+
+  /**
+   * 上传至本地服务器
+   * @param {*} file 图片文件
+   */
+  upload(file) {
+    return this.apiForm('/common/upload/image', { file });
+  }
+}
+
+export const Common = new CommonStore({ key: 'common' });

+ 40 - 0
front/project/www/stores/main.js

@@ -0,0 +1,40 @@
+import BaseStore from '@src/stores/base';
+
+export default class MainStore extends BaseStore {
+  /**
+   * 获取首页配置
+   */
+  getIndex() {
+    return this.apiGet('/base/index');
+  }
+
+  /**
+   * 获取广告列表
+   */
+  getAd() {
+    return this.apiGet('/base/ad');
+  }
+
+  /**
+   * 获取考分排行信息
+   */
+  getScore(total, quant) {
+    return this.apiGet('/base/score', { total, quant });
+  }
+
+  /**
+   * 所有练习层级
+   */
+  getExercise() {
+    return this.apiGet('/exercise/struct');
+  }
+
+  /**
+   * 所有模考层级
+   */
+  getExamination() {
+    return this.apiGet('/examination/struct');
+  }
+}
+
+export const Main = new MainStore({ key: 'main' });

+ 151 - 0
front/project/www/stores/my.js

@@ -0,0 +1,151 @@
+import BaseStore from '@src/stores/base';
+
+export default class MyStore extends BaseStore {
+  /**
+   * 绑定邮箱
+   * @param {*} email 邮箱
+   */
+  bindEmail(email) {
+    return this.apiPost('/auth/email', { email });
+  }
+
+  /**
+   * 修改用户信息
+   * @param {*} info  nickname avatar
+   */
+  editInfo(info) {
+    return this.apiPost('/auth/info', { ...info });
+  }
+
+  /**
+   * 实名认证
+   * @param {*} file
+   */
+  real(file) {
+    return this.apiForm('/auth/real', { file });
+  }
+
+  /**
+   * 用户站内信
+   * @param {*} page
+   * @param {*} size
+   * @param {*} type
+   * @param {*} read
+   */
+  message(page, size, type, read) {
+    return this.apiGet('/auth/message', { page, size, type, read });
+  }
+
+  /**
+   * 读取用户消息/全部
+   */
+  readAllMessage() {
+    return this.apiPut('/auth/message/read');
+  }
+
+  /**
+   * 修改备考信息
+   * @param {*} info prepareStatus: 身份  prepareGoal: 目标分数 prepareExaminationTime: 考试时间 prepareScoreTime: 出分时间
+   */
+  editPrepare(info) {
+    return this.apiPut('/auth/prepare', { ...info });
+  }
+
+  /**
+   * 获取备考信息
+   */
+  getPrepare() {
+    return this.apiGet('/auth/prepare');
+  }
+
+  /**
+   * 获取学习记录
+   * @param {*} date 时间
+   */
+  getStudy(date) {
+    return this.apiGet('/auth/study', { date });
+  }
+
+  /**
+   * 添加收藏
+   * @param {*} questionNoId
+   */
+  addCollect(questionNoId) {
+    return this.apiPut('/auth/collect', { questionNoId });
+  }
+
+  /**
+   * 删除收藏
+   * @param {*} questionNoId
+   */
+  delCollect(questionNoId) {
+    return this.apiDel('/auth/collect', { id: questionNoId });
+  }
+
+  /**
+   * 获取收藏题目列表
+   * @param {*} module
+   * @param {*} type
+   * @param {*} page
+   * @param {*} size
+   * @param {*} startTime
+   * @param {*} endTime
+   * @param {*} order
+   * @param {*} direction
+   */
+  listCollect(module, type, page, size, startTime, endTime, order, direction) {
+    return this.apiGet('/auth/collect/question', { module, type, page, size, startTime, endTime, order, direction });
+  }
+
+  /**
+   * 获取错题列表
+   * @param {*} module
+   * @param {*} type
+   * @param {*} page
+   * @param {*} size
+   */
+  listError(module, type, page, size) {
+    return this.apiGet('/auth/error/list', { module, type, page, size });
+  }
+
+  /**
+   * 更新笔记
+   * @param {*} questionNoId
+   * @param {*} content
+   */
+  updateNote(questionNoId, content) {
+    return this.apiPut('/auth/note', { questionNoId, content });
+  }
+
+  /**
+   * 获取笔记列表
+   * @param {*} module
+   * @param {*} type
+   * @param {*} page
+   * @param {*} size
+   * @param {*} startTime
+   * @param {*} endTime
+   * @param {*} order
+   * @param {*} direction
+   */
+  noteList(module, type, page, size, startTime, endTime, order, direction) {
+    return this.apiGet('/auth/note/list', { module, type, page, size, startTime, endTime, order, direction });
+  }
+
+  /**
+   * 获取报告列表
+   * @param {*} module
+   * @param {*} type
+   * @param {*} page
+   * @param {*} size
+   * @param {*} startTime
+   * @param {*} endTime
+   * @param {*} order
+   * @param {*} direction
+   */
+  reportList(module, type, page, size, startTime, endTime, order, direction) {
+    return this.apiGet('/auth/report/list', { module, type, page, size, startTime, endTime, order, direction });
+  }
+}
+
+export const My = new MyStore({ key: 'my' });

+ 100 - 0
front/project/www/stores/question.js

@@ -0,0 +1,100 @@
+import BaseStore from '@src/stores/base';
+
+export default class QuestionStore extends BaseStore {
+  /**
+   * 获取课程进度
+   */
+  getClassProcess() {
+    return this.apiGet('/question/class/process');
+  }
+
+  /**
+   * 获取预习作业列表
+   * @param {*} page
+   * @param {*} size
+   * @param {*} category
+   * @param {*} endTime
+   * @param {*} finish
+   */
+  listPreview(page, size, category, endTime, finish) {
+    return this.apiGet('/question/preview/list', { page, size, category, endTime, finish });
+  }
+
+  /**
+   * 练习进度
+   * @param {*} page
+   * @param {*} size
+   */
+  getExerciseProcess(page, size) {
+    return this.apiGet('/question/exercise/process', { page, size });
+  }
+
+  /**
+   * 练习组卷
+   * @param {*} page
+   * @param {*} size
+   */
+  getExercisePaper(page, size) {
+    return this.apiGet('/question/exercise/paper', { page, size });
+  }
+
+  /**
+   * 模考进度
+   * @param {*} page
+   * @param {*} size
+   */
+  getExaminationProcess(page, size) {
+    return this.apiGet('/question/examination/process', { page, size });
+  }
+
+  /**
+   * 模考组卷
+   * @param {*} page
+   * @param {*} size
+   */
+  getExaminationPaper(page, size) {
+    return this.apiGet('/question/examination/paper', { page, size });
+  }
+
+  /**
+   * 获取题目详情
+   * @param {*} questionNoId
+   */
+  getDetail(questionNoId) {
+    return this.apiGet('/question/detail', { questionNoId });
+  }
+
+  /**
+   * 开始考试
+   * @param {*} paperId
+   */
+  start(paperId) {
+    return this.apiPost('/question/start', { paperId });
+  }
+
+  /**
+   * 下一题
+   * @param {*} reportId
+   */
+  next(reportId) {
+    return this.apiPost('/question/next', { reportId });
+  }
+
+  /**
+   * 提交题目答案
+   * @param {*} questionNoId
+   */
+  submit(questionNoId) {
+    return this.apiPost('/question/submit', { questionNoId });
+  }
+
+  /**
+   * 完成考试
+   * @param {*} paperId
+   */
+  finish(paperId) {
+    return this.apiPost('/question/finish', { paperId });
+  }
+}
+
+export const Question = new QuestionStore({ key: 'question' });

+ 85 - 0
front/project/www/stores/sentence.js

@@ -0,0 +1,85 @@
+import BaseStore from '@src/stores/base';
+
+export default class SentenceStore extends BaseStore {
+  /**
+   * 所有长难句信息
+   */
+  getInfo() {
+    return this.apiGet('/sentence/info');
+  }
+
+  /**
+   * 激活长难句
+   * @param {*} code
+   */
+  active(code) {
+    return this.apiPut('/sentence/active', { code });
+  }
+
+  /**
+   * 文章列表
+   * @param {*} chapter
+   */
+  listArticle(chapter) {
+    return this.apiGet('/sentence/article/list', { chapter });
+  }
+
+  /**
+   * 更新长难句文章进度
+   * @param {*} chapter
+   * @param {*} part
+   * @param {*} process
+   */
+  updateProcess(chapter, part, process) {
+    return this.apiPut('/sentence/article/process', { chapter, part, process });
+  }
+
+  /**
+   * 长难句组卷列表
+   */
+  listPaper() {
+    return this.apiGet('/sentence/paper/list');
+  }
+
+  /**
+   * 获取题目详情
+   * @param {*} questionNoId
+   */
+  detail(questionNoId) {
+    return this.apiGet('/sentence/question/detail', { questionNoId });
+  }
+
+  /**
+   * 开始做题
+   * @param {*} paperId
+   */
+  start(paperId) {
+    return this.apiPost('/sentence/paper/start', { paperId });
+  }
+
+  /**
+   * 获取下一题
+   * @param {*} reportId
+   */
+  next(reportId) {
+    return this.apiPost('/sentence/paper/next', { reportId });
+  }
+
+  /**
+   * 提交题目答案
+   * @param {*} questionNoId
+   */
+  submit(questionNoId) {
+    return this.apiPost('//sentence/paper/submit', { questionNoId });
+  }
+
+  /**
+   * 完成考试
+   * @param {*} paperId
+   */
+  finish(paperId) {
+    return this.apiPost('/qu/sentence/paperstion/finish', { paperId });
+  }
+}
+
+export const Sentence = new SentenceStore({ key: 'sentence' });

+ 58 - 1
front/project/www/stores/user.js

@@ -1,5 +1,62 @@
 import BaseStore from '@src/stores/base';
 
-export default class UserStore extends BaseStore {}
+export default class UserStore extends BaseStore {
+  /**
+   * 验证token
+   */
+  token() {
+    return this.apiPost('/auth/token');
+  }
+
+  /**
+   * 登陆
+   * @param {*} mobile 手机号
+   * @param {*} mobileVerifyCode 手机验证码
+   * @param {*} inviteCode 邀请人手机/邀请码
+   */
+  login(mobile, mobileVerifyCode, inviteCode) {
+    return this.apiPost('/auth/login', { mobile, mobileVerifyCode, inviteCode });
+  }
+
+  loginWechat(code) {
+    return this.apiGet('/auth/wechat', { code });
+  }
+
+  loginWechatPC(code) {
+    return this.apiGet('/auth/wechat_pc', { code });
+  }
+
+  /**
+   * 登出
+   */
+  logout() {
+    return this.apiPost('/auth/logout');
+  }
+
+  /**
+   * 绑定手机
+   * @param {*} mobile 手机号
+   * @param {*} mobileVerifyCode 手机验证码
+   * @param {*} inviteCode 邀请人手机/邀请码
+   */
+  bind(mobile, mobileVerifyCode, inviteCode) {
+    return this.apiPost('/auth/bind', { mobile, mobileVerifyCode, inviteCode });
+  }
+
+  /**
+   * 查询邀请码对应账号
+   * @param {*} code 邀请码
+   */
+  validInviteCode(code) {
+    return this.apiGet('/auth/valid/invite_code', { code });
+  }
+
+  /**
+   * 查询手机对应账号
+   */
+  validMobile(mobile) {
+    return this.apiGet('/auth/valid/mobile', { mobile });
+  }
+}
 
 export const User = new UserStore({ key: 'user' });

+ 3 - 3
server/gradlew

@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
 
-warn ( ) {
+warn () {
     echo "$*"
 }
 
-die ( ) {
+die () {
     echo
     echo "$*"
     echo
@@ -155,7 +155,7 @@ if $cygwin ; then
 fi
 
 # Escape application args
-save ( ) {
+save () {
     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
     echo " "
 }