index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <el-col :span="24" class="one">
  6. <div class="loginform">
  7. <el-col :span="24" class="content_1">
  8. <div class="type-list">
  9. <el-tooltip
  10. v-for="(item, index) in typeList"
  11. :key="index"
  12. effect="dark"
  13. :content="item.remark"
  14. placement="top"
  15. >
  16. <span
  17. class="span"
  18. :class="[item.value === type ? 'active' : '']"
  19. @click="toSelect(item.value)"
  20. >{{ item.label }}</span
  21. >
  22. </el-tooltip>
  23. </div>
  24. </el-col>
  25. <el-col :span="24" class="content_2">
  26. <user v-if="type == '0'"></user>
  27. <expert v-if="type == '1'"></expert>
  28. <company v-if="type == '2'"></company>
  29. <Incubator v-if="type == '3'"></Incubator>
  30. <competition v-if="type == '4'"></competition>
  31. <Investment v-if="type == '5'"></Investment>
  32. <association v-if="type == '6'"></association>
  33. <state v-if="type == '7'"></state>
  34. <unit v-if="type == '8'"></unit>
  35. </el-col>
  36. </div>
  37. </el-col>
  38. </el-col>
  39. </el-row>
  40. <el-dialog v-model="dialog" title="使用协议">
  41. <div v-html="configInfo.agreement"></div>
  42. </el-dialog>
  43. </div>
  44. </template>
  45. <script setup>
  46. // API 引用
  47. import { getCity } from '@/utils/city'
  48. import { siteInfo } from '@/layout/site'
  49. const $checkRes = inject('$checkRes')
  50. import { cloneDeep } from 'lodash-es'
  51. // 接口
  52. import { DictDataStore } from '@/store/api/system/dictData'
  53. import { DesignStore } from '@/store/api/platform/design'
  54. const dictDataStore = DictDataStore()
  55. const designStore = DesignStore()
  56. // 组件
  57. import user from './parts/user.vue'
  58. import association from './parts/association.vue'
  59. import company from './parts/company.vue'
  60. import competition from './parts/competition.vue'
  61. import expert from './parts/expert.vue'
  62. import Incubator from './parts/Incubator.vue'
  63. import state from './parts/state.vue'
  64. import unit from './parts/unit.vue'
  65. import Investment from './parts/Investment.vue'
  66. // 路由
  67. const router = useRouter()
  68. // 加载中
  69. const loading = ref(false)
  70. // 表单验证
  71. const ruleFormRef = ref()
  72. // 弹框
  73. const dialog = ref(false)
  74. // 基本设置
  75. const configInfo = ref({})
  76. // 字典
  77. const typeList = ref([])
  78. const genderList = ref([])
  79. const fieldList = ref([])
  80. const educationList = ref([])
  81. const cityList = ref([])
  82. const isUseList = ref([])
  83. // 用户类型
  84. const type = ref('0')
  85. // 用户协议
  86. const isAgree = ref(false)
  87. // 请求
  88. onMounted(async () => {
  89. loading.value = true
  90. await searchOther()
  91. loading.value = false
  92. })
  93. const searchOther = async () => {
  94. let result
  95. // 性别
  96. result = await dictDataStore.query({ code: 'gender', is_use: '0' })
  97. if ($checkRes(result)) genderList.value = result.data
  98. // 用户类型
  99. result = await dictDataStore.query({ code: 'userType', is_use: '0' })
  100. if ($checkRes(result)) typeList.value = result.data
  101. // 专家领域
  102. result = await dictDataStore.query({ code: 'userType', is_use: '0' })
  103. if ($checkRes(result)) fieldList.value = result.data
  104. // 学历
  105. result = await dictDataStore.query({ code: 'education', is_use: '0' })
  106. if ($checkRes(result)) educationList.value = result.data
  107. // 是否使用
  108. result = await dictDataStore.query({ code: 'isUse', is_use: '0' })
  109. if ($checkRes(result)) isUseList.value = result.data
  110. // 基础设置
  111. result = await designStore.query({})
  112. if ($checkRes(result)) configInfo.value = result.data[0] || {}
  113. // 城市
  114. getCity().then((response) => (cityList.value = response.address))
  115. }
  116. // 选择用户类型
  117. const toSelect = async (data) => {
  118. type.value = data
  119. }
  120. // 去登录
  121. const toLogin = () => {
  122. router.push({ path: '/login' })
  123. }
  124. // 返回
  125. const toBack = () => {
  126. router.push({ path: '/home' })
  127. }
  128. // provide
  129. provide('$checkRes', $checkRes)
  130. provide('cloneDeep', cloneDeep)
  131. provide('siteInfo', siteInfo)
  132. provide('dialog', dialog)
  133. provide('isAgree', isAgree)
  134. provide('ruleFormRef ', ruleFormRef)
  135. provide('router', router)
  136. // 字典
  137. provide('genderList', genderList)
  138. provide('fieldList', fieldList)
  139. provide('educationList', educationList)
  140. provide('cityList', cityList)
  141. provide('isUseList', isUseList)
  142. // 方法
  143. provide('toLogin', toLogin)
  144. provide('toBack', toBack)
  145. </script>
  146. <style scoped lang="scss">
  147. .main {
  148. .one {
  149. background-image: url(@/assets/loginbg.jpeg);
  150. background-position: center center;
  151. background-repeat: no-repeat;
  152. height: calc(100vh - 23vh);
  153. width: 100%;
  154. background-size: cover;
  155. display: flex;
  156. justify-content: space-evenly;
  157. .loginform {
  158. width: 800px;
  159. position: absolute;
  160. top: 50%;
  161. left: 50%;
  162. min-height: 400px;
  163. background: hsla(0, 0%, 100%, 0.6);
  164. box-shadow: 0 0 30px 0 rgba(51, 51, 51, 0.2);
  165. -webkit-transform: translate(-50%, -50%);
  166. transform: translate(-50%, -50%);
  167. border-top: 10px solid #1492ff;
  168. .content_1 {
  169. text-align: center;
  170. padding: 10px;
  171. .type-list {
  172. margin: 10px 0 0 0;
  173. .span {
  174. padding: 0 10px;
  175. margin-left: 5px;
  176. height: 26px;
  177. line-height: 24px;
  178. border: 1px solid #ddd;
  179. border-radius: 3px;
  180. background-color: #f4f4f4;
  181. }
  182. .span:hover {
  183. border-color: #3497fc;
  184. background-color: #d2f1fe;
  185. }
  186. .active {
  187. border-color: #3497fc;
  188. background-color: #d2f1fe;
  189. background-image: url(@/assets/icon_2.png);
  190. background-position: top right;
  191. background-repeat: no-repeat;
  192. }
  193. }
  194. }
  195. .content_2 {
  196. margin: 0 20px;
  197. overflow-y: auto;
  198. }
  199. .content_2::-webkit-scrollbar {
  200. display: none;
  201. }
  202. }
  203. }
  204. }
  205. </style>