浏览代码

Merge branch 'master' of http://face3d.4dage.com:7005/shaogen1995/YFYC-H5

任一存 2 年之前
父节点
当前提交
1ffce052fd

+ 1 - 1
yfyc/src/api/interact.js

@@ -2,6 +2,6 @@ import axios from '../utils/request'
 // 登录----
 export const getCodeAPI = (code) => {
   return axios({
-    url: `wxMini/wxLogin/${code}`,
+    url: `wxMini/mp/wxLogin/${code}`,
   })
 }

二进制
yfyc/src/assets/img/home/13.jpg


二进制
yfyc/src/assets/img/home/3.jpg


二进制
yfyc/src/assets/img/home/4.jpg


二进制
yfyc/src/assets/img/home/5.jpg


二进制
yfyc/src/assets/img/home/6.jpg


+ 10 - 8
yfyc/src/views/Goods/components/GoodsMap.vue

@@ -11,16 +11,18 @@
 export default {
   name: "GoodsMap",
   components: {},
+  props:{
+    mapData:{
+      type:Object,
+      default:()=>{}
+    }
+  },
   data() {
     //这里存放数据
     return {
       keywords: "",
       arr: [],
-      map: {
-        name: "中江塔",
-        x: 118.363387,
-        y: 31.325179,
-      },
+      map: null,
     };
   },
   //监听属性 类似于data概念
@@ -33,11 +35,11 @@ export default {
       window.onLoad = () => {
         this.map = new AMap.Map("myMap", {
           zoom: 18,
-          center: [118.363387, 31.325179],
+          center: [this.mapData.x, this.mapData.y],
           // viewMode: '3D'
         });
         const marker = new AMap.Marker({
-          position: [118.363387, 31.325179], // 位置
+          position: [this.mapData.x, this.mapData.y], // 位置
           label: {
             offset: new AMap.Pixel(20, 20),
             content: "点击打开高德地图",
@@ -45,7 +47,7 @@ export default {
         });
         marker.on("click", function (e) {
           marker.markOnAMAP({
-            name: "中江塔",
+            name: this.mapData.name,
             position: marker.getPosition(),
           });
         });

+ 8 - 8
yfyc/src/views/Interact/components/interactLocation.vue

@@ -28,14 +28,14 @@ export default {
       txt: "",
       locationData:[
         {id:1,name:'芜湖市',loc:'中国安徽省芜湖市',num:''},
-        {id:2,name:'鸠兹广场',loc:'安徽省芜湖市镜湖区滨江路桥口',num:'247m'},
-        {id:3,name:'中江塔',loc:'安徽省芜湖市镜湖区滨江路桥口',num:'425m'},
-        {id:4,name:'方特旅游区',loc:'安徽省芜湖市镜湖区银湖北路80号',num:'692m'},
-        {id:5,name:'芜湖滨江公园',loc:'芜湖市镜湖区新芜路7号',num:'849m'},
-        {id:6,name:'芜湖长江三桥',loc:'安徽省芜湖市',num:'945m'},
-        {id:7,name:'鸠兹古镇',loc:'安徽省芜湖市鸠江区陈棱路与徽州路交汇处西北角',num:'1007m'},
-        {id:8,name:'临江桥',loc:'安徽省芜湖市',num:'1205m'},
-        {id:9,name:'芜湖大剧院',loc:'安徽芜湖市镜湖区滨江路17号',num:'2351m'}
+        {id:2,name:'鸠兹广场',loc:'安徽省芜湖市镜湖区滨江路桥口',num:''},
+        {id:3,name:'中江塔',loc:'安徽省芜湖市镜湖区滨江路桥口',num:''},
+        {id:4,name:'方特旅游区',loc:'安徽省芜湖市镜湖区银湖北路80号',num:''},
+        {id:5,name:'芜湖滨江公园',loc:'芜湖市镜湖区新芜路7号',num:''},
+        {id:6,name:'芜湖长江三桥',loc:'安徽省芜湖市',num:''},
+        {id:7,name:'鸠兹古镇',loc:'安徽省芜湖市鸠江区陈棱路与徽州路交汇处西北角',num:''},
+        {id:8,name:'临江桥',loc:'安徽省芜湖市',num:''},
+        {id:9,name:'芜湖大剧院',loc:'安徽芜湖市镜湖区滨江路17号',num:''}
       ]
     };
   },

+ 46 - 25
yfyc/src/views/Interact/index.vue

@@ -49,7 +49,8 @@
 </template>
 
 <script>
-import {getCodeAPI} from '@/api/interact.js'
+import { Toast } from "vant";
+import { getCodeAPI } from "@/api/interact.js";
 export default {
   components: {},
   data() {
@@ -79,26 +80,29 @@ export default {
   computed: {},
   watch: {},
   methods: {
+    // 封装获取用户code的方法
+    getUserCode() {
+      //此处的ID是在文档的开发-基本配置里面
+      let appid = "wx3255043d1b21a4f7";
+      // let url = "http://192.168.20.48:8080/#/layout/interact";
+      let url = "https://tp.wuhu.12301china.com/vote";
+      window.location.href =
+        "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
+        appid +
+        "&redirect_uri=" +
+        encodeURIComponent(url) +
+        "&response_type=code&scope=snsapi_userinfo&state=bc17befd6d5060f16de95e38f6eaf69c&connect_redirect=1#wechat_redirect";
+    },
     // 点击+号
-   async addInteract() {
-      let code = this.getQueryCode();
-      if (code) {
-        let res =await getCodeAPI(code)
-        console.log('-----',res);
-        // this.$router.push("/layout/interact/issue");
-        }
-      else {
-        //此处的ID是在文档的开发-基本配置里面
-        let appid = "wx3255043d1b21a4f7";
-        // let url = "http://192.168.20.48:8080/#/layout/interact";
-        let url = "https://tp.wuhu.12301china.com/vote";
-        window.location.href =
-          "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
-          appid +
-          "&redirect_uri=" +
-          encodeURIComponent(url) +
-          "&response_type=code&scope=snsapi_userinfo&state=bc17befd6d5060f16de95e38f6eaf69c&connect_redirect=1#wechat_redirect";
-      }
+    async addInteract() {
+      let userInfo = localStorage.getItem("YFYC_userInfo");
+      let nowTime = Date.now();
+      if (userInfo) {
+        let data = JSON.parse(userInfo);
+        // 超过了6个小时
+        if (nowTime - data.time >= 1000 * 60 * 60 * 6) this.getUserCode();
+        else this.$router.push("/layout/interact/issue");
+      } else this.getUserCode();
     },
     searchFu() {
       this.getList();
@@ -111,15 +115,27 @@ export default {
     },
     // 获取地址栏参数的方法
     getQueryCode() {
-      return this.$route.query.code?this.$route.query.code:''
+      return this.$route.query.code ? this.$route.query.code : "";
     },
   },
-  created() {
+  async created() {
     document.querySelector("#app").style.maxWidth = "500px";
 
     this.getList();
+
     let code = this.getQueryCode();
-    console.log("---------", code);
+    if (code) {
+      let res = await getCodeAPI(code);
+      if (res.code === 0) {
+        localStorage.setItem("YFYC_token", res.data.token);
+        localStorage.setItem(
+          "YFYC_userInfo",
+          JSON.stringify({ ...res.data.wxUser, time: Date.now() })
+        );
+      } else {
+        Toast.fail("登录失败,请联系管理人员");
+      }
+    }
   },
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前
@@ -134,12 +150,17 @@ export default {
 <style lang='less' scoped>
 .My {
   width: 100%;
-  height: calc(100% - 80px);
+  height: calc(100% - 130px);
   overflow-y: auto;
   padding: 20px 15px;
   position: relative;
   .issue {
-    margin: 20px 0;
+    position: fixed;
+    z-index: 10;
+    bottom: 80px;
+    left: 50%;
+    transform: translateX(-50%);
+    height: 40px;
     text-align: center;
     & > img {
       width: 40px;