zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
<template>
  <Card class="card">
 
    <div class="cardBox">
      <div class="methodItem">
        <img src="../../../assets/aliyun.png" height="172" width="440"/>
        <h4>阿里云短信</h4></div>
      <div class="bar">
        <div class="status" style="color: rgb(53, 189, 129);">已启用</div>
        <div><a class="links">编辑</a></div>
      </div>
    </div>
    <!-- 阿里云的短信参数 -->
    <Modal
      :title="modalTitle"
      v-model="modalVisible"
      :mask-closable="false"
      :width="500"
    >
      <Form ref="form" :model="form" :label-width="100" :rules="formValidate">
        <FormItem label="accessKeyId" prop="addressName">
          <Input v-model="form.accessKeyId" clearable style="width: 100%"/>
        </FormItem>
        <FormItem label="accessSecret" prop="accessSecret">
          <Input v-model="form.accessSecret" clearable style="width: 100%"/>
        </FormItem>
        <FormItem label="signName" prop="signName">
          <Input v-model="form.signName" clearable style="width: 100%"/>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button type="text" @click="modalVisible = false">取消</Button>
        <Button type="primary" :loading="submitLoading" @click="saveSetting"
        >提交
        </Button
        >
      </div>
    </Modal>
 
  </Card>
</template>
<script>
  import {getSetting, setSetting} from "@/api/index.js";
  import template from "./template";
  export default {
    name: "smsSettingManage",
    components: {
      template
    },
 
    data() {
      return {
        submitLoading: false, // 提交状态
        template, // 模板
        selected: "", // 已选数据
        settingData: "", // 设置数据
        modalTitle: '设置', // modal标题
        modalVisible: false, // modal显隐
        form: {}, // 表单数据
      }
    },
    methods: {
      // 初始化数据
      init() {
        settingInfo("SMS_SETTING")
      },
      // 保存设置
      saveSetting() {
        setSetting("SMS_SETTING", this.form).then((res) => {
          if (res.success) {
            this.$Message.success("保存成功!");
          } else {
            this.$Message.error("保存失败!");
          }
          this.modalVisible = false
        });
      },
      // 查看
      settingInfo(v) {
        alert()
        this.selected = v
        getSetting(v).then((res) => {
          if (res.result) {
            console.log(res)
            this.modalVisible = true
            this.form = res
          }
        });
      }
    },
    mounted() {
      this.init();
    },
  };
</script>
<style lang="scss">
  .card {
    width: 100%;
    height: 100%;
    position: fixed;
  }
  .cardBox {
    display: inline-block;
    border-radius: 2px;
    line-height: 1.5;
    margin-right: 20px;
    width: 300px;
    border: 1px solid #eee;
    padding: 10px;
  }
 
  .methodItem {
    width: 100%;
    border: 1px solid #f5f5f5;
    text-align: center;
    padding: 20px 0;
  }
 
  methodItem img {
    width: 220px;
    height: 86px;
  }
 
  methodItem h4 {
    font-size: 14px;
    color: #333;
    margin-top: 5px;
  }
 
  .methodItem img {
    width: 220px;
    height: 86px;
  }
 
  .bar {
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-align-items: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    padding: 10px 8px 0;
  }
</style>