Browse Source

修复头疼bug

shaogen1995 3 years ago
parent
commit
5ba1a555c0

BIN
favicon.png


+ 54 - 54
src/common/http.js

@@ -2,72 +2,72 @@ import axios from 'axios'
 
 var isProduction = process.env.NODE_ENV === 'production'
 
-// const serverName = isProduction ? 'http://192.168.0.135:8001/' : 'http://192.168.0.135:8001/'
-const serverName = isProduction ? 'http://8.135.106.227:8001/' : 'http://8.135.106.227:8001/'
+const serverName = isProduction ? 'http://192.168.0.135:8001/' : 'http://192.168.0.135:8001/'
+// const serverName = isProduction ? 'http://8.135.106.227:8001/' : 'http://8.135.106.227:8001/'
 
 axios.defaults.baseURL = serverName
 axios.defaults.headers['X-Requested-with'] = 'XMLHttpRequest'
 // axios.defaults.headers['token'] = window.localStorage.getItem('token')
 
 axios.interceptors.request.use(function (config) {
-    if (config.method === 'post') {
-        config.data = {
-            ...config.data,
-            rnd: Math.random()
-        }
-    } else if (config.method === 'get') {
-        config.params = {
-            rnd: Math.random(),
-            ...config.params
-        }
+  if (config.method === 'post') {
+    config.data = {
+      ...config.data,
+      rnd: Math.random()
     }
+  } else if (config.method === 'get') {
+    config.params = {
+      rnd: Math.random(),
+      ...config.params
+    }
+  }
 
-    return config
+  return config
 }, function (error) {
-    // 对请求错误做些什么
-    return Promise.reject(error)
+  // 对请求错误做些什么
+  return Promise.reject(error)
 })
 
 // 配置response拦截器
 axios.interceptors.response.use(
-    response => {
-        let data = response.data
-        let code = Number(response.data.code)
-        switch (code) {
-            case -1:
-                break
-            case 4500:
-                break
-            case 5001:
-                console.log('50015001500150015001')
-                break
-            case 5002:
-                break
-            case 500:
-                break
-            case 0:
-                break
-            default:
-                alert(data.msg)
-                break
-        }
-        return data
-    },
-    error => {
-        if (error.response) {
-            switch (error.response.status) {
-                case 400:
-                    console.log('=======前端参数传错了======')
-                    break
-                case 500:
-                    console.log('========服务器错误=======')
-                    break
-                default:
-                    console.log('error.response', error.response)
-                    break
-            }
-        }
-        return Promise.reject(error)
+  response => {
+    let data = response.data
+    let code = Number(response.data.code)
+    switch (code) {
+      case -1:
+        break
+      case 4500:
+        break
+      case 5001:
+        console.log('50015001500150015001')
+        break
+      case 5002:
+        break
+      case 500:
+        break
+      case 0:
+        break
+      default:
+        alert(data.msg)
+        break
     }
+    return data
+  },
+  error => {
+    if (error.response) {
+      switch (error.response.status) {
+        case 400:
+          console.log('=======前端参数传错了======')
+          break
+        case 500:
+          console.log('========服务器错误=======')
+          break
+        default:
+          console.log('error.response', error.response)
+          break
+      }
+    }
+    return Promise.reject(error)
+  }
 )
-export { axios }
+export { axios }

+ 57 - 3
src/pages/activity/activity-type.vue

@@ -389,6 +389,20 @@ export default {
   },
   // 方法集合
   methods: {
+    // 问卷提交
+    async saveSubmit (data) {
+      let res = await this.$http({
+        method: 'post',
+        url: '/api/web/questionGroup/save',
+        data
+      })
+      if (res.code === 0) {
+        this.$message.success('提交成功')
+        this.getQuestion()
+        this.name = this.phone = ''
+      }
+      console.log(999, res)
+    },
     async getList () {
       let result = await this.$http({
         method: 'post',
@@ -443,8 +457,6 @@ export default {
     },
     save () {
       // 点击提交
-
-      console.log(9999999999, this.question)
       this.question.forEach((item) => {
         if (item.type === 'radio' && !item.Answer) {
           this.questionComplete = true
@@ -468,11 +480,53 @@ export default {
       if (!checkPhone(this.phone)) {
         this.$message.warning('请输入正确的手机号码')
       }
+      // 处理数据
+      const answer = []
+      const objTemp = {
+        0: 'A',
+        1: 'B',
+        2: 'C',
+        3: 'D',
+        4: 'E',
+        5: 'F',
+        6: 'G',
+        7: 'H',
+        8: 'I',
+        9: 'J',
+        10: 'K',
+        11: 'L',
+        12: 'M',
+        13: 'N',
+        14: 'O',
+        15: 'P'
+      }
+      const obj = {}
+      this.question.forEach((v, i) => {
+        // 单选
+        if (v.type === 'radio') {
+          v.answer.forEach((p, pI) => {
+            // 有几个选项就变成ABC
+            if (v.Answer === p.value) answer.push({answer: objTemp[pI], num: i + 1})
+          })
+        } else if (v.type === 'multiple') {
+          v.Answer.forEach((p1, i1) => {
+            v.answer.forEach((p2, i2) => {
+              if (p1 === p2.value) answer.push({answer: objTemp[i2], num: i + 1})
+            })
+          })
+        }
+      })
+      obj.phone = this.phone
+      obj.realName = this.name
+      obj.questionGroupId = this.question[0].questionGroupId
+      obj.answer = answer
+      this.saveSubmit(obj)
+      // console.log(9999999999, obj)
     },
     // 答题卡吸顶
     handleScroll () {
       let topMove = document.documentElement.scrollTop
-      console.log(topMove, '---', this.offsetTop)
+      // console.log(topMove, '---', this.offsetTop)
       if (topMove > this.offsetTop) this.move = true
       else this.move = false
     }

+ 60 - 3
src/pages/collection/collection-detail.vue

@@ -64,7 +64,10 @@
             <div class="detail">
               <div class="detail-wrapper">
                 <div class="detail-picOrModel">
-                  <img v-if="detail.type === 'img'" :src="$cdnUrl + detail.thumb" alt=""   />
+                  <div class="lookImg" v-if="detail.type === 'img'">
+                  <img :src="$cdnUrl + detail.thumb" alt=""   />
+                  <i class="el-icon-zoom-in" @click="lookImg($cdnUrl,detail.thumb)"></i>
+                  </div>
                   <iframe v-if="detail.type === 'model'" :src="detail.modelUrl" frameborder="0"></iframe>
                 </div>
                 <div class="detail-title">{{ detail.name }}</div>
@@ -79,6 +82,11 @@
         </div>
       </div>
     </div>
+    <!-- 点击放大镜查看大图 -->
+    <div class="bigImg" v-if="bigImgIsShow">
+      <img :src="bigImg" alt="">
+      <div class="imgBtnX" @click="bigImgIsShow=false">关 闭</div>
+    </div>
   </div>
 </template>
 
@@ -92,6 +100,8 @@ export default {
   data () {
     // 这里存放数据
     return {
+      bigImgIsShow: false,
+      bigImg: '',
       collectionType: 'boutique',
       detail: {}
     }
@@ -110,11 +120,16 @@ export default {
         path: '/collection-type',
         query: { type: this.detail.navType || '' }
       })
+    },
+    // 点击放大镜查看大图
+    lookImg (url1, url2) {
+      this.bigImgIsShow = true
+      this.bigImg = `${url1}${url2}`
     }
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created () {
-    console.log(77777, this.$route.query)
+    // console.log(77777, this.$route.query)
     this.detail = this.$route.query
     this.collectionType = this.detail.navType
   },
@@ -130,6 +145,35 @@ export default {
 }
 </script>
 <style lang='less' scoped>
+.bigImg{
+  z-index: 99999;
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100vw;
+  height: 100vh;
+  background-color: rgba(0,0,0,.7);
+  text-align: center;
+  img {
+    margin-top: 15px;
+    max-width: 80vw;
+    max-height: 80vh;
+  }
+  .imgBtnX {
+    cursor: pointer;
+    width: 100px;
+    height: 30px;
+    position: absolute;
+    left: 50%;
+    bottom: 20px;
+    background-color: #fff;
+    border-radius: 8px;
+    color: black;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+}
 .bg {
   width: 100%;
   height: 100%;
@@ -228,18 +272,31 @@ export default {
           .detail {
             width: 100%;
             .detail-wrapper {
+
               width: 95%;
               margin: 152px auto 80px;
               overflow: hidden;
               .detail-picOrModel {
+                text-align: center;
                 width: 100%;
                 img {
-                  width: 100%;
+                  max-width: 100%;
+                  max-height: 400px;
                 }
                 iframe {
                   width: 100%;
                   height: 700px;
                 }
+                .lookImg{
+                  position: relative;
+                  i {
+                    font-size: 30px;
+                    cursor: pointer;
+                    position: absolute;
+                    bottom: 0;
+                    right: 0;
+                  }
+                }
               }
               .detail-title {
                 width: 100%;

+ 45 - 45
src/pages/collection/collection.vue

@@ -47,69 +47,69 @@
 </template>
 
 <script>
-//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
-//例如:import 《组件名称》 from '《组件路径》';
+// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+// 例如:import 《组件名称》 from '《组件路径》';
 
 export default {
-  name: "collection",
-  //import引入的组件需要注入到对象中才能使用
+  name: 'collection',
+  // import引入的组件需要注入到对象中才能使用
   components: {},
-  data() {
-    //这里存放数据
+  data () {
+    // 这里存放数据
     return {
-      select: "",
+      select: '',
       boutiqueHover: false,
-      threeDimensionalHover: false,
-    };
+      threeDimensionalHover: false
+    }
   },
-  //监听属性 类似于data概念
+  // 监听属性 类似于data概念
   computed: {},
-  //监控data中的数据变化
+  // 监控data中的数据变化
   watch: {},
-  //方法集合
+  // 方法集合
   methods: {
-    toType(type) {
-      this.$router.push({ path: "/collection-type", query: { type } });
+    toType (type) {
+      this.$router.push({ path: '/collection-type', query: { type } })
     },
-    mouseOver(type) {
-      this.select = type;
+    mouseOver (type) {
+      this.select = type
       switch (type) {
-        case "boutique":
-          this.boutiqueHover = true;
-          break;
-        case "threeDimensional":
-          this.threeDimensionalHover = true;
-          break;
+        case 'boutique':
+          this.boutiqueHover = true
+          break
+        case 'threeDimensional':
+          this.threeDimensionalHover = true
+          break
         default:
-          break;
+          break
       }
     },
-    mouseLeave(type) {
-      this.select = "";
+    mouseLeave (type) {
+      this.select = ''
       switch (type) {
-        case "boutique":
-          this.boutiqueHover = false;
-          break;
-        case "threeDimensional":
-          this.threeDimensionalHover = false;
-          break;
+        case 'boutique':
+          this.boutiqueHover = false
+          break
+        case 'threeDimensional':
+          this.threeDimensionalHover = false
+          break
         default:
-          break;
+          break
       }
-    },
+    }
   },
-  //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
-  //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  beforeCreate() {}, //生命周期 - 创建之前
-  beforeMount() {}, //生命周期 - 挂载之前
-  beforeUpdate() {}, //生命周期 - 更新之前
-  updated() {}, //生命周期 - 更新之后
-  beforeDestroy() {}, //生命周期 - 销毁之前
-  destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
-};
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created () {},
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted () {},
+  beforeCreate () {}, // 生命周期 - 创建之前
+  beforeMount () {}, // 生命周期 - 挂载之前
+  beforeUpdate () {}, // 生命周期 - 更新之前
+  updated () {}, // 生命周期 - 更新之后
+  beforeDestroy () {}, // 生命周期 - 销毁之前
+  destroyed () {}, // 生命周期 - 销毁完成
+  activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
+}
 </script>
 <style lang='less' scoped>
 .collection {

+ 1 - 1
src/pages/exhibition/exhibition-detail.vue

@@ -46,7 +46,7 @@
                     :class="{ cur: exhibitionType === 'preview' }"
                     @click="switchType('preview')"
                   >
-                    <a>展览预告</a>
+                    <a>固定展览</a>
                     <div class="arrow" v-if="exhibitionType === 'preview'">
                       <img :src="require('@/assets/images/arrow.png')" alt="" />
                     </div>

+ 4 - 1
src/pages/exhibition/exhibition-type.vue

@@ -41,7 +41,7 @@
                     :class="{ cur: exhibitionType === 'preview' }"
                     @click="switchType('preview')"
                   >
-                    <a>展览预告</a>
+                    <a>固定展览</a>
                     <div class="arrow" v-if="exhibitionType === 'preview'">
                       <img :src="require('@/assets/images/arrow.png')" alt="" />
                     </div>
@@ -140,6 +140,9 @@ export default {
   // 方法集合
   methods: {
     async getList () {
+      if (this.exhibitionType === 'hot') this.params.type = 'start'
+      if (this.exhibitionType === 'preview') this.params.type = 'fixed'
+      if (this.exhibitionType === 'review') this.params.type = 'end'
       let result = await this.$http({
         method: 'post',
         url: '/api/web/exhibition/list',

+ 1 - 1
src/pages/exhibition/exhibition.vue

@@ -36,7 +36,7 @@
             alt=""
           />
           <div class="txt" :class="{ active: select === 'preview' }">
-            展览预告
+            固定展览
           </div>
         </li>
 

+ 26 - 26
src/pages/layout/footer.vue

@@ -20,8 +20,8 @@
       </ul>
       <div class="address">
         <p>
-          地址:大理古城复兴路111号 邮编:671000 传真:0872-2128614
-          电话:0872-2661777
+          地址:大理古城复兴路111号 邮编:671000 传真:0872-2670196
+          电话:0872-2670196
         </p>
         <p>Copyright 2018-2028 大理市博物馆 版权所有 滇lCP备20001302号-1</p>
       </div>
@@ -30,41 +30,41 @@
 </template>
 
 <script>
-const DIGIT = 4;
+const DIGIT = 4
 export default {
-  name: "mfooter",
-  data() {
+  name: 'mfooter',
+  data () {
     return {
-      visits: 0,
-    };
+      visits: 0
+    }
   },
-  created() {
-    this.getVisit();
+  created () {
+    this.getVisit()
   },
   methods: {
-    routeTo(path, type) {
-      if (type === "message") {
-        this.$router.push({ path, query: { navType: type } });
-        return;
+    routeTo (path, type) {
+      if (type === 'message') {
+        this.$router.push({ path, query: { navType: type } })
+        return
       }
-      this.$router.push({ path, query: { type } });
+      this.$router.push({ path, query: { type } })
     },
-    async getVisit() {
+    async getVisit () {
       let result = await this.$http({
-        method: "get",
-        url: "/api/web/addVisitWeb/web",
-      });
-      this.visits = this.addPreZero(DIGIT,result.data);    
+        method: 'get',
+        url: '/api/web/addVisitWeb/web'
+      })
+      this.visits = this.addPreZero(DIGIT, result.data)
     },
-    addPreZero(digit,num) {
-      var t = (num + "").length,s = "";
+    addPreZero (digit, num) {
+      var t = (num + '').length, s = ''
       for (var i = 0; i < digit - t; i++) {
-        s += "0";
+        s += '0'
       }
-      return s + num;
-    },
-  },
-};
+      return s + num
+    }
+  }
+}
 </script>
 
 <style lang="less" scoped>

+ 24 - 25
src/router/index.js

@@ -3,112 +3,111 @@ import Router from 'vue-router'
 
 Vue.use(Router)
 
-
 const routes = [
 
   {
-    path: "/",
-    component: () => import("@/pages/layout/index.vue"),
+    path: '/',
+    component: () => import('@/pages/layout/index.vue'),
     children: [
       {
         path: '/',
-        redirect: "/home"
+        redirect: '/home'
       },
       {
         path: '/home',
         name: 'home',
-        component: () => import("@/pages/home/home.vue")
+        component: () => import('@/pages/home/home.vue')
       },
       {
         path: '/survey',
         name: 'survey',
-        component: () => import("@/pages/survey/survey.vue")
+        component: () => import('@/pages/survey/survey.vue')
       },
       {
         path: '/survey-type',
         name: 'survey-type',
-        component: () => import("@/pages/survey/survey-type.vue")
+        component: () => import('@/pages/survey/survey-type.vue')
       },
       {
         path: '/information',
         name: 'information',
-        component: () => import("@/pages/information/information.vue")
+        component: () => import('@/pages/information/information.vue')
       },
       {
         path: '/information-type',
         name: 'information-type',
-        component: () => import("@/pages/information/information-type.vue")
+        component: () => import('@/pages/information/information-type.vue')
       },
       {
         path: '/information-detail',
         name: 'information-detail',
-        component: () => import("@/pages/information/information-detail.vue")
+        component: () => import('@/pages/information/information-detail.vue')
       },
       {
         path: '/exhibition',
         name: 'exhibition',
-        component: () => import("@/pages/exhibition/exhibition.vue")
+        component: () => import('@/pages/exhibition/exhibition.vue')
       },
       {
         path: '/exhibition-type',
         name: 'exhibition-type',
-        component: () => import("@/pages/exhibition/exhibition-type.vue")
+        component: () => import('@/pages/exhibition/exhibition-type.vue')
       },
       {
         path: '/exhibition-detail',
         name: 'exhibition-detail',
-        component: () => import("@/pages/exhibition/exhibition-detail.vue")
+        component: () => import('@/pages/exhibition/exhibition-detail.vue')
       },
       {
         path: '/collection',
         name: 'collection',
-        component: () => import("@/pages/collection/collection.vue")
+        component: () => import('@/pages/collection/collection.vue')
       },
       {
         path: '/collection-type',
         name: 'collection-type',
-        component: () => import("@/pages/collection/collection-type.vue")
+        component: () => import('@/pages/collection/collection-type.vue')
       },
       {
         path: '/collection-detail',
         name: 'collection-detail',
-        component: () => import("@/pages/collection/collection-detail.vue")
+        component: () => import('@/pages/collection/collection-detail.vue')
       },
       {
         path: '/service',
         name: 'service',
-        component: () => import("@/pages/service/service.vue")
+        component: () => import('@/pages/service/service.vue')
       },
       {
         path: '/service-detail',
         name: 'service-detail',
-        component: () => import("@/pages/service/service-detail.vue")
+        component: () => import('@/pages/service/service-detail.vue')
       },
       {
         path: '/activity',
         name: 'activity',
-        component: () => import("@/pages/activity/activity.vue")
+        component: () => import('@/pages/activity/activity.vue')
       },
       {
         path: '/activity-type',
         name: 'activity-type',
-        component: () => import("@/pages/activity/activity-type.vue")
+        component: () => import('@/pages/activity/activity-type.vue')
       },
       {
         path: '/activity-detail',
         name: 'activity-detail',
-        component: () => import("@/pages/activity/activity-detail.vue")
-      },
+        component: () => import('@/pages/activity/activity-detail.vue')
+      }
     ]
   }
 ]
 
 const router = new Router({
-  routes 
+  routes
 })
 
-router.beforeEach((to,from,next)=>{
+router.beforeEach((to, from, next) => {
   next()
 })
 
-export default router;
+export default router