| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <html>
- <head>
- <jsp:include page="head.jsp"/>
- <title>领先共享汽车</title>
- <style>.avatar-uploader .el-upload {
- border: 1px dashed #d9d9d9;
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- }
- .avatar-uploader .el-upload:hover {
- border-color: #20a0ff;
- }
- .avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 178px;
- height: 178px;
- line-height: 178px;
- text-align: center;
- }
- .avatar {
- width: 178px;
- height: 178px;
- display: block;
- }
- </style>
- </head>
- <body>
- <jsp:include page="contentBefore.jsp"/>
- <template>
- <el-form ref="form" :model="row_info" label-width="80px">
- <el-form-item label="评论">
- <el-input v-model="row_info.comment"></el-input>
- </el-form-item>
-
- <el-form-item label="星级">
- <el-input v-model="row_info.starLevel"></el-input>
- </el-form-item>
-
- <el-form-item>
- <el-button type="primary" @click="onSubmit">{{edit?'保存':'立即创建'}}</el-button>
- <el-button>取消</el-button>
- </el-form-item>
- </el-form>
- </template>
- <jsp:include page="contentAfter.jsp"/>
- </body>
- <script>
- function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return null;
- }
- new Vue({
- el: '#app',
- created: function () {
- var id = getQueryString('id');
- if (id) {
- $.get({
- url: '../quickComment/getQuickComment',
- data: {
- id: id
- }
- }).then(function (res) {
- if (res.success) {
- this.edit = true;
- this.row_info = res.data;
- }
- }.bind(this));
- }
- },
- data: function () {
- return {
- menu: '7-1',
- user: {
- id: '',
- username: 'admin',
- avatar: ''
- },
- loading: false,
- edit: false,
- tab: 1,
- row_info : {
- starLevel : 5
- },
- };
- },
- methods: {
- logout: function () {
- this.$confirm('确定要注销吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'info'
- }).then(function () {
- localStorage.removeItem('user');
- this.$router.push({path: '/login'});
- }.bind(this)).catch(function (e) {
- });
- },
- onSubmit: function () {
- if (!this.row_info.comment) {
- this.$message.warning('请填写评论');
- } else {
- var data = JSON.parse(JSON.stringify(this.row_info));
- $.post({
- url: this.edit ? '../quickComment/update' : '../quickComment/save',
- data: data
- }).then(function (res) {
- if (res.success) {
- if (!this.edit) {
- this.row_info.id = res.data;
- }
- this.edit = true;
- this.$message.success(this.edit ? '保存成功' : '创建成功');
- } else {
- this.$message.error(this.edit ? '保存失败' : '创建失败');
- }
- }.bind(this))
- }
- },
- }
- })
- </script>
- </html>
|