index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="common-layout">
  3. <div class="top">
  4. <el-row :gutter="20" align="middle">
  5. <el-col :span="6" class="top_1">
  6. <el-image
  7. class="image"
  8. v-if="configInfo && configInfo.logoUrl && configInfo.logoUrl.length > 0"
  9. :src="configInfo.logoUrl[0].url"
  10. fit="fill"
  11. />
  12. <el-image class="image" v-else :src="siteInfo.logoUrl" fit="fill" />
  13. <div class="content">
  14. <text class="title">{{ configInfo.zhTitle || siteInfo.zhTitle }}</text>
  15. <!-- <text class="english">{{ siteInfo.zhBrief }}</text> -->
  16. </div>
  17. </el-col>
  18. <el-col :span="13">
  19. <el-menu :default-active="current" mode="horizontal" @select="selectMenu">
  20. <template v-for="item in data" :key="item._id">
  21. <template v-if="item.type === '0'">
  22. <el-sub-menu :index="item._id" :class="[current == item.href ? 'current' : '']">
  23. <template #title>
  24. <span @click="selectMenu(item.href)">{{ item.title }}</span>
  25. </template>
  26. <el-menu-item v-for="tag in item.children" :key="tag._id" :index="tag.href">{{
  27. tag.title
  28. }}</el-menu-item>
  29. </el-sub-menu>
  30. </template>
  31. <template v-else-if="item.type === '1'">
  32. <el-menu-item :index="item.href"> {{ item.title }}</el-menu-item>
  33. </template>
  34. </template>
  35. </el-menu>
  36. </el-col>
  37. <el-col :span="5">
  38. <el-row :gutter="20">
  39. <el-col :span="6" class="top_2">
  40. <el-button :icon="Search" size="small" @click="toSearch('search')">搜索</el-button>
  41. </el-col>
  42. <el-col :span="6" class="top_2">
  43. <el-dropdown>
  44. <el-button size="small" :icon="Edit">发布</el-button>
  45. <template #dropdown>
  46. <el-dropdown-menu>
  47. <el-dropdown-item @click="toRelease('demand')">我的需求</el-dropdown-item>
  48. <el-dropdown-item @click="toRelease('project')">我的项目</el-dropdown-item>
  49. <el-dropdown-item @click="toRelease('match')">我的赛事</el-dropdown-item>
  50. <el-dropdown-item @click="toRelease('achievement')">我的成果</el-dropdown-item>
  51. </el-dropdown-menu>
  52. </template>
  53. </el-dropdown>
  54. </el-col>
  55. <el-col :span="6" class="top_2" v-if="user && user._id">
  56. <el-button :icon="Bell" size="small" @click="toCommon(1)">消息</el-button>
  57. </el-col>
  58. <el-col :span="6" v-if="user && user._id" class="top_3">
  59. <el-dropdown>
  60. <el-button size="small" :icon="User" type="primary">
  61. {{ user.nick_name || '游客' }}
  62. </el-button>
  63. <template #dropdown>
  64. <el-dropdown-menu>
  65. <el-dropdown-item @click="toOpen">管理中心</el-dropdown-item>
  66. <el-dropdown-item @click="toCommon(2)">个人中心</el-dropdown-item>
  67. <el-dropdown-item @click="toSearch('collection')">我的收藏</el-dropdown-item>
  68. <el-dropdown-item @click="toCommon(3)">我的报名</el-dropdown-item>
  69. <el-dropdown-item @click="toLogout">注销</el-dropdown-item>
  70. </el-dropdown-menu>
  71. </template>
  72. </el-dropdown>
  73. </el-col>
  74. <el-col :span="10" v-else class="top_3">
  75. <el-button @click="toLogin(1)" type="primary" size="small">登录</el-button>
  76. <el-button @click="toLogin(2)" type="primary" size="small">注册</el-button>
  77. </el-col>
  78. </el-row>
  79. </el-col>
  80. </el-row>
  81. </div>
  82. <div class="center">
  83. <el-col :span="24" class="container">
  84. <router-view :style="viewStyle"></router-view>
  85. </el-col>
  86. </div>
  87. <div class="bottom">
  88. <div class="w_1200 footflex">
  89. <el-image
  90. class="image"
  91. v-if="foot && foot.Unit && foot.Unit.length > 0"
  92. :src="foot.Unit[0].url"
  93. fit="fill"
  94. />
  95. <el-image class="image" v-else :src="footInfo.Unit" fit="fill" />
  96. <el-col :span="12" class="foot_1">
  97. <div class="footTitle">
  98. <span>业务洽谈:{{ foot.Phone || footInfo.Phone }}</span>
  99. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  100. <span>企业邮箱:{{ foot.Email || footInfo.Email }}</span>
  101. </div>
  102. <div class="footTitle">地 址:{{ foot.Address || footInfo.Address }}</div>
  103. <div class="footTitle">版权所有:{{ foot.Copyright || footInfo.Copyright }}</div>
  104. <div class="footTitle">技术支持:{{ foot.Company || footInfo.Company }}</div>
  105. </el-col>
  106. <el-col :span="3" class="foot_2">
  107. <div class="footTop">关于我们</div>
  108. <div class="footTitle footflex1">
  109. <span class="footSpan" @click="toHelp('1')">关于我们</span>
  110. <span class="footSpan" @click="toHelp('3')">联系我们</span>
  111. <!-- <span class="footSpan" @click="toHelp('2')">意见反馈</span> -->
  112. </div>
  113. <!-- <div class="footTitle footflex1">
  114. <span class="footSpan" @click="toHelp('3')">联系我们</span>
  115. <span class="footSpan" @click="toHelp('4')">法律条款</span>
  116. </div> -->
  117. </el-col>
  118. <el-col :span="4" class="foot_3 footflex">
  119. <el-image
  120. class="image"
  121. v-if="foot && foot.Code && foot.Code.length > 0"
  122. :src="foot.Code[0].url"
  123. fit="fill"
  124. />
  125. <el-image class="image" v-else :src="footInfo.Code" fit="fill" />
  126. <el-image
  127. class="image"
  128. v-if="foot && foot.Code && foot.Code.length > 0"
  129. :src="foot.Code[0].url"
  130. fit="fill"
  131. />
  132. <el-image class="image" v-else :src="footInfo.Code" fit="fill" />
  133. </el-col>
  134. </div>
  135. </div>
  136. </div>
  137. </template>
  138. <script setup>
  139. import { siteInfo, footInfo, menuList } from '@/layout/site'
  140. import { Search, Edit, User, Bell } from '@element-plus/icons-vue'
  141. // 接口
  142. import { TagsStore } from '@/store/api/system/tags'
  143. const store = TagsStore()
  144. import { DesignStore } from '@/store/api/platform/design'
  145. const designStore = DesignStore()
  146. const router = useRouter()
  147. const route = useRoute()
  148. const current = ref(route.name || 'home')
  149. import { UserStore } from '@/store/user'
  150. const userStore = UserStore()
  151. const user = computed(() => userStore.user)
  152. const data = ref([])
  153. const configInfo = ref({ logoUrl: [], Unit: [], Code: [] })
  154. const foot = ref({})
  155. // 请求
  156. onMounted(async () => {
  157. await search()
  158. })
  159. const search = async () => {
  160. const res = await store.query({ is_use: '0' })
  161. if (res.errcode == '0' && res.total > 0) data.value = res.data
  162. else data.value = menuList
  163. // 基础设置
  164. const result = await designStore.query({})
  165. if (res.errcode == '0' && res.total > 0) {
  166. configInfo.value = result.data[0] || {}
  167. foot.value = result.data[0].footInfo || {}
  168. }
  169. }
  170. const selectMenu = (item) => {
  171. current.value = item
  172. router.push({ path: `/${item}` })
  173. }
  174. // 登录|注册
  175. const toLogin = (status) => {
  176. if (status === 1) router.push({ path: '/login' })
  177. else router.push({ path: '/register' })
  178. }
  179. // 帮助中心
  180. const toHelp = (type) => {
  181. router.push({ path: '/help', query: { type } })
  182. }
  183. // 打开管理端
  184. const toOpen = async () => {
  185. window.location.href = import.meta.env.VITE_APP_HOME
  186. }
  187. // 基础跳转
  188. const toCommon = (type) => {
  189. if (type == '1') router.push('/chat')
  190. else if (type == '2') router.push('/center')
  191. else if (type == '3') router.push('/sign')
  192. }
  193. // 收藏搜索
  194. const toSearch = (type) => {
  195. router.push({ path: '/search', query: { type } })
  196. }
  197. // 发布
  198. const toRelease = (type) => {
  199. router.push({ path: '/release', query: { type } })
  200. }
  201. // 退出登录
  202. const toLogout = () => {
  203. userStore.logOut()
  204. router.push('/login')
  205. }
  206. watch(
  207. route,
  208. (newVal) => {
  209. if (newVal && newVal.name) selectMenu(newVal.name)
  210. },
  211. {
  212. immediate: true //初始化立即执行
  213. }
  214. )
  215. // provide
  216. provide('selectMenu', selectMenu)
  217. </script>
  218. <style scoped lang="scss">
  219. .common-layout {
  220. height: 100%;
  221. width: 100%;
  222. .top {
  223. position: sticky;
  224. top: 0;
  225. z-index: 100;
  226. padding: 10px 80px;
  227. background: #ffffff;
  228. .current {
  229. border-bottom: 2px solid #409eff;
  230. background-color: #ecf5ff;
  231. :deep(.el-sub-menu__title) {
  232. color: #409eff !important;
  233. }
  234. }
  235. .top_1 {
  236. display: flex;
  237. align-items: center;
  238. .image {
  239. height: 45px;
  240. width: 45px;
  241. margin: 0 5px 0 0;
  242. }
  243. .content {
  244. margin: 0 0 0 5px;
  245. .title {
  246. margin: 0 0 5px 0;
  247. font-size: 23px;
  248. font-weight: bold;
  249. }
  250. .english {
  251. margin: 0 0 0 5px;
  252. font-size: 12px;
  253. opacity: 0.8;
  254. color: #1c66e7;
  255. }
  256. }
  257. }
  258. :deep(.ant-tabs-nav) {
  259. margin: 0 !important;
  260. }
  261. :deep(.ant-tabs-nav::before) {
  262. border: 0 !important;
  263. }
  264. :deep(.el-menu) {
  265. border: none !important;
  266. }
  267. .top_3 {
  268. display: flex;
  269. .example-showcase .el-dropdown-link {
  270. cursor: pointer;
  271. color: #1c66e7;
  272. display: flex;
  273. align-items: center;
  274. }
  275. }
  276. }
  277. .center {
  278. min-height: 77vh;
  279. }
  280. .bottom {
  281. width: 100%;
  282. padding: 7px 0;
  283. font-size: 14px;
  284. background-color: #2e3546;
  285. color: #f0f2f5;
  286. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
  287. 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
  288. 'Noto Color Emoji';
  289. font-variant: tabular-nums;
  290. line-height: 1.5715;
  291. font-feature-settings: 'tnum', 'tnum';
  292. .image {
  293. width: 78px;
  294. height: 78px;
  295. }
  296. .footTitle {
  297. margin: 5px 0 0 0;
  298. .footSpan {
  299. margin-bottom: 3px;
  300. }
  301. }
  302. .footTop {
  303. font-size: 18px;
  304. margin-bottom: 12px;
  305. }
  306. }
  307. .footflex {
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-evenly;
  311. }
  312. .footflex1 {
  313. display: flex;
  314. align-items: center;
  315. justify-content: space-between;
  316. }
  317. }
  318. </style>