simulationLibrary.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. <template>
  2. <view class="s_container">
  3. <!-- <image src="../../assets/home/simulationLibrary/topImg.png" class="s_logo" mode=""></image> -->
  4. <view class="s_content_container">
  5. <view class="s_search" style="">
  6. <view class="" style="position: relative;width: 100%;">
  7. <img src="../../assets/home/search.png" class="s_search_img_input" alt="">
  8. <input type="text" value="" class="s_search_input" style="width: 96%;" placeholder="请输入搜索内容" />
  9. </view>
  10. <button type="warn" size="mini" class="s_btn_search">搜索</button>
  11. </view>
  12. <!-- <view class="s_search_condition">
  13. <view class="uni-list">
  14. <view class="uni-list-cell">
  15. <view class="uni-list-cell-db">
  16. <picker @change="bindPickerChange" :value="index" :range="array">
  17. <view class="uni-input">{{array[index]}}</view>
  18. </picker>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="uni-list">
  23. <view class="uni-list-cell">
  24. <view class="uni-list-cell-db">
  25. <picker @change="bindPickerChange" :value="index" :range="array">
  26. <view class="uni-input">{{array[index]}}</view>
  27. </picker>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="uni-list">
  32. <view class="uni-list-cell">
  33. <view class="uni-list-cell-db">
  34. <picker @change="bindPickerChange" :value="index" :range="array">
  35. <view class="uni-input">{{array[index]}}</view>
  36. </picker>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="uni-list">
  41. <view class="uni-list-cell">
  42. <view class="uni-list-cell-db">
  43. <picker @change="bindPickerChange" :value="index" :range="array">
  44. <view class="uni-input">{{array[index]}}</view>
  45. </picker>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="uni-list">
  50. <view class="uni-list-cell">
  51. <view class="uni-list-cell-db">
  52. <picker @change="bindPickerChange" :value="index" :range="array">
  53. <view class="uni-input">{{array[index]}}</view>
  54. </picker>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="uni-list">
  59. <view class="uni-list-cell">
  60. <view class="uni-list-cell-db">
  61. <picker @change="bindPickerChange" :value="index" :range="array">
  62. <view class="uni-input">{{array[index]}}</view>
  63. </picker>
  64. </view>
  65. </view>
  66. </view>
  67. </view> -->
  68. <view class="s_search_img">
  69. <view class="s_img_left">
  70. <view class="s_top_img">
  71. <view class="s_top_content" v-for="(item,index) in allContentArr" :key="index">
  72. <img :src="item.src" class="ab_image" mode="" @click="change(index)"></img>
  73. <view class="s_operation" v-show="index==act">
  74. <text>{{item.name}}</text>
  75. <view>
  76. <img src="../../assets/home/find.png" @click="preview(index)">
  77. <img src="../../assets/home/dowload.png" alt="" @click="dowload(index)">
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="s_img">
  83. <view class="s_img_title" v-text="'角色'"></view>
  84. <view class="s_img_image">
  85. <view class="s_img_content" v-for="(item,index) in charactorArr" :key="index">
  86. <img :src="item.src" class="s_image" mode="" @click="change2(index)"></img>
  87. <view class="s_operation" v-show="index==act2">
  88. <text>{{item.name}}</text>
  89. <view>
  90. <img src="../../assets/home/find.png" alt="" @click="preview2(index)">
  91. <img src="../../assets/home/dowload.png" alt="" @click="dowload2(index)">
  92. </view>
  93. </view>
  94. </view>
  95. <img src="../../assets/home/left.png" class="v-left" alt="">
  96. </view>
  97. </view>
  98. <view class="s_img">
  99. <view class="s_img_title" v-text="'场景'"></view>
  100. <view class="s_img_image">
  101. <view class="s_img_content" v-for="(item,index) in sceneArr" :key="index">
  102. <img :src="item.src" class="s_image" mode="" @click="change3(index)"></img>
  103. <view class="s_operation" v-show="index==act3">
  104. <text>{{item.name}}</text>
  105. <view>
  106. <img src="../../assets/home/find.png" alt="" @click="preview3(index)">
  107. <img src="../../assets/home/dowload.png" alt="" @click="dowload3(index)">
  108. </view>
  109. </view>
  110. </view>
  111. <img src="../../assets/home/left.png" class="v-left" alt="">
  112. </view>
  113. </view>
  114. <view class="s_img s_img_1">
  115. <view class="s_img_title" v-text="'道具'"></view>
  116. <view class="s_img_image">
  117. <view class="s_img_content" v-for="(item,index) in itemArr" :key="index">
  118. <img :src="item.src" class="s_image" mode="" @click="change1(index)"></img>
  119. <view class="s_operation" v-show="index==act1">
  120. <text>{{item.name}}</text>
  121. <view>
  122. <img src="../../assets/home/find.png" alt="" @click="preview1(index)">
  123. <img src="../../assets/home/dowload.png" alt="" @click="dowload1(index)">
  124. </view>
  125. </view>
  126. </view>
  127. <img src="../../assets/home/left.png" class="v-left" alt="">
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="s_footer" style="text-align: center;padding: 80rpx;">
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. export default {
  139. name: "simulationLibrary",
  140. data() {
  141. return {
  142. act: -1,
  143. act1: -1,
  144. act2: -1,
  145. act3: -1,
  146. array: ['项目类型'],
  147. index: 0,
  148. url: '/assets/home/homeBG.jpg',
  149. allContentArr:[],
  150. itemArr:[],
  151. charactorArr:[],
  152. sceneArr:[],
  153. }
  154. },
  155. methods: {
  156. init() {
  157. //临时
  158. this.allContentArr.length = 0;
  159. this.itemArr.length = 0;
  160. this.charactorArr.length = 0;
  161. this.sceneArr.length = 0;
  162. for(let i=1;i<3+1;i++){
  163. let data = {};
  164. data.src = require("../../assets/library/big/"+i+".png");
  165. data.name = 'name';
  166. data.fbx = 'www.baidu.com';
  167. this.allContentArr.push(data);
  168. }
  169. for(let i=1;i<6+1;i++){
  170. let data = {};
  171. // data.src = '../../assets/library/item/'+i+'.png';
  172. data.src = require("../../assets/library/item/"+i+".png");
  173. data.name = 'name';
  174. data.fbx = 'www.baidu.com';
  175. this.itemArr.push(data);
  176. }
  177. for(let i=1;i<6+1;i++){
  178. let data = {};
  179. // data.src = '../../assets/library/charactor/'+i+'.png';
  180. data.src = require("../../assets/library/charactor/"+i+".png");
  181. data.name = 'name';
  182. data.fbx = 'www.baidu.com';
  183. this.charactorArr.push(data);
  184. }
  185. for(let i=1;i<6+1;i++){
  186. let data = {};
  187. // data.src = '../../assets/library/scene/'+i+'.png';
  188. data.src = require("../../assets/library/scene/"+i+".png");
  189. data.name = 'name';
  190. data.fbx = 'www.baidu.com';
  191. this.sceneArr.push(data);
  192. }
  193. return;
  194. console.log('simulationLibrary=',mydata_userInfo.UserID)
  195. uni.request({
  196. url: mydata_api + "/item/getitemlist",
  197. data: {
  198. "BeginNum" : 0, //第一个
  199. "EndNum" : 3, //最后一个
  200. "UserID": mydata_userInfo.UserID,
  201. "ItemType":"" //道具 角色 场景 空为全部
  202. },
  203. method: "POST",
  204. dataType: "json",
  205. success: res => {
  206. // console.log('res=',res)
  207. let items = res.data.Items;
  208. console.log('全部=',items)
  209. items.forEach(item=>{
  210. let data = {};
  211. data.src = item.Texture_Url;
  212. data.name = item.Name;
  213. data.fbx = item.Fbx_Url;
  214. this.allContentArr.push(data);
  215. });
  216. }
  217. })
  218. //道具
  219. uni.request({
  220. url: mydata_api + "/item/getitemlist",
  221. data: {
  222. "BeginNum" : 0, //第一个
  223. "EndNum" : 5, //最后一个
  224. "UserID": mydata_userInfo.UserID,
  225. "ItemType":"道具" //道具 角色 场景 空为全部
  226. },
  227. method: "POST",
  228. dataType: "json",
  229. success: res => {
  230. let items = res.data.Items;
  231. console.log('道具=',items)
  232. items.forEach(item=>{
  233. let data = {};
  234. data.src = item.Texture_Url;
  235. data.name = item.Name;
  236. data.fbx = item.Fbx_Url;
  237. this.itemArr.push(data);
  238. });
  239. }
  240. })
  241. //角色
  242. uni.request({
  243. url: mydata_api + "/item/getitemlist",
  244. data: {
  245. "BeginNum" : 0, //第一个
  246. "EndNum" : 5, //最后一个
  247. "UserID": mydata_userInfo.UserID,
  248. "ItemType":"角色" //道具 角色 场景 空为全部
  249. },
  250. method: "POST",
  251. dataType: "json",
  252. success: res => {
  253. let items = res.data.Items;
  254. console.log('角色=',items)
  255. items.forEach(item=>{
  256. let data = {};
  257. data.src = item.Texture_Url;
  258. data.name = item.Name;
  259. data.fbx = item.Fbx_Url;
  260. this.charactorArr.push(data);
  261. });
  262. }
  263. })
  264. //场景
  265. uni.request({
  266. url: mydata_api + "/item/getitemlist",
  267. data: {
  268. "BeginNum" : 0, //第一个
  269. "EndNum" : 5, //最后一个
  270. "UserID": mydata_userInfo.UserID,
  271. "ItemType":"场景" //道具 角色 场景 空为全部
  272. },
  273. method: "POST",
  274. dataType: "json",
  275. success: res => {
  276. let items = res.data.Items;
  277. console.log('场景=',items)
  278. items.forEach(item=>{
  279. let data = {};
  280. data.src = item.Texture_Url;
  281. data.name = item.Name;
  282. data.fbx = item.Fbx_Url;
  283. this.sceneArr.push(data);
  284. });
  285. }
  286. })
  287. },
  288. previewImage(url){
  289. uni.downloadFile({
  290. url:url,
  291. success: (res) => {
  292. if (res.statusCode === 200) {
  293. uni.openDocument({
  294. filePath: res.tempFilePath,
  295. // 如果文件名包含中文,建议使用escape(res.tempFilePath)转码,防止ios和安卓客户端导致的差异
  296. success: function(res) {
  297. console.log('打开文档成功');
  298. }
  299. });
  300. }
  301. },
  302. });
  303. },
  304. bindPickerChange(e) {
  305. this.index = e.target.value
  306. },
  307. change(e) {
  308. if (this.act == e) {
  309. this.act = -1;
  310. } else {
  311. this.act = e;
  312. }
  313. },
  314. change1(e) {
  315. if (this.act1 == e) {
  316. this.act1 = -1;
  317. } else {
  318. this.act1 = e;
  319. }
  320. },
  321. change2(e) {
  322. if (this.act2 == e) {
  323. this.act2 = -1;
  324. } else {
  325. this.act2 = e;
  326. }
  327. },
  328. change3(e) {
  329. if (this.act3 == e) {
  330. this.act3 = -1;
  331. } else {
  332. this.act3 = e;
  333. }
  334. },
  335. preview(e) {
  336. // allContentArr:[],
  337. // itemArr:[],
  338. // charactorArr:[],
  339. // sceneArr:[],
  340. // console.log('this.allContentArr=',this.allContentArr);
  341. // console.log('typeof(e)=',typeof(e),'=',e);
  342. let index = parseInt(e);
  343. console.log('index=',typeof(index),'=',index);
  344. if(this.allContentArr[index])
  345. {
  346. // console.log('this.allContentArr[index]=',this.allContentArr[index]);
  347. console.log('src=',this.allContentArr[index].src);
  348. this.previewImage(this.allContentArr[index].src);
  349. }
  350. },
  351. dowload(e) {
  352. let index = parseInt(e);
  353. console.log('index=',typeof(index),'=',index);
  354. if(this.allContentArr[index])
  355. {
  356. console.log('fbx=',this.allContentArr[index].fbx);
  357. window.location.href = this.allContentArr[index].fbx;
  358. }
  359. },
  360. preview1(e) {
  361. },
  362. dowload1(e) {
  363. },
  364. preview2(e) {
  365. },
  366. dowload2(e) {
  367. },
  368. preview3(e) {
  369. },
  370. dowload3(e) {
  371. }
  372. }
  373. }
  374. </script>
  375. <style scoped>
  376. .s_container {
  377. width: 100%;
  378. height: 100%;
  379. background-color: #fff;
  380. }
  381. .s_logo {
  382. width: 100%;
  383. height: 400rpx;
  384. }
  385. .m_btn_download {
  386. height: 80rpx;
  387. line-height: 80rpx;
  388. padding: 0 70rpx;
  389. background: #EA252C;
  390. color: #fff;
  391. font-family: MicrosoftYaHei;
  392. }
  393. .s_search {
  394. display: flex;
  395. justify-content: space-between;
  396. }
  397. .s_search_input {
  398. border: 2rpx solid #DDDDDD;
  399. width: 100%;
  400. height: 80rpx;
  401. line-height: 80rpx;
  402. padding: 0 60rpx;
  403. border-radius: 10rpx;
  404. font-size: 20rpx;
  405. }
  406. .s_content_container {
  407. padding: 40rpx 100rpx;
  408. }
  409. .s_btn_search {
  410. width: 130rpx;
  411. height: 80rpx;
  412. line-height: 80rpx;
  413. margin-left: 20rpx;
  414. }
  415. .s_search_condition {
  416. background-color: #F9F9F9;
  417. margin-top: 40rpx;
  418. height: 100rpx;
  419. width: 100%;
  420. }
  421. .m_select {
  422. width: 300rpx;
  423. line-height: 80rpx;
  424. }
  425. .uni-list-cell-db {
  426. width: 300rpx;
  427. // height: 100rpx;
  428. line-height: 100rpx;
  429. }
  430. .uni-selector-select .uni-picker-item.selected {
  431. color: red;
  432. }
  433. .uni-input {
  434. text-align: center;
  435. }
  436. .s_search_condition {
  437. display: flex;
  438. justify-items: start;
  439. }
  440. .uni-list {
  441. position: relative;
  442. }
  443. .uni-list::after {
  444. content: url(../../assets/learning/icon_ylrz_arrow.png);
  445. position: absolute;
  446. right: 0;
  447. top: 50%;
  448. transform: translateY(-50%);
  449. }
  450. .s_image_text {
  451. margin-left: 20rpx;
  452. }
  453. .s_top_img {
  454. display: flex;
  455. justify-content: space-between;
  456. padding-bottom: 80rpx;
  457. border-bottom: 3rpx solid #D7D7D7;
  458. }
  459. .s_top_content {
  460. margin-top: 40rpx;
  461. width: 30%;
  462. position: relative;
  463. }
  464. .s_top_image {
  465. width: 100%;
  466. }
  467. .s_top_title {
  468. color: #fff;
  469. position: absolute;
  470. bottom: 40rpx;
  471. font-size: 2.0rem;
  472. line-height: 100rpx;
  473. font-weight: 500;
  474. width: 100%;
  475. text-align: left;
  476. margin-left: 50rpx;
  477. }
  478. .s_img_title {
  479. font-size: 36rpx;
  480. line-height: 200rpx;
  481. font-weight: bold;
  482. }
  483. /* .s_top_image {
  484. width: 400rpx;
  485. } */
  486. .s_img_image {
  487. display: flex;
  488. position: relative;
  489. }
  490. /* .s_image {
  491. margin-right: 40rpx; */
  492. /* height: 550rpx; */
  493. /* } */
  494. .s_img_1 {
  495. padding-bottom: 80rpx;
  496. border-bottom: 3rpx solid #D7D7D7;
  497. }
  498. .s_img_left {
  499. padding-right: 130rpx;
  500. }
  501. .s_img_content {
  502. position: relative;
  503. padding: 10rpx;
  504. /* display: flex; */
  505. /* justify-content: left; */
  506. /* justify-items: center; */
  507. }
  508. .ab_image{
  509. width: 100%;
  510. height: 100%;
  511. }
  512. .s_image {
  513. /* width: 100%;
  514. height: 100%; */
  515. width: 350rpx;
  516. height: 350rpx;
  517. }
  518. .s_operation {
  519. /* position: absolute;
  520. bottom: -10rpx;
  521. left: 0;
  522. width: 100%; */
  523. margin-top: 30rpx;
  524. display: flex;
  525. justify-content: space-between;
  526. /* margin-right: 40rpx; */
  527. background-color: #dbd9d9;
  528. padding: 10rpx 20rpx;
  529. border-radius: 10rpx;
  530. }
  531. .s_operation img {
  532. margin-left: 20rpx;
  533. }
  534. .v-left {
  535. position: absolute;
  536. width: 25rpx;
  537. height: 50rpx;
  538. right: -100rpx;
  539. top: 50%;
  540. transform: translateY(-50%);
  541. }
  542. .s_search_img_input {
  543. position: absolute;
  544. left: 20rpx;
  545. top: 50%;
  546. width: 30rpx;
  547. transform: translateY(-50%);
  548. }
  549. /* img{
  550. width: 100%;
  551. } */
  552. </style>