index.blade.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. @extends('layouts.base')
  2. @section('content')
  3. @include('public.admin.uploadMultimediaImg')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <style>
  6. .upload-box {
  7. flex-direction: column;
  8. position: relative;
  9. }
  10. .tips {
  11. color: #8f8f8f;
  12. }
  13. </style>
  14. <div id="app">
  15. <div class="all">
  16. <div class="vue-head">
  17. <div class="vue-main-title">
  18. <div class="vue-main-title-left"></div>
  19. <div class="vue-main-title-content">分享设置</div>
  20. </div>
  21. <div style="padding: 30px 500px 100px 150px">
  22. <el-form ref="form" :model="form" label-width="10%">
  23. <el-form-item label="分享标题">
  24. <el-input v-model="form.title" placeholder="请输入"></el-input>
  25. <div class="tips">不填写默认商城名称</div>
  26. </el-form-item>
  27. <el-form-item label="分享图标">
  28. <div class="upload-box" @click="upload('1')" :style="[{backgroundImage:form.icon? `url(${form.icon})`:''},{backgroundSize: '100% 100%'}]">
  29. <i class="el-icon-plus" style="font-size:32px" v-if="!form.icon"></i>
  30. <i class="el-icon-error" style=" position: absolute; right: 0;top: 0px;cursor: pointer;" @click="deletePicture" v-else></i>
  31. <div style=" width: 100%;
  32. text-align: center;
  33. margin-top: 0px;
  34. position: relative;
  35. background-color: #333333c2;
  36. color: #ffffff;" :style="{top: !form.icon ? '39px' : '55px' }">点击上传照片</div>
  37. </div>
  38. </el-form-item>
  39. <el-form-item label="分享描述">
  40. <el-input type="textarea" :rows="4" placeholder="请输入内容" v-model="form.desc">
  41. </el-input>
  42. </el-form-item>
  43. </el-form>
  44. </div>
  45. </div>
  46. <div class="vue-page">
  47. <div class="vue-center">
  48. <el-button type="primary" @click.native.prevent="onSubmit">提交
  49. </el-button>
  50. </div>
  51. </div>
  52. </div>
  53. <upload-multimedia-img :upload-show="uploadShow" @sure="sure" :type="uploadType" @replace="replace"></upload-multimedia-img>
  54. </div>
  55. <script>
  56. var app = new Vue({
  57. el: '#app',
  58. delimiters: ['[[', ']]'],
  59. data() {
  60. return {
  61. form: {
  62. title: '',
  63. icon:'',
  64. desc:''
  65. },
  66. uploadType: '',
  67. uploadShow: false
  68. }
  69. },
  70. mounted() {
  71. },
  72. methods: {
  73. onSubmit() {
  74. this.$http.post("{!! yzWebFullUrl('plugin.material-center.admin.set.save') !!}", {
  75. set: {
  76. ...this.form
  77. }
  78. }).then(res => {
  79. if (res.data.result) {
  80. this.$message.success(res.data.msg);
  81. this.getData()
  82. } else {
  83. this.$message.error(res.data.msg);
  84. }
  85. })
  86. },
  87. sure(name, uploadShow, imgUrl) {
  88. this.uploadShow = false
  89. this.form.icon = imgUrl[0].url
  90. },
  91. upload(type) {
  92. this.uploadType = type
  93. this.uploadShow = true
  94. },
  95. replace() {
  96. this.uploadShow = false
  97. },
  98. deletePicture(event){
  99. event.stopPropagation()
  100. this.form.icon = ''
  101. },
  102. getData(){
  103. this.$http.post("{!! yzWebFullUrl('plugin.material-center.admin.set.index') !!}" ,{
  104. }).then(res => {
  105. if (res.data.result) {
  106. this.form = {...res.data.data.set}
  107. } else {
  108. this.$message.error(res.data.msg);
  109. }
  110. })
  111. }
  112. },
  113. created(){
  114. this.getData()
  115. }
  116. });
  117. </script>
  118. @endsection