|
@@ -1,85 +1,110 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-form ref="form" :model="form" label-width="120px">
|
|
|
- <el-form-item label="Activity name">
|
|
|
- <el-input v-model="form.name" />
|
|
|
+ <div class="el-container">
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ status-icon
|
|
|
+ :rules="rules"
|
|
|
+ ref="ruleForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ style="margin: auto"
|
|
|
+ >
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="ruleForm.password"
|
|
|
+ autocomplete="off"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="Activity zone">
|
|
|
- <el-select v-model="form.region" placeholder="please select your zone">
|
|
|
- <el-option label="Zone one" value="shanghai" />
|
|
|
- <el-option label="Zone two" value="beijing" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="Activity time">
|
|
|
- <el-col :span="11">
|
|
|
- <el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%;" />
|
|
|
- </el-col>
|
|
|
- <el-col :span="2" class="line">-</el-col>
|
|
|
- <el-col :span="11">
|
|
|
- <el-time-picker v-model="form.date2" type="fixed-time" placeholder="Pick a time" style="width: 100%;" />
|
|
|
- </el-col>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="Instant delivery">
|
|
|
- <el-switch v-model="form.delivery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="Activity type">
|
|
|
- <el-checkbox-group v-model="form.type">
|
|
|
- <el-checkbox label="Online activities" name="type" />
|
|
|
- <el-checkbox label="Promotion activities" name="type" />
|
|
|
- <el-checkbox label="Offline activities" name="type" />
|
|
|
- <el-checkbox label="Simple brand exposure" name="type" />
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="Resources">
|
|
|
- <el-radio-group v-model="form.resource">
|
|
|
- <el-radio label="Sponsor" />
|
|
|
- <el-radio label="Venue" />
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="Activity form">
|
|
|
- <el-input v-model="form.desc" type="textarea" />
|
|
|
+ <el-form-item label="地址组名称" prop="groupName">
|
|
|
+ <el-input v-model="ruleForm.groupName" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="onSubmit">Create</el-button>
|
|
|
- <el-button @click="onCancel">Cancel</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="resetForm('ruleForm')">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
+import AES from "@/utils/aes";
|
|
|
+import Axios from "axios";
|
|
|
+import { Message } from "element-ui";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- form: {
|
|
|
- name: '',
|
|
|
- region: '',
|
|
|
- date1: '',
|
|
|
- date2: '',
|
|
|
- delivery: false,
|
|
|
- type: [],
|
|
|
- resource: '',
|
|
|
- desc: ''
|
|
|
- }
|
|
|
- }
|
|
|
+ url: process.env.VUE_APP_BASE_API,
|
|
|
+ ruleForm: {
|
|
|
+ password: "",
|
|
|
+ groupName: "",
|
|
|
+ address: "",
|
|
|
+ },
|
|
|
+ rules: {},
|
|
|
+ };
|
|
|
},
|
|
|
methods: {
|
|
|
- onSubmit() {
|
|
|
- this.$message('submit!')
|
|
|
- },
|
|
|
- onCancel() {
|
|
|
- this.$message({
|
|
|
- message: 'cancel!',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-.line{
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-</style>
|
|
|
+ submitForm(formName) {
|
|
|
+ const service = Axios.create({
|
|
|
+ // axios中请求配置有baseURL选项,表示请求URL公共部分
|
|
|
+ baseURL:
|
|
|
+ this.url + "ams/address/download/batch-keystore",
|
|
|
+ // 超时
|
|
|
+ timeout: 10000,
|
|
|
+ });
|
|
|
|
|
|
+ service.interceptors.response.use((response) => {
|
|
|
+ console.log("hello world");
|
|
|
+ console.log(response);
|
|
|
+ });
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ Axios.post(
|
|
|
+ this.url + "ams/address/download/batch-keystore",
|
|
|
+ {
|
|
|
+ groupName: this.ruleForm.groupName,
|
|
|
+ password: AES.encryptAes(this.ruleForm.password),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ responseType: "arraybuffer",
|
|
|
+ headers: {
|
|
|
+ "Conntent-Type": "application/json; application/octet-stream;",
|
|
|
+ },
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then((response) => {
|
|
|
+ console.log(response.data);
|
|
|
+ // this.downloadFile(response.data);
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ Message.error("download error!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ downloadFile(data) {
|
|
|
+ let blob = new Blob([data], {
|
|
|
+ type: "application/zip",
|
|
|
+ });
|
|
|
+ let url = window.URL.createObjectURL(blob);
|
|
|
+ const link = document.createElement("a"); // 创建a标签
|
|
|
+ link.href = url;
|
|
|
+ link.download = this.ruleForm.groupName + ".zip";
|
|
|
+ link.click();
|
|
|
+ URL.revokeObjectURL(url); // 释放内存
|
|
|
+ },
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ saveAs() {
|
|
|
+ return saveAs;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|