simulationLibrary.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. <template>
  2. <view class="s_container">
  3. <view class="s_content_container" v-if="bShow[0]">
  4. <view class="s_search">
  5. <img src="../../assets/home/search.png" class="s_search_img_logo" alt="">
  6. <input type="text" value="" class="s_search_input" placeholder="请输入搜索内容" />
  7. <button type="warn" size="mini" class="s_btn_search">搜索</button>
  8. </view>
  9. <view class="content">
  10. <view class="top-dispaly-block">
  11. <view class="top_content" v-for="(item,index) in allContentArr" :key="index">
  12. <img :src="item.Texture_Url" class="top_image" mode="" @click="viewDetail(index)"></img>
  13. </view>
  14. </view>
  15. <view class="s_content_block">
  16. <view class="s_img_title" v-text="'角色'"></view>
  17. <view class="s_img_image_block">
  18. <view class="s_img_content">
  19. <view class="s_image_block" v-for="(item,index) in charactorArr" :key="index">
  20. <img :src="item.Texture_Url" class="s_image" mode="" @click="viewDetail0(index)"></img>
  21. </view>
  22. </view>
  23. <img src="../../assets/home/left.png" class="v-left" alt="" @click="more0()">
  24. </view>
  25. </view>
  26. <view class="s_content_block">
  27. <view class="s_img_title" v-text="'场景'"></view>
  28. <view class="s_img_image_block">
  29. <view class="s_img_content">
  30. <view class="s_image_block" v-for="(item,index) in sceneArr" :key="index">
  31. <img :src="item.Texture_Url" class="s_image" mode="" @click="viewDetail1(index)"></img>
  32. </view>
  33. </view>
  34. <img src="../../assets/home/left.png" class="v-left" alt="" @click="more1()">
  35. </view>
  36. </view>
  37. <view class="s_content_block">
  38. <view class="s_img_title" v-text="'道具'"></view>
  39. <view class="s_img_image_block">
  40. <view class="s_img_content">
  41. <view class="s_image_block" v-for="(item,index) in itemArr" :key="index">
  42. <img :src="item.Texture_Url" class="s_image" mode="" @click="viewDetail2(index)"></img>
  43. </view>
  44. </view>
  45. <img src="../../assets/home/left.png" class="v-left" alt="" @click="more2()">
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="detail" v-if="bShow[1]">
  51. <view class="creator-info-block">
  52. <view class="firstLine">
  53. <img src="../../assets/login/loginPic3.png" class="avatar" alt="">
  54. <text class="creatorName">{{creatorName}}</text>
  55. </view>
  56. <view class="secondLine">
  57. <view class="secondLine-block1">
  58. <view class="Star"></view>
  59. <view class="CollectionAuth">收藏作者</view>
  60. </view>
  61. <view class="secondLine-block2"><text>联系作者</text></view>
  62. </view>
  63. <view class="detailBack" @click="detailBack()"><text>返回</text></view>
  64. </view>
  65. <view class="detail-block">
  66. <view class="DefaultDisplayImg-block">
  67. <!-- <image :src="imageUrl" mode="widthFix"></image> -->
  68. <img :src="imageUrl" mode="widthFix"></img>
  69. </view>
  70. <view class="Label-block">
  71. <text>作品名称:{{ItemName}}</text>
  72. <text>上传时间:{{uploadTime}}</text>
  73. <text @click="dowload()">下载</text>
  74. <!-- <text>学生互评</text> -->
  75. </view>
  76. </view>
  77. </view>
  78. <view class="more" v-if="bShow[2]">
  79. <view class="ListBack" @click="detailBack()"><text>返回</text></view>
  80. <view class="detail_image_block" v-for="(item,index) in detailArr" :key="index">
  81. <img :src="item.Texture_Url" class="detail_image" @click="viewDetail0(index)" :style="{left:`${index%3*400}rpx`,top:`${parseInt(index/3)*400+100}rpx`}" v-if="bShowImg[0]"></img>
  82. <img :src="item.Texture_Url" class="detail_image" @click="viewDetail1(index)" :style="{left:`${index%3*400}rpx`,top:`${parseInt(index/3)*400+100}rpx`}" v-if="bShowImg[1]"></img>
  83. <img :src="item.Texture_Url" class="detail_image" @click="viewDetail2(index)" :style="{left:`${index%3*400}rpx`,top:`${parseInt(index/3)*400+100}rpx`}" v-if="bShowImg[2]"></img>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. name: "simulationLibrary",
  91. data() {
  92. return {
  93. array: ['项目类型'],
  94. index: 0,
  95. // url: '/assets/home/homeBG.jpg',
  96. // imageUrl:require('../../assets/home/simulationLibrary/DefaultDisplayImg.png'),
  97. imageUrl:'',
  98. fbx_url:'',
  99. allContentArr:[],
  100. itemArr:[],
  101. charactorArr:[],
  102. sceneArr:[],
  103. bShow: [
  104. true, //normal
  105. false, //detail
  106. false, //more
  107. ],
  108. bShowImg:[
  109. false, //normal
  110. false, //detail
  111. false, //more
  112. ],
  113. detailArr:[],
  114. creatorName:"姓名",
  115. ItemName:'物品名',
  116. uploadTime:'上传时间',
  117. }
  118. },
  119. methods: {
  120. init() {
  121. //临时
  122. this.allContentArr.length = 0;
  123. this.itemArr.length = 0;
  124. this.charactorArr.length = 0;
  125. this.sceneArr.length = 0;
  126. uni.request({
  127. url: mydata_api + "/item/getitemlist",
  128. data: {
  129. "BeginNum" : 0, //第一个
  130. "EndNum" : 3, //最后一个
  131. "UserID": mydata_userInfo.UserID,
  132. "ItemType":"" //道具 角色 场景 空为全部
  133. },
  134. method: "POST",
  135. dataType: "json",
  136. success: res => {
  137. // console.log('res111111111=',res)
  138. this.allContentArr = res.data.Items;
  139. // let items = res.data.Items;
  140. console.log('全部=',res.data.Items)
  141. }
  142. })
  143. //道具
  144. uni.request({
  145. url: mydata_api + "/item/getitemlist",
  146. data: {
  147. "BeginNum" : 0, //第一个
  148. "EndNum" : 5, //最后一个
  149. "UserID": mydata_userInfo.UserID,
  150. "ItemType":"道具" //道具 角色 场景 空为全部
  151. },
  152. method: "POST",
  153. dataType: "json",
  154. success: res => {
  155. this.itemArr = res.data.Items;
  156. // let items = res.data.Items;
  157. // console.log('道具=',items)
  158. }
  159. })
  160. //角色
  161. uni.request({
  162. url: mydata_api + "/item/getitemlist",
  163. data: {
  164. "BeginNum" : 0, //第一个
  165. "EndNum" : 5, //最后一个
  166. "UserID": mydata_userInfo.UserID,
  167. "ItemType":"角色" //道具 角色 场景 空为全部
  168. },
  169. method: "POST",
  170. dataType: "json",
  171. success: res => {
  172. this.charactorArr = res.data.Items;
  173. // let items = res.data.Items;
  174. // console.log('角色=',items)
  175. }
  176. })
  177. //场景
  178. uni.request({
  179. url: mydata_api + "/item/getitemlist",
  180. data: {
  181. "BeginNum" : 0, //第一个
  182. "EndNum" : 5, //最后一个
  183. "UserID": mydata_userInfo.UserID,
  184. "ItemType":"场景" //道具 角色 场景 空为全部
  185. },
  186. method: "POST",
  187. dataType: "json",
  188. success: res => {
  189. this.sceneArr = res.data.Items;
  190. }
  191. })
  192. },
  193. // previewImage(url){
  194. // uni.downloadFile({
  195. // url:url,
  196. // success: (res) => {
  197. // if (res.statusCode === 200) {
  198. // uni.openDocument({
  199. // filePath: res.tempFilePath,
  200. // // 如果文件名包含中文,建议使用escape(res.tempFilePath)转码,防止ios和安卓客户端导致的差异
  201. // success: function(res) {
  202. // console.log('打开文档成功');
  203. // }
  204. // });
  205. // }
  206. // },
  207. // });
  208. // },
  209. viewDetail(e) {
  210. let index = parseInt(e);
  211. let aItem = this.allContentArr[index];
  212. console.log('aItem=',aItem)
  213. if(aItem)
  214. {
  215. this.imageUrl = aItem.Texture_Url;
  216. this.bShow = [
  217. false, //normal
  218. true, //detail
  219. false, //more
  220. ]
  221. this.creatorName = aItem.CreateUserName;
  222. this.ItemName = aItem.Name;
  223. this.uploadTime = aItem.UploadTime;
  224. this.fbx_url = aItem.Fbx_Url;
  225. }
  226. },
  227. viewDetail0(e) {
  228. let index = parseInt(e);
  229. let aItem = this.charactorArr[index];
  230. if(aItem)
  231. {
  232. this.imageUrl = aItem.Texture_Url;
  233. this.bShow = [
  234. false, //normal
  235. true, //detail
  236. false, //more
  237. ]
  238. this.creatorName=aItem.CreateUserName;
  239. this.ItemName = aItem.Name;
  240. this.uploadTime = aItem.UploadTime;
  241. this.fbx_url = aItem.Fbx_Url;
  242. }
  243. },
  244. viewDetail1(e) {
  245. let index = parseInt(e);
  246. let aItem = this.sceneArr[index];
  247. if(aItem)
  248. {
  249. this.imageUrl = aItem.Texture_Url;
  250. this.bShow = [
  251. false, //normal
  252. true, //detail
  253. false, //more
  254. ]
  255. this.creatorName=aItem.CreateUserName;
  256. this.ItemName = aItem.Name;
  257. this.uploadTime = aItem.UploadTime;
  258. this.fbx_url = aItem.Fbx_Url;
  259. }
  260. },
  261. viewDetail2(e) {
  262. let index = parseInt(e);
  263. let aItem = this.itemArr[index];
  264. if(aItem)
  265. {
  266. this.imageUrl = aItem.Texture_Url;
  267. this.bShow = [
  268. false, //normal
  269. true, //detail
  270. false, //more
  271. ]
  272. this.creatorName=aItem.CreateUserName;
  273. this.ItemName = aItem.Name;
  274. this.uploadTime = aItem.UploadTime;
  275. this.fbx_url = aItem.Fbx_Url;
  276. }
  277. },
  278. more0(){
  279. this.bShow = [
  280. false, //normal
  281. false, //detail
  282. true, //more
  283. ]
  284. this.bShowImg = [
  285. true, //normal
  286. false, //detail
  287. false, //more
  288. ]
  289. this.detailArr=this.charactorArr;//.itemArr;
  290. },
  291. more1(){
  292. this.bShow = [
  293. false, //normal
  294. false, //detail
  295. true, //more
  296. ]
  297. this.bShowImg = [
  298. false, //normal
  299. true, //detail
  300. false, //more
  301. ]
  302. this.detailArr=this.sceneArr;//charactorArr;
  303. },
  304. more2(){
  305. this.bShow = [
  306. false, //normal
  307. false, //detail
  308. true, //more
  309. ]
  310. this.bShowImg = [
  311. false, //normal
  312. false, //detail
  313. true, //more
  314. ]
  315. this.detailArr=this.itemArr;
  316. console.log('this.detailArr=',this.detailArr);
  317. },
  318. detailBack(){
  319. this.bShow = [
  320. true, //normal
  321. false, //detail
  322. false, //more
  323. ]
  324. },
  325. dowload() {
  326. window.location.href = this.fbx_url;
  327. }
  328. // preview(e) {
  329. // let index = parseInt(e);
  330. // console.log('index=',typeof(index),'=',index);
  331. // if(this.allContentArr[index])
  332. // {
  333. // // console.log('this.allContentArr[index]=',this.allContentArr[index]);
  334. // console.log('src=',this.allContentArr[index].src);
  335. // this.previewImage(this.allContentArr[index].src);
  336. // }
  337. // },
  338. // dowload(e) {
  339. // let index = parseInt(e);
  340. // console.log('index=',typeof(index),'=',index);
  341. // if(this.allContentArr[index])
  342. // {
  343. // console.log('fbx=',this.allContentArr[index].fbx);
  344. // window.location.href = this.allContentArr[index].fbx;
  345. // }
  346. // },
  347. }
  348. }
  349. </script>
  350. <style scoped>
  351. .s_container {
  352. width: 100%;
  353. height: 100%;
  354. display: flex;
  355. justify-content: center;
  356. align-items:center;
  357. flex-direction: column;
  358. background-color: #fff;
  359. }
  360. .s_content_container {
  361. width: 96%;
  362. height: 96%;
  363. display: flex;
  364. justify-content: center;
  365. align-items:center;
  366. flex-direction: column;
  367. border-bottom: 3rpx solid #D7D7D7;
  368. }
  369. .s_search {
  370. width: 100%;
  371. height: 3%;
  372. margin-top: 3%;
  373. display: flex;
  374. justify-content: space-between;
  375. align-items:center;
  376. flex-direction: row;
  377. }
  378. .s_search_img_logo{
  379. height: 100%;
  380. margin-right: 1%;
  381. }
  382. .s_search_input {
  383. width: 100%;
  384. height: 100%;
  385. border-radius: 10rpx;
  386. font-size: 20rpx;
  387. border: 2rpx solid #DDDDDD;
  388. }
  389. .s_btn_search {
  390. width: 130rpx;
  391. height: 100%;
  392. line-height: 80rpx;
  393. margin-left: 1%;
  394. }
  395. .content{
  396. width: 100%;
  397. height: 100%;
  398. display: flex;
  399. justify-content: center;
  400. align-items:center;
  401. flex-direction: column;
  402. margin-top: 1%;
  403. margin-bottom: 1%;
  404. }
  405. .top-dispaly-block {
  406. width: 100%;
  407. height: 30%;
  408. display: flex;
  409. justify-content: space-between;
  410. align-items:center;
  411. flex-direction: row;
  412. border-bottom: 3rpx solid #D7D7D7;
  413. }
  414. .top_content {
  415. width: 30%;
  416. height: 90%;
  417. display: flex;
  418. justify-content: center;
  419. align-items:center;
  420. margin-right: 1%;
  421. }
  422. .top_image{
  423. width: 100%;
  424. height: 100%;
  425. }
  426. .s_content_block {
  427. width: 100%;
  428. height: 20%;
  429. margin-bottom: 3%;
  430. display: flex;
  431. justify-content: center;
  432. align-items:center;
  433. flex-direction: column;
  434. /* border: 1rpx solid #ff0000; */
  435. }
  436. .s_img_title {
  437. width: 100%;
  438. font-size: 36rpx;
  439. line-height: 200rpx;
  440. font-weight: bold;
  441. display: flex;
  442. justify-content: left;
  443. align-items:center;
  444. flex-direction: row;
  445. }
  446. .s_img_image_block {
  447. width: 100%;
  448. height: 100%;
  449. display: flex;
  450. justify-content: space-around;
  451. align-items:center;
  452. flex-direction: row;
  453. }
  454. .s_img_content {
  455. width: 100%;
  456. display: flex;
  457. justify-content: left;
  458. align-items:center;
  459. flex-direction: row;
  460. }
  461. .s_image_block{
  462. margin-right: 1%;
  463. /* border: 1rpx solid #ff0000; */
  464. }
  465. .s_image {
  466. width: 350rpx;
  467. height: 350rpx;
  468. /* border: 1rpx solid #ff0000; */
  469. }
  470. .v-left {
  471. width: 25rpx;
  472. height: 50rpx;
  473. }
  474. .detail{
  475. position: absolute;
  476. width: 100%;
  477. height: 100%;
  478. background-color: #FFFFFF;
  479. display: flex;
  480. justify-content: space-between;
  481. align-items:center;
  482. flex-direction: row;
  483. /* border: 1rpx solid #ff0000; */
  484. }
  485. .detailBack{
  486. width: 100%;
  487. height: 3%;
  488. display: flex;
  489. justify-content: center;
  490. align-items:center;
  491. margin-top:60%;
  492. /* border: 1rpx solid #000000; */
  493. }
  494. .detailBack text{
  495. width: 30%;
  496. height: 100%;
  497. display: flex;
  498. justify-content: center;
  499. align-items:center;
  500. border: 1rpx solid #000000;
  501. }
  502. .creator-info-block{
  503. width: 30%;
  504. height: 100%;
  505. /* border: 1rpx solid #ff0000; */
  506. }
  507. .firstLine{
  508. height: 8%;
  509. margin-left: 10%;
  510. margin-top: 30%;
  511. display: flex;
  512. justify-content: flex-start;
  513. align-items:center;
  514. flex-direction: row;
  515. /* border: 1rpx solid #ff0000; */
  516. }
  517. .avatar{
  518. }
  519. .creatorName{
  520. font-size: 50rpx;
  521. color: #A27452;
  522. margin-left: 5%;
  523. /* border: 1rpx solid #ff0000; */
  524. }
  525. .secondLine{
  526. height: 4%;
  527. margin-left: 10%;
  528. margin-top: 10%;
  529. display: flex;
  530. justify-content: space-between;
  531. align-items:center;
  532. flex-direction: row;
  533. /* border: 1rpx solid #ff0000; */
  534. }
  535. .secondLine-block1{
  536. background-image:url( "../../assets/home/simulationLibrary/Bg.png");
  537. background-size: 90% 90%;
  538. background-repeat: no-repeat;
  539. width:48%;
  540. height: 100%;
  541. display: flex;
  542. justify-content: space-between;
  543. align-items:center;
  544. flex-direction: row;
  545. /* border: 1rpx solid #000000; */
  546. }
  547. .Star{
  548. background-image:url( "../../assets/home/simulationLibrary/Start.png");
  549. background-size: 99% 99%;
  550. background-repeat: no-repeat;
  551. display: flex;
  552. justify-content: center;
  553. align-items:center;
  554. width:10%;
  555. height: 50%;
  556. margin-left: 10%;
  557. margin-bottom: 2%;
  558. /* border: 1rpx solid #000000; */
  559. }
  560. .CollectionAuth{
  561. color: #000000;
  562. font-size: 30rpx;
  563. width:80%;
  564. height: 80%;
  565. display: flex;
  566. justify-content: center;
  567. align-items:center;
  568. margin-right: 1%;
  569. margin-bottom: 2%;
  570. /* border: 1rpx solid #000000; */
  571. }
  572. .secondLine-block2{
  573. background-image:url( "../../assets/home/simulationLibrary/Block2.png");
  574. background-size: 90% 90%;
  575. background-repeat: no-repeat;
  576. width:48%;
  577. height: 100%;
  578. display: flex;
  579. justify-content: center;
  580. align-items:center;
  581. color: #000000;
  582. font-size: 30rpx;
  583. /* border: 1rpx solid #000000; */
  584. }
  585. .secondLine-block2 text{
  586. margin-right: 10%;
  587. margin-bottom: 1%;
  588. color: #000000;
  589. font-size: 30rpx;
  590. /* border: 1rpx solid #000000; */
  591. }
  592. .detail-block{
  593. width: 70%;
  594. height: 100%;
  595. display: flex;
  596. justify-content: center;
  597. align-items:center;
  598. flex-direction: column;
  599. border: 1rpx solid #000000;
  600. }
  601. .DefaultDisplayImg-block{
  602. width: 90%;
  603. height: 100%;
  604. display: flex;
  605. justify-content: center;
  606. align-items:center;
  607. margin-top: 20%;
  608. margin-bottom: 5%;
  609. /* border: 1rpx solid #ff0000; */
  610. }
  611. .DefaultDisplayImg-block image{
  612. width: 100%;
  613. /* height: 80%; */
  614. }
  615. .Label-block{
  616. width:70%;
  617. height:10%;
  618. display: flex;
  619. justify-content: space-between;
  620. align-items:center;
  621. flex-direction: row;
  622. margin-bottom: 10%;
  623. /* border: 1rpx solid #ff0000; */
  624. }
  625. .more{
  626. position: absolute;
  627. width: 80%;
  628. height: 80%;
  629. /* background-color: #000000; */
  630. /* background-color: #FFFFFF; */
  631. /* display: flex;
  632. justify-content: space-between;
  633. align-items:center;
  634. flex-direction: column; */
  635. /* border: 1rpx solid #ff0000; */
  636. }
  637. .detail_image_block{
  638. width:30%;
  639. /* height:90%; */
  640. /* display: flex;
  641. justify-content: space-between;
  642. align-items:center;
  643. flex-direction: row; */
  644. /* border: 1rpx solid #ff0000; */
  645. }
  646. .detail_image{
  647. position: absolute;
  648. width: 350rpx;
  649. height: 350rpx;
  650. }
  651. .ListBack{
  652. width: 5%;
  653. height: 3%;
  654. display: flex;
  655. justify-content: center;
  656. align-items:center;
  657. margin-bottom: 5%;
  658. border: 1rpx solid #000000;
  659. }
  660. </style>