zhujindu hai 8 meses
pai
achega
83d2e18caa
Modificáronse 2 ficheiros con 31 adicións e 1 borrados
  1. 27 0
      src/utils/digest.js
  2. 4 1
      src/views/home/index.vue

+ 27 - 0
src/utils/digest.js

@@ -0,0 +1,27 @@
+import Vue from 'vue';
+import { getTicketFun } from '@/utils/TXApiFun';
+// 微信JSSDK实例
+const wx = Vue.prototype.wx;
+import { wxLogin } from '@/api/digest';
+
+export function WXdigest() {
+  getTicketFun(['getCurExternalContact'], 'agentConfig')
+    .then(() => {
+      // 获取用户code
+      getWeChatCode();
+    })
+    .catch((err) => {
+      debugger;
+      console.log(err);
+    });
+}
+
+function getWeChatCode() {
+  wx.invoke('getCurExternalContact', {}, (res) => {
+    if (res.err_msg === 'getCurExternalContact:ok') {
+      console.log(res);
+    } else {
+      console.log(res);
+    }
+  });
+}

+ 4 - 1
src/views/home/index.vue

@@ -46,6 +46,7 @@ import tabBar from '@/components/tabBar';
 import ABtarget from './ABtarget.vue';
 import { mapState } from 'vuex';
 import bottomBtn from './bottomBtn.vue';
+import { WXdigest } from '@/utils/digest';
 export default {
   name: 'home',
   components: { tabBar, hintTabPage, ABtarget, bottomBtn },
@@ -87,7 +88,9 @@ export default {
   created() {
     this.getDict();
   },
-  mounted() {},
+  mounted() {
+    WXdigest();
+  },
   methods: {
     onRefresh() {
       this.getDict(true);