index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div
  3. :class="mobile ? 'mobileMain' : ''"
  4. :style="{
  5. marginTop: mainMarginTop,
  6. marginBottom: mobile ? '0px' : '30px !important'
  7. }"
  8. >
  9. <div class="requirements-container" v-if="!mobile">
  10. <div class="requirements-title">发布需求</div>
  11. <div class="requirements-tips">
  12. 程序员客栈拥有
  13. <span
  14. ><b>{{ developer_number }}</b
  15. >个</span
  16. >
  17. 互联网人才,成功完成了
  18. <span
  19. ><b>{{ project_number }}</b
  20. >个</span
  21. >
  22. 项目,请放心发布您的需求!
  23. </div>
  24. <div class="requirements-step-container">
  25. <div class="requirements-step">
  26. <div class="requirements-step-status">
  27. <div class="requirements-step-icon" :class="FirstStepStatus">
  28. <div class="requirements-step-tips">
  29. 选择需求类型
  30. </div>
  31. </div>
  32. </div>
  33. <div class="requirements-step-line" :class="FirstStepStatus"></div>
  34. </div>
  35. <div class="requirements-step">
  36. <div class="requirements-step-status">
  37. <div class="requirements-step-icon" :class="secondStepStatus">
  38. <div class="requirements-step-tips">
  39. 填写需求描述
  40. </div>
  41. </div>
  42. </div>
  43. <div class="requirements-step-line" :class="secondStepStatus"></div>
  44. </div>
  45. <div class="requirements-step">
  46. <div class="requirements-step-status">
  47. <div class="requirements-step-icon" :class="thirdStepStatus">
  48. <div class="requirements-step-tips">
  49. 发布成功
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <FormFirstStep
  56. v-if="isFirstFormShow"
  57. v-on:formSubmit="formSubmit"
  58. v-on:formChange="formChange"
  59. ></FormFirstStep>
  60. <FormXuQiu
  61. v-if="isFormXuqiuShow"
  62. v-on:formChange="formChange"
  63. v-on:formSubmit="formSubmit"
  64. ></FormXuQiu>
  65. <FormZhengBao
  66. v-if="isFormZhengBaoShow"
  67. v-on:formChange="formChange"
  68. v-on:formSubmit="formSubmit"
  69. ></FormZhengBao>
  70. <FormYunDuan
  71. v-if="isFormYunDuanShow"
  72. v-on:formChange="formChange"
  73. v-on:formSubmit="formSubmit"
  74. ></FormYunDuan>
  75. <StepEnd v-if="isStepEndShow"></StepEnd>
  76. <FormRecommend ref="FormRecommend" :projectid="projectid"></FormRecommend>
  77. </div>
  78. </div>
  79. </template>
  80. <script>
  81. import { mapState } from "vuex";
  82. import qs from "qs";
  83. import FormFirstStep from "./components/FormFirstStep.vue";
  84. // 发布需求梳理表单
  85. import FormXuQiu from "./components/Form_xuqiu.vue";
  86. // 发布整包表单
  87. import FormZhengBao from "./components/Form_zhengbao";
  88. // 发布云端项目
  89. import FormYunDuan from "./components/Form_yunduan";
  90. import FormRecommend from "./components/Form_recommend.vue";
  91. // 发布成功页
  92. import StepEnd from "./components/StepEnd.vue";
  93. export default {
  94. name: "SeoLearnList",
  95. components: {
  96. FormFirstStep,
  97. FormXuQiu,
  98. FormZhengBao,
  99. FormYunDuan,
  100. StepEnd,
  101. FormRecommend
  102. },
  103. data() {
  104. return {
  105. baseUrl: "",
  106. mobile: false,
  107. // firstLoad: true,
  108. isWeixinApp: true,
  109. // 0 默认 1云端工作 2 项目整包 3 需求梳理
  110. type: 0,
  111. // 当前激活的状态
  112. active: 1,
  113. // wait process finish
  114. activeStatus: "wait",
  115. projectid: "",
  116. developer_number: 0,
  117. project_number: 0
  118. };
  119. },
  120. async asyncData({ route, $axios }) {
  121. let active;
  122. if (route.query.step) {
  123. active = Number(route.query.step);
  124. console.log(active, 2222);
  125. } else {
  126. active = 1;
  127. }
  128. let countResult = await $axios.$post("/api/index/count");
  129. let developer_number = 0;
  130. let project_number = 0;
  131. if (countResult.status === 1) {
  132. developer_number = countResult.data.developer_number;
  133. project_number = countResult.data.project_number;
  134. }
  135. return {
  136. active,
  137. developer_number,
  138. project_number
  139. };
  140. },
  141. head() {
  142. const {
  143. title = "项目外包_方案定制_专业服务众包平台-【程序员客栈项目开发】-程序员客栈",
  144. keyword = "众包,众包平台,众包网站,软件外包,软件众包平台,项目外包,兼职,兼职平台,软件开发,APP开发,小程序开发,微信小程序开发,网站建设,游戏开发,微信开发,移动应用开发,行业解决方案,创意设计,LOGO设计,动画动漫,影视制作,工业设计,技术服务,短期驻场,IT运维,测试服务,入驻赚钱,外包线索",
  145. description = "程序员客栈项目开发服务,为科技企业提供技术新⼈⼒解决⽅案,为程序员提供各式⼯作成⻓机会。",
  146. h1 = "",
  147. canonical = "",
  148. metaLocation
  149. } = this.head || {};
  150. let obj = {
  151. title: title,
  152. meta: [
  153. {
  154. name: "keywords",
  155. content: keyword
  156. },
  157. {
  158. name: "description",
  159. content: description
  160. },
  161. {
  162. name: "h1",
  163. content: h1
  164. }
  165. ],
  166. link: [
  167. {
  168. rel: "canonical",
  169. href: canonical
  170. }
  171. ]
  172. };
  173. if (metaLocation) {
  174. obj.meta.push({
  175. name: "location",
  176. content: metaLocation
  177. });
  178. }
  179. return obj;
  180. },
  181. computed: {
  182. ...mapState(["deviceType"]),
  183. showWxHeader() {
  184. return (
  185. !this.deviceType.app &&
  186. !this.isWeixinApp &&
  187. (this.deviceType.android || this.deviceType.ios)
  188. );
  189. },
  190. mainMarginTop() {
  191. if (this.mobile && this.showWxHeader) {
  192. return "64px !important";
  193. } else if (this.mobile) {
  194. return "0px !important";
  195. } else {
  196. return "20px !important";
  197. }
  198. },
  199. FirstStepStatus: function() {
  200. let status = "";
  201. switch (this.active) {
  202. case 1:
  203. status = this.activeStatus;
  204. break;
  205. case 2:
  206. status = "success";
  207. break;
  208. case 3:
  209. status = "success";
  210. break;
  211. default:
  212. status = "wait";
  213. }
  214. return status;
  215. },
  216. secondStepStatus: function() {
  217. let status = "";
  218. switch (this.active) {
  219. case 1:
  220. status = "wait";
  221. break;
  222. case 2:
  223. status = this.activeStatus;
  224. break;
  225. case 3:
  226. status = "success";
  227. break;
  228. default:
  229. status = "wait";
  230. }
  231. return status;
  232. },
  233. thirdStepStatus: function() {
  234. let status = "";
  235. switch (this.active) {
  236. case 1:
  237. status = "wait";
  238. break;
  239. case 2:
  240. status = "wait";
  241. break;
  242. case 3:
  243. status = "success";
  244. break;
  245. default:
  246. status = "wait";
  247. }
  248. return status;
  249. },
  250. isFirstFormShow: function() {
  251. return this.active == 1;
  252. },
  253. isFormXuqiuShow: function() {
  254. return this.active == 2 && this.type == 3;
  255. },
  256. isFormZhengBaoShow: function() {
  257. return this.active == 2 && this.type == 2;
  258. },
  259. isFormYunDuanShow: function() {
  260. return this.active == 2 && this.type == 1;
  261. },
  262. isStepEndShow: function() {
  263. return this.active == 3;
  264. }
  265. },
  266. watch: {
  267. "$route.query": function(val) {
  268. if (val.step) {
  269. this.active = Number(val.step);
  270. } else {
  271. this.active = 1;
  272. }
  273. if (val.type) {
  274. this.type = Number(val.type);
  275. } else {
  276. this.type = 0;
  277. }
  278. if (val.type == 1 && val.step == 3 && val.projectid) {
  279. this.projectid = val.projectid;
  280. this.$nextTick(() => {
  281. this.$refs["FormRecomment"].show();
  282. });
  283. }
  284. this.activeStatus = "wait";
  285. }
  286. },
  287. mounted() {
  288. let query = this.$route.query;
  289. if (query.step) {
  290. this.active = Number(query.step);
  291. } else {
  292. this.active = 1;
  293. }
  294. if (query.type) {
  295. this.type = Number(query.type);
  296. } else {
  297. this.type = 0;
  298. }
  299. if (query.type == 1 && query.step == 3 && query.projectid) {
  300. this.projectid = query.projectid;
  301. this.$nextTick(() => {
  302. if (query.show) {
  303. this.$refs["FormRecommend"].show();
  304. } else {
  305. this.$refs["FormRecommend"].hide();
  306. }
  307. });
  308. }
  309. this.baseUrl = this.$store.state.domainConfig.siteUrl;
  310. this.isWeixinApp = navigator.userAgent.indexOf("miniProgram") > -1;
  311. },
  312. methods: {
  313. formSubmit(step, data) {
  314. this.checkLogin(true);
  315. let query = {};
  316. query["show"] = false;
  317. if (step == 1) {
  318. this.type = data;
  319. query["type"] = this.type;
  320. }
  321. if (step == 2 && this.type == 1) {
  322. query["projectid"] = data;
  323. query["type"] = this.type;
  324. }
  325. if (step == 3) {
  326. query["show"] = true;
  327. }
  328. // 进入下一步
  329. step++;
  330. this.active = step;
  331. query["step"] = this.active;
  332. this.activeStatus = "process";
  333. this.$nextTick(() => {
  334. this.$router.push({
  335. path: "/frontend/requirements",
  336. query: query
  337. });
  338. });
  339. },
  340. formChange(step, type) {
  341. this.active = step;
  342. this.activeStatus = type;
  343. }
  344. }
  345. };
  346. </script>
  347. <style lang="scss">
  348. @import "@/assets/css/requirements/index.scss";
  349. </style>