import urlAlias from '../url' import request from '../request' const { mylovelist, myloveadd, myloveupdate, } = urlAlias const state = { loveList: [], } const mutations = { INIT: (state, data) => { state.loveList = data }, // 更新关心人验光单 UPDATE: (state, data) => { // state.loveList.push(data) // console.log('UPDATA=====>',data) }, } const actions = { getLoveList({ commit }, param) { request({ url: mylovelist, data: param, success: (res) => { // console.log(res.data); commit('INIT', res.data.data.list) }, }) }, addMylove({ commit }, param) { // console.log('myloveupdate-parm====>', param) return new Promise((resolve) => request({ url: myloveadd, data: param, success: (res) => { console.log('addMylove-parm====>', param) // console.log(res.data) resolve(res.data) // commit("ADD", args); }, })) }, updateMylove({ commit }, param) { request({ url: myloveupdate, data: param, success: (res) => { console.log('myloveupdate-parm====>', param) // console.log(res) // commit("UPDATE", param); }, }) }, } export default { namespaced: true, state, mutations, actions, }