Sfoglia il codice sorgente

guan2023525 commit

BophGuan 1 anno fa
parent
commit
3f714ececc

BIN
vuespringboot/public/iconxw.png


+ 4 - 2
vuespringboot/public/index.html

@@ -4,8 +4,10 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <link rel="icon" href="<%= BASE_URL %>iconxw.png">
+<!--    <title><%= htmlWebpackPlugin.options.title %></title>-->
+      <title>马村农家乐管理平台</title>
+
   </head>
   <body>
     <noscript>

+ 10 - 10
vuespringboot/src/components/Aside.vue

@@ -10,10 +10,10 @@
 
   >
     <div style="height: 60px;line-height: 60px;text-align: center">
-      <img src=""
+      <img src="public/iconxw.png"
            alt="" style="width: 30px;position: relative;top: 9px;margin-right: 5px"
       >
-      <el-link href="https://baike.baidu.com/item/%E9%B8%A1%E4%BD%A0%E5%A4%AA%E7%BE%8E/53592938?fr=aladdin" target="_blank" style="color: rgba(0,167,255,0.7);font-family: 幼圆;text-align:center" v-show="logoTextShow">农家乐管理系统</el-link>
+      <el-link target="_blank" style="color: rgb(255,255,255);font-family: 幼圆;text-align:center" v-show="logoTextShow" >马村农家乐管理系统</el-link>
       <!--            <b style="color: #fb87ff;font-family: 幼圆;text-align:center" v-show="logoTextShow">小黑子管理系统</b>-->
 
     </div>
@@ -39,39 +39,39 @@
         </el-menu-item>
       <el-menu-item index="/merchant">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
+          <i class="el-icon-s-shop"></i>
           <span slot="title">商户管理</span>
         </template>
       </el-menu-item>
       <el-menu-item index="/scenicspot">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
+          <i class="el-icon-location"></i>
           <span slot="title">景点管理</span>
         </template>
       </el-menu-item>
       <el-menu-item index="/introduce">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
+          <i class="el-icon-notebook-2"></i>
           <span slot="title">简介管理</span>
         </template>
       </el-menu-item>
 
       <el-menu-item index="/notification">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
+          <i class="el-icon-postcard"></i>
           <span slot="title">公告管理</span>
         </template>
       </el-menu-item>
       <el-menu-item index="/strategy">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
+          <i class="el-icon-magic-stick"></i>
           <span slot="title">攻略管理</span>
         </template>
       </el-menu-item>
       <el-menu-item index="/banner">
         <template slot="title">
-          <i class="el-icon-s-custom"></i>
-          <span slot="title">走马灯</span>
+          <i class="el-icon-files"></i>
+          <span slot="title">轮播图</span>
         </template>
       </el-menu-item>
     </el-submenu>
@@ -95,7 +95,7 @@ export default {
     const user = window.localStorage.getItem("userInfo")
     if (user){
       this.user = JSON.parse(user)
-      if (this.user.nickname === '管理员'){
+      if (this.user.nickname === '管理员' || this.user.nickname === '超级管理员'){
         this.authorizeVisible = false
       }else {
         this.authorizeVisible = true

+ 1 - 1
vuespringboot/src/components/Header.vue

@@ -65,7 +65,7 @@ export default {
   methods:{
     logout(){
       localStorage.removeItem("userInfo")
-      cookie.set('user_token','',{domain: 'localhost'})
+      cookie.set('user_token','',{domain: 'nongjialeguanli.natapp1.cc'})
       this.$router.push({path:'/login'})
       this.request.post("/user/logout").then(res =>{
 

+ 3 - 1
vuespringboot/src/components/HelloWorld.vue

@@ -53,6 +53,8 @@ li {
   margin: 0 10px;
 }
 a {
-  color: #42b983;
+  color: #01110c;
+  /*color: #42b983;*/
+
 }
 </style>

+ 1 - 1
vuespringboot/src/router/index.js

@@ -52,7 +52,7 @@ const routes = [
       },
       {
         path: 'banner',
-        name: '走马灯',
+        name: '轮播图',
         component: () => import( '../views/Banner.vue'),
       },
     ]

+ 1 - 1
vuespringboot/src/utils/request.js

@@ -2,7 +2,7 @@ import axios from 'axios'
 import cookie from "js-cookie";
 
 const request = axios.create({
-    baseURL: 'http://192.168.0.185:9090',  // 注意!! 这里是全局统一加上了 '/api' 前缀,也就是说所有接口都会加上'/api'前缀在,页面里面写接口的时候就不要加 '/api'了,否则会出现2个'/api',类似 '/api/api/user'这样的报错,切记!!!
+    baseURL: '/api',  //'http://192.168.0.185:9090'  注意!! 这里是全局统一加上了 '/api' 前缀,也就是说所有接口都会加上'/api'前缀在,页面里面写接口的时候就不要加 '/api'了,否则会出现2个'/api',类似 '/api/api/user'这样的报错,切记!!!
     timeout: 5000,
 })
 

+ 17 - 6
vuespringboot/src/views/Banner.vue

@@ -15,19 +15,21 @@
     <el-dialog title="图片上传" :visible.sync="tupianshangchuanVisible" width="80%" :destroy-on-close="true">
       <el-form label-width="80px" size="medium">
         <el-form-item :label-width="formLabelWidth">
-          {{'请上传走马灯图片'}}
+          {{'请上传轮播图照片'}}
         </el-form-item>
         <el-upload
             class="upload-demo"
-            action="http://localhost:9090/file/upload"
+            action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+            accept=".jpg,.png"
             :on-preview="handlePreview"
             :on-remove="handleRemove"
             :before-remove="beforeRemove"
             :file-list="fileList"
             list-type="picture"
-            :on-success="handleSuccess">
+            :on-success="handleSuccess"
+            :before-upload="handleBeforeUpload">
           <el-button size="mini" type="primary">点击上传</el-button>
-          <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+          <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
         </el-upload>
 
       </el-form>
@@ -71,7 +73,7 @@ export default {
          for (var i=0 ; i<res.length ; i++){
            this.url = res[i].iconPath
            this.getUrl= {
-             name:this.url.substring(31),
+             name:this.url.substring(39),
              url:this.url
            }
            this.fileList.push(this.getUrl)
@@ -102,10 +104,19 @@ export default {
          if(res == true){
            this.$message.success("删除成功")
          }else {
-           this.$message.error("删除失败")
+           // this.$message.error("删除失败")
          }
        })
      },
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+      const isLt2M = file.size / 1024 /1024 < 2;
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不得超过2MB!");
+      }
+      //  校验不通过则不上传文件
+      return isLt2M && isLt2M;
+    },
    }
 }
 </script>

+ 1 - 1
vuespringboot/src/views/Home.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <h2>欢迎来到:</h2>
-    <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xx村农家乐管理系统!</h2>
+    <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;村农家乐管理系统!</h2>
   </div>
 </template>
 

+ 20 - 8
vuespringboot/src/views/Introduce.vue

@@ -1,9 +1,9 @@
 <template>
   <div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange" size="medium">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange" size="medium">
       <el-table-column prop="id" label="id" width="120" >
       </el-table-column>
-      <el-table-column prop="title" label="商户名" width="240">
+      <el-table-column prop="title" label="简介名" width="240">
       </el-table-column>
       <!--      <el-table-column prop="nickname" label="昵称" width="120">-->
       <!--      </el-table-column>-->
@@ -29,15 +29,17 @@
               </el-form-item>
               <el-upload
                   class="upload-demo"
-                  action="http://localhost:9090/file/upload"
+                  action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+                  accept=".jpg,.png"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :before-remove="beforeRemove"
                   :file-list="fileList"
                   list-type="picture"
-                  :on-success="handleSuccess">
+                  :on-success="handleSuccess"
+                  :before-upload="handleBeforeUpload">
                 <el-button size="mini" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
               </el-upload>
 
             </el-form>
@@ -129,7 +131,7 @@ export default {
 
       rules:{
         title:[
-          { required: true,message: '请输入商户名',trigger: 'blur'}
+          { required: true,message: '请输入简介标题',trigger: 'blur'}
         ],
         latitude:[
           { required: true,message: '请输入纬度',trigger: 'blur'},
@@ -201,7 +203,7 @@ export default {
         if(res == true){
           this.$message.success("删除成功")
         }else {
-          this.$message.error("删除失败")
+          // this.$message.error("删除失败")
         }
       })
     },
@@ -223,6 +225,16 @@ export default {
       return this.$confirm(`确定移除 ${ file.name }?`);
 
     },
+
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+      const isLt2M = file.size / 1024 /1024 < 2;
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不得超过2MB!");
+      }
+      //  校验不通过则不上传文件
+      return isLt2M && isLt2M;
+    },
     ///////////////////
     tupianAdd(row){
       this.fileList=[],
@@ -234,7 +246,7 @@ export default {
         for (var i=0 ; i<res.length ; i++){
           this.url = res[i].iconPath
           this.getUrl= {
-            name:this.url.substring(31),
+            name:this.url.substring(39),
             url:this.url
           }
           console.log(this.getUrl)

+ 2 - 2
vuespringboot/src/views/Login.vue

@@ -2,7 +2,7 @@
 
   <div class="wrapper">
     <div style="margin: 280px auto; background-color: #fff;width: 350px; height: 320px;padding: 20px; border-radius: 10px">
-      <div style="margin: 15px 0; text-align: match-parent; font-size: 15px"><b>农家乐管理系统</b></div>
+      <div style="margin: 15px 0; text-align: match-parent; font-size: 15px"><b>马村农家乐管理系统</b></div>
       <div style="margin: 20px 0; text-align: center; font-size: 24px"><b>Login</b></div>
       <el-form :model="user" :rules="rules" ref="userLoginForm">
         <el-form-item prop="username">
@@ -47,7 +47,7 @@ export default {
             if(res.code === 20001){
               this.$message.error("用户名或密码错误")
             }else {
-              cookie.set('user_token',res.data.token,{domain: '192.168.0.185'})
+              cookie.set('user_token',res.data.token,{domain: 'nongjialeguanli.natapp1.cc'}) //192.168.0.160
               console.log('123456')
               console.log(res.data.token)
               localStorage.setItem('userInfo',JSON.stringify(res.data.userInfo))

+ 17 - 8
vuespringboot/src/views/Merchant.vue

@@ -33,7 +33,7 @@
 <!--      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
 
     </div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
       <el-table-column
           type="selection"
           width="55">
@@ -99,15 +99,17 @@
               </el-form-item>
               <el-upload
                   class="upload-demo"
-                  action="http://localhost:9090/file/upload"
+                  action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+                  accept=".jpg,.png"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :before-remove="beforeRemove"
                   :file-list="fileList"
                   list-type="picture"
-                  :on-success="handleSuccess">
+                  :on-success="handleSuccess"
+                  :before-upload="handleBeforeUpload">
                 <el-button size="mini" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
               </el-upload>
 
             </el-form>
@@ -306,7 +308,7 @@ export default {
         if(res == true){
           this.$message.success("删除成功")
         }else {
-          this.$message.error("删除失败")
+          // this.$message.error("删除失败")
         }
       })
     },
@@ -330,8 +332,15 @@ export default {
 
     },
 
-
-
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+        const isLt2M = file.size / 1024 /1024 < 2;
+        if (!isLt2M) {
+           this.$message.error("上传图片大小不得超过2MB!");
+        }
+        //  校验不通过则不上传文件
+        return isLt2M && isLt2M;
+    },
     ///////////////////
     tupianAdd(row){
       this.fileList=[],
@@ -343,7 +352,7 @@ export default {
         for (var i=0 ; i<res.length ; i++){
           this.url = res[i].iconPath
           this.getUrl= {
-            name:this.url.substring(31),
+            name:this.url.substring(39), //39
             url:this.url
           }
           console.log(this.getUrl)

+ 20 - 8
vuespringboot/src/views/Notification.vue

@@ -2,7 +2,7 @@
   <div>
 
     <div style="margin: 10px 0">
-      <el-input style="width: 200px" placeholder="请输入景点名" suffix-icon="el-icon-search" v-model="title"></el-input>
+      <el-input style="width: 200px" placeholder="请输入公告名" suffix-icon="el-icon-search" v-model="title"></el-input>
       <el-button class="ml-5" type="warning" @click="load">搜索</el-button>
     </div>
 
@@ -28,7 +28,7 @@
       <!--      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
 
     </div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
       <el-table-column
           type="selection"
           width="55">
@@ -93,15 +93,17 @@
               </el-form-item>
               <el-upload
                   class="upload-demo"
-                  action="http://localhost:9090/file/upload"
+                  action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+                  accept=".jpg,.png"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :before-remove="beforeRemove"
                   :file-list="fileList"
                   list-type="picture"
-                  :on-success="handleSuccess">
+                  :on-success="handleSuccess"
+                  :before-upload="handleBeforeUpload">
                 <el-button size="mini" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
               </el-upload>
 
             </el-form>
@@ -194,7 +196,7 @@ export default {
 
       rules:{
         title:[
-          { required: true,message: '请输入商户名',trigger: 'blur'}
+          { required: true,message: '请输入公告标题',trigger: 'blur'}
         ],
       }
     }
@@ -271,7 +273,7 @@ export default {
         if(res == true){
           this.$message.success("删除成功")
         }else {
-          this.$message.error("删除失败")
+          // this.$message.error("删除失败")
         }
       })
     },
@@ -295,6 +297,16 @@ export default {
 
     },
 
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+      const isLt2M = file.size / 1024 /1024 < 2;
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不得超过2MB!");
+      }
+      //  校验不通过则不上传文件
+      return isLt2M && isLt2M;
+    },
+
 
 
     ///////////////////
@@ -308,7 +320,7 @@ export default {
         for (var i=0 ; i<res.length ; i++){
           this.url = res[i].iconPath
           this.getUrl= {
-            name:this.url.substring(31),
+            name:this.url.substring(39),
             url:this.url
           }
           console.log(this.getUrl)

+ 29 - 9
vuespringboot/src/views/Person.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
-    <el-form label-width="100px" size="small">
-      <el-form-item label="输入旧密码" :label-width="formLabelWidth">
-        <el-input class="input-reader-name" v-model="form.oldPassword" autocomplete="off" show-password></el-input>
+    <el-form label-width="100px" size="small" :rules="rules" :model="form">
+      <el-form-item label="输入旧密码" :label-width="formLabelWidth" prop="oldPassword">
+        <el-input class="input-reader-name" v-model="form.oldPassword" autocomplete="off" show-password ></el-input>
       </el-form-item>
-      <el-form-item label="输入新密码" :label-width="formLabelWidth" >
-        <el-input class="input-reader-name" v-model="form.newPassword" autocomplete="off" show-password></el-input>
+      <el-form-item label="输入新密码" :label-width="formLabelWidth" prop="newPassword">
+        <el-input class="input-reader-name" v-model="form.newPassword" autocomplete="off" show-password ></el-input>
       </el-form-item>
-      <el-form-item label="确认密码" :label-width="formLabelWidth">
-        <el-input class="input-reader-name" v-model="confirmPassword" autocomplete="off" show-password></el-input>
+      <el-form-item label="确认密码" :label-width="formLabelWidth">
+        <el-input class="input-reader-name" v-model="confirmPassword" autocomplete="off" show-password ></el-input>
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -19,6 +19,8 @@
 </template>
 
 <script>
+import cookie from "js-cookie";
+
 export default {
   name: 'Person',
   created() {
@@ -27,7 +29,17 @@ export default {
   data(){
     return{
       confirmPassword:'',
-      form:{}
+      form:{},
+
+      rules:{
+        oldPassword:[
+          { required: true,message: '请输入原始密码',trigger: 'blur'}
+        ],
+        newPassword:[
+          { required: true,message: '请输入将要修改的密码',trigger: 'blur'},
+          { min: 8, max: 20, message: '新密码长度在8到20个字符之间', trigger: 'blur' }
+        ]
+      }
     }
   },
   methods:{
@@ -45,13 +57,21 @@ export default {
             this.$message.error("旧密码输入有误")
           }else if (res.message === "成功"){
             this.$message.success("修改成功")
-            this.$router.push("/")
+            this.logout()
           }
         })
       }else {
         this.$message.error("新密码不一致")
       }
 
+    },
+    logout(){
+      localStorage.removeItem("userInfo")
+      cookie.set('user_token','',{domain: 'nongjialeguanli.natapp1.cc'})
+      this.$router.push({path:'/login'})
+      this.request.post("/user/logout").then(res =>{
+
+      })
     }
   }
 }

+ 19 - 7
vuespringboot/src/views/ScenicSpot.vue

@@ -34,7 +34,7 @@
       <!--      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
 
     </div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
       <el-table-column
           type="selection"
           width="55">
@@ -104,15 +104,17 @@
               </el-form-item>
               <el-upload
                   class="upload-demo"
-                  action="http://localhost:9090/file/upload"
+                  action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+                  accept=".jpg,.png"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :before-remove="beforeRemove"
                   :file-list="fileList"
                   list-type="picture"
-                  :on-success="handleSuccess">
+                  :on-success="handleSuccess"
+                  :before-upload="handleBeforeUpload">
                 <el-button size="mini" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
               </el-upload>
 
             </el-form>
@@ -223,7 +225,7 @@ export default {
 
       rules:{
         title:[
-          { required: true,message: '请输入商户名',trigger: 'blur'}
+          { required: true,message: '请输入景点名',trigger: 'blur'}
         ],
         latitude:[
           { required: true,message: '请输入纬度',trigger: 'blur'},
@@ -312,7 +314,7 @@ export default {
         if(res == true){
           this.$message.success("删除成功")
         }else {
-          this.$message.error("删除失败")
+          // this.$message.error("删除失败")
         }
       })
     },
@@ -336,6 +338,16 @@ export default {
 
     },
 
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+      const isLt2M = file.size / 1024 /1024 < 2;
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不得超过2MB!");
+      }
+      //  校验不通过则不上传文件
+      return isLt2M && isLt2M;
+    },
+
 
 
     ///////////////////
@@ -349,7 +361,7 @@ export default {
         for (var i=0 ; i<res.length ; i++){
           this.url = res[i].iconPath
           this.getUrl= {
-            name:this.url.substring(31),
+            name:this.url.substring(39),
             url:this.url
           }
           console.log(this.getUrl)

+ 22 - 10
vuespringboot/src/views/Strategy.vue

@@ -2,7 +2,7 @@
   <div>
 
     <div style="margin: 10px 0">
-      <el-input style="width: 200px" placeholder="请输入景点名" suffix-icon="el-icon-search" v-model="title"></el-input>
+      <el-input style="width: 200px" placeholder="请输入攻略名" suffix-icon="el-icon-search" v-model="title"></el-input>
       <el-button class="ml-5" type="warning" @click="load">搜索</el-button>
     </div>
 
@@ -28,7 +28,7 @@
       <!--      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
 
     </div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
       <el-table-column
           type="selection"
           width="55">
@@ -91,15 +91,17 @@
               </el-form-item>
               <el-upload
                   class="upload-demo"
-                  action="http://localhost:9090/file/upload"
+                  action="http://nongjialeguanli.natapp1.cc/api/file/upload"
+                  accept=".jpg,.png"
                   :on-preview="handlePreview"
                   :on-remove="handleRemove"
                   :before-remove="beforeRemove"
                   :file-list="fileList"
                   list-type="picture"
-                  :on-success="handleSuccess">
+                  :on-success="handleSuccess"
+                  :before-upload="handleBeforeUpload">
                 <el-button size="mini" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过2MB</div>
               </el-upload>
 
             </el-form>
@@ -135,7 +137,7 @@
           <el-input
               type="textarea"
               autosize
-              placeholder="strategy"
+              placeholder="请输入攻略内容"
               maxlength="400"
               show-word-limit
               v-model="form.strategy">
@@ -192,7 +194,7 @@ export default {
 
       rules:{
         title:[
-          { required: true,message: '请输入商户名',trigger: 'blur'}
+          { required: true,message: '请输入攻略标题',trigger: 'blur'}
         ],
       }
     }
@@ -268,7 +270,7 @@ export default {
         if(res == true){
           this.$message.success("删除成功")
         }else {
-          this.$message.error("删除失败")
+          // this.$message.error("删除失败")
         }
       })
     },
@@ -291,7 +293,15 @@ export default {
       return this.$confirm(`确定移除 ${ file.name }?`);
 
     },
-
+    // 图片上传之前的判断
+    handleBeforeUpload(file) {
+      const isLt2M = file.size / 1024 /1024 < 2;
+      if (!isLt2M) {
+        this.$message.error("上传图片大小不得超过2MB!");
+      }
+      //  校验不通过则不上传文件
+      return isLt2M && isLt2M;
+    },
 
 
     ///////////////////
@@ -305,7 +315,7 @@ export default {
         for (var i=0 ; i<res.length ; i++){
           this.url = res[i].iconPath
           this.getUrl= {
-            name:this.url.substring(31),
+            name:this.url.substring(39),
             url:this.url
           }
           console.log(this.getUrl)
@@ -383,6 +393,7 @@ export default {
 <style>
 .headerBg{
   background: rgba(64, 158, 255, 100) !important;
+
 }
 
 .avatar-uploader .el-upload {
@@ -394,6 +405,7 @@ export default {
 }
 .avatar-uploader .el-upload:hover {
   border-color: #409EFF;
+
 }
 .avatar-uploader-icon {
   font-size: 28px;

+ 56 - 28
vuespringboot/src/views/User.vue

@@ -14,26 +14,27 @@
 
     <div style="margin: 10px 0">
       <el-button type="primary" @click="handleAdd">新增<i class="el-icon-circle-plus"></i></el-button>
-      <el-popconfirm
-          class="ml-5"
-          confirm-button-text='好的'
-          cancel-button-text='不用了'
-          icon="el-icon-info"
-          icon-color="red"
-          title="确定删除吗?"
-          @confirm="delBatch"
+<!--      <el-popconfirm-->
+<!--          class="ml-5"-->
+<!--          confirm-button-text='好的'-->
+<!--          cancel-button-text='不用了'-->
+<!--          icon="el-icon-info"-->
+<!--          icon-color="red"-->
+<!--          title="确定删除吗?"-->
+<!--          @confirm="delBatch"-->
+
+<!--      >-->
+<!--        <el-button type="danger" slot="reference">批量删除<i class="el-icon-delete"></i></el-button>-->
+<!--      </el-popconfirm>-->
 
-      >
-        <el-button type="danger" slot="reference">批量删除<i class="el-icon-delete"></i></el-button>
-      </el-popconfirm>
 <!--      <el-upload-->
 <!--          action="http://localhost:9090/user/import" :show-file-list="false" accept=".xlsx" :on-success="handleImportSuccess" style="display: inline-block">-->
 <!--        <el-button type="primary" class="ml-5" >导入<i class="el-icon-upload2"></i></el-button>-->
 <!--      </el-upload>-->
-      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>
+<!--      <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
 
     </div>
-    <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
+    <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
       <el-table-column
           type="selection"
           width="55">
@@ -52,7 +53,7 @@
 <!--      </el-table-column>-->
       <el-table-column label="操作">
         <template slot-scope="scope">
-          <el-button type="success" @click="handleEdit(scope.row)" icon="el-icon-edit ">编辑</el-button>
+          <el-button type="success" @click="handleEdit(scope.row)" icon="el-icon-edit " :style="{display: authorizeVisible}">编辑</el-button>
           <el-popconfirm
               class="ml-5"
               confirm-button-text='好的'
@@ -60,11 +61,13 @@
               icon="el-icon-info"
               icon-color="red"
               title="确定删除吗?"
-              @confirm="del(scope.row.id)"
+              @confirm="del(scope.row)"
 
           >
-            <el-button type="danger" slot="reference"  icon="el-icon-remove">删除</el-button>
+            <el-button type="danger" slot="reference"  icon="el-icon-remove" :style="{display: authorizeVisible}">删除</el-button>
           </el-popconfirm>
+          <el-button type="warning" disabled :style="{display: normalVisible}">对不起!您暂无权限</el-button>
+
         </template>
       </el-table-column>
     </el-table>
@@ -84,11 +87,11 @@
     </div>
 
     <el-dialog title="用户信息" :visible.sync="dialogFormVisible" width="30%">
-      <el-form label-width="80px" size="small">
-        <el-form-item label="用户名" :label-width="formLabelWidth">
+      <el-form label-width="80px" size="small" :rules="rules" :model="form">
+        <el-form-item label="用户名" :label-width="formLabelWidth" prop="username">
           <el-input v-model="form.username" autocomplete="off"></el-input>
         </el-form-item>
-        <el-form-item label="角色" :label-width="formLabelWidth" >
+        <el-form-item label="角色" :label-width="formLabelWidth" v-show="form.nickname !== '超级管理员'">
 <!--          <el-input v-model="form.nickname" autocomplete="off"></el-input>-->
           <el-select v-model="form.nickname" placeholder="请选择">
             <el-option
@@ -145,6 +148,15 @@ export default {
       }],
       user: {},
 
+      rules:{
+        username:[
+          { required: true, message: '请输入用户名', trigger: 'blur' },
+        ]
+      },
+      authorizeVisible: '',
+      normalVisible: ''
+
+
     }
   },
   created() {
@@ -153,6 +165,12 @@ export default {
       this.user = JSON.parse(user)
       if (this.user.nickname === '员工'){
         window.top.location.href = '/'
+      }else if (this.user.nickname === '超级管理员'){
+        this.authorizeVisible = ''
+        this.normalVisible = 'none'
+      }else {
+        this.authorizeVisible = 'none'
+        this.normalVisible = ''
       }
     }
 
@@ -178,6 +196,9 @@ export default {
     },
 
     save(){
+      // if (this.form.nickname === '超级管理员'){
+      //
+      // }else
       if(this.form.id){
         this.request.post("/user",this.form).then(res =>{
           if(res){
@@ -232,15 +253,20 @@ export default {
       this.form = Object.assign({},row)
       this.dialogFormVisible = true
     },
-    del(id){
-      this.request.delete("/user/" + id).then(res =>{
-        if(res){
-          this.$message.success("删除成功")
-          this.load()
-        }else {
-          this.$message.error("删除失败")
-        }
-      })
+    del(row){
+      if (row.nickname === "超级管理员"){
+        this.$message.error("超级管理员账号不可删除")
+      }else {
+        this.request.delete("/user/" + row.id).then(res =>{
+          if(res){
+            this.$message.success("删除成功")
+            this.load()
+          }else {
+            this.$message.error("删除失败")
+          }
+        })
+      }
+
     },
     delBatch(){
       let ids = this.multipleSelection.map(v => v.id)
@@ -283,5 +309,7 @@ export default {
 <style>
 .headerBg{
   background:#409EFF
+
+
 }
 </style>

+ 12 - 1
vuespringboot/vue.config.js

@@ -3,6 +3,17 @@ module.exports = defineConfig({
   transpileDependencies: true,
   devServer: {
     port: 8080,
-    host:"192.168.0.185"
+    host:"192.168.0.160", //192.168.0.184
+
+    publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
+    proxy:{
+        '/api':{
+            target:"http://192.168.0.160:9090",
+            changOrigin: true,  //允许跨域
+            pathRewrite:{
+                '^/api':''  //重写路径
+            }
+        }
+    }
   }
 })

+ 1 - 0
xiaoheiziboot/xiaoheizi/src/main/java/com/gjz/xiaoheizi/config/CorsConfig.java

@@ -23,6 +23,7 @@ public class CorsConfig {
         UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
         CorsConfiguration corsConfiguration = new CorsConfiguration();
         corsConfiguration.addAllowedOrigin(frontUrl);//"http://192.168.0.177:8080"
+        //corsConfiguration.addAllowedOrigin("http://192.168.0.160:8080");//"http://192.168.0.177:8080"
         corsConfiguration.setAllowCredentials(true);
         corsConfiguration.addAllowedHeader("*");
         corsConfiguration.addAllowedMethod("*");

+ 1 - 0
xiaoheiziboot/xiaoheizi/src/main/java/com/gjz/xiaoheizi/filter/LoginCheckFilter.java

@@ -30,6 +30,7 @@ public class LoginCheckFilter implements Filter {
 
         //1.获取本次请求的URI
         String requestURI = request.getRequestURI();
+        System.out.println(requestURI);
 
         //定义不需要处理的请求路径
         String[] urls = new String[]{

+ 4 - 3
xiaoheiziboot/xiaoheizi/src/main/resources/application.yml

@@ -24,10 +24,11 @@ mybatis-plus:
 
 files:
   upload:
-    path: D:/学习/files/
-    urlhead: http://192.168.0.185:9090/file/
+    path: /home/photo/
+#    path: D:/学习/files/
+    urlhead: https://njlbackground.mynatapp.cc/file/  #http://192.168.0.185:9090/file/
 
 localhost:
-  frontUrl: http://192.168.0.185:8080
+  frontUrl: http://192.168.0.160:8082  #http://192.168.0.185:8080
 
 

+ 25 - 25
xiaoheiziboot/xiaoheizi/src/test/java/com/gjz/xiaoheizi/XiaoheiziApplicationTests.java

@@ -1,25 +1,25 @@
-package com.gjz.xiaoheizi;
-
-import com.gjz.xiaoheizi.controller.dto.MerchantDto;
-import com.gjz.xiaoheizi.entity.Merchant;
-import com.gjz.xiaoheizi.mapper.MerchantMapper;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.List;
-
-@SpringBootTest
-class XiaoheiziApplicationTests {
-
-    @Autowired
-    private MerchantMapper merchantMapper;
-
-    @Test
-    void contextLoads() {
-
-        MerchantDto byId = merchantMapper.findById(1);
-        System.out.println(byId);
-    }
-
-}
+//package com.gjz.xiaoheizi;
+//
+//import com.gjz.xiaoheizi.controller.dto.MerchantDto;
+//import com.gjz.xiaoheizi.entity.Merchant;
+//import com.gjz.xiaoheizi.mapper.MerchantMapper;
+//import org.junit.jupiter.api.Test;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.test.context.SpringBootTest;
+//
+//import java.util.List;
+//
+//@SpringBootTest
+//class XiaoheiziApplicationTests {
+//
+//    @Autowired
+//    private MerchantMapper merchantMapper;
+//
+//    @Test
+//    void contextLoads() {
+//
+//        MerchantDto byId = merchantMapper.findById(1);
+//        System.out.println(byId);
+//    }
+//
+//}