There's nothing unconstitutional about it. States can allocate electors any way they want. But it's not a good idea unless every state did it.
You're right that every state would have to do it for it to be fair. And since that will never happen, then it's a bad idea.
It could cause a constitutional crisis in a case in which the popular vote were so close that it could reasonably be disputed. This could lead to 50-state recounts (since margin would matter even in states where there was a wide margin of victory for a certain candidate) before individual states could resolve how to assign their electoral votes. And I think it's well outside the spirit of the constitution to effectively have people in other states determining how a state assigns its electoral votes. While a state can use any method it wants (though Democrats were sure not arguing this when the Florida legislature talked about assigning the state's electoral votes to Bush in 2000 regardless of the outcome of the recounts), I think it goes without saying that it should somehow be representative of the people of that state, not 49 other states.
In sum, a terrible idea. California is going off the deep end lately. It's scary what has happened to that state.