That would be illegal. It is a violation of federal law to promise a federal post to someone to help win an election, or, in this case, to secure the nomination for a federal office.
Definitely not the case with the VP candidate. That is at the discretion of the party.
However, since the president is the one who nominates the heads of the various departments, it is entirely at his discretion at the time of the nomination to whom it applies. It is not unusual at all for a candidate to say, “I’ll nominate General XYZ to be head of the DoD.” That’s entirely within their discretion. They don’t have to do so.
At the same time, they don’t have to receive the party’s nomination, either. The party can turn elsewhere.