simulationLibrary.vue 13 KB

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