Setting.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="view-setting" app-border dir-left>
  3. <div class="ui-title">初始场景</div>
  4. <div class="preview">
  5. <img v-if="info.firstScene" :src="info.firstScene.icon" alt="">
  6. <div class="tips" v-else>
  7. <i class="iconfont iconphotoview" style="font-size: 40px"></i>
  8. </div>
  9. </div>
  10. <div class="setinit" v-if="info.firstScene">
  11. <button class="ui-button" @click="deleteIndexInfo">删除场景</button>
  12. <button @click="showInitScene=true" class="ui-button submit" :class="{disable:false}">
  13. 修改场景
  14. </button>
  15. </div>
  16. <template v-else>
  17. <div class="setinit">
  18. <button style="width:100%" @click="showInitScene=true" class="ui-button submit" :class="{disable:false}">
  19. 设置初始场景
  20. </button>
  21. </div>
  22. <div class="ui-remark">初始场景为查看链接时进入的第一个场景,未设置时,不固定从某一场景打开</div>
  23. </template>
  24. <div class="dialog" style="z-index: 2000" v-if="showInitScene">
  25. <Select
  26. @cancle="showInitScene = false"
  27. :selected='info.firstScene'
  28. :title="'选择素材'"
  29. @submit="handleSelect"
  30. >
  31. </Select>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import { mapGetters } from "vuex";
  37. import Select from "@/components/select";
  38. export default {
  39. components:{Select},
  40. data(){
  41. return {
  42. showInitScene:false
  43. }
  44. },
  45. methods:{
  46. deleteIndexInfo(){
  47. this.$confirm({
  48. content: "是否删除?",
  49. ok: () => {
  50. this.info.firstScene = ''
  51. this.$store.commit("SetInfo", this.info);
  52. this.$msg.success('删除成功')
  53. }
  54. });
  55. },
  56. handleSelect(data){
  57. this.info.firstScene = data
  58. this.$store.commit("SetInfo", this.info);
  59. console.log(this.info.firstScene);
  60. this.showInitScene=false
  61. }
  62. },
  63. computed: {
  64. ...mapGetters({
  65. info: "info",
  66. backupInfo: "backupInfo"
  67. })
  68. },
  69. mounted(){
  70. }
  71. }
  72. </script>
  73. <style lang="less" scoped>
  74. .dialog {
  75. position: fixed;
  76. z-index: 30;
  77. left: 0;
  78. top: 0;
  79. width: 100%;
  80. height: 100%;
  81. background-color: rgba(0, 0, 0, 0.5);
  82. }
  83. .view-setting {
  84. padding: 10px;
  85. width: 100%;
  86. }
  87. .preview {
  88. width: 100%;
  89. height: 102px;
  90. overflow: hidden;
  91. >img{
  92. width: 100%;
  93. height: 100%;
  94. }
  95. }
  96. .setinit {
  97. width: 100%;
  98. margin: 15px 0;
  99. display: flex;
  100. justify-content: space-between;
  101. .ui-button {
  102. width: 48%;
  103. }
  104. }
  105. </style>