| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-rich-text');
- ?>
- <div id="app" v-cloak>
- <el-card class="box-card" shadow="never" style="border:0;min-width: 1250px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item>
- <span style="color: #409EFF;cursor: pointer" @click="$navigate({r:'mall/optimize/list'})">优化建议</span>
- </el-breadcrumb-item>
- <el-breadcrumb-item>添加优化建议</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="form-body" style="padding: 20px 45% 0 10px">
- <el-form :model="ruleForm" :rules="rules" size="small" ref="ruleForm" label-width="160px">
- <el-row>
- <el-col :span="24">
- <el-form-item label="选择类目" prop="category">
- <ul flex="cross:center wrap:wrap">
- <li style="width: 125px;margin-right: 12px;" v-for="(item, type) in typeArr" :key="type">
- <div class="select-type" :class="item.type == ruleForm.category ? 'select-type-active' : ''" @click="categoryClick(item)">
- <div class="type-content" flex="main:justify cross:center">
- <img class="img-rg" :src="item.type == ruleForm.category ? item.active : item.unactive" alt="">
- <div class="cont-lf">{{item.name}}</div>
- </div>
- </div>
- </li>
- <li>
- <el-tooltip :disabled="disabled" placement="right-start" effect="light">
- <i class="el-icon-question" style="color: #9B9B9B; font-size: 16px;"></i>
- <div slot="content">
- <el-image src="<?php echo \Yii::$app->request->hostInfo . '/resources/img/admin/optimize-notice.png'; ?>"></el-image>
- </div>
- </el-tooltip>
- </li>
- </ul>
- </el-form-item>
- <el-form-item label="后台路径" prop="backend_path">
- <el-cascader style="width: 400px;" :options="backend_options" :props="{ multiple: true, checkStrictly: true }" clearable @change="backendChange"></el-cascader>
- </el-form-item>
- <el-form-item label="联系方式" prop="mobile">
- <el-input v-model="ruleForm.mobile" placeholder="请输入联系手机号" type="text" maxlength="20" show-word-limit style=" width: 260px;"></el-input>
- </el-form-item>
- <el-form-item label="建议标题" prop="title">
- <el-input v-model="ruleForm.title" placeholder="请输入标题" type="text" ></el-input>
- </el-form-item>
- <el-form-item label="内容描述" prop="optimize">
- <com-rich-text style="min-width: 750px" v-model="ruleForm.optimize"></com-rich-text>
- </el-form-item>
- <el-form-item>
- <el-button
- class="button-item"
- :loading="btnLoading"
- type="primary"
- @click="submitForm('ruleForm')"
- size="small"
- >保存</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- ruleForm: {
- category: 'optimize',
- mobile: '', //当前选中等级
- optimize: '',
- annex: '',
- backend_path: '',
- },
- showViewer: false,
- backend_options: [],
- typeArr: [
- {
- name: '功能优化',
- unactive: '/resources/img/mall/optimize/optimize-unactive.png',
- active: '/resources/img/mall/optimize/optimize-active.png',
- type: 'optimize'
- },
- {
- name: 'BUG修复',
- unactive: '/resources/img/mall/optimize/bug-unactive.png',
- active: '/resources/img/mall/optimize/bug-active.png',
- type: 'bug'
- },
- {
- name: '其他建议',
- unactive: '/resources/img/mall/optimize/others-unactive.png',
- active: '/resources/img/mall/optimize/others-active.png',
- type: 'others'
- }
- ],
- select_img: [],
- rules: {
- category: [
- {required: true, message: '请选择类目', trigger: 'change'},
- ],
- mobile: [
- {required: true, message: '请输入手机号码', trigger: 'change'},
- ],
- title: [
- {required: true, message: '请输入标题内容', trigger: 'change'},
- ],
- optimize: [
- {required: true, message: '请输入建议内容', trigger: 'change'},
- ],
- },
- btnLoading: false,
- };
- },
- mounted() {
- this.getBackendMenu();
- },
- methods: {
- getBackendMenu() {
- request({
- params: {
- r: 'mall/optimize/get-backend-menu'
- },
- method: 'get',
- }).then(e => {
- if (e.data.code == 0) {
- this.backend_options = e.data.data
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.$message.error(e.data.msg);
- });
- },
- //提交表单
- submitForm(formName) {
- let self = this;
- this.$refs[formName].validate((valid) => {
- if (valid) {
- self.btnLoading = true;
- request({
- params: {
- r: 'mall/optimize/edit'
- },
- method: 'post',
- data: {
- form: self.ruleForm,
- }
- }).then(e => {
- self.btnLoading = false;
- if (e.data.code == 0) {
- navigateTo({
- r: 'mall/optimize/list'
- })
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.$message.error(e.data.msg);
- self.btnLoading = false;
- });
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- categoryClick(data) {
- this.ruleForm.category = data.type
- },
- backendChange(value) {
- if (!isEmpty(value)) this.ruleForm.backend_path = JSON.stringify(value)
- }
- }
- });
- </script>
- <style>
- .del-btn {
- position: relative;
- bottom: 95px;
- left: 65px;
- }
- .cont-lf {
- font-size: 16px;
- }
- .select-type {
- background-color: #F2F2F2;
- padding: 10px 15px;
- border-radius: 5px;
- cursor: pointer;
- border: 1px solid #DCDCDC;
- color: #9B9B9B;
- }
- .select-type-active {
- background-color: #F2F6FF;
- border: 1px solid #CEDAF6;
- color: #587BCE;
- }
- .img-rg {
- width: 25%;
- }
- </style>
|