1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //导出家长信息存储模块
- export default {
- //开启命名空间
- namespaced: true,
- //模块数据
- state: () => ({
- token: uni.getStorageSync('token') || '',//openid和session_key
- parentinfo: JSON.parse(uni.getStorageSync('parentinfo') || '{}'),
- // {
- // avatarUrl: "https://thirdwx.qlogo.cn/mmopen/vi_32/P79Xu1vuLVV1VykYd37lYsjXJxdBuibMlQRz9qSSzFmjEEf80ibISEtmUoxGQvyJ9QYBIicXYca2mX2qOEVBhuOdw/132",
- // city: "",
- // country: "",
- // gender: 0,
- // language: "zh_CN",
- // nickName: "荒川",
- // province: ""
- // }
- parentdetail: {
- phoneNumber: '17882237075',
- name: '家长姓名',
- defaultChild: 'tmdid01',
- childrenList: [{
- avatar: '/static/boy.png',
- name: '张三',
- classid: '0301',
- className: '三年级一班',
- tmdid: 'tmdid01'
- }, {
- avatar: '/static/boy.png',
- name: '张五',
- classid: '0304',
- className: '三年级四班',
- tmdid: 'tmdid02'
- }, {
- avatar: '/static/girl.png',
- name: '张梅',
- classid: '0504',
- className: '五年级四班',
- tmdid: 'tmdid03'
- },
- ]
- },
- }),
- //模块方法(修改数据)
- mutations: {
- //更新用户信息
- updateParentInfo(state, parentinfo) {
- state.parentinfo = parentinfo
- this.commit('m_parent/saveParentInfoToStorage')
- },
- //持久化存储
- saveParentInfoToStorage(state) {
- uni.setStorageSync('parentinfo', JSON.stringify(state.parentinfo))
- },
- //更新家长详细信息
- updateParentDetail(state,parentdetail){
- state.parentdetail = parentdetail
- this.commit('m_parent/saveParentDetailToStorage')
- },
- //持久化存储
- saveParentDetailToStorage(state){
- uni.setStorageSync('parentinfo', JSON.stringify(state.parentdetail))
- },
- //更新token字符串
- updateToken(state, token) {
- state.token = token
- this.commit('m_parent/saveTokenToStorage')
- },
- //token持久化存储
- saveTokenToStorage(state) {
- uni.setStorageSync('token',state.token)
- },
- },
- //模块属性(数据包装)
- getters: {
- }
- }
|