change.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div :class="mobile ? 'mobileMain' : ''" :style="{marginTop: mainMarginTop, marginBottom: mobile ? '0px' : '30px !important'}">
  3. <div class="account-change-panel-container" v-if="!mobile">
  4. <div class="account-change-title">选择您的角色</div>
  5. <div class="account-change-main">
  6. <div class="account-change-item" @click="changeType(1)" :class="isCompany? 'cur':''">
  7. <div class="account-change-img">
  8. <img :src=" isCompany ?userInfo.icon_url: companyIcon " />
  9. </div>
  10. <div class="account-change-tips">
  11. 我是需求方
  12. </div>
  13. <div v-if="isCompany" class="account-change-cur"></div>
  14. </div>
  15. <div class="account-change-item" @click="changeType(2)" :class="isPersonal? 'cur':''">
  16. <div class="account-change-img">
  17. <img :src="isPersonal ?userInfo.icon_url:personalIcon" />
  18. </div>
  19. <div class="account-change-tips">
  20. 我是开发者
  21. </div>
  22. <div v-if="isPersonal" class="account-change-cur"></div>
  23. </div>
  24. </div>
  25. <div @click="submit" class="account-change-submit">确认选择</div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import {
  31. mapState
  32. } from "vuex"
  33. import DealSeoList from "@/components/learn/dealSeoList"
  34. import qs from "qs"
  35. import companyIcon from "@/assets/img/account/company.png"
  36. import personalIcon from "@/assets/img/account/personal.png"
  37. export default {
  38. name: 'SeoLearnList',
  39. data() {
  40. return {
  41. baseUrl: '',
  42. mobile: false,
  43. // firstLoad: true,
  44. isWeixinApp: true,
  45. personalIcon,
  46. companyIcon,
  47. home_page_type: ""
  48. }
  49. },
  50. head() {
  51. const {
  52. title = "",
  53. keyword = "",
  54. description = "",
  55. h1 = "",
  56. canonical = "",
  57. metaLocation
  58. } = this.head || {}
  59. let obj = {
  60. title: title,
  61. meta: [{
  62. name: "keywords",
  63. content: keyword
  64. }, {
  65. name: "description",
  66. content: description
  67. }, {
  68. name: "h1",
  69. content: h1
  70. }],
  71. link: [{
  72. rel: "canonical",
  73. href: canonical
  74. }]
  75. }
  76. if (metaLocation) {
  77. obj.meta.push({
  78. name: "location",
  79. content: metaLocation
  80. })
  81. }
  82. return obj
  83. },
  84. computed: {
  85. ...mapState(["deviceType"]),
  86. showWxHeader() {
  87. return !this.deviceType.app && !this.isWeixinApp &&
  88. (this.deviceType.android || this.deviceType.ios)
  89. },
  90. mainMarginTop() {
  91. if (this.mobile && this.showWxHeader) {
  92. return '64px !important'
  93. } else if (this.mobile) {
  94. return '0px !important'
  95. } else {
  96. return '20px !important'
  97. }
  98. },
  99. userInfo() {
  100. return this.$store.state.userinfo
  101. },
  102. isCompany() {
  103. return this.home_page_type == 1
  104. },
  105. isPersonal() {
  106. return this.home_page_type == 2
  107. }
  108. },
  109. mounted() {
  110. this.home_page_type = this.userInfo.home_page_type
  111. // console.log(444,)
  112. this.baseUrl = this.$store.state.domainConfig.siteUrl
  113. this.isWeixinApp = navigator.userAgent.indexOf("miniProgram") > -1
  114. },
  115. methods: {
  116. changeType(e) {
  117. console.log(e)
  118. this.home_page_type = e
  119. },
  120. async submit() {
  121. let home_page_type = this.userInfo.home_page_type
  122. if(home_page_type != this.home_page_type){
  123. let res = await this.$axios.$post("/api/user/update_info", {
  124. home_page_type: this.home_page_type
  125. });
  126. if(Number(res.status) !== 1){
  127. this.$message.error(res.info);
  128. }
  129. }
  130. // TODO:跳转对应的首页
  131. location.href = "/"
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. .account-change-panel-container {
  138. width: 880px;
  139. height: 600px;
  140. background: #FFFFFF;
  141. border-radius: 8px;
  142. overflow: hidden;
  143. }
  144. .account-change-title {
  145. margin-top: 40px;
  146. margin-bottom: 50px;
  147. text-align: center;
  148. font-size: 28px;
  149. font-family: PingFangSC-Medium, PingFang SC;
  150. font-weight: 500;
  151. color: #0B121A;
  152. line-height: 40px
  153. }
  154. .account-change-main {
  155. margin-left: 58px;
  156. margin-right: 58px;
  157. overflow: hidden;
  158. display: flex;
  159. justify-content: space-between;
  160. }
  161. .account-change-item {
  162. width: 360px;
  163. height: 300px;
  164. background: #FFFFFF;
  165. border-radius: 16px;
  166. border: 2px dotted #CED3D9;
  167. cursor: pointer;
  168. &.cur {
  169. border: 2px solid #308EFF;
  170. }
  171. }
  172. .account-change-img {
  173. margin: 60px auto 0;
  174. width: 90px;
  175. height: 90px;
  176. border-radius: 100%;
  177. overflow: hidden;
  178. img {
  179. width: 90px;
  180. height: 90px;
  181. border-radius: 100%;
  182. }
  183. }
  184. .account-change-tips {
  185. margin-top: 24px;
  186. font-size: 24px;
  187. font-family: PingFangSC-Medium, PingFang SC;
  188. font-weight: 500;
  189. color: #0B121A;
  190. line-height: 33px;
  191. text-align: center
  192. }
  193. .account-change-submit {
  194. margin: 58px auto 0;
  195. width: 140px;
  196. height: 48px;
  197. border-radius: 24px;
  198. border: 1px solid #4A5D74;
  199. line-height: 48px;
  200. text-align: center;
  201. font-size: 18px;
  202. font-weight: 500;
  203. color: #4B5D73;
  204. cursor: pointer;
  205. }
  206. .account-change-cur {
  207. margin: 15px auto 0;
  208. width: 34px;
  209. height: 34px;
  210. background: url("~@/assets/img/account/cur.png") no-repeat 50% 50%;
  211. background-size: 100% auto;
  212. }
  213. </style>