// 该文件用于创建store实例 import { action, observable } from 'mobx-miniprogram' export const store = observable({ // 数据字段 userInfo: {}, // 阅读结果 readDetail: {}, //pk数据,包括被pk人的身份信息与录音得分 pkData: {}, // 计算属性 get androidMaskFun() { return !this.userInfo.uid }, // actions setUser: action(function (step) { let grade = step.grade var gradeObj = { "PRIMARY_FIRST_GRADE": "一年级", "PRIMARY_SECOND_GRADE": "二年级", "PRIMARY_THREE_GRADE": "三年级", "PRIMARY_SENIOR_GRADE": "四年级", "PRIMARY_FIVE_GRADE":"五年级", "PRIMARY_SIX_GRADE":"六年级", "PRESCHOOL": "学前班", } step.gradeName = grade ? gradeObj[grade] : '请选择' this.userInfo = step }, ), setReadDetail: action(function (detail) { this.readDetail = detail }), setPkData: action(function (data) { this.pkData = data }) })