|
@@ -0,0 +1,112 @@
|
|
|
+<template>
|
|
|
+ <div class="editReply" v-loading="loading">
|
|
|
+ <h2>关键词编辑</h2>
|
|
|
+ <el-form ref="form" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="投放渠道">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-model="form.name"></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="链接代码">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-if="editId" v-model="form.makeUrl"></el-input>
|
|
|
+ <el-input v-else v-model="form.makeUrl" :disabled="true"></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="生成二维码链接">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-model="form.wxUrl"></el-input>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="onSubmit">{{editId ? '保存修改' : '立即创建'}}</el-button>
|
|
|
+ <el-button @click="goBackList">取消</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'list',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ editId: null,
|
|
|
+ form: {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ makeUrl: '',
|
|
|
+ wxUrl: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.editId = this.$route.query.id
|
|
|
+ this.doLoad(this.editId)
|
|
|
+ } else {
|
|
|
+ this.getMakeURL()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ goBackList () {
|
|
|
+ this.$router.replace('/huiju/qrCodeList')
|
|
|
+ },
|
|
|
+ getMakeURL () {
|
|
|
+ this.$request('/QrCodeManage/codeObtain').success(res => {
|
|
|
+ if (res.status === 'success') {
|
|
|
+ this.form.makeUrl = res.data.code
|
|
|
+ } else {
|
|
|
+ this.$toast(res.info || '获取链接代码失败')
|
|
|
+ }
|
|
|
+ }).post()
|
|
|
+ },
|
|
|
+ onSubmit() {
|
|
|
+ const params = Object.assign({}, this.form)
|
|
|
+ console.log('submit!', params);
|
|
|
+ this.$request(this.editId ? '/QrCodeManage/update' : '/QrCodeManage/insert').data(params).success((res) => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.status === 'success') {
|
|
|
+ this.$toast(res.info || '操作成功')
|
|
|
+ this.goBackList()
|
|
|
+ } else {
|
|
|
+ this.$toast(res.info || '操作失败')
|
|
|
+ }
|
|
|
+ }).post()
|
|
|
+ },
|
|
|
+ doLoad (id) {
|
|
|
+ if (this.loading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ this.$request('/QrCodeManage/find').data({ id }).success((res) => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.status === 'success' && res.data) {
|
|
|
+ const data = res.data || {}
|
|
|
+ this.form.id = id
|
|
|
+ this.form.name = data.name
|
|
|
+ this.form.wxUrl = data.wx_url
|
|
|
+ this.form.makeUrl = data.make_url
|
|
|
+ }
|
|
|
+ }).get()
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.editReply {
|
|
|
+ .action-button {
|
|
|
+ font-size: 16px;
|
|
|
+ margin-left: 12px;
|
|
|
+ }
|
|
|
+ //
|
|
|
+}
|
|
|
+</style>
|