quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<template>
  <!--
          作者:luoyiming
          时间:2019-10-24
          描述:设置引导收藏
      -->
  <div class="attention">
    <div class="attention-left"><img :src="mobile_url" alt="" /></div>
    <div class="attention-right">
      <div class="alert-warning">
        <div class="alert-icon"><span class="icon iconfont icon-gantanhao"></span></div>
        <span class="alert-desc"><div>1.新用户首次进入小程序的时候才会显示如图所示的弹窗提示,只显示一次!</div></span>
      </div>
      <el-form ref="form" size="small" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="引导收藏" prop="status"><el-switch v-model="form.status"></el-switch></el-form-item>
        <!--提交-->
        <div class="common-button-wrapper"><el-button type="primary" @click="onSubmit" :loading="loading">提交</el-button></div>
      </el-form>
    </div>
  </div>
</template>
 
<script>
import mobile from '@/assets/img/guidcollection.png';
import CollectionApi from '@/api/collection.js';
export default {
  data() {
    return {
      /*手机图像*/
      mobile_url: mobile,
      form: {
        status: 0
      },
      Data: [],
      loading: false
    };
  },
  created() {
    /*获取数据*/
    this.getData();
  },
  methods: {
    /*获取当前数据*/
    getData() {
      let self = this;
      let Params = {};
      CollectionApi.getData(Params, true)
        .then(data => {
          self.loading = false;
          if(data.data.vars.values.status=='1'){
            self.form.status = true;
          }else{
            self.form.status = false;
          }
          self.form.app_id = data.data.app_id;
        })
        .catch(error => {});
    },
    onSubmit() {
      let self = this;
      let params={};
      if(self.form.status){
        params.status=1;
      }else{
        params.status=0;
      }
      self.loading = true;
      CollectionApi.saveData(params, true)
        .then(data => {
          self.loading = false;
          if (data.code == 1) {
            self.$message({
              message: '恭喜你,保存成功',
              type: 'success'
            });
            self.getData();
          } else {
            self.loading = false;
          }
        })
        .catch(error => {
          self.loading = false;
        });
    }
  }
};
</script>
 
<style>
.attention {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}
.attention-left {
  width: 375px;
  margin-right: 30px;
}
.attention-right .alert-warning {
  position: relative;
  padding: 16px 16px 16px 69px;
  border-radius: 6px;
  margin-bottom: 10px;
  color: #495060;
  line-height: 1.5;
  border: 1px solid #ffebcc;
  background-color: #fff5e6;
}
.attention-right .alert-warning .alert-icon {
  position: absolute;
  top: 10px;
  left: 24px;
}
.attention-right .alert-warning .alert-icon .svg-icon {
  color: #f90;
}
.attention .attention-left img {
  width: 100%;
  border: 1px solid #eeeeee;
}
</style>