shaogen1995 пре 3 година
родитељ
комит
d488842cdb

+ 60 - 17
houtai/package-lock.json

@@ -8,7 +8,9 @@
       "name": "houtai",
       "version": "0.1.0",
       "dependencies": {
+        "axios": "^0.27.2",
         "core-js": "^3.6.5",
+        "default-passive-events": "^2.0.0",
         "element-ui": "2.15.2",
         "js-base64": "^3.7.2",
         "vue": "^2.6.11",
@@ -3125,8 +3127,7 @@
     "node_modules/asynckit": {
       "version": "0.4.0",
       "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
-      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
-      "dev": true
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
     },
     "node_modules/atob": {
       "version": "2.1.2",
@@ -3173,6 +3174,28 @@
       "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
       "dev": true
     },
+    "node_modules/axios": {
+      "version": "0.27.2",
+      "resolved": "https://registry.npmmirror.com/axios/-/axios-0.27.2.tgz",
+      "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
+      "dependencies": {
+        "follow-redirects": "^1.14.9",
+        "form-data": "^4.0.0"
+      }
+    },
+    "node_modules/axios/node_modules/form-data": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
+      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+      "dependencies": {
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.8",
+        "mime-types": "^2.1.12"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
     "node_modules/babel-helper-vue-jsx-merge-props": {
       "version": "2.0.3",
       "resolved": "https://registry.npmmirror.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
@@ -4319,7 +4342,6 @@
       "version": "1.0.8",
       "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
       "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
-      "dev": true,
       "dependencies": {
         "delayed-stream": "~1.0.0"
       },
@@ -5377,6 +5399,11 @@
         "node": ">= 8"
       }
     },
+    "node_modules/default-passive-events": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmmirror.com/default-passive-events/-/default-passive-events-2.0.0.tgz",
+      "integrity": "sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ=="
+    },
     "node_modules/defaults": {
       "version": "1.0.3",
       "resolved": "https://registry.npmmirror.com/defaults/-/defaults-1.0.3.tgz",
@@ -5459,7 +5486,6 @@
       "version": "1.0.0",
       "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
       "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
-      "dev": true,
       "engines": {
         "node": ">=0.4.0"
       }
@@ -6551,7 +6577,6 @@
       "version": "1.15.1",
       "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.1.tgz",
       "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
-      "dev": true,
       "engines": {
         "node": ">=4.0"
       },
@@ -8666,7 +8691,6 @@
       "version": "1.52.0",
       "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
       "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
-      "dev": true,
       "engines": {
         "node": ">= 0.6"
       }
@@ -8675,7 +8699,6 @@
       "version": "2.1.35",
       "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
       "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
-      "dev": true,
       "dependencies": {
         "mime-db": "1.52.0"
       },
@@ -16814,8 +16837,7 @@
     "asynckit": {
       "version": "0.4.0",
       "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
-      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
-      "dev": true
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
     },
     "atob": {
       "version": "2.1.2",
@@ -16850,6 +16872,27 @@
       "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
       "dev": true
     },
+    "axios": {
+      "version": "0.27.2",
+      "resolved": "https://registry.npmmirror.com/axios/-/axios-0.27.2.tgz",
+      "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
+      "requires": {
+        "follow-redirects": "^1.14.9",
+        "form-data": "^4.0.0"
+      },
+      "dependencies": {
+        "form-data": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
+          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+          "requires": {
+            "asynckit": "^0.4.0",
+            "combined-stream": "^1.0.8",
+            "mime-types": "^2.1.12"
+          }
+        }
+      }
+    },
     "babel-helper-vue-jsx-merge-props": {
       "version": "2.0.3",
       "resolved": "https://registry.npmmirror.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
@@ -17838,7 +17881,6 @@
       "version": "1.0.8",
       "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
       "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
-      "dev": true,
       "requires": {
         "delayed-stream": "~1.0.0"
       }
@@ -18700,6 +18742,11 @@
         }
       }
     },
+    "default-passive-events": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmmirror.com/default-passive-events/-/default-passive-events-2.0.0.tgz",
+      "integrity": "sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ=="
+    },
     "defaults": {
       "version": "1.0.3",
       "resolved": "https://registry.npmmirror.com/defaults/-/defaults-1.0.3.tgz",
@@ -18770,8 +18817,7 @@
     "delayed-stream": {
       "version": "1.0.0",
       "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
-      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
-      "dev": true
+      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
     },
     "depd": {
       "version": "2.0.0",
@@ -19693,8 +19739,7 @@
     "follow-redirects": {
       "version": "1.15.1",
       "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.1.tgz",
-      "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==",
-      "dev": true
+      "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA=="
     },
     "for-in": {
       "version": "1.0.2",
@@ -21397,14 +21442,12 @@
     "mime-db": {
       "version": "1.52.0",
       "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
-      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
-      "dev": true
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
     },
     "mime-types": {
       "version": "2.1.35",
       "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
       "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
-      "dev": true,
       "requires": {
         "mime-db": "1.52.0"
       }

+ 2 - 0
houtai/package.json

@@ -7,7 +7,9 @@
     "build": "vue-cli-service build"
   },
   "dependencies": {
+    "axios": "^0.27.2",
     "core-js": "^3.6.5",
+    "default-passive-events": "^2.0.0",
     "element-ui": "2.15.2",
     "js-base64": "^3.7.2",
     "vue": "^2.6.11",

BIN
houtai/public/data/tab1Add.png


+ 1 - 0
houtai/src/main.js

@@ -4,6 +4,7 @@ import router from './router'
 import ElementUI from 'element-ui';
 import 'element-ui/lib/theme-chalk/index.css';
 Vue.use(ElementUI);
+import 'default-passive-events'
 Vue.config.productionTip = false
 import './assets/base.css'
 new Vue({

+ 19 - 13
houtai/src/router/index.js

@@ -21,6 +21,12 @@ const routes = [
         component: () => import('../views/tab1/index.vue')
       },
       {
+        path: 'tab1Add',
+        name: 'tab1Add',
+        meta: { myInd: 1, myBac: 'tab2Bac' },
+        component: () => import('../views/tab1/add.vue')
+      },
+      {
         path: 'tab2',
         name: 'tab2',
         meta: { myInd: 2, myBac: 'tab2Bac' },
@@ -35,18 +41,18 @@ const router = new VueRouter({
   routes
 })
 
-// router.beforeEach((to, from, next) => {
-//   // 如果是去登录页,不需要验证,直接下一步
-//   if (to.name === 'login') next()
-//   // 否则要有token值才能下一步,不然就返回登录页
-//   else {
-//     const token = localStorage.getItem('JMYZU_token')
-//     if (token) next()
-//     else {
-//       Message.warning('登录失效,请重新登录')
-//       next({ name: 'login' })
-//     }
-//   }
-// })
+router.beforeEach((to, from, next) => {
+  // 如果是去登录页,不需要验证,直接下一步
+  if (to.name === 'login') next()
+  // 否则要有token值才能下一步,不然就返回登录页
+  else {
+    const token = localStorage.getItem('WLBWG_token')
+    if (token) next()
+    else {
+      Message.warning('登录失效,请重新登录')
+      next({ name: 'login' })
+    }
+  }
+})
 
 export default router

+ 33 - 0
houtai/src/utils/api.js

@@ -0,0 +1,33 @@
+import axios from './request'
+// 用户登录接口
+export const userLogin = (data) => {
+  return axios({
+    method: 'post',
+    url: '/admin/login',
+    data
+  })
+}
+// 修改密码
+export const updatePwd = (data) => {
+  return axios({
+    method: 'post',
+    url: '/sys/user/updatePwd',
+    data
+  })
+}
+// 操作日志列表
+export const getList = (data) => {
+  return axios({
+    method: 'post',
+    url: '/cms/activity/list',
+    data
+  })
+}
+// 获取活动列表
+export const logList = (data) => {
+  return axios({
+    method: 'post',
+    url: '/sys/log/list',
+    data
+  })
+}

+ 3 - 2
houtai/src/utils/request.js

@@ -1,8 +1,8 @@
 import axios from 'axios'
 const service = axios.create({
-  // baseURL: 'http://192.168.0.135:8017', // 本地调试
+  baseURL: 'http://192.168.10.38:8018', // 本地调试
   // baseURL: 'http://project.4dage.com:8017', // 线上调试
-  baseURL: '', // build
+  // baseURL: '', // build
   timeout: 5000
 })
 // 请求拦截器
@@ -28,6 +28,7 @@ service.interceptors.response.use(function (response) {
   if (response.data.code === 5001 || response.data.code === 5002) {
     // Toast.fail('未登录,请先登录')
     localStorage.removeItem('WLBWG_token')
+    location.reload(true)
   }
   return response.data
 }, function (error) {

+ 30 - 22
houtai/src/views/Layout.vue

@@ -1,11 +1,14 @@
 <!--  -->
 <template>
-  <div class="Layout" :style="`background: url('/data/${$route.meta.myBac}.png');background-size: 100% 100%;`">
+  <div
+    class="Layout"
+    :style="`background: url('/data/${$route.meta.myBac}.png');background-size: 100% 100%;`"
+  >
     <div class="top">
       <div class="topL">温岭社教活动管理后台</div>
       <div class="topR" @mouseenter="cut = true" @mouseleave="cut = false">
         <div class="user">
-          <span>admin</span>
+          <span>{{ userName }}</span>
           <!-- 下箭头 -->
           <div class="pull_down" v-if="cut"></div>
           <div class="pull_up" v-else></div>
@@ -84,9 +87,9 @@
 </template>
 
 <script>
-// import { encodeStr } from '../../utils/pass'
-// import { Base64 } from 'js-base64'
-// import { updatePwd } from '@/apis/login'
+import { encodeStr } from "@/utils/pass";
+import { Base64 } from "js-base64";
+import { updatePwd } from "@/utils/api";
 
 export default {
   name: "Layout",
@@ -144,22 +147,22 @@ export default {
     },
     // 修改密码点击确定
     async btnOk() {
-      // await this.$refs.ruleForm.validate();
-      // try {
-      //   const data = {
-      //     oldPassword: encodeStr(Base64.encode(this.form.oldPassword)),
-      //     newPassword: encodeStr(Base64.encode(this.form.newPassword)),
-      //   };
-      //   const res = await updatePwd(data);
-      //   if (res.code === 0) {
-      //     this.$message.success("修改成功");
-      //     localStorage.clear("WLBWG_token");
-      //     localStorage.clear("WLBWG_userInfo");
-      //     this.$router.push("/");
-      //   } else this.$message.error(res.msg);
-      // } catch (error) {
-      //   console.log(error);
-      // }
+      await this.$refs.ruleForm.validate();
+      try {
+        const data = {
+          oldPassword: encodeStr(Base64.encode(this.form.oldPassword)),
+          newPassword: encodeStr(Base64.encode(this.form.newPassword)),
+        };
+        const res = await updatePwd(data);
+        if (res.code === 0) {
+          this.$message.success("修改成功");
+          localStorage.clear("WLBWG_token");
+          localStorage.clear("WLBWG_userInfo");
+          this.$router.push("/");
+        } else this.$message.error(res.msg);
+      } catch (error) {
+        console.log(error);
+      }
     },
     // 点击退出登录
     outLogin() {
@@ -184,7 +187,11 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    // 获取用户名
+    const res = localStorage.getItem("WLBWG_userName");
+    this.userName = res;
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前
@@ -323,6 +330,7 @@ export default {
         }
         .active {
           color: orange;
+          pointer-events: none;
         }
       }
     }

+ 21 - 24
houtai/src/views/Login.vue

@@ -5,7 +5,7 @@
     <div class="main">
       <!-- logo -->
       <div class="logo">
-        <img src="../assets/img/logo.png" alt="">
+        <img src="../assets/img/logo.png" alt="" />
       </div>
       <div class="mainCon">
         <div class="mainConL">
@@ -48,9 +48,9 @@
 </template>
 
 <script>
-// import { encodeStr } from "../utils/pass";
-// import { Base64 } from "js-base64";
-// import { userLogin } from '@/apis/login'
+import { encodeStr } from "@/utils/pass";
+import { Base64 } from "js-base64";
+import { userLogin } from "@/utils/api";
 export default {
   name: "Login",
   components: {},
@@ -74,25 +74,22 @@ export default {
   //方法集合
   methods: {
     async login() {
-      this.$router.push("/layout/tab1");
-      this.$message.success("登录成功");
-
-      // try {
-      //   await this.$refs.ruleForm.validate();
-      //   const data = {
-      //     userName: this.ruleForm.userName,
-      //     passWord: encodeStr(Base64.encode(this.ruleForm.passWord)),
-      //   };
-      //   const res = await userLogin(data);
-      //   if (res.code === 0) {
-      //     localStorage.setItem("WLBWG_token", res.data.token);
-      //     localStorage.setItem("WLBWG_userName", res.data.user.userName);
-      //     this.$router.push("/layout/tab1");
-      //     this.$message.success("登录成功");
-      //   } else this.$message.warning(res.msg);
-      // } catch (error) {
-      //   console.log(error);
-      // }
+      try {
+        await this.$refs.ruleForm.validate();
+        const data = {
+          userName: this.ruleForm.userName,
+          passWord: encodeStr(Base64.encode(this.ruleForm.passWord)),
+        };
+        const res = await userLogin(data);
+        if (res.code === 0) {
+          localStorage.setItem("WLBWG_token", res.data.token);
+          localStorage.setItem("WLBWG_userName", res.data.user.userName);
+          this.$router.push("/layout/tab1");
+          this.$message.success("登录成功");
+        } else this.$message.warning(res.msg);
+      } catch (error) {
+        console.log(error);
+      }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -130,7 +127,7 @@ export default {
     width: 100%;
     height: calc(100% - 80px);
     position: relative;
-    .logo{
+    .logo {
       position: absolute;
       top: 38px;
       left: 198px;

+ 442 - 0
houtai/src/views/tab1/add.vue

@@ -0,0 +1,442 @@
+<template>
+  <div class="tab1Add">
+    <div class="top">
+      <div class="tit"></div>
+      活动发布
+    </div>
+    <div class="main">
+      <div class="mainTit1">活动信息</div>
+      <div class="mainBox">
+        <el-form
+          :model="ruleForm"
+          :rules="rules"
+          ref="ruleForm"
+          label-width="140px"
+          class="demo-ruleForm"
+        >
+          <el-form-item label="活动名称:" prop="name">
+            <el-input
+              placeholder="请输入"
+              v-model="ruleForm.name"
+              maxlength="30"
+              show-word-limit
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="活动地点:" prop="name2">
+            <el-input
+              placeholder="请输入"
+              v-model="ruleForm.name2"
+              maxlength="50"
+              show-word-limit
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="活动主持人:" prop="name2">
+            <el-input
+              placeholder="请输入"
+              v-model="ruleForm.name2"
+              maxlength="10"
+              show-word-limit
+            ></el-input>
+          </el-form-item>
+          <div class="row">
+            <el-form-item label="参与活动年龄段:" prop="name2">
+              <el-select
+                v-model="ruleForm.name2"
+                placeholder="请选择"
+                style="width: 170px"
+              >
+                <el-option
+                  v-for="i in 99"
+                  :key="i"
+                  :label="`${i}岁`"
+                  :value="i"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <span class="fenge">-</span>
+            <el-form-item prop="name3" class="mySelect">
+              <el-select
+                v-model="ruleForm.name3"
+                placeholder="请选择"
+                style="width: 170px"
+              >
+                <el-option
+                  v-for="i in 99"
+                  :key="i"
+                  :label="`${i}岁`"
+                  :value="i"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </div>
+          <!-- 照片墙1 -->
+          <el-form-item label="图文封面:">
+            <span class="biaoshi">*</span>
+            <el-upload
+              accept=".png,.jpg,.jpeg,.gif"
+              :action="baseURL + '/cms/content/upload'"
+              :data="{}"
+              :file-list="imgUpList1"
+              :headers="{ token }"
+              :limit="1"
+              :on-exceed="handleExceed"
+              list-type="picture-card"
+              :on-preview="handlePictureCardPreview"
+              :on-remove="handleRemove1"
+              :before-remove="beforeRemove"
+              :before-upload="beforethumbUploadImg"
+              :on-success="upload_thumb_successImg1"
+            >
+              <i class="el-icon-plus"></i>
+              <div slot="tip" class="el-upload__tip">
+                格式要求:支持png、jpg、gif和jpeg的图片格式;最大支持20M
+              </div>
+            </el-upload>
+          </el-form-item>
+          <!-- 照片墙2 -->
+          <el-form-item label="活动顶部配图:">
+            <span class="biaoshi biaoshi2">*</span>
+            <el-upload
+              accept=".png,.jpg,.jpeg,.gif"
+              :action="baseURL + '/cms/content/upload'"
+              :data="{}"
+              :file-list="imgUpList2"
+              :headers="{ token }"
+              :limit="1"
+              :on-exceed="handleExceed"
+              list-type="picture-card"
+              :on-preview="handlePictureCardPreview"
+              :on-remove="handleRemove2"
+              :before-remove="beforeRemove"
+              :before-upload="beforethumbUploadImg"
+              :on-success="upload_thumb_successImg2"
+            >
+              <i class="el-icon-plus"></i>
+              <div slot="tip" class="el-upload__tip">
+                格式要求:支持png、jpg、gif和jpeg的图片格式;最大支持20M
+              </div>
+            </el-upload>
+          </el-form-item>
+        </el-form>
+      </div>
+      <div class="mainTit1 mainTit2">活动时间</div>
+      <div class="mainBox">
+        <div class="row2">
+          <div>
+            <span>活动时间:</span>
+            <el-date-picker
+              value-format="yyyy-MM-dd"
+              v-model="time1"
+              type="daterange"
+              range-separator="-"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+            >
+            </el-date-picker>
+          </div>
+        </div>
+        <div class="row2 row3" v-for="(item, index) in timeArr" :key="item.id">
+          <div>
+            <span>活动时段{{ index + 1 }}:</span>
+            <el-date-picker
+              value-format="yyyy-MM-dd"
+              v-model="timeArr[index].time"
+              type="daterange"
+              range-separator="-"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+            >
+            </el-date-picker>
+          </div>
+          <div>
+            <span>预设名额{{ index + 1 }}:</span>
+            <el-input
+              style="width: 300px"
+              onkeyup="value=value.replace(/[^\d]/g,'')"
+              onblur="value=value.replace(/[^\d]/g,'')"
+              placeholder="请输入数字"
+              v-model="timeArr[index].num"
+              maxlength="3"
+            ></el-input>
+            <div class="addTime" v-if="index === 0" @click="addTime">
+              增加时间段+
+            </div>
+            <div
+              class="addTime el-icon-close"
+              v-else
+              @click="delTime(item.id)"
+            ></div>
+          </div>
+        </div>
+      </div>
+      <div class="mainTit1">活动详情</div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "tab1Add",
+  components: {},
+  data() {
+    //这里存放数据
+    return {
+      token: "",
+      baseURL: "",
+      dialogImageUrl: "",
+      dialogVisible: false,
+      imgUpList1: [],
+      imgUpList2: [],
+      // 关于照片墙 👆
+      time1: "",
+      timeArr: [{ id: Date.now(), time: "", num: "" }],
+      //关于活动时间 👆
+      ruleForm: {
+        name: "",
+        name2: 18,
+        name3: 40,
+      },
+      rules: {
+        name: [{ required: true, message: "不能为空", trigger: "blur" }],
+        name2: [{ required: true, message: "不能为空", trigger: "blur" }],
+        name3: [{ required: true, message: "不能为空", trigger: "blur" }],
+      },
+    };
+  },
+  //监听属性 类似于data概念
+  computed: {},
+  //监控data中的数据变化
+  watch: {
+    time(val) {
+      if (!val) this.formData.startTime = this.formData.endTime = "";
+      else {
+        this.formData.startTime = val[0];
+        this.formData.endTime = val[1];
+      }
+    },
+  },
+  //方法集合
+  methods: {
+    // 关于活动时间
+    addTime() {
+      this.timeArr.push({ id: Date.now(), time: "", num: "" });
+    },
+    delTime(id) {
+      this.$confirm("确定删除吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.timeArr = this.timeArr.filter((v) => v.id !== id);
+
+          this.$message.success("删除成功!");
+        })
+        .catch(() => {
+          this.$message.info("已取消");
+        });
+    },
+    // ---------------照片墙1
+    beforeRemove(file, fileList) {
+      if (file && file.status === "success") {
+        return this.$confirm(`此操作将永久删除 ${file.name}`);
+      }
+    },
+    async handleRemove1(file, fileList) {
+      const id = file.id || file.response.data.id;
+      const res = await delFileApi(id);
+      if (res.code === 0) {
+        this.$message.success("删除成功");
+        this.imgUpList1 = [];
+      } else this.$message.warning(res.msg);
+    },
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    beforethumbUploadImg(file) {
+      // console.log(998, file)
+      // 限制图片大小和格式
+      const sizeOk = file.size / 1024 / 1024 < 20;
+      const typeOk =
+        file.type === "image/png" ||
+        file.type === "image/gif" ||
+        (file.type === "image/jpeg" && !file.name.includes(".jfif"));
+
+      return new Promise((resolve, reject) => {
+        if (!typeOk) {
+          this.$message.error("图片格式有误!");
+          reject(file);
+        } else if (!sizeOk) {
+          this.$message.error("图片大小超过20M!");
+          reject(file);
+        } else {
+          resolve(file);
+        }
+      });
+    },
+    upload_thumb_successImg1(data) {
+      this.$message.success("上传图片成功");
+      this.imgUpList1 = [data.data.id];
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning("最多上传1张图片");
+    },
+    // 照片墙2
+    async handleRemove2(file, fileList) {
+      const id = file.id || file.response.data.id;
+      const res = await delFileApi(id);
+      if (res.code === 0) {
+        this.$message.success("删除成功");
+        this.imgUpList2 = [];
+      } else this.$message.warning(res.msg);
+    },
+    upload_thumb_successImg2(data) {
+      this.$message.success("上传图片成功");
+      this.imgUpList2 = [data.data.id];
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang='less' scoped>
+.tab1Add {
+  width: 100%;
+  height: 100%;
+  .top {
+    position: relative;
+    padding: 0 30px;
+    width: 100%;
+    height: 50px;
+    background-color: #fff;
+    box-shadow: 1px 1px 6px 0px black;
+    color: #b7b7b7;
+    font-size: 14px;
+    letter-spacing: 2px;
+    display: flex;
+    align-items: center;
+    .tit {
+      margin-right: 5px;
+      width: 3px;
+      height: 20px;
+      background-color: #6f774e;
+    }
+  }
+  .main {
+    margin-top: 15px;
+    background-color: #fff;
+    box-shadow: 1px 1px 6px 0px;
+    width: 100%;
+    height: calc(100% - 65px);
+    overflow-y: auto;
+    .mainTit1 {
+      height: 38px;
+      line-height: 38px;
+      background-color: #d5d8cc;
+      padding-left: 26px;
+      margin-bottom: 20px;
+    }
+    .mainTit2 {
+      background-color: #ece3d4;
+    }
+    .mainBox {
+      width: 1200px;
+      padding-left: 35px;
+      /deep/.el-form {
+        display: flex;
+        justify-content: space-between;
+        flex-wrap: wrap;
+      }
+      /deep/.el-form-item {
+        width: 500px;
+      }
+      /deep/.el-input__inner {
+        padding-right: 50px;
+      }
+      .row {
+        width: 500px;
+        display: flex;
+        .fenge {
+          border-top: 1px solid #dcdfe6;
+          border-bottom: 1px solid #dcdfe6;
+          display: inline-block;
+          line-height: 36px;
+          padding: 0 7px;
+          height: 40px;
+        }
+        /deep/input {
+          border-radius: 4px 0 0 4px;
+          border: 1px solid #dcdfe6;
+          border-right: none;
+        }
+      }
+      .mySelect {
+        /deep/input {
+          border-radius: 0 4px 4px 0;
+          border-right: 1px solid #dcdfe6;
+          border-left: none;
+        }
+      }
+      .biaoshi {
+        position: absolute;
+        top: 0;
+        left: -92px;
+        color: #f56c6c;
+      }
+      .biaoshi2 {
+        left: -120px;
+      }
+      .row2 {
+        & > div {
+          & > span {
+            display: inline-block;
+            width: 140px;
+            text-align: right;
+            font-size: 14px;
+            color: #606266;
+            padding-right: 12px;
+            &::before {
+              content: "*";
+              color: #f56c6c;
+              margin-right: 4px;
+            }
+          }
+        }
+      }
+      .row3 {
+        display: flex;
+        margin: 22px 0;
+        & > div {
+          width: 50%;
+          display: flex;
+          align-items: center;
+        }
+        .addTime {
+          cursor: pointer;
+          color: #b02323;
+          margin-left: 27px;
+          height: 40px;
+          line-height: 40px;
+        }
+      }
+    }
+    .mySelect {
+      /deep/.el-form-item__content {
+        margin-left: 0 !important;
+      }
+    }
+  }
+}
+</style>

+ 52 - 34
houtai/src/views/tab1/index.vue

@@ -4,7 +4,7 @@
     <div class="top">
       <div class="tit"></div>
       活动列表
-      <div class="btn"></div>
+      <div class="btn" @click="toAdd"></div>
     </div>
     <div class="main">
       <!-- 顶部状态栏 -->
@@ -44,8 +44,9 @@
           </el-input>
         </div>
         <div class="btnn">
-          <el-button type="primary">查 询</el-button>&emsp;
-          <el-button>重 置</el-button>
+          <el-button type="primary" @click="getList(formData)">查 询</el-button
+          >&emsp;
+          <el-button @click="reset">重 置</el-button>
         </div>
       </div>
       <!-- 表格 -->
@@ -93,21 +94,22 @@
 </template>
 
 <script>
+import { getList } from "@/utils/api";
 export default {
   name: "tab1",
   components: {},
   data() {
     //这里存放数据
     return {
-      total: 100,
+      total: 0,
       time: "",
-      mainTopInd: 1,
+      mainTopInd: "",
       mainTop: [
-        { id: 1, name: "全部" },
-        { id: 2, name: "草稿中" },
-        { id: 3, name: "活动中" },
-        { id: 4, name: "未开始" },
-        { id: 5, name: "已介绍" },
+        { id: "", name: "全部" },
+        { id: 0, name: "草稿中" },
+        { id: 2, name: "活动中" },
+        { id: 1, name: "未开始" },
+        { id: 3, name: "已介绍" },
       ],
       formData: {
         pageNum: 1,
@@ -115,27 +117,9 @@ export default {
         searchKey: "",
         startTime: "",
         endTime: "",
+        status: "",
       },
-      tableData: [
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-      ],
+      tableData: [],
     };
   },
   //监听属性 类似于data概念
@@ -152,24 +136,58 @@ export default {
   },
   //方法集合
   methods: {
+    // 点击重置
+    reset() {
+      this.time = "";
+      this.formData = {
+        pageNum: 1,
+        pageSize: 10,
+        searchKey: "",
+        startTime: "",
+        endTime: "",
+        status: "",
+      };
+      this.getList(this.formData);
+    },
+    // 点击新增
+    toAdd() {
+      this.$router.push({
+        path: "/layout/tab1Add",
+        query: { k: this.formData.pageNum },
+      });
+    },
+    // 切换 全部--草稿……
     cutTop(id) {
       this.mainTopInd = id;
+      this.formData.status = id;
+      this.getList(this.formData);
     },
     // 分页器方法
     currentChange(val) {
       // console.log('当前页改变了', val)
       this.formData.pageNum = val;
-      this.goodsList(this.formData);
+      this.getList(this.formData);
     },
     sizeChange(val) {
       // console.log('条数改变了', val)
       this.formData.pageNum = 1;
       this.formData.pageSize = val;
-      this.goodsList(this.formData);
+      this.getList(this.formData);
+      s;
+    },
+    // 封装一个获取列表的方法
+    async getList(data) {
+      const res = await getList(data);
+      this.total = res.data.total;
+      this.tableData = res.data.records;
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    const k = this.$route.query.k;
+    if (k) this.formData.pageNum = Number(k);
+    this.getList(this.formData);
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前
@@ -270,7 +288,7 @@ export default {
           font-weight: 700;
         }
       }
-      .btnn{
+      .btnn {
         position: absolute;
         right: 0;
         top: 0;

+ 34 - 30
houtai/src/views/tab2/index.vue

@@ -21,8 +21,10 @@
           </el-date-picker>
         </div>
         <div>
-          <el-button type="primary">查 询</el-button>&emsp;
-          <el-button>重 置</el-button>
+          <el-button type="primary" @click="getLogList(formData)"
+            >查 询</el-button
+          >&emsp;
+          <el-button @click="reset">重 置</el-button>
         </div>
       </div>
       <!-- 表格 -->
@@ -35,10 +37,12 @@
               }}
             </template>
           </el-table-column>
-          <el-table-column prop="address" label="操作者"> </el-table-column>
-          <el-table-column prop="address" label="操作日期"> </el-table-column>
-          <el-table-column prop="address" label="IP地址"> </el-table-column>
-          <el-table-column prop="address" label="操作记录"> </el-table-column>
+          <el-table-column prop="userName" label="操作者"> </el-table-column>
+          <el-table-column prop="createTime" label="操作日期">
+          </el-table-column>
+          <el-table-column prop="ip" label="IP地址"> </el-table-column>
+          <el-table-column prop="description" label="操作记录">
+          </el-table-column>
         </el-table>
       </div>
       <!-- 分页 -->
@@ -59,13 +63,14 @@
 </template>
 
 <script>
+import { logList } from "@/utils/api";
 export default {
   name: "tab2",
   components: {},
   data() {
     //这里存放数据
     return {
-      total: 100,
+      total: 0,
       time: "",
       formData: {
         pageNum: 1,
@@ -73,26 +78,7 @@ export default {
         startTime: "",
         endTime: "",
       },
-      tableData: [
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-        { name: 1 },
-      ],
+      tableData: [],
     };
   },
   //监听属性 类似于data概念
@@ -109,21 +95,39 @@ export default {
   },
   //方法集合
   methods: {
+    // 点击重置
+    reset() {
+      this.time=''
+      this.formData = {
+        pageNum: 1,
+        pageSize: 10,
+        startTime: "",
+        endTime: "",
+      };
+      this.getLogList(this.formData);
+    },
     // 分页器方法
     currentChange(val) {
       // console.log('当前页改变了', val)
       this.formData.pageNum = val;
-      this.goodsList(this.formData);
+      this.getLogList(this.formData);
     },
     sizeChange(val) {
       // console.log('条数改变了', val)
       this.formData.pageNum = 1;
       this.formData.pageSize = val;
-      this.goodsList(this.formData);
+      this.getLogList(this.formData);
+    },
+    async getLogList(data) {
+      const res = await logList(data);
+      this.total = res.data.total;
+      this.tableData = res.data.records;
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    this.getLogList(this.formData);
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前