Browse Source

用户详情

xiuli.gao 2 years ago
parent
commit
55c812508d

File diff suppressed because it is too large
+ 1 - 1
qwh5/dist/css/userPortrait.d8d32e03.css


File diff suppressed because it is too large
+ 1 - 1
qwh5/dist/index.html


File diff suppressed because it is too large
+ 0 - 1
qwh5/dist/js/app.185b50d2.js


File diff suppressed because it is too large
+ 1 - 0
qwh5/dist/js/app.deed75e8.js


File diff suppressed because it is too large
+ 0 - 1
qwh5/dist/js/userPortrait.8120cccf.js


File diff suppressed because it is too large
+ 1 - 0
qwh5/dist/js/userPortrait.88b047f9.js


+ 16 - 0
qwh5/src/utils/common.ts

@@ -0,0 +1,16 @@
1
+//获取地址栏参数,name:参数名称
2
+export function getQueryString(name?: string) {
3
+  const url = window.location.href
4
+  const theRequest: any = {}
5
+  if (url.indexOf('?') != -1) {
6
+    const str = url.split('?')[1]
7
+    const strs = str.split('&')
8
+    for (let i = 0; i < strs.length; i++) {
9
+      theRequest[strs[i].split('=')[0]] = decodeURIComponent(strs[i].split('=')[1])
10
+    }
11
+  }
12
+  if (!name) {
13
+    return theRequest
14
+  }
15
+  return theRequest[name] ? theRequest[name] : ''
16
+}

+ 3 - 21
qwh5/src/utils/getWxConfig.ts

@@ -1,4 +1,5 @@
1 1
 import axios from './axios';
2
+import { getQueryString } from './common'
2 3
 function getAuthInfo(cb) {//jsapi通用授权数据
3 4
   console.log('0000', 'corpid', getQueryString('corpid'));
4 5
 
@@ -44,11 +45,11 @@ function initYYConfig(authInfo, cb) { // 应用
44 45
     jsApiList: ['getCurExternalContact'], // 必填,传入需要使用的接口名称
45 46
     success: function (res) {
46 47
       console.log('333')
47
-      cb ? cb() : ''
48
+
49
+      cb ? cb(authInfo) : ''
48 50
     },
49 51
     fail: function (res) {
50 52
       console.log(res);
51
-
52 53
       if (res.errMsg.indexOf('function not exist') > -1) {
53 54
         alert('版本过低请升级')
54 55
       }
@@ -58,22 +59,3 @@ function initYYConfig(authInfo, cb) { // 应用
58 59
 
59 60
 
60 61
 export default getAuthInfo
61
-// return;
62
-
63
-
64
-//获取地址栏参数,name:参数名称
65
-function getQueryString(name?: string) {
66
-  const url = window.location.href
67
-  const theRequest: any = {}
68
-  if (url.indexOf('?') != -1) {
69
-    const str = url.split('?')[1]
70
-    const strs = str.split('&')
71
-    for (let i = 0; i < strs.length; i++) {
72
-      theRequest[strs[i].split('=')[0]] = decodeURIComponent(strs[i].split('=')[1])
73
-    }
74
-  }
75
-  if (!name) {
76
-    return theRequest
77
-  }
78
-  return theRequest[name] ? theRequest[name] : ''
79
-}

+ 46 - 37
qwh5/src/views/userPortrait.vue

@@ -29,7 +29,7 @@
29 29
           </div>
30 30
         </div>
31 31
       </div>
32
-      {{curExternalContactInfo}}
32
+      {{self_url}}
33 33
       <div class="sidePadding marginTop6">
34 34
         <div class="titleBox">
35 35
           <div class="title">客户标签</div>
@@ -119,7 +119,8 @@ import tag from '@/components/tag.vue'
119 119
 import noData from '@/components/noData.vue'
120 120
 import { Dialog,Toast } from 'vant';
121 121
 import getWxConfig from '@/utils/getWxConfig';
122
-import {ref, onMounted, getCurrentInstance} from "vue";
122
+import {ref, onMounted, onBeforeMount, getCurrentInstance} from "vue";
123
+import { getQueryString } from '@/utils/common'
123 124
 export default {
124 125
   components: {
125 126
     noData,
@@ -137,17 +138,32 @@ export default {
137 138
     const updataTag = ref([])
138 139
     const h5CustomerDynamicList = ref([])
139 140
     const h5CustomerOrderList = ref([])
140
-    const curExternalContactInfo = ref(null)
141
-    const configInfo = {
142
-      corpid:'wwc8d3e33f8e096671',
143
-      external_userid:'wmezvKNwAAF17OWc13Hg6X0ob31ijZmg',
144
-      user_id:'bc85094e2cfd56a8bd6cd726bd98b14b'
145
-    }
146
-    onMounted(() => {//组件挂载之前
147
-      getWxConfig(()=>{
148
-        console.log('hhhh')
149
-        getCurExternalContact()
150
-      });
141
+    const configInfo = ref(null)
142
+    const self_url = ref()
143
+    // const configInfo = {
144
+    //   corpid:'wwc8d3e33f8e096671',
145
+    //   external_userid:'wmezvKNwAAF17OWc13Hg6X0ob31ijZmg',
146
+    //   user_id:'bc85094e2cfd56a8bd6cd726bd98b14b'
147
+    // }
148
+    onBeforeMount(() => {//组件挂载之前
149
+      if(getQueryString('againJump')){
150
+        getWxConfig(()=>{
151
+          self_url.value = window.location.href
152
+          getCurExternalContact()//获取企业外部联系人ID
153
+        });
154
+      }else{//获取用户信息
155
+        getWxConfig((authInfo)=>{
156
+          let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${authInfo.corpid}&redirect_uri=${window.location.href+'&againJump=true'}&response_type=code&scope=snsapi_base&state=&agentid=${authInfo.agent_id}#wechat_redirect`;
157
+          let link = document.createElement("a");
158
+          link.href = url;
159
+          document.body.appendChild(link);
160
+          link.click();
161
+          document.body.removeChild(link);
162
+        });
163
+      }
164
+    });
165
+    onMounted(() => {//DOM挂载完成
166
+      
151 167
     
152 168
     // (proxy as any).$getAuthInfo(()=>{
153 169
     //   console.log('hhhh')
@@ -178,9 +194,9 @@ export default {
178 194
         return v.tag_md5
179 195
       });
180 196
       (proxy as any).$axios.post("/api/h5/portrait/h5CustomerTagUpdate", {
181
-        corpid:configInfo.corpid,
182
-        external_userid:configInfo.external_userid,
183
-        user_id:configInfo.user_id,
197
+        corpid:configInfo.value.value.corpid,
198
+        external_userid:configInfo.value.external_userid,
199
+        user_id:configInfo.value.user_id,
184 200
         selected_tag_id_list:selected_tag_id_list
185 201
       },true).then((res) => {
186 202
         tag_visible.value = false;
@@ -191,9 +207,9 @@ export default {
191 207
     }
192 208
     function get_user_info(){//获取客户信息
193 209
       (proxy as any).$axios.get("/api/h5/portrait/customerDetail", {
194
-        corpid:configInfo.corpid,
195
-        external_userid:configInfo.external_userid,
196
-        user_id:configInfo.user_id,
210
+        corpid:configInfo.value.corpid,
211
+        external_userid:configInfo.value.external_userid,
212
+        user_id:configInfo.value.user_id,
197 213
       },true).then((res) => {
198 214
         //请求成功
199 215
         let data = res.rst;
@@ -206,9 +222,9 @@ export default {
206 222
     }
207 223
     function get_h5CustomerDynamicList(){//客户画像-动态
208 224
        (proxy as any).$axios.get("/api/h5/portrait/h5CustomerDynamicList",{
209
-        corpid:configInfo.corpid,
210
-        external_userid:configInfo.external_userid,
211
-        user_id:configInfo.user_id,
225
+        corpid:configInfo.value.corpid,
226
+        external_userid:configInfo.value.external_userid,
227
+        user_id:configInfo.value.user_id,
212 228
       },true).then((res) => {
213 229
         //请求成功
214 230
         let data = res.rst;
@@ -219,9 +235,9 @@ export default {
219 235
     }
220 236
     function get_h5CustomerOrderList(){//客户画像-订单
221 237
        (proxy as any).$axios.get("/api/h5/portrait/h5CustomerOrderList", {
222
-        corpid:configInfo.corpid,
223
-        external_userid:configInfo.external_userid,
224
-        user_id:configInfo.user_id,
238
+        corpid:configInfo.value.corpid,
239
+        external_userid:configInfo.value.external_userid,
240
+        user_id:configInfo.value.user_id,
225 241
         page:1,
226 242
         page_size:20,
227 243
       },true).then((res) => {
@@ -232,13 +248,14 @@ export default {
232 248
         console.log(err,'err')
233 249
       })
234 250
     }
251
+    function wx_getuserinfo(){//获取访问用户身份
252
+
253
+    }
235 254
     function getCurExternalContact(){//获取当前外部联系人userid
236 255
       wx.invoke('getCurExternalContact', {
237 256
         }, function(res){
238
-          curExternalContactInfo.value = res;
239 257
         if(res.err_msg == "getCurExternalContact:ok"){
240
-            console.log(res);
241
-            
258
+            configInfo.value.external_userid = res.userId;
242 259
         }else {
243 260
             //错误处理
244 261
         }
@@ -255,18 +272,10 @@ export default {
255 272
       userInfo,
256 273
       h5CustomerDynamicList,
257 274
       h5CustomerOrderList,
258
-      curExternalContactInfo,
275
+      self_url,
259 276
       confirm_tag,
260 277
       onBeforeClose,
261 278
       _closeTag,
262
-      theadList: [
263
-        { name: '订单ID', width: '28%' },
264
-        { name: '商品' },
265
-        { name: '创建时间' },
266
-        { name: '付款状态' },
267
-        { name: '订单金额' },
268
-      ],
269
-      orderList: [{ "order_id": "62322a7c89ae2416ab9cda4", "pay_money": 9.9, "created_ts": "2022-05-02 23:03", "pay_status": 1, "playlet_name": "极品仙婿" }],
270 279
     }
271 280
   },
272 281
 }