index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div :class="mobile ? 'mobileMain' : ''" :style="{
  3. marginTop: mainMarginTop,
  4. marginBottom: mobile ? '0px' : '30px !important'
  5. }">
  6. <div class="requirements-container" v-if="!mobile">
  7. <div class="requirements-title">发布需求</div>
  8. <div class="requirements-step-container">
  9. <div class="requirements-step">
  10. <div class="requirements-step-status">
  11. <div class="requirements-step-icon" :class="FirstStepStatus">
  12. <div class="requirements-step-tips">
  13. 选择需求类型
  14. </div>
  15. </div>
  16. </div>
  17. <div class="requirements-step-line" :class="FirstStepStatus"></div>
  18. </div>
  19. <div class="requirements-step">
  20. <div class="requirements-step-status">
  21. <div class="requirements-step-icon" :class="secondStepStatus">
  22. <div class="requirements-step-tips">
  23. 填写需求描述
  24. </div>
  25. </div>
  26. </div>
  27. <div class="requirements-step-line" :class="secondStepStatus"></div>
  28. </div>
  29. <div class="requirements-step">
  30. <div class="requirements-step-status">
  31. <div class="requirements-step-icon" :class="thirdStepStatus">
  32. <div class="requirements-step-tips">
  33. 发布成功
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <FormFirstStep v-if="isFirstFormShow" v-on:formSubmit="formSubmit" v-on:formChange="formChange"></FormFirstStep>
  40. <FormXuQiu v-if="isFormXuqiuShow" v-on:formChange="formChange" v-on:formSubmit="formSubmit"></FormXuQiu>
  41. <FormZhengBao v-if="isFormZhengBaoShow" v-on:formChange="formChange" v-on:formSubmit="formSubmit"></FormZhengBao>
  42. <StepEnd v-if="isStepEndShow"></StepEnd>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import {
  48. mapState
  49. } from "vuex";
  50. import qs from "qs";
  51. import FormFirstStep from "./components/FormFirstStep.vue";
  52. // 发布需求梳理表单
  53. import FormXuQiu from "./components/Form_xuqiu.vue"
  54. // 发布整包表单
  55. import FormZhengBao from "./components/Form_zhengbao"
  56. // 发布成功页
  57. import StepEnd from './components/StepEnd.vue'
  58. export default {
  59. name: "SeoLearnList",
  60. components: {
  61. FormFirstStep,
  62. FormXuQiu,
  63. FormZhengBao,
  64. StepEnd
  65. },
  66. data() {
  67. return {
  68. baseUrl: "",
  69. mobile: false,
  70. // firstLoad: true,
  71. isWeixinApp: true,
  72. // 0 默认 1云端工作 2 项目整包 3 需求梳理
  73. type: 0,
  74. // 当前激活的状态
  75. active: 0,
  76. // wait process finish
  77. activeStatus: "wait"
  78. };
  79. },
  80. head() {
  81. const {
  82. title = "",
  83. keyword = "",
  84. description = "",
  85. h1 = "",
  86. canonical = "",
  87. metaLocation
  88. } = this.head || {};
  89. let obj = {
  90. title: title,
  91. meta: [{
  92. name: "keywords",
  93. content: keyword
  94. },
  95. {
  96. name: "description",
  97. content: description
  98. },
  99. {
  100. name: "h1",
  101. content: h1
  102. }
  103. ],
  104. link: [{
  105. rel: "canonical",
  106. href: canonical
  107. }]
  108. };
  109. if (metaLocation) {
  110. obj.meta.push({
  111. name: "location",
  112. content: metaLocation
  113. });
  114. }
  115. return obj;
  116. },
  117. computed: {
  118. ...mapState(["deviceType"]),
  119. showWxHeader() {
  120. return (
  121. !this.deviceType.app &&
  122. !this.isWeixinApp &&
  123. (this.deviceType.android || this.deviceType.ios)
  124. );
  125. },
  126. mainMarginTop() {
  127. if (this.mobile && this.showWxHeader) {
  128. return "64px !important";
  129. } else if (this.mobile) {
  130. return "0px !important";
  131. } else {
  132. return "20px !important";
  133. }
  134. },
  135. FirstStepStatus: function () {
  136. let status = "";
  137. switch (this.active) {
  138. case 1:
  139. status = this.activeStatus;
  140. break;
  141. case 2:
  142. status = "success";
  143. break;
  144. case 3:
  145. status = "success";
  146. break;
  147. default:
  148. status = "wait";
  149. }
  150. return status;
  151. },
  152. secondStepStatus: function () {
  153. let status = "";
  154. switch (this.active) {
  155. case 1:
  156. status = "wait";
  157. break;
  158. case 2:
  159. status = this.activeStatus;
  160. break;
  161. case 3:
  162. status = "success";
  163. break;
  164. default:
  165. status = "wait";
  166. }
  167. return status;
  168. },
  169. thirdStepStatus: function () {
  170. let status = "";
  171. switch (this.active) {
  172. case 1:
  173. status = "wait";
  174. break;
  175. case 2:
  176. status = "wait";
  177. break;
  178. case 3:
  179. status = "success";
  180. break;
  181. default:
  182. status = "wait";
  183. }
  184. return status;
  185. },
  186. isFirstFormShow: function () {
  187. return this.active == 1
  188. },
  189. isFormXuqiuShow: function () {
  190. return this.active == 2 && this.type == 3
  191. },
  192. isFormZhengBaoShow: function () {
  193. return this.active == 2 && this.type == 2
  194. },
  195. isStepEndShow: function () {
  196. return this.active == 3
  197. }
  198. },
  199. watch: {
  200. '$route.query': function (val) {
  201. if (val.step) {
  202. this.active = Number(val.step)
  203. } else {
  204. this.active = 1
  205. }
  206. if (val.type) {
  207. this.type = Number(val.type)
  208. } else {
  209. this.type = 0
  210. }
  211. this.activeStatus = "wait"
  212. }
  213. },
  214. mounted() {
  215. let query = this.$route.query;
  216. if (query.step) {
  217. this.active = Number(query.step)
  218. } else {
  219. this.active = 1
  220. }
  221. if (query.type) {
  222. this.type = Number(query.type)
  223. } else {
  224. this.type = 0
  225. }
  226. this.baseUrl = this.$store.state.domainConfig.siteUrl;
  227. this.isWeixinApp = navigator.userAgent.indexOf("miniProgram") > -1;
  228. },
  229. methods: {
  230. formSubmit(step, data) {
  231. let query = {}
  232. if (step == 1) {
  233. this.type = data;
  234. query['type'] = this.type
  235. }
  236. // 进入下一步
  237. step++;
  238. this.active = step
  239. query['step'] = this.active
  240. this.activeStatus = "process";
  241. this.$nextTick(() => {
  242. this.$router.push({
  243. path: "/frontend/requirements",
  244. query: query
  245. });
  246. })
  247. },
  248. formChange(step, type) {
  249. this.active = step;
  250. this.activeStatus = type;
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss">
  256. @import "@/assets/css/requirements/index.scss";
  257. </style>