tab1_look.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <!-- -->
  2. <template>
  3. <div class="template">
  4. <div class="top">
  5. <div class="location">数据管理 / 项目资料 / <span>查看</span></div>
  6. </div>
  7. <div class="conten">
  8. <div class="search">
  9. <div class="txt">{{ tab0Data.name }}</div>
  10. <ul>
  11. <li
  12. v-for="(item, index) in topTab"
  13. :key="index"
  14. :class="{ active: topTabInd === index }"
  15. @click="tabCut(index)"
  16. >
  17. <a href="javascript:;">{{ item.name }}</a>
  18. </li>
  19. </ul>
  20. </div>
  21. <div class="tabAll">
  22. <!-- 项目详情 -->
  23. <div id="tab0" class="conten_box">
  24. <div class="title">项目详情</div>
  25. <div class="row">
  26. <div>项 目 名 称:</div>
  27. {{ tab0Data.name }}
  28. </div>
  29. <div class="row">
  30. <div>项 目 时 间:</div>
  31. {{ tab0Data.age ? tab0Data.age : "-" }}
  32. </div>
  33. <div class="row">
  34. <div>项 目 分 类:</div>
  35. {{ tab0Data.projectTypeName }}
  36. </div>
  37. <div class="row">
  38. <div>展 示 形 式:</div>
  39. {{ tab0Data.application }}
  40. </div>
  41. <div class="row">
  42. <div>应 用 技 术:</div>
  43. {{ tab0Data.technology }}
  44. </div>
  45. <div class="row">
  46. <div>保 密 级 别:</div>
  47. {{ tab0Data.level }}
  48. </div>
  49. <div class="row">
  50. <div>项目合作方:&nbsp;&nbsp;</div>
  51. {{ tab0Data.cooperation ? tab0Data.cooperation : "-" }}
  52. </div>
  53. </div>
  54. <div id="tab1" class="conten_box">
  55. <div class="title">项目网址</div>
  56. <div
  57. class="row"
  58. v-show="item.name && item.url"
  59. v-for="item in tab1Data"
  60. :key="item.id"
  61. >
  62. <div :title='item.name'>{{ item.name }}:</div>
  63. <a :href="item.url" target="_blank">{{ item.url }}</a>
  64. </div>
  65. <div
  66. class="noData"
  67. v-if="
  68. tab1Data.length === 1 &&
  69. tab1Data[0].name === '' &&
  70. tab1Data[0].url === ''
  71. "
  72. >
  73. 暂无数据
  74. </div>
  75. </div>
  76. <div id="tab2" class="conten_box">
  77. <div class="title">三维场景</div>
  78. <div
  79. class="row"
  80. v-show="item.name && item.url"
  81. v-for="item in tab2Data"
  82. :key="item.id"
  83. >
  84. <div :title='item.name'>{{ item.name }}:</div>
  85. <a :href="item.url" target="_blank">{{ item.url }}</a>
  86. </div>
  87. <div
  88. class="noData"
  89. v-if="
  90. tab2Data.length === 0"
  91. >
  92. 暂无数据
  93. </div>
  94. </div>
  95. <div id="tab3" class="conten_box">
  96. <div class="title">资料文档</div>
  97. <div class="imgBox" v-if="tab3Data.length">
  98. <div class="wendang" v-for="item in tab3Data" :key="item.id">
  99. <a :href="baseURL + item.filePath" target="_blank" download>{{
  100. item.name
  101. }}</a>
  102. </div>
  103. </div>
  104. <div v-else class="noData">暂无数据</div>
  105. </div>
  106. <div id="tab4" class="conten_box">
  107. <div class="title">文物</div>
  108. <div class="imgBox" v-if="tab4Data.length">
  109. <div v-for="item in tab4Data" :key="item.id" :title="item.name">
  110. <a :href="item.url" target="_blank">
  111. <img :src="baseURL + item.thumb" :onerror="defaultImg" alt="" />
  112. </a>
  113. <p>{{ item.name }}</p>
  114. <!-- 点击详细信息 -->
  115. <div class="details" @click="lookDetail(item.id)">详细信息</div>
  116. </div>
  117. </div>
  118. <div v-else class="noData">暂无数据</div>
  119. </div>
  120. </div>
  121. <!-- 底部按钮 -->
  122. <div class="button_btn">
  123. <div @click="$router.go(-1)">返 回</div>
  124. <div class="edit" @click="projecEdit" v-if="userLogo">编 辑</div>
  125. </div>
  126. </div>
  127. <!-- 点击文详细信息的弹窗 -->
  128. <el-dialog title="详细信息" :visible.sync="isShow" @close="isShow = false">
  129. <el-form
  130. :model="addForm"
  131. ref="addForm"
  132. label-width="100px"
  133. class="demo-ruleForm"
  134. >
  135. <el-form-item label="名称:">
  136. <el-input
  137. disabled
  138. v-model="addForm.name"
  139. placeholder="请输入名称"
  140. style="width: 500px"
  141. ></el-input>
  142. </el-form-item>
  143. <el-form-item label="链接:">
  144. <el-input
  145. disabled
  146. style="width: 500px"
  147. v-model="addForm.url"
  148. placeholder="请输入网址链接"
  149. ></el-input>
  150. </el-form-item>
  151. <el-form-item label="文物类别:">
  152. <el-select v-model="addForm.goodsTypeId" disabled>
  153. <el-option
  154. v-for="item in antiqueArr"
  155. :key="item.id"
  156. :label="item.name"
  157. :value="item.id"
  158. ></el-option>
  159. </el-select>
  160. </el-form-item>
  161. <el-form-item label="文物图片:" class="myImgBox">
  162. <div class="upImgBox" v-if="imgList.length">
  163. <div
  164. class="imgdiv"
  165. :class="{ active: item.isIndex === 1 }"
  166. v-for="(item, index) in imgList"
  167. :key="index"
  168. @mouseenter="imgIconInd = index"
  169. @mouseleave="imgIconInd = null"
  170. >
  171. <img
  172. style="width: 100%; height: 100%"
  173. :src="baseURL + item.filePath"
  174. :onerror="defaultImg"
  175. />
  176. <div class="imgIcon" v-show="index === imgIconInd">
  177. <i class="el-icon-zoom-in" @click="lookImg(item.filePath)"></i>
  178. <a :href="baseURL + item.filePath" target="_blank" download
  179. ><i class="el-icon-download"></i
  180. ></a>
  181. </div>
  182. </div>
  183. </div>
  184. <div v-else style="font-weight: 700;">暂 无</div>
  185. </el-form-item>
  186. </el-form>
  187. <div slot="footer" class="dialog-footer">
  188. <el-button type="primary" @click="isShow = false">确 定</el-button>
  189. </div>
  190. </el-dialog>
  191. <!-- 点击查看图片 -->
  192. <div class="lookImg" v-if="dialogImageIshow">
  193. <img :src="baseURL + dialogImageUrl" alt="" :onerror="defaultImg" />
  194. <div class="imgBtnX" @click="dialogImageIshow = false">关 闭</div>
  195. </div>
  196. </div>
  197. </template>
  198. <script>
  199. import axios from '@/utils/request'
  200. import { getDetail, getGoodsType, getAntiqueById } from '@/apis/tab1'
  201. export default {
  202. // import引入的组件需要注入到对象中才能使用
  203. name: 'tab1Look',
  204. components: {},
  205. data () {
  206. // 这里存放数据
  207. return {
  208. dialogImageUrl: '',
  209. dialogImageIshow: false,
  210. imgIconInd: null,
  211. isShow: false,
  212. antiqueArr: [],
  213. addForm: {},
  214. imgList: [],
  215. // --------------查看详情的数据 👆————————————————————————————————
  216. userLogo: true, // 用户标识
  217. baseURL: '',
  218. tab0Data: {},
  219. tab1Data: [],
  220. tab2Data: [],
  221. tab3Data: [],
  222. tab4Data: [],
  223. myId: null, // 项目总id
  224. topTabInd: 0,
  225. topTab: [
  226. { name: '项目详情', id: '#tab0' },
  227. { name: '项目网址', id: '#tab1' },
  228. { name: '三维场景', id: '#tab2' },
  229. { name: '资料文档', id: '#tab3' },
  230. { name: '文物', id: '#tab4' }
  231. ]
  232. }
  233. },
  234. // 监听属性 类似于data概念
  235. computed: {},
  236. // 监控data中的数据变化
  237. watch: {},
  238. // 方法集合
  239. methods: {
  240. // 文物详情弹窗里面的查看图片
  241. lookImg (url) {
  242. this.dialogImageUrl = url
  243. this.dialogImageIshow = true
  244. },
  245. // 点击查看详情
  246. async lookDetail (id) {
  247. const res = await getAntiqueById(id)
  248. this.addForm = res.data.entity
  249. this.imgList = res.data.file
  250. this.isShow = true
  251. // console.log(999, res)
  252. },
  253. // 点击编辑调整编辑页面
  254. projecEdit () {
  255. this.$router.push({
  256. path: '/layout/tab1_edit',
  257. query: { id: this.myId }
  258. })
  259. },
  260. tabCut (index) {
  261. const tabAll = document.querySelector('.tabAll')
  262. const tab0 = document.querySelector('#tab0')
  263. const tab1 = document.querySelector('#tab1')
  264. const tab2 = document.querySelector('#tab2')
  265. const tab3 = document.querySelector('#tab3')
  266. if (index === 0 && this.topTabInd !== index) {
  267. tabAll.scrollTop = 0
  268. } else if (index === 1 && this.topTabInd !== index) {
  269. tabAll.scrollTop = tab0.offsetHeight + 10
  270. } else if (index === 2 && this.topTabInd !== index) {
  271. tabAll.scrollTop = tab0.offsetHeight + tab1.offsetHeight + 20
  272. } else if (index === 3 && this.topTabInd !== index) {
  273. tabAll.scrollTop =
  274. tab0.offsetHeight + tab1.offsetHeight + tab2.offsetHeight + 30
  275. } else if (index === 4 && this.topTabInd !== index) {
  276. tabAll.scrollTop =
  277. tab0.offsetHeight +
  278. tab1.offsetHeight +
  279. tab2.offsetHeight +
  280. tab3.offsetHeight +
  281. 40
  282. }
  283. this.topTabInd = index
  284. }
  285. },
  286. // 生命周期 - 创建完成(可以访问当前this实例)
  287. async created () {
  288. // 获取文物类别
  289. const res1 = await getGoodsType()
  290. this.antiqueArr = res1.data
  291. this.antiqueArr.unshift({ id: null, name: ' ' })
  292. // 获取服务器前缀地址
  293. this.baseURL = axios.defaults.baseURL
  294. // 拿到路由跳转传过来的数据
  295. this.myId = this.$route.query.id
  296. const res = await getDetail(this.myId)
  297. // console.log(999, res)
  298. this.tab0Data = res.data.entity
  299. this.tab0Data.technology = this.myTechnology(this.tab0Data.technology)
  300. this.tab0Data.application = this.myApplication(this.tab0Data.application)
  301. this.tab0Data.level = this.myLevel(this.tab0Data.level)
  302. this.tab1Data = res.data.website
  303. // console.log(999, this.tab1Data.length, this.tab1Data[0].name, this.tab1Data[0].url)
  304. this.tab2Data = res.data.scene
  305. this.tab3Data = res.data.doc
  306. this.tab4Data = res.data.goods
  307. // 获取用户信息
  308. const aaa = localStorage.getItem('SWKK_userInfo')
  309. // console.log(999, JSON.parse(res))
  310. const userData = JSON.parse(aaa)
  311. // 如果是普通用户---删掉场景案例
  312. if (userData.roleId === 2) {
  313. this.userLogo = false
  314. }
  315. },
  316. // 生命周期 - 挂载完成(可以访问DOM元素)
  317. mounted () {},
  318. beforeCreate () {}, // 生命周期 - 创建之前
  319. beforeMount () {}, // 生命周期 - 挂载之前
  320. beforeUpdate () {}, // 生命周期 - 更新之前
  321. updated () {}, // 生命周期 - 更新之后
  322. beforeDestroy () {}, // 生命周期 - 销毁之前
  323. destroyed () {}, // 生命周期 - 销毁完成
  324. activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
  325. }
  326. </script>
  327. <style lang='less' scoped>
  328. //@import url(); 引入公共css类
  329. .template {
  330. .lookImg {
  331. padding-top: 15px;
  332. display: flex;
  333. justify-content: center;
  334. left: 0;
  335. top: 0;
  336. width: 100vw;
  337. height: 100vh;
  338. position: fixed;
  339. z-index: 9999;
  340. background-color: rgba(0, 0, 0, 0.7);
  341. img {
  342. max-width: 80vw;
  343. max-height: 80vh;
  344. }
  345. .imgBtnX {
  346. cursor: pointer;
  347. width: 100px;
  348. height: 30px;
  349. position: absolute;
  350. left: 50%;
  351. transform: translateX(-50%);
  352. bottom: 20px;
  353. background-color: #fff;
  354. border-radius: 8px;
  355. color: black;
  356. display: flex;
  357. justify-content: center;
  358. align-items: center;
  359. }
  360. }
  361. .myImgBox {
  362. /deep/.el-form-item__content {
  363. display: flex;
  364. flex-wrap: wrap;
  365. }
  366. /deep/.el-upload-dragger {
  367. width: 135px;
  368. height: 135px;
  369. border: 1px solid #ccc;
  370. }
  371. }
  372. .upImgBox {
  373. display: flex;
  374. flex-wrap: wrap;
  375. .active {
  376. border: 2px solid #dc3545;
  377. }
  378. }
  379. .imgdiv {
  380. position: relative;
  381. margin: 0 10px 10px 0;
  382. border: 1px solid #ccc;
  383. width: 135px;
  384. height: 135px;
  385. & > img {
  386. width: 100%;
  387. height: 100%;
  388. object-fit: contain;
  389. }
  390. .imgIcon {
  391. justify-content: space-around;
  392. align-items: center;
  393. display: flex;
  394. position: absolute;
  395. width: 100%;
  396. height: 100%;
  397. left: 0;
  398. top: 0;
  399. background-color: rgba(0, 0, 0, 0.6);
  400. i {
  401. color: #fff;
  402. font-size: 24px;
  403. cursor: pointer;
  404. }
  405. a {
  406. i {
  407. margin-top: 10px;
  408. }
  409. }
  410. i:hover {
  411. color: #dc3545;
  412. }
  413. & > span {
  414. cursor: pointer;
  415. color: #fff;
  416. position: absolute;
  417. bottom: 0px;
  418. left: 50%;
  419. transform: translateX(-50%);
  420. }
  421. & > span:hover {
  422. color: #dc3545;
  423. }
  424. }
  425. }
  426. .noData {
  427. font-weight: 700;
  428. margin-top: 10px;
  429. }
  430. position: relative;
  431. padding: 0px 30px;
  432. .top {
  433. display: flex;
  434. align-items: center;
  435. height: 58px;
  436. width: 100%;
  437. .location {
  438. font-size: 22px;
  439. color: #999;
  440. & > span {
  441. color: black;
  442. }
  443. }
  444. }
  445. .conten {
  446. width: 100%;
  447. height: 720px;
  448. .txt {
  449. font-weight: 700;
  450. height: 40px;
  451. border-bottom: 1px solid #a3a2a9;
  452. }
  453. .search {
  454. margin-bottom: 10px;
  455. position: relative;
  456. padding: 15px 20px 0;
  457. border-radius: 5px;
  458. box-shadow: 0px 0px 5px 0px;
  459. height: 110px;
  460. background-color: #d8dadc;
  461. ul {
  462. margin-top: 15px;
  463. display: flex;
  464. li {
  465. padding-bottom: 5px;
  466. cursor: pointer;
  467. margin-right: 100px;
  468. a {
  469. color: #666;
  470. }
  471. }
  472. li:hover {
  473. border-bottom: 2px solid #dc3545;
  474. a {
  475. color: black;
  476. }
  477. }
  478. .active {
  479. border-bottom: 2px solid #dc3545;
  480. a {
  481. color: black;
  482. }
  483. }
  484. }
  485. }
  486. #tab1{
  487. .row{
  488. width: 60%;
  489. }
  490. }
  491. #tab2{
  492. .row{
  493. width: 60%;
  494. }
  495. }
  496. .conten_box {
  497. padding: 15px 30px;
  498. background-color: #fff;
  499. margin-top: 10px;
  500. .title {
  501. font-weight: 700;
  502. padding-bottom: 8px;
  503. font-size: 20px;
  504. color: #c82333;
  505. border-bottom: 1px solid #ccc;
  506. }
  507. .row {
  508. display: flex;
  509. align-items: center;
  510. margin: 15px 0 0;
  511. & > div {
  512. font-weight: 700;
  513. }
  514. a {
  515. flex: 1;
  516. // width: 700px;
  517. overflow: hidden;
  518. text-overflow: ellipsis;
  519. white-space: nowrap;
  520. background-color: #e7e9eb;
  521. padding: 5px 10px;
  522. }
  523. }
  524. .imgBox {
  525. display: flex;
  526. flex-wrap: wrap;
  527. & > div {
  528. word-wrap: break-word;
  529. text-align: center;
  530. width: 85px;
  531. margin-right: 20px;
  532. }
  533. img {
  534. width: 68px;
  535. height: 75px;
  536. object-fit: contain;
  537. }
  538. .wendang {
  539. text-align: left;
  540. margin-top: 10px;
  541. width: 100%;
  542. a:hover {
  543. color: #dc3545;
  544. }
  545. }
  546. }
  547. }
  548. #tab4 {
  549. .imgBox {
  550. & > div {
  551. position: relative;
  552. word-wrap: break-word;
  553. text-align: center;
  554. display: block;
  555. width: 120px;
  556. height: auto;
  557. margin-top: 10px;
  558. margin-right: 20px;
  559. padding: 15px 0 35px 0;
  560. img {
  561. transition: all 0.3s;
  562. }
  563. p {
  564. overflow: hidden;
  565. text-overflow: ellipsis;
  566. white-space: nowrap;
  567. }
  568. }
  569. img {
  570. &:hover {
  571. transform: translate(2px, -2px);
  572. }
  573. border: 1px solid #ccc;
  574. box-shadow: 1px 1px 3px 0px;
  575. padding: 5px;
  576. width: 120px;
  577. height: 120px;
  578. margin-bottom: 10px;
  579. object-fit: contain;
  580. }
  581. .details {
  582. width: 100%;
  583. position: absolute;
  584. bottom: 5px;
  585. left: 50%;
  586. transform: translateX(-50%);
  587. cursor: pointer;
  588. color: #dc3545;
  589. }
  590. }
  591. }
  592. .tabAll {
  593. border-radius: 10px;
  594. max-height: 600px;
  595. overflow-y: auto;
  596. }
  597. }
  598. .button_btn {
  599. display: flex;
  600. justify-content: space-between;
  601. align-items: center;
  602. position: absolute;
  603. left: 100px;
  604. bottom: 30px;
  605. width: 300px;
  606. height: 40px;
  607. div {
  608. border-radius: 10px;
  609. display: flex;
  610. justify-content: center;
  611. align-items: center;
  612. width: 100px;
  613. height: 40px;
  614. background-color: #fff;
  615. cursor: pointer;
  616. }
  617. .edit {
  618. color: #fff;
  619. background-color: #dc3545;
  620. }
  621. }
  622. }
  623. </style>