Did Wilde write The Picture of Dorian Gray with the intention to draw a moral out of it?
The answer to your question "No". The reason for it is that, as any Wildean scholar will argue, Wilde's role in the Aesthetic movement, his philosophy on Art, and the staunch believe in Walter Pater'sL'Art pour L'Art(Art for Art's sake) ideal make it basically impossible to imagine Wilde ever exerting a moral code upon anyone who reads, or listens, to his words.
In writingThe Picture of Dorian Gray,Oscar Wilde had absolutely no intention of creating a work that produces any moral or immoral sense in the reader. Instead, Wilde really aimed in producing what he called in his trial "something with a quality of beauty". As he says in the preface of his novel
There is no such thing as a moral, or an immoral book; books are well-written, or badly written.
This statement is much more than just one of Wilde's many epigrams; he is actually stating his posture as one of the leading representatives of the Aesthetic movement in the mid and late Victorian period.
The canon of this movement was quite simple, but very hard for the average, middle-class and inartistic Victorian to understand: that the gift of the artist is not motivated by a need to teach a lesson, or by the want to make a rule; the artist, the writer, the singer, the artistic soul, has one aim and one aim only. This aim is to produce, reproduce, and re-discover beauty. Why can't we just enjoy art instead of trying to learn something from it? Why not let Art just "be"?
Since this is the overall sentiment of Aesthetes, and Wilde leads the pack when it comes to Aestheticism (after his mentor, Walter Pater) it is quite safe to defend the position that Oscar Wilde never had, and never intended to produce, any didactic work using Art as a conduit. It would have simply gone against his principle as a man who, simply, saw things quite differently than the much less gifted people of his time- he called them "Philistines".
As a further evidence of Wilde's choice not to produce morality works, it would very helpful to read H. Montgomery Hyde's published transcripts of the three Trials of Oscar Wilde in 1895-1896. The Picture of Dorian Gray comes greatly under fire during those trials, and Sir Edward Carson, Q.C., MP, Wilde's prosecuting attorney, questions intensely the moral purpose of the novel.
The response that Wilde gives during his trials (recorded on the Montgomery Hyde book) is very clear in that there is no intention whatever in assigning Dorian Gray any kind of moral quality, whether good or bad. Moreover, in his "Art and Morality" essay Wilde writes,
There is not a single real poet or prose-writer of this [XIX]century on whom the British public has not solemnly conferred diplomas of immorality.... Of course, the public is very reckless in the use of the word.... An artist is, of course, not disturbed by it. The true artist is a man who believes absolutely in himself, because he is absolutely himself.
Therefore, any biographer that ever researched Wilde's position on morality will agree in that Wilde considered his immediate society too hypocritical and sanctimonious to even bother with this "morality" they so talk about. Instead, he preached other canons: Hedonism, Aestheticism, and the eternal search for perfect beauty in everything.