| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- Ext.define('school.view.viewport.ViewportModel', {
- extend: 'Ext.app.ViewModel',
- alias: 'viewmodel.viewport',
- data: {
- account: null
- },
- formulas: {
- avatarUrl: function (get) {
- var account = get('account');
- return (account && account.avatarUrl) || 'resources/images/default/user-icon.png'
- }
- },
- stores: {
- store_navigationMenu: {
- autoLoad: true,
- fields: ['text', 'iconCls'],
- proxy: {
- type: 'ajax',
- url: 'resources/json/navigation.json',
- reader: {
- type: 'json'
- }
- }
- },
- store_gradeclass: {
- type: 'tree',
- autoLoad: false,
- // model: 'school.model.Grade',
- fields: [{
- name: 'text'
- }],
- proxy: {
- type: 'ajax',
- // url: 'http://10.1.80.47:9560/grade/read/1',
- url: '/api/school/grade/read/' + school.util.BaseUtil.getCurrentUser().school_id,
- reader: {
- transform: {
- fn: function(data) {
- let grades = data.data.children;
- grades.map(function(s) {
- s._id = s.id;
- s.id = 'grade-' + s.id;
- let classes = s.children;
- let d = classes.map(function(c) {
- c._id = c.id;
- c.id = 'class-' + c.id;
- return c;
- });
- return s;
- });
- return grades;
- },
- scope: this
- }
- }
- },
- root: {
- text: '全年级',
- type: 'SCHOOL',
- expanded: true
- }
- }
- }
- });
|