Browse Source

2024.1.19更新版本

kyoyue 1 year ago
parent
commit
03aa14fdbf

+ 1 - 1
.gitignore

@@ -1,6 +1,5 @@
 .DS_Store
 node_modules
-h5
 /saas
 
 
@@ -22,3 +21,4 @@ pnpm-debug.log*
 *.njsproj
 *.sln
 *.sw?
+dist

+ 5 - 4
env.js

@@ -1,20 +1,21 @@
 const envs = {
   development: {
     BASE_URL: '/mobile/', // 路由基础路径
-    // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
+    // BASE_API: 'https://dev.linkwechat.net/linkwechat-api',
     BASE_API: 'https://www.ascrm.cn/linkwechat-api',
+    // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
   },
   test: {
     BASE_URL: '/mobile/',
+    // BASE_API: 'https://demo.linkwechat.net/linkwechat-api',
     BASE_API: 'https://www.ascrm.cn/linkwechat-api',
     // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
   },
   production: {
     BASE_URL: '/mobile/',
-    // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
-    // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
+    // BASE_API: 'https://demo.linkwechat.net/linkwechat-api',
     BASE_API: 'https://www.ascrm.cn/linkwechat-api',
-   
+    // BASE_API: 'https://scrm.gooki.com/linkwechat-api',
   },
 }
 let env = envs[process.env.VUE_APP_ENV]

+ 3 - 3
package-lock.json

@@ -1,17 +1,16 @@
 {
-  "name": "link-wechat-mobile",
+  "name": "gooki-wechat-mobile",
   "version": "0.1.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
-      "name": "link-wechat-mobile",
+      "name": "gooki-wechat-mobile",
       "version": "0.1.0",
       "license": "GPL-3.0",
       "dependencies": {
         "ali-oss": "^6.18.0",
         "axios": "^0.21.1",
-        "caniuse-lite": "^1.0.30001522",
         "clipboard": "^2.0.8",
         "core-js": "^3.6.5",
         "cos-js-sdk-v5": "^1.4.19",
@@ -4032,6 +4031,7 @@
       "version": "1.0.30001522",
       "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001522.tgz",
       "integrity": "sha512-TKiyTVZxJGhsTszLuzb+6vUZSjVOAhClszBr2Ta2k9IwtNBT/4dzmL6aywt0HCgEZlmwJzXJd8yNiob6HgwTRg==",
+      "dev": true,
       "funding": [
         {
           "type": "opencollective",

+ 2 - 3
package.json

@@ -1,7 +1,7 @@
 {
-  "name": "link-wechat-mobile",
+  "name": "gooki-wechat-mobile",
   "version": "0.1.0",
-  "description": "LinkWeChat mobile",
+  "description": "gookiWeChat mobile",
   "license": "GPL-3.0",
   "scripts": {
     "dev": "vue-cli-service serve",
@@ -15,7 +15,6 @@
   "dependencies": {
     "ali-oss": "^6.18.0",
     "axios": "^0.21.1",
-    "caniuse-lite": "^1.0.30001522",
     "clipboard": "^2.0.8",
     "core-js": "^3.6.5",
     "cos-js-sdk-v5": "^1.4.19",

+ 8 - 8
src/api/community.js

@@ -55,11 +55,11 @@ export function changeStatus(userId, taskId, taskType) {
  * @param {*} word 搜索的关键词或活码名称
  * @returns
  */
-export function getKeywordTasks(word) {
-  return request({
-    url: service + '/filter',
-    params: {
-      taskNameOrKeys: word,
-    },
-  })
-}
+// export function getKeywordTasks(word) {
+//   return request({
+//     url: service + '/filter',
+//     params: {
+//       taskNameOrKeys: word,
+//     },
+//   })
+// }

+ 15 - 8
src/api/groupCode.js

@@ -13,7 +13,14 @@ export function getDetail(uuid) {
 // 获取新客自动拉群详情
 export function getNewCustomerGroupDetail(id) {
   return request({
-    url: weChat + '/groupCode//findWeCommunityNewGroupById/' + id,
+    url: weChat + '/groupCode/findWeCommunityNewGroupById/' + id,
+  })
+}
+
+// 获取新客自动拉群详情
+export function getOldCustomerGroupDetail(id) {
+  return request({
+    url: weChat + '/groupCode/findWePresTagGroupById/' + id,
   })
 }
 
@@ -33,10 +40,10 @@ export function getCodeBase(params) {
   })
 }
 
-export function recordCode(data) {
-  return request({
-    url: weChat + '/storeCode/countUserBehavior',
-    method: 'post',
-    data,
-  })
-}
+// export function recordCode(data) {
+//   return request({
+//     url: weChat + '/storeCode/countUserBehavior',
+//     method: 'post',
+//     data,
+//   })
+// }

File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/chaping.svg


File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/chaping_un.svg


File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/haoping.svg


File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/haoping_un.svg


File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/yiban.svg


File diff suppressed because it is too large
+ 0 - 0
src/assets/icons/svg/yiban_un.svg


+ 6 - 0
src/components/PullRefreshScrollLoadList.vue

@@ -3,6 +3,11 @@
 export default {
   name: '',
   props: {
+    // 查询参数
+    params: {
+      type: Object,
+      default: () => ({}),
+    },
     // 加载请求接口
     request: {
       type: Function,
@@ -60,6 +65,7 @@ export default {
       this.finished = false
       page && (this.query.pageNum = page)
 
+      Object.assign(this.query, this.params)
       this.dealQueryFun && this.dealQueryFun(this.query)
       this.query = Object.assign({ pageNum: 1, pageSize: 10 }, this.query)
 

+ 10 - 7
src/config.js

@@ -14,17 +14,20 @@ const common = {
   // QRCODE_CONTACT_US: env.BASE_URL + 'static/QRCODE_CONTACT_US.png',
   // QRCODE_CUSTOMER_SERVICE: env.BASE_URL + 'static/QRCODE_CUSTOMER_SERVICE.png',
   // IS_PUBLISH_DIALOG: true, // 是否显示发布弹窗
-  DEFAULT_H5_PIC: env.BASE_URL + 'static/PIC.png',
-  DEFAULT_H5_ART: env.BASE_URL + 'static/ARTICAL.png', // 文章默认封面
-  DEFAULT_H5_TP: env.BASE_URL + 'static/TEXT_PIC.png', // 图文默认封面
-  DEFAULT_H5_PDF: env.BASE_URL + 'static/PDF.png', // pdf默认封面
-  DEFAULT_H5_WORDE: env.BASE_URL + 'static/WORD.png',
-  DEFAULT_H5_PPT: env.BASE_URL + 'static/PPT.png',
-  DEFAULT_H5_COLLECT: env.BASE_URL + 'static/COLLECT.png', // 收集表默认封面
+  DEFAULT_H5_PIC: globalThis.location?.origin + env.BASE_URL + 'static/PIC.png',
+  DEFAULT_H5_ART: globalThis.location?.origin + env.BASE_URL + 'static/ARTICAL.png', // 文章默认封面
+  DEFAULT_H5_TP: globalThis.location?.origin + env.BASE_URL + 'static/TEXT_PIC.png', // 图文默认封面
+  DEFAULT_H5_PDF: globalThis.location?.origin + env.BASE_URL + 'static/PDF.png', // pdf默认封面
+  DEFAULT_H5_WORDE: globalThis.location?.origin + env.BASE_URL + 'static/WORD.png',
+  DEFAULT_H5_PPT: globalThis.location?.origin + env.BASE_URL + 'static/PPT.png',
+  DEFAULT_H5_COLLECT: globalThis.location?.origin + env.BASE_URL + 'static/COLLECT.png', // 收集表默认封面
   TOKEN: '', // 本地开发调试用的token,仅本地开发环境生效
   PRIVACY_POLICY: env.BASE_URL + 'static/yszc.pdf', // 隐私政策
   // IS_VCONSOLE: process.env.VUE_APP_ENV !== 'production', // 是否显示VCONSOLE
   PRIVIEW_URL: 'https://www.ascrm.cn/fileView/onlinePreview?url=', // kkfileview,素材预览服务地址
+  // PRIVACY_POLICY: globalThis.location?.origin + env.BASE_URL + 'static/yszc.pdf', // 隐私政策
+  // IS_VCONSOLE: process.env.VUE_APP_ENV !== 'production' || globalThis.location?.origin.includes('demo.linkwechat.net'), // 是否显示VCONSOLE
+  // PRIVIEW_URL: 'https://dev.linkwechat.net/fileView/onlinePreview?url=', // kkfileview,素材预览服务地址
 }
 
 let config = {

+ 87 - 61
src/router/index.js

@@ -1,10 +1,10 @@
 import Vue from 'vue'
 import VueRouter from 'vue-router'
 import Home from '../views/Home.vue'
-import { getAgentTicket } from '@/api/common'
+import { getWxTicket, getAgentTicket } from '@/api/common'
 import store from '@/store'
 import { Toast } from 'vant'
-import { param2Obj, getQueryValue } from '@/utils/index'
+import { getWxCode, getQueryValue } from '@/utils/index'
 
 Vue.use(VueRouter)
 let noAuth = false // 设置页面是否关闭授权登录鉴权,用于开发静态页面统一配置
@@ -14,6 +14,8 @@ let noAuth = false // 设置页面是否关闭授权登录鉴权,用于开发
  * meta:{
  *   title: 页面标题
  *   noAuth: 设置页面是否关闭授权登录鉴权,用于本地开发静态页面调试和某些不要登录的页面
+ *   authType: 登录类型: 企微登录(默认),wechat(微信登录)
+ *   wxSDKConfigType:  wx JS SDK config类型; 取值: 无值默认(企微端), wechat(微信端), no(不调用sdk config配置)
  * }
  */
 const routes = [
@@ -33,8 +35,7 @@ const routes = [
     component: () => import('../views/index/Parent'),
     meta: {
       title: window.lwConfig.SYSTEM_NAME,
-      noAuth,
-      //  noAuth:true,
+      // noAuth:true,
     },
     children: [
       {
@@ -43,8 +44,7 @@ const routes = [
         component: () => import('../views/index/index.vue'),
         meta: {
           title: '首页',
-          noAuth,
-          //  noAuth:true,
+          // noAuth: true,
           icon: 'home-o',
         },
       },
@@ -88,7 +88,6 @@ const routes = [
     meta: {
       title: '企业动态',
       noAuth,
-      //  noAuth:true,
     },
   },
 
@@ -121,7 +120,6 @@ const routes = [
     meta: {
       title: '客户/客群SOP',
       noAuth,
-      // noAuth: true,
     },
   },
 
@@ -132,7 +130,7 @@ const routes = [
     component: () => import('../views/pullNews/pullNews'),
     meta: {
       title: '新客红包',
-      // noAuth: true,
+      noAuth: true,
     },
   },
   //   企业动态
@@ -173,8 +171,7 @@ const routes = [
     component: () => import('../views/chat/detail'),
     meta: {
       title: '素材详情',
-      noAuth,
-      // noAuth: true,
+      noAuth: true,
     },
   },
 
@@ -324,6 +321,8 @@ const routes = [
     hidden: true,
     meta: {
       title: '关键词群',
+      authType: 'wechat',
+      wxSDKConfigType: 'no',
     },
   },
 
@@ -503,14 +502,14 @@ const routes = [
   },
 
   // 老客迁移 (旧的客户公海)
-  {
-    path: '/highSeas',
-    name: 'highSeas',
-    component: () => import('../views/highSeas/index'),
-    meta: {
-      title: '老客迁移',
-    },
-  },
+  // {
+  //   path: '/highSeas',
+  //   name: 'highSeas',
+  //   component: () => import('../views/highSeas/index'),
+  //   meta: {
+  //     title: '老客迁移',
+  //   },
+  // },
 
   // 线索公海
   {
@@ -612,12 +611,11 @@ router.beforeEach(async (to, from, next) => {
   }
   // 通过config接口注入权限验证配置
   // 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
-  const noAuth = to.meta ? to.meta.noAuth : false
   try {
-    if (!sessionStorage.token && !noAuth) {
+    if (!sessionStorage.token && !to.meta?.noAuth) {
       Toast.loading()
-      await store.dispatch('login')
-      process.env.NODE_ENV !== 'development' && (await wxConfig())
+      await (to.meta?.authType === 'wechat' ? getWxCode() : store.dispatch('login'))
+      process.env.NODE_ENV !== 'development' && to.meta?.wxSDKConfigType !== 'no' && (await wxConfig(to.meta?.authType))
       Toast.clear()
     }
     next()
@@ -629,51 +627,79 @@ router.beforeEach(async (to, from, next) => {
     // }
   } catch (error) {
     // error && alert(JSON.stringify(error))
+    Toast.clear()
     next(false)
   }
 })
 
-async function wxConfig() {
-  let { data } = await getAgentTicket(window.location.href.split('#')[0])
+function wxConfig(type) {
   try {
-    let { timestamp, nonceStr, signature } = data
     return new Promise((resolve, reject) => {
-      setTimeout(() => {
-        wx.agentConfig({
-          beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-          debug: true,
-          corpid: sessionStorage.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-          agentid: sessionStorage.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-          timestamp, // 必填,生成签名的时间戳
-          nonceStr, // 必填,生成签名的随机串
-          signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-          jsApiList: [
-            'sendChatMessage',
-            'getContext',
-            'getCurExternalContact',
-            'getCurExternalChat',
-            'openEnterpriseChat',
-            'shareToExternalContact',
-            'shareToExternalChat',
-            'navigateToAddCustomer',
-            'openEnterpriseChat',
-            'openExistedChatWithMsg',
-            'shareToExternalMoments',
-          ], //必填
-          success: (res) => {
-            // 回调
-            // toast('agentId成功:')
-            resolve()
-          },
-          fail: (res) => {
-            alert('agent config失败:' + JSON.stringify(res))
-            if (res.errMsg.indexOf('function not exist') > -1) {
-              alert('版本过低请升级')
-            }
-            reject()
-          },
+      if (type === 'wechat') {
+        getWxTicket(window.location.href.split('#')[0]).then(({ data }) => {
+          let { timestamp, nonceStr, signature } = data
+          wx.config({
+            beta: true,
+            debug: true,
+            appId: sessionStorage.getItem('weAppId'),
+            timestamp, // 必填,生成签名的时间戳
+            nonceStr, // 必填,生成签名的随机串
+            signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+            jsApiList: ['getLocation', 'chooseImage', 'previewImage'], //必填
+            openTagList: ['wx-open-launch-weapp'],
+            success: (res) => {
+              resolve()
+            },
+            fail: (res) => {
+              alert('config失败:' + JSON.stringify(res))
+              if (res.errMsg.indexOf('function not exist') > -1) {
+                alert('版本过低请升级')
+              }
+              reject()
+            },
+          })
+        })
+      } else {
+        getAgentTicket(window.location.href.split('#')[0]).then(({ data }) => {
+          let { timestamp, nonceStr, signature } = data
+          setTimeout(() => {
+            wx.agentConfig({
+              beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
+              debug: true,
+              corpid: sessionStorage.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
+              agentid: sessionStorage.agentId, // 必填,企业微信的应用id (e.g. 1000247)
+              timestamp, // 必填,生成签名的时间戳
+              nonceStr, // 必填,生成签名的随机串
+              signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+              jsApiList: [
+                'sendChatMessage',
+                'getContext',
+                'getCurExternalContact',
+                'getCurExternalChat',
+                'openEnterpriseChat',
+                'shareToExternalContact',
+                'shareToExternalChat',
+                'navigateToAddCustomer',
+                'openEnterpriseChat',
+                'openExistedChatWithMsg',
+                'shareToExternalMoments',
+              ], //必填
+              success: (res) => {
+                // 回调
+                // toast('agentId成功:')
+                resolve()
+              },
+              fail: (res) => {
+                alert('agent config失败:' + JSON.stringify(res))
+                if (res.errMsg.indexOf('function not exist') > -1) {
+                  alert('版本过低请升级')
+                }
+                reject()
+              },
+            })
+          }, 20)
         })
-      }, 20)
+      }
     })
   } catch (error) {
     error && alert(JSON.stringify(error))

+ 20 - 13
src/utils/index.js

@@ -91,6 +91,7 @@ import { getUserOpenid, getWechatUserInfo, getWxRedirect, wxLogin } from '@/api/
 
 // 微信端授权登录
 export async function getWxCode() {
+  process.env.NODE_ENV == 'development' && window.lwConfig.TOKEN && (sessionStorage.token = window.lwConfig.TOKEN)
   let userinfo = sessionStorage.getItem('userinfo')
   //取缓存中的用户信息
   if (userinfo) {
@@ -102,20 +103,26 @@ export async function getWxCode() {
     return userinfo
   }
   try {
-    let code = getQueryValue('code') //是否存在code
-    if (!code) {
-      let url = (await getWxRedirect()).data
-      let id = getQueryValue('appid', url)
-      sessionStorage.setItem('weAppId', id)
-      window.location.href = url
-      return new Promise(() => {})
-    } else {
-      let { data: dataLogin } = await wxLogin(code)
-      sessionStorage.setItem('token', dataLogin.access_token)
-      let { data: dataUser } = await getWechatUserInfo()
-      sessionStorage.setItem('userinfo', JSON.stringify(dataUser))
-      return dataUser
+    if (!sessionStorage.token) {
+      let code = getQueryValue('code') //是否存在code
+      if (!code) {
+        let url = (await getWxRedirect()).data
+        let id = getQueryValue('appid', url)
+        sessionStorage.setItem('weAppId', id)
+        window.location.href = url
+        return new Promise(() => {})
+      } else {
+        let { data: dataLogin } = await wxLogin(code)
+        sessionStorage.setItem('token', dataLogin.access_token)
+      }
     }
+    let { data: dataUser } = await getWechatUserInfo()
+    sessionStorage.setItem('userinfo', JSON.stringify(dataUser))
+    sessionStorage.setItem('openId', dataUser.openId)
+    sessionStorage.setItem('unionId', dataUser.unionId)
+    sessionStorage.setItem('nickName', dataUser.nickName)
+    sessionStorage.setItem('avatar', dataUser.avatar)
+    return dataUser
   } catch (error) {
     return Promise.reject()
   }

+ 2 - 6
src/utils/request.js

@@ -4,11 +4,6 @@ import { Toast, Dialog } from 'vant'
 //   'token',
 //   'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX3R5cGUiOiIwMiIsInVzZXJfaWQiOjM0LCJsb2dpbl90eXBlIjoiTGlua1dlQ2hhdEFQSSIsInVzZXJfbmFtZSI6IueOi-eOieabvCIsInVzZXJfa2V5IjoiMzZkYmIyYzItMmFkZi00NTdkLTg4YmUtNWFlMThhNGY3MjU3IiwiY29ycF9uYW1lIjoi5Luf5b6u56eR5oqAIiwiY29ycF9pZCI6Ind3NjIyZmM4NTJmNzljM2YxMyJ9.tRC5oiHsY4sJw4Q0OCJpzk07vBVRjNu295xL2O329PqNKyLFAwfuu8zijPs7ge86lT2CcBFy61npEp6I4XlsJA'
 // )
-// sessionStorage.setItem(
-//   'token',
-//   'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX3R5cGUiOiIwMCIsInVzZXJfaWQiOjEsImxvZ2luX3R5cGUiOiJMaW5rV2VDaGF0QVBJIiwidXNlcl9uYW1lIjoiYWRtaW4iLCJ1c2VyX2tleSI6Ijc1YmFkNTEwLTdhZDktNDRjYS1iNzg4LWZjYWRiYmEwYjQ5MSIsImNvcnBfbmFtZSI6IuWGoOWuoueyvueBtSIsImNvcnBfaWQiOiJ3dzRhMzQzNDMxOTRjNDQ1ODcifQ.0nBMq1TL48SsCoj5P4nkFiPU1wVpb0bcnELbNvfsMojJSKl7XtSuOarzenT-F45aAwiyEalaIvccE3m8S1wnrA'
-// )
-
 function createAxios(getway = '') {
   const service = axios.create({
     baseURL: (process.env.NODE_ENV === 'development' ? '/api' : window.lwConfig.BASE_API) + getway,
@@ -135,8 +130,9 @@ function createAxios(getway = '') {
 
 // const httpRequest = createAxios()
 
-// 创建常用 open 网关接口请求
+// 创建常用网关接口请求
 export const requestOpen = createAxios(window.lwConfig.services.wecom)
+export const requestWeChat = createAxios(window.lwConfig.services.weChat)
 
 // 老的方式,接口路径需要手动加网关
 export default createAxios()

+ 8 - 11
src/views/Home.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="home">
-    <div class="logo ac">linkWeChat</div>
+    <div class="logo ac">gookiWeChat</div>
     <template v-if="isShow">
       <router-link
         class="router-link"
@@ -20,24 +20,21 @@
 // @ is an alias to /src
 
 export default {
-  name: "Home",
+  name: 'Home',
   components: {},
   data() {
     return {
-      isShow: process.env.NODE_ENV === "development",
-      tips: "",
-    };
+      isShow: process.env.NODE_ENV === 'development',
+      tips: '',
+    }
   },
   created() {
-    if (
-      location.href.includes("redPacketReceive") &&
-      !navigator.userAgent.includes("Mobile")
-    ) {
-      this.tips = "该业务仅支持手机微信用户,请在手机微信端打开";
+    if (location.href.includes('redPacketReceive') && !navigator.userAgent.includes('Mobile')) {
+      this.tips = '该业务仅支持手机微信用户,请在手机微信端打开'
     } else {
     }
   },
-};
+}
 </script>
 
 <style lang="less" scoped>

+ 23 - 23
src/views/_authCallback.vue

@@ -1,65 +1,65 @@
 <template>
   <div class="home">
-    <div class="logo ac">linkWeChat</div>
+    <div class="logo ac">gookiWeChat</div>
   </div>
 </template>
 
 <script>
-import { getQueryValue } from "@/utils/index";
-import { getWechatUserInfo } from "@/api/common";
+import { getQueryValue } from '@/utils/index'
+import { getWechatUserInfo } from '@/api/common'
 export default {
-  name: "authCallback",
+  name: 'authCallback',
   data() {
     return {
-      keyword: "",
+      keyword: '',
       active: 0,
       list: [],
       loading: false,
       finished: false,
       show: false,
       // userId: this.$store.state.userId,
-    };
+    }
   },
   created() {
-    alert(1);
-    this.getWxCode();
+    alert(1)
+    this.getWxCode()
   },
   methods: {
     getWxCode() {
       try {
-        let appid = window.lwConfig.appId; // 公众号appid
+        let appid = window.lwConfig.appId // 公众号appid
         // let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid
-        alert(2);
-        let code = getQueryValue("code"); //是否存在code
-        alert(3);
-        let local = window.location.href;
-        alert(code);
+        alert(2)
+        let code = getQueryValue('code') //是否存在code
+        alert(3)
+        let local = window.location.href
+        alert(code)
         if (!code) {
           //不存在就打开上面的地址进行授权
           window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(
-            local
-          )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
+            local,
+          )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
 
           // window.location.href =
           //     `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
         } else {
-          this.getUserInfo(code);
+          this.getUserInfo(code)
         }
       } catch (error) {
-        alert(error);
-        this.$toast(JSON.stringify(error));
+        alert(error)
+        this.$toast(JSON.stringify(error))
       }
     },
     getUserInfo(code) {
       getWechatUserInfo(code).then(({ data }) => {
         if (data && data.openId) {
-          localStorage.setItem("userinfo", JSON.stringify(data));
-          alert(data.openId);
+          localStorage.setItem('userinfo', JSON.stringify(data))
+          alert(data.openId)
         }
-      });
+      })
     },
   },
-};
+}
 </script>
 
 <style lang="less" scoped>

+ 18 - 0
src/views/communityOperating/keywords/api.js

@@ -0,0 +1,18 @@
+import { requestWeChat } from '@/utils/request'
+const { get } = requestWeChat
+const service = '/keywordGroup'
+
+/** 获取关键词拉群详情
+ * @param {*} keywordGroupId
+ * @param {*} unionId
+ * @returns
+ */
+export const getDetail = (keywordGroupId, unionId = sessionStorage.unionId) =>
+  get(`${service}/getBaseInfo`, { keywordGroupId, unionId })
+
+/** 获取关键词拉群详情中关键词拉群列表
+ * @param {*} keywordGroupId
+ * @param {*} keyword
+ * @returns
+ */
+export const getDetailList = (data) => get(`${service}/findGroupSubs`, data)

+ 81 - 106
src/views/communityOperating/keywords/index.vue

@@ -1,141 +1,116 @@
 <template>
   <div>
-    <div>
-      <van-search v-model="keyword" placeholder="搜索活码名或关键词" shape="round" @search="onSearch" @clear="clear">
-      </van-search>
-    </div>
-
-    <div class="history-wrapper">
-      <template v-for="k of history">
-        <van-tag :key="k" size="large" closeable @click="search(k)" @close="removeHistory(k)"> {{ k }} </van-tag>
+    <van-search v-model="keyword" placeholder="搜索关键词" shape="round" @search="search" @clear="clear" show-action>
+      <template #action>
+        <div @click="search()">搜索</div>
       </template>
-    </div>
+    </van-search>
 
-    <div class="bottom-line"></div>
-
-    <div>
-      <template v-if="!tasks || tasks.length === 0">
-        <van-empty description="暂无数据" />
-      </template>
-      <template v-else>
-        <template v-for="task of tasks">
-          <KeywordPanel :key="task.taskId" :task="task" :state="false"></KeywordPanel>
-        </template>
-      </template>
+    <div class="desc">
+      {{ data.descrition }}
     </div>
 
-    <van-overlay :show="loading" class-name="overlay">
-      <van-loading type="spinner"></van-loading>
-    </van-overlay>
+    <PullRefreshScrollLoadList
+      ref="prsl"
+      class="list"
+      :params="{ keywordGroupId: $route.query.id, keyword }"
+      :request="getDetailList"
+    >
+      <template v-slot="list">
+        <li class="fxbw li" v-for="(item, index) in list" :key="index">
+          <div
+            class="blod"
+            v-html="
+              keyword ? item.keyword.replace(keyword, `<span class='heighlight'>${keyword}</span>`) : item.keyword
+            "
+          ></div>
+          <div
+            class="heighlight"
+            @click="
+              show = true
+              focus = item
+            "
+          >
+            加入群聊
+          </div>
+        </li>
+      </template>
+    </PullRefreshScrollLoadList>
+
+    <van-dialog v-model="show" :title="focus.codeName">
+      <div class="ac mb10">
+        <img :src="focus.groupCodeUrl" />
+        <div class="">长按二维码添加企业客群</div>
+      </div>
+    </van-dialog>
   </div>
 </template>
 
 <script>
-import KeywordPanel from './panel'
-import { getKeywordTasks } from '@/api/community'
+import { getDetail, getDetailList } from './api'
 
 export default {
-  components: { KeywordPanel },
-
   data() {
     return {
+      getDetailList,
+      data: {},
+      focus: {},
       keyword: '',
-      storageKey: 'keywords',
-      history: [],
-      tasks: [],
-      loading: false,
-      focus: false
+      show: false,
     }
   },
 
+  created() {
+    this.getDetail()
+  },
   methods: {
-    getTasks() {
-      this.loading = true
-      getKeywordTasks(this.keyword)
-        .then((res) => {
-          if (res.code === 200) {
-            let timeStamp = (dateString) => (dateString ? +new Date(dateString.replace(/-/g, '/')) : 0)
-            this.tasks = res.rows.sort((a, b) => timeStamp(b.updateTime) - timeStamp(a.updateTime))
-          }
-          this.loading = false
+    getDetail() {
+      this.$toast.loading()
+      getDetail(this.$route.query.id)
+        .then(({ data }) => {
+          this.data = data || {}
         })
-        .catch(() => {
-          this.loading = false
+        .finally(() => {
+          this.$toast.clear()
         })
     },
-
-    setHistory(keyword) {
-      if (!keyword) return
-
-      if (!this.history.includes(keyword)) {
-        this.history.push(keyword)
-        localStorage.setItem(this.storageKey, JSON.stringify(this.history))
-      }
-    },
-
-    removeHistory(keyword) {
-      if (this.history.includes(keyword)) {
-        this.history.splice(this.history.indexOf(keyword), 1)
-        localStorage.setItem(this.storageKey, JSON.stringify(this.history))
-      }
-    },
-
-    getHistory() {
-      this.history = JSON.parse(localStorage.getItem(this.storageKey)) || []
+    search() {
+      this.$refs.prsl.getList(1)
     },
-
-    onSearch() {
-      this.setHistory(this.keyword)
-
-      this.getTasks()
-    },
-
-    search(keyword) {
-      this.keyword = keyword
-
-      this.getTasks()
-    },
-
     clear() {
       this.keyword = ''
-      this.getTasks()
-    }
-  },
-
-  computed: {
-    url() {
-      return window.location.href
-    }
+      this.search()
+    },
   },
-
-  created() {
-    this.getHistory()
-
-    this.getTasks()
-  }
 }
 </script>
 
 <style lang="less" scoped>
-.history-wrapper {
-  padding: 0 20px 20px;
-
-  .van-tag {
-    margin: 10px 10px 0 0;
-  }
+.main {
+  background: var(--bg-white, #fff);
+  height: 100%;
 }
-
-.bottom-line {
-  background-color: #f2f2f2;
-  height: 15px;
+.search {
+  padding: 15px 10px 10px;
 }
-
-.overlay {
-  display: flex;
-  align-items: center;
-
-  .van-loading {
-    margin: auto;
+.desc {
+  margin: 10px;
+  padding: 10px;
+  background: var(--bg-black-8, #ccc);
+}
+.list {
+  border-top: 10px solid var(--border-black-10, #f2f2f2);
+  margin-top: 10px;
+  padding: 0 10px;
+}
+.li {
+  padding: 10px 0;
+  border-bottom: 1px solid var(--border-black-8, #ccc);
+  // & + .li {
+  //   border-top: 1px solid var(--border-black-8, #ccc);
+  // }
+  ::v-deep .heighlight {
+    color: @color !important;
   }
 }
 </style>

+ 0 - 0
src/views/communityOperating/task/OldCustomer.vue → src/views/communityOperating/task/_OldCustomer.vue


+ 28 - 43
src/views/communityOperating/task/list.vue

@@ -6,27 +6,17 @@
     </van-tabs>
 
     <div class="type-area">
-      <van-button
-        round
-        size="small"
-        @click="taskType = 0"
-        :type="taskType === 0 ? 'info' : 'default'"
-        >全部</van-button
-      >
-      <van-button
+      <van-button round size="small" @click="taskType = 0" :type="taskType === 0 ? 'info' : 'default'">全部</van-button>
+      <!-- <van-button
         round
         size="small"
         @click="taskType = 1"
         :type="taskType === 1 ? 'info' : 'default'"
         >标签建群</van-button
-      >
-      <van-button
-        round
-        size="small"
-        @click="taskType = 2"
-        :type="taskType === 2 ? 'info' : 'default'"
-        >群SOP</van-button
-      >
+      > -->
+      <van-button round size="small" @click="taskType = 2" :type="taskType === 2 ? 'info' : 'default'">
+        群SOP
+      </van-button>
     </div>
 
     <template v-if="!tasks || tasks.length === 0">
@@ -34,21 +24,16 @@
     </template>
     <template v-else>
       <template v-for="task in tasks">
-        <template v-if="task.type === 1">
+        <!-- <template v-if="task.type === 1">
           <OldCustomer
             :key="task.taskId"
             :task="task"
             :state="isDone ? true : false"
             @refresh="getTasks"
           ></OldCustomer>
-        </template>
-        <template v-else>
-          <Sop
-            :key="task.ruleId"
-            :task="task"
-            :state="isDone ? true : false"
-            @refresh="getTasks"
-          ></Sop>
+        </template> -->
+        <template>
+          <Sop :key="task.ruleId" :task="task" :state="isDone ? true : false" @refresh="getTasks"></Sop>
         </template>
       </template>
     </template>
@@ -60,12 +45,12 @@
 </template>
 
 <script>
-import { getTasks } from "@/api/community";
-import OldCustomer from "./OldCustomer";
-import Sop from "./Sop";
+import { getTasks } from '@/api/community'
+// import OldCustomer from './OldCustomer'
+import Sop from './Sop'
 
 export default {
-  components: { OldCustomer, Sop },
+  components: { Sop },
 
   data() {
     return {
@@ -74,52 +59,52 @@ export default {
       loading: false, // 加载状态
       todo: [], // 待处理数据
       done: [], // 已处理数据
-    };
+    }
   },
 
   methods: {
     // 获取老客标签建群和群SOP任务数据
     getTasks() {
-      this.loading = true;
+      this.loading = true
       getTasks(this.$store.state.userId, this.taskType)
         .then(({ data }) => {
-          this.todo = data.todo || [];
-          this.done = data.done || [];
-          this.loading = false;
+          this.todo = data.todo || []
+          this.done = data.done || []
+          this.loading = false
         })
         .catch((error) => {
-          this.loading = false;
-        });
+          this.loading = false
+        })
     },
   },
 
   computed: {
     userId() {
-      return this.$store.state.userId;
+      return this.$store.state.userId
     },
 
     tasks() {
-      if (this.isDone === 1) return this.done;
-      return this.todo;
+      if (this.isDone === 1) return this.done
+      return this.todo
     },
   },
 
   watch: {
     taskType(val) {
-      if (this.userId) this.getTasks();
+      if (this.userId) this.getTasks()
     },
 
     userId(val) {
       if (val) {
-        this.getTasks();
+        this.getTasks()
       }
     },
   },
 
   created() {
-    this.taskType = parseInt(this.$route.query.type);
+    this.taskType = parseInt(this.$route.query.type)
   },
-};
+}
 </script>
 
 <style lang="less" scoped>

+ 136 - 136
src/views/evaluate/evaluate.vue

@@ -10,32 +10,24 @@
       </div>
       <div class="evaluate_type" v-if="!evaluate">
         <div class="evaluate_unit" @click="evaluate = '101'">
-          <svg-icon class="svg_icon" name="haoping_un"></svg-icon>
+          <svg-icon class="svg_icon-type" name="haoping"></svg-icon>
           <div class="sub_title">好评</div>
         </div>
         <div class="evaluate_unit" @click="evaluate = '102'">
-          <svg-icon class="svg_icon" name="yiban_un"></svg-icon>
+          <svg-icon class="svg_icon-type" name="yiban"></svg-icon>
           <div class="sub_title">一般</div>
         </div>
         <div class="evaluate_unit" @click="evaluate = '103'">
-          <svg-icon class="svg_icon" name="chaping_un"></svg-icon>
+          <svg-icon class="svg_icon-type" name="chaping"></svg-icon>
           <div class="sub_title">差评</div>
         </div>
       </div>
       <div v-else>
         <div class="evaluate_result">
           <div style="flex: 0.7; text-align: right;">
-            <svg-icon
-              v-if="evaluate == 101"
-              style="height: 60px; width: 60px; margin-right: 10px;"
-              name="haoping"
-            ></svg-icon>
-            <svg-icon
-              v-else-if="evaluate == 102"
-              style="height: 60px; width: 60px; margin-right: 10px;"
-              name="yiban"
-            ></svg-icon>
-            <svg-icon v-else style="height: 60px; width: 60px; margin-right: 10px;" name="chaping"></svg-icon>
+            <svg-icon v-if="evaluate == 101" class="svg-icon-result" name="haoping"></svg-icon>
+            <svg-icon v-else-if="evaluate == 102" class="svg-icon-result" name="yiban"></svg-icon>
+            <svg-icon v-else class="svg-icon-result" name="chaping"></svg-icon>
           </div>
           <div class="evaluate_result_sub">
             <span>{{ evaluate == '101' ? '好评' : evaluate == '102' ? '一般' : evaluate == '103' ? '差评' : '' }}</span>
@@ -75,152 +67,160 @@
               show = false
               aleradyEvaluated = true
             "
-            >确定</van-button
           >
+            确定
+          </van-button>
         </div>
       </div>
     </van-popup>
   </div>
 </template>
 <script>
-  import { addEvaluation, getEvaluation } from '@/api/evaluate.js'
-  import { getWxCode, getQueryValue, baiduMapError, splitName } from '@/utils/index'
+import { addEvaluation, getEvaluation } from '@/api/evaluate.js'
+import { getWxCode, getQueryValue, baiduMapError, splitName } from '@/utils/index'
 
-  export default {
-    name: 'evaluate',
-    data() {
-      return {
-        aleradyEvaluated: false,
-        show: false,
-        value: '',
-        evaluate: null,
-        poolId: '',
-        tenantId: '',
-        loading: false
+export default {
+  name: 'evaluate',
+  data() {
+    return {
+      aleradyEvaluated: false,
+      show: false,
+      value: '',
+      evaluate: null,
+      poolId: '',
+      tenantId: '',
+      loading: false,
+    }
+  },
+  methods: {
+    submit() {
+      if (!this.evaluate) {
+        this.$toast({ type: 'fail', message: '请选择评价类型', icon: 'none' })
+        return
       }
-    },
-    methods: {
-      submit() {
-        if (!this.evaluate) {
-          this.$toast({ type: 'fail', message: '请选择评价类型', icon: 'none' })
-          return
-        }
-        if (!this.value) {
-          this.$toast({ type: 'fail', message: '请输入评价语', icon: 'none' })
-          return
-        }
-        addEvaluation({
-          poolId: this.poolId,
-          msgType: '31',
-          content: JSON.stringify({
-            menu_id: this.evaluate,
-            content: this.value
-          }),
-          evaluationType: this.evaluate
-          // tenantId: this.tenantId
-        }).then((res) => {
-          if (res.code === 200) {
-            // this.aleradyEvaluated = true
-            this.show = true
-          }
-        })
+      if (!this.value) {
+        this.$toast({ type: 'fail', message: '请输入评价语', icon: 'none' })
+        return
       }
+      addEvaluation({
+        poolId: this.poolId,
+        msgType: '31',
+        content: JSON.stringify({
+          menu_id: this.evaluate,
+          content: this.value,
+        }),
+        evaluationType: this.evaluate,
+        // tenantId: this.tenantId
+      }).then((res) => {
+        if (res.code === 200) {
+          // this.aleradyEvaluated = true
+          this.show = true
+        }
+      })
     },
-    async created() {
-      this.loading = false
-      this.$toast.loading()
-      await getWxCode()
-      if (sessionStorage.getItem('userinfo')) {
-        // this.tenantId = this.$route.query.tenantId
-        this.poolId = this.$route.query.poolId
-        getEvaluation({ poolId: this.poolId, msgType: '31' }).then((res) => {
-          if (res.code === 200) {
-            if (res.data.evaluationType) {
-              this.evaluate = res.data.evaluationType
-            }
-            if (res.data.content) {
-              let eva = JSON.parse(res.data.content)
-              if (eva.content) {
-                this.value = JSON.parse(res.data.content).content
-              }
-              if (eva.menu_id) {
-                this.evaluate = JSON.parse(res.data.content).menu_id
-              }
+  },
+  async created() {
+    this.loading = false
+    this.$toast.loading()
+    await getWxCode()
+    if (sessionStorage.getItem('userinfo')) {
+      // this.tenantId = this.$route.query.tenantId
+      this.poolId = this.$route.query.poolId
+      getEvaluation({ poolId: this.poolId, msgType: '31' }).then((res) => {
+        if (res.code === 200) {
+          if (res.data.evaluationType) {
+            this.evaluate = res.data.evaluationType
+          }
+          if (res.data.content) {
+            let eva = JSON.parse(res.data.content)
+            if (eva.content) {
+              this.value = JSON.parse(res.data.content).content
             }
-            if (this.value && this.evaluate) {
-              this.aleradyEvaluated = true
+            if (eva.menu_id) {
+              this.evaluate = JSON.parse(res.data.content).menu_id
             }
           }
-          this.loading = true
-          this.$toast.clear()
-        })
-      }
+          if (this.value && this.evaluate) {
+            this.aleradyEvaluated = true
+          }
+        }
+        this.loading = true
+        this.$toast.clear()
+      })
     }
-  }
+  },
+}
 </script>
 <style lang="less" scoped>
-  .svg_icon {
-    height: 45px;
-    width: 45px;
+.svg_icon-type {
+  height: 45px;
+  width: 45px;
+  color: #c6c6c6;
+}
+.svg-icon-result {
+  height: 60px;
+  width: 60px;
+  margin-right: 10px;
+  color: #f5ee35;
+}
+.con {
+  margin: 40px 10px 0px 10px;
+  padding: 20px;
+  background-color: #fff;
+  border-radius: 5px;
+  min-height: 500px;
+  .title {
+    margin-top: 30px;
+    text-align: center;
+    font-size: 16px;
+    font-weight: 600;
   }
-  .con {
-    margin: 40px 10px 0px 10px;
-    padding: 20px;
-    background-color: #fff;
-    border-radius: 5px;
-    min-height: 500px;
-    .title {
-      margin-top: 30px;
+  .evaluate_type {
+    margin-top: 40px;
+    display: flex;
+    justify-content: space-around;
+    .evaluate_unit {
       text-align: center;
-      font-size: 16px;
-      font-weight: 600;
-    }
-    .evaluate_type {
-      margin-top: 40px;
-      display: flex;
-      justify-content: space-around;
-      .evaluate_unit {
-        text-align: center;
-        .sub_title {
-          margin-top: 5px;
-        }
-      }
-    }
-    .evaluate_text {
-      margin-top: 40px;
-    }
-    .evaluate_result {
-      margin-top: 40px;
-      display: flex;
-      .evaluate_result_sub {
-        // flex: 1;
-        display: flex;
-        flex-direction: column;
-        justify-content: space-between;
+      .sub_title {
+        margin-top: 5px;
       }
     }
   }
-  .save-btn {
-    width: 90%;
-    margin: 20px auto;
-    .van-button {
-      height: 40px;
-      line-height: 40px;
-    }
+  .evaluate_text {
+    margin-top: 40px;
   }
-  .confirm_content {
-    height: 200px;
-    width: 300px;
-    padding: 10px;
-    background: url('../../assets/success.svg') no-repeat center center;
-    border-radius: 5px;
+  .evaluate_result {
+    margin-top: 40px;
     display: flex;
-    flex-direction: column;
-    justify-content: flex-end;
-    .confirm_info {
-      text-align: center;
-      font-size: 16px;
-      margin-bottom: 20px;
+    .evaluate_result_sub {
+      // flex: 1;
+      display: flex;
+      flex-direction: column;
+      justify-content: space-between;
     }
   }
+}
+.save-btn {
+  width: 90%;
+  margin: 20px auto;
+  .van-button {
+    height: 40px;
+    line-height: 40px;
+  }
+}
+.confirm_content {
+  height: 200px;
+  width: 300px;
+  padding: 10px;
+  background: url('../../assets/success.svg') no-repeat center center;
+  border-radius: 5px;
+  display: flex;
+  flex-direction: column;
+  justify-content: flex-end;
+  .confirm_info {
+    text-align: center;
+    font-size: 16px;
+    margin-bottom: 20px;
+  }
+}
 </style>

+ 1 - 1
src/views/friends/components/ShowFile.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 文件展示 -->
-  <div class="show-file">
+  <div class="show-file" v-if="materialList && materialList[0]">
     <div class="file-pic" v-if="materialList[0].mediaType === '0'">
       <van-image
         width="32%"

+ 21 - 136
src/views/friends/detail.vue

@@ -25,10 +25,7 @@
         执行状态
       </div>
       <div class="detail-content">
-        <div
-          class="detail-content-button"
-          :class="detailObj.executeStatus ? 'task-button-blue' : 'task-button-red'"
-        >
+        <div class="detail-content-button" :class="detailObj.executeStatus ? 'task-button-blue' : 'task-button-red'">
           {{ detailObj.executeStatus ? '已执行' : '未执行' }}
         </div>
       </div>
@@ -110,7 +107,7 @@
         <ShowFile :materialList="detailObj.materialList" />
       </div>
     </div>
-    <div>
+    <!-- <div>
       <div class="detail-name">
         发送目标客户类型
       </div>
@@ -118,14 +115,13 @@
         <div class="type-top">
           <span>预计{{ detailObj.customerNum }}名客户</span>
         </div>
-        <!-- ?全部客户 -->
         <div class="type-tag">
           <div class="type-tag-item" v-for="(item, index) in detailObj.customerTags" :key="index">
             {{ item }}
           </div>
         </div>
       </div>
-    </div>
+    </div> -->
     <!-- <div class="send-button" v-if="detailObj.status === 2"> -->
     <div class="send-button">
       <div
@@ -170,44 +166,9 @@ export default {
     }
   },
   mounted() {
-    let id = this.$route.query.id
-    if (id) {
-      this.getDetail(id)
-    }
+    this.getDetail(this.$route.query.id)
   },
   methods: {
-    // 企业微信端授权登录
-    // async getLogin() {
-    //   //取缓存中的用户信息
-    //   // if (!sessionStorage.token) {
-    //   //   // 解决授权重定向返回问题
-    //   //   let indexRoute = router.getRoutes().find((e) => e.path == '')
-    //   //   indexRoute && (indexRoute.redirect = window.location.hash.slice(1))
-    //   //   //缓存中没有用户信息,进入授权流程
-    //   //   let code = getQueryValue('code') //是否存在code
-    //   //   if (!code) {
-    //   //     this.count++
-    //   //     let url = (await getWcRedirect()).data
-    //   //     window.location.replace(url)
-    //   //     return Promise.reject()
-    //   //   }
-    //   //   // 第三方授权重定向回来手动刷新页面
-    //   //   // if (code && this.count === 1) {
-    //   //   //   commit('reload')
-    //   //   // }
-    //   //   if (code) {
-    //   //     let dataLogin = await login(code)
-    //   //     // 存入sessionStorage,解决刷新重复code获取用户问题
-    //   //     dataLogin.data && sessionStorage.setItem('token', dataLogin.data.access_token)
-    //   //   }
-    //   // }
-    //   // sessionStorage.setItem(
-    //   //   'token',
-    //   //   'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX3R5cGUiOiIwMiIsInVzZXJfaWQiOjY3LCJsb2dpbl90eXBlIjoiTGlua1dlQ2hhdEFQSSIsInVzZXJfbmFtZSI6IueOi-eOieabvCIsInVzZXJfa2V5IjoiNzFjMmZjZjItMTRmYS00NTA3LTk4YzEtODVjN2NkZjE2ZjZmIiwiY29ycF9uYW1lIjoi5Luf5b6u56eR5oqAIiwiY29ycF9pZCI6Ind3NjIyZmM4NTJmNzljM2YxMyJ9.kJKsc0JWHMVyX6RaVNT_jMKYeDCfwp6LH6sDUvy7Rlbcujw-PIF7urs_paXzUTXHRB78Ey-dGsUMoxU7Fanfug'
-    //   // )
-    //   // this.wxConfig()
-    // },
-    // 将日期转为毫秒
     dealTime(time) {
       let nowTime = +new Date()
       let numTime = +new Date(time)
@@ -217,80 +178,11 @@ export default {
         return 0
       }
     },
-    // async wxConfig() {
-    //   if (sessionStorage.token && !sessionStorage.userId) {
-    //     let dataUser = {}
-    //     try {
-    //       dataUser = await getUserInfo()
-    //     } catch (error) {
-    //       return Promise.reject()
-    //     }
-    //     try {
-    //       let corpInfo = dataUser.corpInfo
-    //       dataUser.user.weUserId && sessionStorage.setItem('userId', dataUser.user.weUserId) // 当前 登录/使用 企业员工真实姓名大驼峰 eg:QinShiHuang
-    //       dataUser.user.userId && sessionStorage.setItem('sysId', dataUser.user.userId) // 当前系统的userId
-    //       // commit('userId', sessionStorage.userId)
-    //       corpInfo.appId && sessionStorage.setItem('appId', corpInfo.appId) // 微信公众号appid
-    //       sessionStorage.setItem('corpId', corpInfo.corpId) // 企业id
-    //       sessionStorage.setItem('agentId', corpInfo.agentId) // 自建应用agentId
-    //       dataUser.user.companyName &&
-    //         sessionStorage.setItem('companyName', dataUser.user.companyName) // 公司名称
-    //       dataUser.user.avatar && sessionStorage.setItem('avatar', dataUser.user.avatar) // 用户头像
-    //       dataUser.user.userName && sessionStorage.setItem('userName', dataUser.user.userName) // 用户姓名
-    //       dataUser.user.nickName && sessionStorage.setItem('nickName', dataUser.user.nickName) // 用户昵称
-    //       dataUser.user.position && sessionStorage.setItem('position', dataUser.user.position) // 用户部门
-    //     } catch (error) {
-    //       alert(JSON.stringify(error))
-    //       return Promise.reject()
-    //     }
-    //   }
-    //   try {
-    //     let { data } = await getAgentTicket(window.location.href.split('#')[0])
-    //     let { timestamp, nonceStr, signature } = data
-    //     return new Promise((resolve, reject) => {
-    //       setTimeout(() => {
-    //         wx.agentConfig({
-    //           beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-    //           debug: true,
-    //           corpid: sessionStorage.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-    //           agentid: sessionStorage.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-    //           timestamp, // 必填,生成签名的时间戳
-    //           nonceStr, // 必填,生成签名的随机串
-    //           signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-    //           jsApiList: [
-    //             'sendChatMessage',
-    //             'getContext',
-    //             'getCurExternalContact',
-    //             'getCurExternalChat',
-    //             'openEnterpriseChat',
-    //             'shareToExternalContact',
-    //             'shareToExternalChat',
-    //             'navigateToAddCustomer',
-    //             'openEnterpriseChat',
-    //             'openExistedChatWithMsg',
-    //             'shareToExternalMoments',
-    //           ], //必填
-    //           success: (res) => {
-    //             // 回调
-    //             // toast('agentId成功:')
-    //             resolve()
-    //           },
-    //           fail: (res) => {
-    //             alert('agent config失败:' + JSON.stringify(res))
-    //             if (res.errMsg.indexOf('function not exist') > -1) {
-    //               alert('版本过低请升级')
-    //             }
-    //             reject()
-    //           },
-    //         })
-    //       }, 20)
-    //     })
-    //   } catch (error) {
-    //     error && alert(JSON.stringify(error))
-    //     return Promise.reject()
-    //   }
-    // },
     goSend(item) {
+      if (!navigator.userAgent.includes('Mobile')) {
+        this.$toast('仅支持手机端发送!')
+        return
+      }
       let attachments = []
       if (item.materialList && item.materialList.length) {
         if (item.materialList[0].mediaType === '0') {
@@ -321,9 +213,7 @@ export default {
               {
                 msgtype: 'link', // 消息类型,必填
                 link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
+                  title: item.materialList[0].materialName ? item.materialList[0].materialName : ' ', // H5消息标题
                   imgUrl: item.materialList[0].coverUrl
                     ? item.materialList[0].coverUrl
                     : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
@@ -338,9 +228,7 @@ export default {
               {
                 msgtype: 'link', // 消息类型,必填
                 link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
+                  title: item.materialList[0].materialName ? item.materialList[0].materialName : ' ', // H5消息标题
                   imgUrl: item.materialList[0].coverUrl
                     ? item.materialList[0].coverUrl
                     : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
@@ -355,9 +243,7 @@ export default {
               {
                 msgtype: 'link', // 消息类型,必填
                 link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
+                  title: item.materialList[0].materialName ? item.materialList[0].materialName : ' ', // H5消息标题
                   imgUrl: this.filPicType(item.materialList[0].materialUrl), // H5消息封面图片URL
                   url: linkUrl, // H5消息页面url 必填
                 },
@@ -370,9 +256,7 @@ export default {
               {
                 msgtype: 'link', // 消息类型,必填
                 link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
+                  title: item.materialList[0].materialName ? item.materialList[0].materialName : ' ', // H5消息标题
                   imgUrl: item.materialList[0].materialUrl
                     ? item.materialList[0].materialUrl
                     : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
@@ -433,7 +317,7 @@ export default {
           if (res.err_msg == 'shareToExternalMoments:ok') {
             that.getMomentsFinish(item.weMomentsTaskId)
           }
-        }
+        },
       )
     },
     filPicType(file) {
@@ -460,13 +344,14 @@ export default {
         .catch()
     },
     getDetail(id) {
-      momentsDetail(id)
-        .then((res) => {
-          if (res.code === 200) {
-            this.detailObj = res.data
-          }
-        })
-        .catch()
+      id &&
+        momentsDetail(id)
+          .then((res) => {
+            if (res.code === 200) {
+              this.detailObj = res.data
+            }
+          })
+          .catch()
     },
   },
 }

+ 14 - 200
src/views/friends/index.vue

@@ -1,12 +1,6 @@
 <template>
   <div>
-    <van-tabs
-      v-model="active"
-      title-active-color="#1869FF"
-      title-inactive-color="#1D2129"
-      @click="onClick"
-      sticky
-    >
+    <van-tabs v-model="active" title-active-color="#1869FF" title-inactive-color="#1D2129" @click="onClick" sticky>
       <van-tab :title="item.title" v-for="(item, index) in tabList" :key="index">
         <van-list
           :loading="loading"
@@ -20,10 +14,7 @@
               <!-- 任务名称 -->
               <div class="task">
                 <div class="task-name">{{ item.name }}</div>
-                <div
-                  class="task-button "
-                  :class="item.executeStatus ? 'task-button-blue' : 'task-button-red'"
-                >
+                <div class="task-button " :class="item.executeStatus ? 'task-button-blue' : 'task-button-red'">
                   {{ item.executeStatus ? '已执行' : '未执行' }}
                 </div>
               </div>
@@ -43,22 +34,17 @@
                   </template>
                 </van-count-down>
               </div>
-              <div class="task-time" v-if="query.status === 3">
-                {{ item.executeTime }}--{{ item.executeEndTime }}
-              </div>
+              <div class="task-time" v-if="query.status === 3">{{ item.executeTime }}--{{ item.executeEndTime }}</div>
               <van-divider />
               <!-- 引导语 -->
               <div class="guide">
                 <span>{{ item.content }}</span>
               </div>
               <!-- 文件展示 -->
-              <ShowFile
-                :materialList="item.materialList"
-                v-if="item.materialList && item.materialList.length"
-              />
-              <van-divider />
+              <ShowFile :materialList="item.materialList" v-if="item.materialList && item.materialList.length" />
+              <!-- <van-divider /> -->
               <!-- 目标类型 -->
-              <div class="model-type">
+              <!-- <div class="model-type">
                 <div class="type-top">
                   <span>发送目标客户类型</span>
                   <span>{{ item.customerNum }}名客户</span>
@@ -69,10 +55,10 @@
                   </div>
                 </div>
                 <div class="all-curstom" v-else>全部客户</div>
-              </div>
-              <div class="send-button" v-if="item.executeStatus === 0 && query.status === 2">
-                <div class="button-send" @click="goSend($event, item)">前往发送</div>
-              </div>
+              </div> -->
+              <!-- <div class="send-button" v-if="item.executeStatus === 0 && query.status === 2">
+                <div class="button-send" @click.stop="goSend(item)"></div>
+              </div> -->
             </div>
           </van-cell>
         </van-list>
@@ -82,8 +68,7 @@
 </template>
 
 <script>
-import { momentsList, momentsFinish } from '@/api/friends'
-import { dateFormat } from '@/utils'
+import { momentsList } from '@/api/friends'
 import ShowFile from './components/ShowFile.vue'
 export default {
   components: {
@@ -105,6 +90,9 @@ export default {
       total: 0,
     }
   },
+  mounted() {
+    this.getList(true)
+  },
   methods: {
     onClick(a, b) {
       if (a === 0) {
@@ -421,177 +409,6 @@ export default {
     goDetail(id) {
       this.$router.push({ name: 'friendsDetail', query: { id } })
     },
-    goSend(e, item) {
-      e.stopPropagation()
-      // item.materialList
-      let attachments = []
-      if (item.materialList && item.materialList.length) {
-        if (item.materialList[0].mediaType && item.materialList[0].mediaType === '0') {
-          // 图片类型
-          item.materialList.forEach((el) => {
-            let obj = {
-              msgtype: 'image', // 消息类型,必填
-              image: {
-                // mediaid: '', // 图片的素材id
-                imgUrl: el.materialUrl, // 图片的imgUrl,跟图片mediaid填其中一个即可
-              },
-            }
-            attachments.push(obj)
-          })
-        }
-        let linkUrl =
-          window.document.location.origin +
-          window.lwConfig.BASE_URL +
-          '#/metrialDetail?materiaId=' +
-          item.materialList[0].id +
-          '&otherModle=' +
-          true
-        switch (item.materialList[0].mediaType) {
-          case '2':
-          case '12':
-            // 视频/文章
-            attachments = [
-              {
-                msgtype: 'link', // 消息类型,必填
-                link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
-                  imgUrl: item.materialList[0].coverUrl
-                    ? item.materialList[0].coverUrl
-                    : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
-                  url: linkUrl, // H5消息页面url 必填
-                },
-              },
-            ]
-            break
-          case '9':
-            // 图文
-            attachments = [
-              {
-                msgtype: 'link', // 消息类型,必填
-                link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
-                  imgUrl: item.materialList[0].coverUrl
-                    ? item.materialList[0].coverUrl
-                    : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
-                  url: item.materialList[0].materialUrl ? item.materialList[0].materialUrl : ' ', // H5消息页面url 必填
-                },
-              },
-            ]
-            break
-          case '3':
-            // 普通文件
-            attachments = [
-              {
-                msgtype: 'link', // 消息类型,必填
-                link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
-                  imgUrl: this.filPicType(item.materialList[0].materialUrl), // H5消息封面图片URL
-                  url: linkUrl, // H5消息页面url 必填
-                },
-              },
-            ]
-            break
-          case '5':
-            // 普通文件
-            attachments = [
-              {
-                msgtype: 'link', // 消息类型,必填
-                link: {
-                  title: item.materialList[0].materialName
-                    ? item.materialList[0].materialName
-                    : ' ', // H5消息标题
-                  imgUrl: item.materialList[0].materialUrl
-                    ? item.materialList[0].materialUrl
-                    : window.lwConfig.DEFAULT_H5_PIC, // H5消息封面图片URL
-                  url: linkUrl, // H5消息页面url 必填
-                },
-              },
-            ]
-            break
-
-          default:
-            break
-        }
-      }
-
-      // let attachments = [
-      //   {
-      //     msgtype: 'image', // 消息类型,必填
-      //     image: {
-      //       // mediaid: '', // 图片的素材id
-      //       imgUrl:
-      //         'https://dev.linkwechat.net/fileUpload/afb88b4a-a989-47df-82af-9d285a5cfcb1.png', // 图片的imgUrl,跟图片mediaid填其中一个即可
-      //     },
-      //   },
-      //   {
-      //     msgtype: 'image', // 消息类型,必填
-      //     image: {
-      //       // mediaid: '', // 图片的素材id
-      //       imgUrl:
-      //         'https://dev.linkwechat.net/fileUpload/afb88b4a-a989-47df-82af-9d285a5cfcb1.png', // 图片的imgUrl,跟图片mediaid填其中一个即可
-      //     },
-      //   },
-      //   // {
-      //   //   msgtype: 'link', // 消息类型,必填
-      //   //   link: {
-      //   //     title: '', // H5消息标题
-      //   //     imgUrl: '', // H5消息封面图片URL
-      //   //     url: '', // H5消息页面url 必填
-      //   //   },
-      //   // },
-      //   // {
-      //   //   msgtype: 'video', // 消息类型,必填
-      //   //   video: {
-      //   //     mediaid: '', // 视频的素材id
-      //   //   },
-      //   // },
-      // ]
-      let that = this
-      wx.invoke(
-        'shareToExternalMoments',
-        {
-          text: {
-            content: item.content ? item.content : '', // 文本内容
-          },
-          attachments: attachments,
-        },
-        function(res) {
-          // alert(res)
-          if (res.err_msg == 'shareToExternalMoments:ok') {
-            that.getMomentsFinish(item.id)
-          }
-        }
-      )
-    },
-    filPicType(file) {
-      let filecontent = JSON.parse(JSON.stringify(file))
-      filecontent = filecontent.split('.')
-      let type = filecontent[filecontent.length - 1]
-      if (type === 'pdf') {
-        return window.lwConfig.DEFAULT_H5_PDF
-      } else if (['doc', 'docx'].includes(type)) {
-        return window.lwConfig.DEFAULT_H5_WORDE
-      } else if (['ppt', 'pptx', 'pps', 'pptsx'].includes(type)) {
-        return window.lwConfig.DEFAULT_H5_PPT
-      } else {
-        return ''
-      }
-    },
-    getMomentsFinish(id) {
-      let sendTime = dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss')
-      let form = { weMomentsTaskId: id, sendTime }
-      momentsFinish(form)
-        .then((res) => {
-          console.log(res)
-        })
-        .catch()
-    },
     // 将日期转为毫秒
     dealTime(time) {
       let nowTime = +new Date()
@@ -603,9 +420,6 @@ export default {
       }
     },
   },
-  mounted() {
-    this.getList(true)
-  },
 }
 </script>
 

+ 12 - 1
src/views/groupCode/index.vue

@@ -44,7 +44,7 @@
 </template>
 
 <script>
-import { getDetail, getNewCustomerGroupDetail } from '@/api/groupCode'
+import { getDetail, getNewCustomerGroupDetail, getOldCustomerGroupDetail } from '@/api/groupCode'
 
 export default {
   data() {
@@ -84,6 +84,17 @@ export default {
           this.loading = false
           if (msg) this.message = msg
         })
+      } else if (this.$route.query.type === 'oldCustomerGroup') {
+        getOldCustomerGroupDetail(id).then(({ data, msg }) => {
+          this.code = Object.assign(data, {
+            activityName: data.taskName,
+            guide: data.welcomeMsg,
+            codeUrl: data.groupCodeUrl,
+          })
+          document.title = data.activityName
+          this.loading = false
+          if (msg) this.message = msg
+        })
       } else {
         getDetail(id)
           .then(({ data, msg }) => {

+ 4 - 4
src/views/index/apps.vue

@@ -14,10 +14,10 @@
               <svg-icon class="xsgh-icon" name="xsgh"></svg-icon>
               <span>线索公海</span>
             </div>
-            <div class="bottom-item" @click="goRouter('highSeas')">
+            <!-- <div class="bottom-item" @click="goRouter('highSeas')">
               <svg-icon class="xsgh-icon" name="xsgh"></svg-icon>
               <span>老客迁移</span>
-            </div>
+            </div> -->
             <div class="bottom-item" @click="goRouter('lostCustomers')">
               <svg-icon class="xsgh-icon" name="lskh"></svg-icon>
               <span>流失客户</span>
@@ -37,10 +37,10 @@
             <span>社群运营</span>
           </div>
           <div class="item-cotent-bottom">
-            <div class="bottom-item" @click="goRouterTwo('/task', 1)">
+            <!-- <div class="bottom-item" @click="goRouterTwo('/task', 1)">
               <svg-icon class="xsgh-icon" name="bqjq"></svg-icon>
               <span>标签建群</span>
-            </div>
+            </div> -->
             <div class="bottom-item" @click="goRouter('customerBaseDetails', 2)">
               <svg-icon class="xsgh-icon" name="gsop"></svg-icon>
               <span>客群SOP</span>

+ 477 - 394
src/views/index/customer.vue

@@ -3,27 +3,78 @@
     <!-- <div style='height: 1px; width: 100%;background-color:#EAF5FF;'></div> -->
     <van-sticky>
       <form action="/">
-        <van-search @input="onSearch" v-model="query.name" @search="onSearch" clearable @clear="onClear" placeholder="请输入客户/员工名称" />
+        <van-search
+          @input="onSearch"
+          v-model="query.name"
+          @search="onSearch"
+          clearable
+          @clear="onClear"
+          placeholder="请输入客户/员工名称"
+        />
       </form>
       <div class="menu">
-        <span @click="openDialg('type')">{{menuTypeName}}<img class="select" width="16" height="16" src="../../assets/select@2x.png" /> </span>
-        <span @click="openDialg('state')">{{menuStateName}}<img class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
-        <span @click="openDialg('tag')">企业标签<img class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
-        <span @click="openDialg('date')">添加时间<img class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
+        <span @click="openDialg('type')">
+          {{ menuTypeName }}
+          <img class="select" width="16" height="16" src="../../assets/select@2x.png" />
+        </span>
+        <span @click="openDialg('state')">
+          {{ menuStateName }}
+          <img class="select" width="16" height="16" src="../../assets/select@2x.png" />
+        </span>
+        <span @click="openDialg('tag')">
+          企业标签
+          <img class="select" width="16" height="16" src="../../assets/select@2x.png" />
+        </span>
+        <span @click="openDialg('date')">
+          添加时间
+          <img class="select" width="16" height="16" src="../../assets/select@2x.png" />
+        </span>
       </div>
-      <van-overlay :lock-scroll="false" :show="show" z-index='2'>
+      <van-overlay :lock-scroll="false" :show="show" z-index="2">
         <form action="/">
-          <van-search @input="onSearch" v-model="query.name" @search="onSearch" clearable @clear="onClear" shape="round" placeholder="请输入客户/员工名称" />
+          <van-search
+            @input="onSearch"
+            v-model="query.name"
+            @search="onSearch"
+            clearable
+            @clear="onClear"
+            shape="round"
+            placeholder="请输入客户/员工名称"
+          />
         </form>
         <div class="menu">
-          <span @click="openDialg('type')" :style="showType ? titleActive: ''">{{menuTypeName}}<img v-if="showType" class="select" width="16" height="16" src="../../assets/selected@2x.png" /><img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
-          <span @click="openDialg('state')" :style="showState ? titleActive: ''">{{menuStateName}}<img v-if="showState" class="select" width="16" height="16" src="../../assets/selected@2x.png" /><img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
-          <span @click="openDialg('tag')" :style="showTag ? titleActive: ''">企业标签<img v-if="showTag" class="select" width="16" height="16" src="../../assets/selected@2x.png" /><img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
-          <span @click="openDialg('date')" :style="showDate ? titleActive: ''">添加时间<img v-if="showDate" class="select" width="16" height="16" src="../../assets/selected@2x.png" /><img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" /></span>
+          <span @click="openDialg('type')" :style="showType ? titleActive : ''">
+            {{ menuTypeName }}
+            <img v-if="showType" class="select" width="16" height="16" src="../../assets/selected@2x.png" />
+            <img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" />
+          </span>
+          <span @click="openDialg('state')" :style="showState ? titleActive : ''">
+            {{ menuStateName }}
+            <img v-if="showState" class="select" width="16" height="16" src="../../assets/selected@2x.png" />
+            <img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" />
+          </span>
+          <span @click="openDialg('tag')" :style="showTag ? titleActive : ''">
+            企业标签
+            <img v-if="showTag" class="select" width="16" height="16" src="../../assets/selected@2x.png" />
+            <img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" />
+          </span>
+          <span @click="openDialg('date')" :style="showDate ? titleActive : ''">
+            添加时间
+            <img v-if="showDate" class="select" width="16" height="16" src="../../assets/selected@2x.png" />
+            <img v-else class="select" width="16" height="16" src="../../assets/select@2x.png" />
+          </span>
         </div>
         <template v-if="showType">
           <div class="type_list">
-            <div class="item" :style="item.type === queryTemp.customerType ? activeStyle : ''" v-for="(item, index) in typeActions" :key="index" @click="onSelectType(item)">{{item.name}}</div>
+            <div
+              class="item"
+              :style="item.type === queryTemp.customerType ? activeStyle : ''"
+              v-for="(item, index) in typeActions"
+              :key="index"
+              @click="onSelectType(item)"
+            >
+              {{ item.name }}
+            </div>
           </div>
           <div class="submit">
             <div class="submit_button" @click="submitType">确定</div>
@@ -31,7 +82,15 @@
         </template>
         <template v-if="showState">
           <div class="type_list">
-            <div class="item" :style="item.stageVal == queryTemp.trackState ? activeStyle : ''" v-for="(item, index) in stageList" :key="index" @click="onSelectState(item)">{{item.stageKey}}</div>
+            <div
+              class="item"
+              :style="item.stageVal == queryTemp.trackState ? activeStyle : ''"
+              v-for="(item, index) in stageList"
+              :key="index"
+              @click="onSelectState(item)"
+            >
+              {{ item.stageKey }}
+            </div>
           </div>
           <div class="submit">
             <div class="submit_button" @click="submitState">确定</div>
@@ -39,7 +98,7 @@
         </template>
         <template v-if="showTag">
           <div style="background:#fff;">
-            <select-tag type='1' :selected="selectTagList" @submit="getSelectList"></select-tag>
+            <select-tag type="1" :selected="selectTagList" @submit="getSelectList"></select-tag>
           </div>
         </template>
         <template v-if="showDate">
@@ -51,14 +110,19 @@
     </van-sticky>
     <div class="sub-search">
       <span v-if="isSelectCustomer">选择客户</span>
-      <span v-else>客户总数: {{total}}</span>
+      <span v-else>客户总数: {{ total }}</span>
       <my-switch v-model="checked" text="个人|全部" @change="changeFn"></my-switch>
     </div>
     <van-list v-model="loading" :finished="finished" finished-text="暂无更多数据" @load="onLoad">
       <div class="list">
-        <div class="unit" :class="activeCustomerId == data.id && 'active'" v-for="(data, index) in dataList" :key="index" @click="gotoDetail(data)">
-          <img class="unit_img" :src="data.avatar"/>
-          <!-- </img> -->
+        <div
+          class="unit"
+          :class="activeCustomerId == data.id && 'active'"
+          v-for="(data, index) in dataList"
+          :key="index"
+          @click="gotoDetail(data)"
+        >
+          <img class="unit_img" :src="data.avatar" />
           <div class="unit_content">
             <div style="display: flex;align-items:start;">
               <span class="name" v-html="data.customerName"></span>
@@ -73,9 +137,18 @@
           </div>
           <div class="unit_state">
             <div>
-              <span class="state" :class="{state2: data.trackState === 3, state3: data.trackState === 5, state1:data.trackState !==3 && data.trackState !== 5}">{{trackStateFn(data.trackState)}}</span>
+              <span
+                class="state"
+                :class="{
+                  state2: data.trackState === 3,
+                  state3: data.trackState === 5,
+                  state1: data.trackState !== 3 && data.trackState !== 5,
+                }"
+              >
+                {{ trackStateFn(data.trackState) }}
+              </span>
             </div>
-            <span class="date">{{data.firstAddTime}}</span>
+            <span class="date">{{ data.firstAddTime }}</span>
           </div>
         </div>
       </div>
@@ -84,416 +157,426 @@
 </template>
 
 <script>
-  import SelectTag from '@/components/SelectTag'
-  import SelectDate from '@/components/SelectDate'
-  import ShowRes from '@/components/ShowRes'
-  import MySwitch from '@/components/Switch'
-  import { getDataList } from '@/api/group'
-  import {getStageList} from '@/api/common'
-  export default {
-    name: 'customer_list',
-    props:{
-      // 是否为选择客户组件
-      isSelectCustomer:{
-        type:Boolean,
-        default: false
-      }
+import SelectTag from '@/components/SelectTag'
+import SelectDate from '@/components/SelectDate'
+import ShowRes from '@/components/ShowRes'
+import MySwitch from '@/components/Switch'
+import { getDataList } from '@/api/group'
+import { getStageList } from '@/api/common'
+export default {
+  name: 'customer_list',
+  props: {
+    // 是否为选择客户组件
+    isSelectCustomer: {
+      type: Boolean,
+      default: false,
     },
-    components: { SelectTag, ShowRes, MySwitch, SelectDate },
-    data () {
-      return {
-        loading: false,
-        finished: false,
-        menuTypeName: '客户类型',
-        menuStateName: '商机阶段',
-        currentDate: '',
-        queryTemp: {
-          customerType: null,
-          trackState: null
-        },
-        query: {
-          name: '',
-          tagIds: '',
-          customerType: null,
-          trackState: null,
-          beginTime: '',
-          endTime: '',
-          pageNum: 1,
-          pageSize: 10,
-          delFlag: 0,
-          dataScope: false
-        },
-        checked: true,
-        show: false,
-        showType: false,
-        showState: false,
-        showTag: false,
-        showDate: false,
-        typeActions: [{ name: '全部', type: null }, { name: '微信客户', type: 1 }, { name: '企业客户', type: 2 }],
-        stateActions: [
-          { name: '全部', color: '', type: null },
-          { name: '待跟进', color: '', type: 1 },
-          { name: '跟进中', color: 'warning', type: 2 },
-          { name: '已成交', color: 'success', type: 3 },
-          { name: '无意向', color: 'info', type: 4 },
-          { name: '已流失', color: 'danger', type: 5 }
-        ],
-        activeStyle: {
-          background: '#ECF5FF',
-          color: '#0079DE'
-        },
-        titleActive: {
-          color: '#0079de'
-        },
-        selectTagList: [],
-        dataList: [],
-        total: 0,
-        stageList:[],
+  },
+  components: { SelectTag, ShowRes, MySwitch, SelectDate },
+  data() {
+    return {
+      loading: false,
+      finished: false,
+      menuTypeName: '客户类型',
+      menuStateName: '商机阶段',
+      currentDate: '',
+      queryTemp: {
+        customerType: null,
+        trackState: null,
+      },
+      query: {
+        name: '',
+        tagIds: '',
+        customerType: null,
+        trackState: null,
+        beginTime: '',
+        endTime: '',
+        pageNum: 1,
+        pageSize: 10,
+        delFlag: 0,
+        dataScope: false,
+      },
+      checked: true,
+      show: false,
+      showType: false,
+      showState: false,
+      showTag: false,
+      showDate: false,
+      typeActions: [
+        { name: '全部', type: null },
+        { name: '微信客户', type: 1 },
+        { name: '企业客户', type: 2 },
+      ],
+      stateActions: [
+        { name: '全部', color: '', type: null },
+        { name: '待跟进', color: '', type: 1 },
+        { name: '跟进中', color: 'warning', type: 2 },
+        { name: '已成交', color: 'success', type: 3 },
+        { name: '无意向', color: 'info', type: 4 },
+        { name: '已流失', color: 'danger', type: 5 },
+      ],
+      activeStyle: {
+        background: '#ECF5FF',
+        color: '#0079DE',
+      },
+      titleActive: {
+        color: '#0079de',
+      },
+      selectTagList: [],
+      dataList: [],
+      total: 0,
+      stageList: [],
 
-        activeCustomerId:''
+      activeCustomerId: '',
+    }
+  },
+  computed: {},
+  watch: {},
+  created() {
+    this.getList(), this.getStage()
+  },
+  mounted() {},
+  methods: {
+    getStage() {
+      getStageList().then((res) => {
+        this.stageList = res.data
+        this.stageList.unshift({ stageKey: '全部', stageVal: null })
+      })
+    },
+    gotoDetail(row) {
+      this.activeCustomerId = row.id
+      if (this.isSelectCustomer) {
+        this.$emit('change', row)
+      } else {
+        this.$router.push({
+          name: 'portrait',
+          query: {
+            id: row.externalUserid,
+            userId: row.firstUserId,
+          },
+        })
       }
     },
-    computed: {},
-    watch: {},
-    created () { this.getList(), this.getStage() },
-    mounted () { },
-    methods: {
-      getStage() {
-        getStageList().then(res => {
-          this.stageList = res.data
-          this.stageList.unshift({stageKey: '全部', stageVal: null})
+    getDate(start, end) {
+      this.query.beginTime = start
+      this.query.endTime = end
+      this.showDate = false
+      this.show = false
+      this.getList(1)
+    },
+    onLoad() {
+      if (this.total !== this.dataList.length) {
+        this.query.pageNum++
+        this.getList()
+      }
+    },
+    getSelectList(data) {
+      this.selectTagList = data
+      this.query.tagIds = data
+        .map((dd) => {
+          return dd.tagId
         })
-      },
-      gotoDetail (row) {
-        this.activeCustomerId = row.id
-        if (this.isSelectCustomer) {
-          this.$emit('change',row)
+        .join(',')
+      this.showTag = false
+      this.show = false
+      this.getList(1)
+    },
+    setName() {
+      this.typeActions.forEach((dd) => {
+        if (dd.type === this.query.customerType) {
+          this.menuTypeName = dd.name === '全部' ? '客户类型' : dd.name
+        }
+      })
+    },
+    setStateName() {
+      this.stageList.forEach((dd) => {
+        if (dd.stageVal === this.query.trackState) {
+          this.menuStateName = dd.stageKey === '全部' ? '商机阶段' : dd.stageKey
+        }
+      })
+    },
+    trackStateFn(state) {
+      let str = ''
+      this.stateActions.forEach((dd) => {
+        if (dd.type === state) {
+          str = dd.name
+        }
+      })
+      return str
+    },
+    openDialg(type) {
+      if (type === 'type') {
+        if (this.showType) {
+          this.show = false
         } else {
-          this.$router.push({
-            name: 'portrait',
-            query: {
-              id: row.externalUserid,
-            },
-          })
+          this.queryTemp.customerType = JSON.parse(JSON.stringify(this.query.customerType))
+          this.show = true
         }
-      },
-      getDate (start, end) {
-        this.query.beginTime = start
-        this.query.endTime = end
+        this.showType = !this.showType
+        this.showState = false
+        this.showTag = false
         this.showDate = false
-        this.show = false
-        this.getList(1)
-      },
-      onLoad () {
-        if (this.total !== this.dataList.length) {
-          this.query.pageNum++
-          this.getList()
+      }
+      if (type === 'state') {
+        if (this.showState) {
+          this.show = false
+        } else {
+          this.queryTemp.trackState = JSON.parse(JSON.stringify(this.query.trackState))
+          this.show = true
         }
-      },
-      getSelectList (data) {
-        this.selectTagList = data
-        this.query.tagIds = data.map(dd => { return dd.tagId }).join(',')
+        this.showState = !this.showState
+        this.showType = false
         this.showTag = false
-        this.show = false
-        this.getList(1)
-      },
-      setName () {
-        this.typeActions.forEach(dd => {
-          if (dd.type === this.query.customerType) {
-            this.menuTypeName = dd.name === '全部' ? '客户类型' : dd.name
-          }
-        })
-      },
-      setStateName () {
-        this.stageList.forEach(dd => {
-          if (dd.stageVal === this.query.trackState) {
-            this.menuStateName = dd.stageKey === '全部' ? '商机阶段' : dd.stageKey
-          }
-        })
-      },
-      trackStateFn (state) {
-        let str = ''
-        this.stateActions.forEach(dd => {
-          if (dd.type === state) {
-            str = dd.name
-          }
-        })
-        return str
-      },
-      openDialg (type) {
-        if (type === 'type') {
-          if (this.showType) {
-            this.show = false
-          } else {
-            this.queryTemp.customerType = JSON.parse(JSON.stringify(this.query.customerType))
-            this.show = true
-          }
-          this.showType = !this.showType
-          this.showState = false
-          this.showTag = false
-          this.showDate = false
+        this.showDate = false
+      }
+      if (type === 'tag') {
+        if (this.showTag) {
+          this.show = false
+        } else {
+          this.show = true
         }
-        if (type === 'state') {
-          if (this.showState) {
-            this.show = false
-          } else {
-            this.queryTemp.trackState = JSON.parse(JSON.stringify(this.query.trackState))
-            this.show = true
-          }
-          this.showState = !this.showState
-          this.showType = false
-          this.showTag = false
-          this.showDate = false
+        this.showTag = !this.showTag
+        this.showType = false
+        this.showState = false
+        this.showDate = false
+      }
+      if (type === 'date') {
+        if (this.showDate) {
+          this.show = false
+        } else {
+          this.show = true
         }
-        if (type === 'tag') {
-          if (this.showTag) {
-            this.show = false
+        this.showDate = !this.showDate
+        this.showType = false
+        this.showState = false
+        this.showTag = false
+      }
+    },
+    onSearch() {
+      this.getList(1)
+    },
+    onClear() {
+      this.query.name = ''
+      this.getList(1)
+    },
+    changeFn(data) {
+      this.query.dataScope = !data
+      this.getList(1)
+    },
+    onSelectType(data) {
+      this.queryTemp.customerType = data.type
+    },
+    submitType() {
+      this.query.customerType = JSON.parse(JSON.stringify(this.queryTemp.customerType))
+      this.show = false
+      this.showType = false
+      this.setName()
+      this.getList(1)
+    },
+    onSelectState(data) {
+      this.queryTemp.trackState = data.stageVal
+    },
+    submitState() {
+      this.query.trackState = JSON.parse(JSON.stringify(this.queryTemp.trackState))
+      this.showState = false
+      this.show = false
+      this.setStateName()
+      this.getList(1)
+    },
+    getList(page) {
+      page && (this.query.pageNum = page)
+      this.loading = true
+      this.finished = false
+      // this.dataList = [{customerName: '张三测试', userName:"跟进员工"}]
+      getDataList(this.query).then((res) => {
+        if (res.code === 200) {
+          if (this.query.pageNum > 1) {
+            this.dataList = [...this.dataList, ...res.rows]
           } else {
-            this.show = true
+            this.dataList = res.rows
           }
-          this.showTag = !this.showTag
-          this.showType = false
-          this.showState = false
-          this.showDate = false
-        }
-        if (type === 'date') {
-          if (this.showDate) {
-            this.show = false
-          } else {
-            this.show = true
+          this.total = Number(res.total)
+          if (this.total === this.dataList.length) {
+            this.finished = true
           }
-          this.showDate = !this.showDate
-          this.showType = false
-          this.showState = false
-          this.showTag = false
-        }
-      },
-      onSearch () {
-        this.getList(1)
-      },
-      onClear () {
-        this.query.name = ''
-        this.getList(1)
-      },
-      changeFn (data) {
-        this.query.dataScope = !data
-        this.getList(1)
-      },
-      onSelectType (data) {
-        this.queryTemp.customerType = data.type
-      },
-      submitType () {
-        this.query.customerType = JSON.parse(JSON.stringify(this.queryTemp.customerType))
-        this.show = false
-        this.showType = false
-        this.setName()
-        this.getList(1)
-      },
-      onSelectState (data) {
-        this.queryTemp.trackState = data.stageVal
-      },
-      submitState () {
-        this.query.trackState = JSON.parse(JSON.stringify(this.queryTemp.trackState))
-        this.showState = false
-        this.show = false
-        this.setStateName()
-        this.getList(1)
-      },
-      getList (page) {
-        page && (this.query.pageNum = page)
-        this.loading = true
-        this.finished = false
-        // this.dataList = [{customerName: '张三测试', userName:"跟进员工"}]
-        getDataList(this.query).then(res => {
-          if (res.code === 200) {
-            if (this.query.pageNum > 1) {
-              this.dataList = [...this.dataList, ...res.rows]
-            } else {
-              this.dataList = res.rows
-            }
-            this.total = Number(res.total)
-            if (this.total === this.dataList.length) {
-              this.finished = true
-            }
-            if (this.query.name) {
-              let replaceReg = new RegExp(this.query.name, 'ig')
-              let replaceString = `<span style="color: #0079DE;">${this.query.name}</span>`
-              this.dataList.forEach(dd => {
-                dd.customerName = dd.customerName.replace(replaceReg, replaceString)
-                dd.userName = dd.userName.replace(replaceReg, replaceString)
-              })
-            }
+          if (this.query.name) {
+            let replaceReg = new RegExp(this.query.name, 'ig')
+            let replaceString = `<span style="color: #0079DE;">${this.query.name}</span>`
+            this.dataList.forEach((dd) => {
+              dd.customerName = dd.customerName.replace(replaceReg, replaceString)
+              dd.userName = dd.userName.replace(replaceReg, replaceString)
+            })
           }
-          this.loading = false
-        })
-      },
+        }
+        this.loading = false
+      })
     },
-  }
+  },
+}
 </script>
 
 <style lang="less" scoped>
-
-  .bg {
-    background: linear-gradient(180deg, #eaf5ff 0%, rgba(253, 253, 253, 0) 100%);
-    border-radius: 0px 0px 0px 0px;
-    overflow: auto;
-  }
-  .menu {
-    padding: 11px 16px 14px 16px;
-    background-color: #fff;
-    display: flex;
-    justify-content: space-between;
+.bg {
+  background: linear-gradient(180deg, #eaf5ff 0%, rgba(253, 253, 253, 0) 100%);
+  border-radius: 0px 0px 0px 0px;
+  // overflow: auto;
+}
+.menu {
+  padding: 11px 16px 14px 16px;
+  background-color: #fff;
+  display: flex;
+  justify-content: space-between;
+  font-size: 13px;
+  color: #666;
+}
+.sub-search {
+  font-size: 13px;
+  color: #666;
+  padding: 16px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.type_list {
+  display: flex;
+  padding: 25px 15px;
+  background: #fff;
+  flex-wrap: wrap;
+  .item {
+    margin-left: 13px;
+    margin-bottom: 11px;
+    background: #fafafa;
+    border-radius: 8px;
     font-size: 13px;
-    color: #666;
+    color: #222222;
+    width: 72px;
+    height: 34px;
+    line-height: 34px;
+    text-align: center;
   }
-  .sub-search {
-    font-size: 13px;
-    color: #666;
-    padding: 16px;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
+}
+.submit {
+  padding: 10px 20px;
+  background: #fff;
+  .submit_button {
+    padding: 10px 20px;
+    width: 100%;
+    background: #0079de;
+    border-radius: 8px;
+    color: #ffffff;
+    font-size: 16px;
+    padding: 10px 0;
+    text-align: center;
   }
-  .type_list {
+}
+.list {
+  padding: 0 12px;
+  .unit {
+    margin-bottom: 8px;
+    padding: 14px;
+    background: #ffffff;
+    box-shadow: 0px 2px 6px -3px rgba(0, 0, 0, 0);
+    border-radius: 8px;
     display: flex;
-    padding: 25px 15px;
-    background: #fff;
-    flex-wrap: wrap;
-    .item {
-      margin-left: 13px;
-      margin-bottom: 11px;
-      background: #fafafa;
-      border-radius: 8px;
-      font-size: 13px;
-      color: #222222;
-      width: 72px;
-      height: 34px;
-      line-height: 34px;
-      text-align: center;
+    &.active {
+      background: @colorSub;
     }
-  }
-  .submit {
-    padding: 10px 20px;
-    background: #fff;
-    .submit_button {
-      padding: 10px 20px;
-      width: 100%;
-      background: #0079de;
-      border-radius: 8px;
-      color: #ffffff;
-      font-size: 16px;
-      padding: 10px 0;
-      text-align: center;
+    .unit_img {
+      height: 46px;
+      width: 46px;
+      border-radius: 2px;
     }
-  }
-  .list {
-    padding: 0 12px;
-    .unit {
-      margin-bottom: 8px;
-      padding: 14px;
-      background: #ffffff;
-      box-shadow: 0px 2px 6px -3px rgba(0, 0, 0, 0);
-      border-radius: 8px;
+    .unit_content {
       display: flex;
-      &.active {
-        background: @colorSub;
+      flex-direction: column;
+      justify-content: space-between;
+      flex: 1;
+      padding-left: 10px;
+      .name {
+        margin-right: 4px;
+        font-size: 14px;
+        color: #222222;
+        font-weight: 600;
       }
-      .unit_img {
-        height: 46px;
-        width: 46px;
-        border-radius: 2px;
+      .user {
+        font-size: 13px;
+        color: #9f9f9f;
+        font-weight: 500;
       }
-      .unit_content {
-        display: flex;
-        flex-direction: column;
-        justify-content: space-between;
-        flex: 1;
-        padding-left: 10px;
-        .name {
-          margin-right: 4px;
-          font-size: 14px;
-          color: #222222;
-          font-weight: 600;
-        }
-        .user {
-          font-size: 13px;
-          color: #9f9f9f;
-          font-weight: 500;
-        }
+    }
+    .unit_state {
+      text-align: right;
+      display: flex;
+      flex-direction: column;
+      justify-content: space-between;
+      .date {
+        font-size: 13px;
+        color: #9f9f9f;
       }
-      .unit_state {
-        text-align: right;
-        display: flex;
-        flex-direction: column;
-        justify-content: space-between;
-        .date {
-          font-size: 13px;
-          color: #9f9f9f;
-        }
-        .state {
-          padding: 3px 11px;
-          border-radius: 3px 3px 3px 3px;
-          font-size: 10px;
-        }
-        .state1 {
-          color: #0079de;
-          background: #ecf5ff;
-        }
-        .state2 {
-          background: #effffa;
-          color: #00d695;
-        }
-        .state3 {
-          background: #fff5f6;
-          color: #e34d59;
-        }
+      .state {
+        padding: 3px 11px;
+        border-radius: 3px 3px 3px 3px;
+        font-size: 10px;
+      }
+      .state1 {
+        color: #0079de;
+        background: #ecf5ff;
+      }
+      .state2 {
+        background: #effffa;
+        color: #00d695;
+      }
+      .state3 {
+        background: #fff5f6;
+        color: #e34d59;
       }
     }
   }
-  .select {
-    margin-left: 2px;
-    height: 12px;
-    width: 12px;
-  }
+}
+.select {
+  margin-left: 2px;
+  height: 12px;
+  width: 12px;
+}
 </style>
 <style lang="less">
-  .bg .van-field__control {
-    font-size: 12px;
-  }
-  .bg .van-search {
-    padding: 11px 16px 0 16px;
+.bg .van-field__control {
+  font-size: 12px;
+}
+.bg .van-search {
+  padding: 11px 16px 0 16px;
+}
+.bg .van-search__content {
+  border-radius: 8px 8px 8px 8px;
+}
+.bg input::-webkit-input-placeholder {
+  font-size: 12px;
+}
+.bg input::-moz-input-placeholder {
+  font-size: 12px;
+}
+.bg input::-ms-input-placeholder {
+  font-size: 12px;
+}
+.sub-search {
+  .van-switch {
+    width: 3em;
+    color: #fff;
   }
-  .bg .van-search__content {
-    border-radius: 8px 8px 8px 8px;
+  .van-switch--on .van-switch__node {
+    -webkit-transform: translateX(2em);
+    transform: translateX(2em);
   }
-  .bg input::-webkit-input-placeholder {
-    font-size: 12px;
-  }
-  .bg input::-moz-input-placeholder {
-    font-size: 12px;
-  }
-  .bg input::-ms-input-placeholder {
-    font-size: 12px;
-  }
-  .sub-search {
-    .van-switch {
-      width: 3em;
-      color: #fff;
-    }
-    .van-switch--on .van-switch__node {
-      -webkit-transform: translateX(2em);
-      transform: translateX(2em);
-    }
-    .van-switch--on .van-switch::before {
-    }
-    // .van-switch--on::after {
-    //   content: '企业';
-    //   font-size: 12px;
-    //   position: absolute;
-    //   top: 50%;
-    //   transform: translateY(-50%);
-    //   left: 25px;
-    //   color: '#333';
-    // }
+  .van-switch--on .van-switch::before {
   }
+  // .van-switch--on::after {
+  //   content: '企业';
+  //   font-size: 12px;
+  //   position: absolute;
+  //   top: 50%;
+  //   transform: translateY(-50%);
+  //   left: 25px;
+  //   color: '#333';
+  // }
+}
 </style>

+ 1 - 2
src/views/index/customerGroup.vue

@@ -36,8 +36,7 @@
     <van-list v-model="loading" :finished="finished" finished-text="暂无更多数据" @load="onLoad">
       <div class="list">
         <div class="unit" v-for="(data, index) in dataList" :key="index" @click="gotoDetail(data.chatId)">
-          <img class="unit_img" src="../../assets/avator.png"/>
-          <!-- </img> -->
+          <img class="unit_img" src="../../assets/avator.png"></img>
           <div class="unit_content">
             <div style="display: flex;align-items:center;">
               <span class="name" v-html="data.groupName"></span>

+ 88 - 150
src/views/index/index.vue

@@ -9,9 +9,7 @@
         <div class="left-text">
           <div class="text1">{{ userInfo.nickName }}</div>
           <div class="text2">
-            <span v-if="userInfo.position"
-              >{{ userInfo.position }}&nbsp;&nbsp;</span
-            >
+            <span v-if="userInfo.position">{{ userInfo.position }}&nbsp;&nbsp;</span>
           </div>
           <div class="text3">
             <span>{{ userInfo.companyName }}</span>
@@ -24,11 +22,7 @@
             <svg-icon class=" icon-notice" name="notice"></svg-icon>
           </van-badge>
         </div>
-        <my-switch
-          v-model="checked"
-          text="个人|全部"
-          @change="changeFn"
-        ></my-switch>
+        <my-switch v-model="checked" text="个人|全部" @change="changeFn"></my-switch>
       </div>
     </div>
     <div class="index-card">
@@ -38,11 +32,7 @@
           <span></span>
           <span>客户数据</span>
           <!-- <img src="@/assets/question.png" alt="" @click="showPopup(0)" /> -->
-          <svg-icon
-            class="question-icon"
-            name="question"
-            @click="showPopup(0)"
-          ></svg-icon>
+          <svg-icon class="question-icon" name="question" @click="showPopup(0)"></svg-icon>
         </div>
         <div class="card-box">
           <div class="card-box-item">
@@ -89,11 +79,7 @@
           <span></span>
           <span>客群数据</span>
           <!-- <img src="@/assets/question.png" alt="" @click="showPopup(1)" /> -->
-          <svg-icon
-            class="question-icon"
-            name="question"
-            @click="showPopup(1)"
-          ></svg-icon>
+          <svg-icon class="question-icon" name="question" @click="showPopup(1)"></svg-icon>
         </div>
         <div class="card-box">
           <div class="card-box-item ">
@@ -147,24 +133,18 @@
         <div class="card-box">
           <Empty v-if="!dynamicsOutList.length" />
           <div class="enterprise-dynamics" v-if="dynamicsOutList.length">
-            <div
-              class="dynamics-item"
-              v-for="(item, index) in dynamicsOutList"
-              :key="index"
-            >
+            <div class="dynamics-item" v-for="(item, index) in dynamicsOutList" :key="index">
               <div class="dynamics-left">
                 <div class="top">
                   <span :class="item.operatorType === 1 ? 'customer' : 'staff'">
-                    {{ item.operatorType === 1 ? "客户" : "员工" }}
+                    {{ item.operatorType === 1 ? '客户' : '员工' }}
                   </span>
                   <span>{{ item.operatorName }}</span>
                 </div>
                 <div class="bottom">
                   <span
                     :class="
-                      item.action === '删除员工' ||
-                      item.action === '解散群聊' ||
-                      item.action === '退出群聊'
+                      item.action === '删除员工' || item.action === '解散群聊' || item.action === '退出群聊'
                         ? 'unnomal'
                         : 'nomal'
                     "
@@ -176,13 +156,7 @@
               </div>
               <div class="dynamics-right">
                 <span>
-                  {{
-                    item.trajectoryType === 1
-                      ? "客户动态"
-                      : item.trajectoryType === 5
-                      ? "客群动态"
-                      : ""
-                  }}
+                  {{ item.trajectoryType === 1 ? '客户动态' : item.trajectoryType === 5 ? '客群动态' : '' }}
                 </span>
                 <!-- <span>2022-04-06 08:25:35</span> -->
                 <span>{{ item.createTime }}</span>
@@ -216,11 +190,7 @@
             <div class="pop-bg-bottom"></div>
             <div class="pop-text">
               <div class="pop-title">数据指标</div>
-              <div
-                class="pop-item"
-                v-for="(item, index) in questionData"
-                :key="index"
-              >
+              <div class="pop-item" v-for="(item, index) in questionData" :key="index">
                 <div class="item-top">{{ item.title }}</div>
                 <div class="item-bottom">{{ item.content }}</div>
               </div>
@@ -230,28 +200,20 @@
             </div>
           </div>
           <!-- <img src="@/assets/pop-close.png" alt="" @click="popupClose" /> -->
-          <svg-icon
-            class="pop-close-icon"
-            name="pop-close"
-            @click="popupClose"
-          />
+          <svg-icon class="pop-close-icon" name="pop-close" @click="popupClose" />
         </div>
       </div>
     </van-overlay>
   </div>
 </template>
 <script>
-import MySwitch from "@/components/Switch";
-import {
-  getCustomerAnalysisData,
-  getGroupAnalysisData,
-  getCompanyDynamicsData,
-} from "@/api/index";
-import { getNum } from "@/views/message/api.js";
-import Loading from "@/components/Loading.vue";
-import MyTask from "@/views/myTask/index.vue";
+import MySwitch from '@/components/Switch'
+import { getCustomerAnalysisData, getGroupAnalysisData, getCompanyDynamicsData } from '@/api/index'
+import { getNum } from '@/views/message/api.js'
+import Loading from '@/components/Loading.vue'
+import MyTask from '@/views/myTask/index.vue'
 export default {
-  name: "",
+  name: '',
   components: { MySwitch, Loading, MyTask },
   data() {
     return {
@@ -259,7 +221,7 @@ export default {
       questionShow: false,
       questionData: {},
       dynamicsList: [{}],
-      userInfo: { avatar: "", nickName: "", position: "", companyName: "" },
+      userInfo: { avatar: '', nickName: '', position: '', companyName: '' },
       //   loading: false,
       customerForm: {
         dataScope: false,
@@ -268,7 +230,7 @@ export default {
       customerOutForm: {},
       groupOutForm: {},
       dynamicsFrom: {
-        trajectoryType: "",
+        trajectoryType: '',
         dataScope: false,
         pageSize: 5,
         pageNum: 1,
@@ -278,134 +240,134 @@ export default {
 
       msgNum: 0,
       showTask: false,
-    };
+    }
   },
   computed: {},
   watch: {},
   created() {
     // this.customerForm.Authorization = sessionStorage.getItem("token");
-    this.getNum();
-    this.getCustomerData();
-    this.getGroupData();
-    this.getDynamicsData();
+    this.getNum()
+    this.getCustomerData()
+    this.getGroupData()
+    this.getDynamicsData()
   },
   mounted() {
-    this.userInfo.avatar = sessionStorage.getItem("avatar");
-    this.userInfo.companyName = sessionStorage.getItem("companyName");
-    this.userInfo.nickName = sessionStorage.getItem("nickName")
-      ? sessionStorage.getItem("nickName")
-      : sessionStorage.getItem("userName");
-    this.userInfo.position = sessionStorage.getItem("position");
+    this.userInfo.avatar = sessionStorage.getItem('avatar')
+    this.userInfo.companyName = sessionStorage.getItem('companyName')
+    this.userInfo.nickName = sessionStorage.getItem('nickName')
+      ? sessionStorage.getItem('nickName')
+      : sessionStorage.getItem('userName')
+    this.userInfo.position = sessionStorage.getItem('position')
   },
   methods: {
     // 消息通知数量
     getNum() {
       getNum().then((res) => {
-        this.msgNum = res.data;
-      });
+        this.msgNum = res.data
+      })
     },
     changeFn() {
-      this.checked = !this.checked;
-      this.isLoad = true;
-      this.customerForm.dataScope = !this.checked;
-      this.dynamicsFrom.dataScope = !this.checked;
-      this.getCustomerData();
-      this.getGroupData();
-      this.getDynamicsData();
+      this.checked = !this.checked
+      this.isLoad = true
+      this.customerForm.dataScope = !this.checked
+      this.dynamicsFrom.dataScope = !this.checked
+      this.getCustomerData()
+      this.getGroupData()
+      this.getDynamicsData()
     },
     showPopup(i) {
       let questionList = [
         [
           {
-            title: "【客户总数】",
-            content: "当前员工权限范围内的全部客户数量(含重复)",
+            title: '【客户总数】',
+            content: '当前员工权限范围内的全部客户数量(含重复)',
           },
           {
-            title: "【今日新增】",
-            content: "当前员工权限范围内今日添加的客户数(含重复 及流失)",
+            title: '【今日新增】',
+            content: '当前员工权限范围内今日添加的客户数(含重复 及流失)',
           },
           {
-            title: "【今日跟进】",
-            content: "当前员工权限范围内今日添加的客户数(含重复及流失)",
+            title: '【今日跟进】',
+            content: '当前员工权限范围内今日添加的客户数(含重复及流失)',
           },
           {
-            title: "【今日净增】",
-            content: "当前员工权限范围内今日添加的客户数(不含重复及流失)",
+            title: '【今日净增】',
+            content: '当前员工权限范围内今日添加的客户数(不含重复及流失)',
           },
           {
-            title: "【今日流失】",
-            content: "当前员工权限范围内的流失的全部客户数量",
+            title: '【今日流失】',
+            content: '当前员工权限范围内的流失的全部客户数量',
           },
           {
-            title: "【昨日发送申请】",
-            content: "当前员工数权限范围内主动向客户发起的申请数",
+            title: '【昨日发送申请】',
+            content: '当前员工数权限范围内主动向客户发起的申请数',
           },
         ],
         [
           {
-            title: "【客户总数】",
-            content: "当前员工权限范围内的全部客群数量",
+            title: '【客户总数】',
+            content: '当前员工权限范围内的全部客群数量',
           },
           {
-            title: "【今日新增客群】",
-            content: "当前员工权限范围内今日创建的客群数",
+            title: '【今日新增客群】',
+            content: '当前员工权限范围内今日创建的客群数',
           },
           {
-            title: "【今日解散客群】",
-            content: "当前员工权限范围内今日创建的客群数",
+            title: '【今日解散客群】',
+            content: '当前员工权限范围内今日创建的客群数',
           },
           {
-            title: "【客群成员总数】",
-            content: "当前员工权限范围内客群成员的总数(含员工)",
+            title: '【客群成员总数】',
+            content: '当前员工权限范围内客群成员的总数(含员工)',
           },
           {
-            title: "【今日新增成员】",
-            content: "当前员工权限范围内今日新增客群成员数(含成员)",
+            title: '【今日新增成员】',
+            content: '当前员工权限范围内今日新增客群成员数(含成员)',
           },
           {
-            title: "【今日退出成员】",
-            content: "当前员工数权限范围内今日退出客群成员数(含员工)",
+            title: '【今日退出成员】',
+            content: '当前员工数权限范围内今日退出客群成员数(含员工)',
           },
         ],
-      ];
-      this.questionData = questionList[i];
-      this.questionShow = true;
+      ]
+      this.questionData = questionList[i]
+      this.questionShow = true
     },
     popupClose() {
-      this.questionShow = false;
+      this.questionShow = false
     },
     // 查看全部
     searchAll() {
       this.$router.push({
-        name: "dynamics",
+        name: 'dynamics',
         query: {
           dataScope: this.dynamicsFrom.dataScope,
         },
-      });
+      })
     },
     // 获取客户分析数据
     getCustomerData() {
       getCustomerAnalysisData(this.customerForm).then((res) => {
         if (res.code === 200) {
-          this.customerOutForm = res.data;
+          this.customerOutForm = res.data
         }
-        this.isLoad = false;
-      });
+        this.isLoad = false
+      })
     },
     // 获取客群分析数据
     getGroupData() {
       getGroupAnalysisData(this.customerForm).then((res) => {
         if (res.code === 200) {
-          this.groupOutForm = res.data;
+          this.groupOutForm = res.data
         }
-        this.isLoad = false;
-      });
+        this.isLoad = false
+      })
     },
     // 获取企业轨迹
     getDynamicsData() {
       getCompanyDynamicsData(this.dynamicsFrom).then((res) => {
         if (res.code === 200) {
-          this.dynamicsOutList = res.rows;
+          this.dynamicsOutList = res.rows
           // this.dynamicsOutList = [
           //   {
           //     operatorType: 1,
@@ -420,28 +382,24 @@ export default {
             // let content = "客户:张三 推出群聊:优惠卷群";
             // item.contentList = this.dellString();
             item.operatoredObjectType =
-              item.operatoredObjectType === 1
-                ? "客户"
-                : item.operatoredObjectType === 2
-                ? "员工"
-                : "客群";
-          });
+              item.operatoredObjectType === 1 ? '客户' : item.operatoredObjectType === 2 ? '员工' : '客群'
+          })
         }
-      });
+      })
     },
 
     // 添加千分位符
     setThousandsMark(num) {
       if (num) {
-        num = num + "";
-        let reg = /(?!^)(?=(\d{3})+$)/g;
-        return num.replace(reg, ",");
+        num = num + ''
+        let reg = /(?!^)(?=(\d{3})+$)/g
+        return num.replace(reg, ',')
       } else {
-        return 0;
+        return 0
       }
     },
   },
-};
+}
 </script>
 
 <style lang="less" scoped>
@@ -486,11 +444,7 @@ export default {
         position: absolute;
         top: 0;
         left: 0;
-        background: linear-gradient(
-          360deg,
-          rgba(0, 121, 222, 0) 0%,
-          rgba(0, 121, 222, 0.8) 100%
-        );
+        background: linear-gradient(360deg, rgba(0, 121, 222, 0) 0%, rgba(0, 121, 222, 0.8) 100%);
         opacity: 0.16;
         filter: blur(10px);
       }
@@ -500,11 +454,7 @@ export default {
         position: absolute;
         bottom: 0;
         right: 0;
-        background: linear-gradient(
-          293deg,
-          #e8f3fc 0%,
-          rgba(232, 243, 252, 0) 100%
-        );
+        background: linear-gradient(293deg, #e8f3fc 0%, rgba(232, 243, 252, 0) 100%);
         opacity: 0.7;
         filter: blur(41px);
       }
@@ -645,11 +595,7 @@ export default {
       align-items: center;
       height: 45px;
       padding: 10px 17px;
-      background: linear-gradient(
-        60deg,
-        rgba(0, 214, 149, 0.3) 0%,
-        rgba(255, 255, 255, 0.3) 180%
-      );
+      background: linear-gradient(60deg, rgba(0, 214, 149, 0.3) 0%, rgba(255, 255, 255, 0.3) 180%);
 
       span:nth-child(1) {
         display: block;
@@ -714,11 +660,7 @@ export default {
   }
   .index-card-item:nth-child(2) {
     .card-title {
-      background: linear-gradient(
-        60deg,
-        rgba(250, 114, 22, 0.3),
-        rgba(255, 255, 255, 0.3) 180%
-      );
+      background: linear-gradient(60deg, rgba(250, 114, 22, 0.3), rgba(255, 255, 255, 0.3) 180%);
       span:nth-child(1) {
         background: #fa7216 !important;
       }
@@ -727,11 +669,7 @@ export default {
   //  第三个card
   .dynamics {
     .card-title {
-      background: linear-gradient(
-        60deg,
-        rgba(0, 121, 222, 0.3),
-        rgba(255, 255, 255, 0.3) 180%
-      );
+      background: linear-gradient(60deg, rgba(0, 121, 222, 0.3), rgba(255, 255, 255, 0.3) 180%);
       span:nth-child(1) {
         background: #0079de;
       }

+ 12 - 10
src/views/portrait/index.vue

@@ -213,8 +213,8 @@
     </div>
 
     <!-- 按钮  -->
-    <div class="cancat-btn">
-      <van-button v-if="isQueryExternalUserId" style="width: 90%;" type="info" round @click="concat">
+    <div class="cancat-btn" v-if="isMyCustomer">
+      <van-button v-if="$route.query && $route.query.id" style="width: 90%;" type="info" round @click="concat">
         联系客户
       </van-button>
       <template v-else>
@@ -543,7 +543,7 @@ export default {
       editLabelType: '', // 编辑标签类型
       showAddTag: false,
       newPersonTag: '',
-      isQueryExternalUserId: false,
+      isMyCustomer: false,
 
       detailshow: false,
 
@@ -559,19 +559,21 @@ export default {
   },
   computed: {
     userId() {
-      return process.env.NODE_ENV !== 'development' ? this.$store.state.userId : 'XuXueJun'
+      // return process.env.NODE_ENV !== 'development' ? this.$store.state.userId : 'XuXueJun'
+      return process.env.NODE_ENV !== 'development' ? this.$route.query?.userId || this.$store.state.userId : 'XuXueJun'
     },
   },
   created() {
     this.getOrderList()
     let query = this.$route.query
-    this.externalUserId =
-      process.env.NODE_ENV !== 'development' ? query && query.id : 'wmbhUTLgAA6ByLnY45U-uiC4ccoMvwng' // 风居住的街道
+    this.externalUserId = process.env.NODE_ENV !== 'development' ? query?.id : 'wmbhUTLgAA6ByLnY45U-uiC4ccoMvwng' // 风居住的街道
+    // this.externalUserId = process.env.NODE_ENV !== 'development' ? query && query.id : 'wmbhUTLgAA6ByLnY45U-uiC4ccoMvwng' // 风居住的街道
 
-    this.isQueryExternalUserId = !!this.externalUserId
+
+    this.isMyCustomer = this.userId == this.$store.state.userId
     if (process.env.NODE_ENV === 'production') {
       this.$toast.loading()
-      if (this.isQueryExternalUserId) {
+      if (this.externalUserId) {
         this.start()
         this.$toast.clear()
       } else {
@@ -615,7 +617,7 @@ export default {
     getOrderList() {
       this.orderLoading = true
       this.finished = false
-      this.orderObj.userId = sessionStorage.getItem('userId')
+      this.orderObj.userId = this.userId
       this.orderObj.externalUserid = this.externalUserId
       getOrderList(this.orderObj).then((res) => {
         res.rows.forEach((item) => {
@@ -639,7 +641,7 @@ export default {
       this.getCustomerInfo()
       this.findAddaddEmployes()
       this.findAddGroupNum()
-      this.refreshTrajectory()
+      // this.refreshTrajectory()
       this.getField()
       this.getStage()
     },

+ 6 - 2
src/views/reminder/index.vue

@@ -88,7 +88,7 @@ export default {
         .then(({ openId, unionId, avatar }) => {
           this.query.openid = openId
           this.interLive()
-          let _that = this
+          let _this = this
           this.loading = true
           getWxTicket(window.location.href.split('#')[0]).then((res) => {
             if (res.code === 200) {
@@ -96,10 +96,14 @@ export default {
               wx.ready(function() {
                 // config信息验证后会执行 ready 方法,所有接口调用都必须在 config 接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在 ready 函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在 ready 函数中
                 // alert('成功')
+                console.log('成功')
               })
               wx.error(function(res) {
                 // config信息验证失败会执行 error 函数,如签名过期导致验证失败,具体错误信息可以打开 config 的debug模式查看,也可以在返回的 res 参数中查看,对于 SPA 可以在这里更新签名
-                _that.loading = false
+                _this.loading = false
+                _this.$toast.clear()
+                //错误处理
+                _this.$dialog({ message: 'config失败' + JSON.stringify(res) })
                 // alert('config失败:' + JSON.stringify(res))
                 // if (res.errMsg.indexOf('function not exist') > -1) {
                 //   alert('版本过低请升级')

+ 208 - 201
src/views/storeCode/code.vue

@@ -35,7 +35,8 @@
         长按识别二维码添加添加门店群
       </div>
       <div class="tip" style="margin-top: 20px; font-size: 16px;">
-        <van-icon name="location-o" /> {{ currentItem.address }}
+        <van-icon name="location-o" />
+        {{ currentItem.address }}
       </div>
     </template>
 
@@ -55,7 +56,7 @@
         :options="addressOptions"
         :field-names="{
           text: 'name',
-          value: 'name'
+          value: 'name',
         }"
         @close="addressShow = false"
         @finish="selectedArea"
@@ -64,220 +65,226 @@
   </div>
 </template>
 <script>
-  import { getWxCode, getQueryValue, baiduMapError, splitName } from '@/utils/index'
-  import { getAreaList, getWxTicket } from '@/api/common'
-  import { getCodeInStore, getCodeBase, recordCode } from '@/api/groupCode'
-  export default {
-    name: 'store-group-code',
-    data() {
-      return {
-        loading: false,
+import { getWxCode, getQueryValue, baiduMapError, splitName } from '@/utils/index'
+import { getAreaList, getWxTicket } from '@/api/common'
+import { getCodeInStore, getCodeBase } from '@/api/groupCode'
+export default {
+  name: 'store-group-code',
+  data() {
+    return {
+      loading: false,
+      area: '',
+      userInfo: {},
+      tenantId: '',
+      addressOptions: [],
+      addressShow: false,
+      welcomeMsg: '',
+      form: {
         area: '',
-        userInfo: {},
-        tenantId: '',
-        addressOptions: [],
-        addressShow: false,
-        welcomeMsg: '',
-        form: {
-          area: '',
-          areaId: '',
-          latitude: '',
-          longitude: ''
-        },
-        showPicker: false,
-        columns: [],
-        value: '',
-        data: {
-          outOfRangeTip: '',
-          codeState: 1,
-          customerServiceUrl: ''
-        },
-        currentItem: {
-          storeName: '',
-          address: ''
-        },
-        showTip: false,
-        query: {
-          currentLat: '',
-          currentLng: '',
-          storeCodeId: '',
-          unionid: '',
-          source: 2,
-          tenantId: ''
-        }
-      }
-    },
-    methods: {
-      setStart() {
-        this.timer = setTimeout(() => {
-          this.query.storeCodeId = this.currentItem.id
-          this.query.unionid = this.userInfo.unionId
-          this.query.tenantId = sessionStorage.getItem('tenantId')
-          recordCode(this.query)
-        }, 500)
-      },
-      setEnd() {
-        clearTimeout(this.timer)
+        areaId: '',
+        latitude: '',
+        longitude: '',
       },
-      selectedArea({ selectedOptions }) {
-        this.addressShow = false
-        delete this.form.latitude
-        delete this.form.longitude
-        this.form.area = selectedOptions.map((option) => option.name).join('')
-        this.getStoreList()
+      showPicker: false,
+      columns: [],
+      value: '',
+      data: {
+        outOfRangeTip: '',
+        codeState: 1,
+        customerServiceUrl: '',
       },
-      getAreaList() {
-        getAreaList().then(({ data }) => {
-          this.addressOptions = data
-        })
+      currentItem: {
+        storeName: '',
+        address: '',
       },
-      onConfirm(data, index) {
-        if (data) {
-          this.currentItem = data
-        }
-        this.showPicker = false
+      showTip: false,
+      query: {
+        currentLat: '',
+        currentLng: '',
+        storeCodeId: '',
+        unionid: '',
+        source: 2,
+        tenantId: '',
       },
-      getStoreList(type) {
-        this.loading = true
-        getCodeInStore({
-          storeCodeType: 2,
-          unionid: this.userInfo.unionId,
-          longitude: this.form.longitude,
-          latitude: this.form.latitude,
-          area: this.form.area,
-          tenantId: sessionStorage.getItem('tenantId')
-        }).then((res) => {
-          if (res.code === 200) {
-            this.welcomeMsg = res.data.welcomeMsg
-            this.columns = res.data.weStoreCodes
-            if (!this.columns || this.columns.length === 0) {
-              this.currentItem = {
-                storeName: '',
-                address: ''
+    }
+  },
+  methods: {
+    setStart() {
+      this.timer = setTimeout(() => {
+        this.query.storeCodeId = this.currentItem.id
+        this.query.unionid = this.userInfo.unionId
+        this.query.tenantId = sessionStorage.getItem('tenantId')
+        // recordCode(this.query)
+      }, 500)
+    },
+    setEnd() {
+      clearTimeout(this.timer)
+    },
+    selectedArea({ selectedOptions }) {
+      this.addressShow = false
+      delete this.form.latitude
+      delete this.form.longitude
+      this.form.area = selectedOptions.map((option) => option.name).join('')
+      this.getStoreList()
+    },
+    getAreaList() {
+      getAreaList().then(({ data }) => {
+        this.addressOptions = data
+      })
+    },
+    onConfirm(data, index) {
+      if (data) {
+        this.currentItem = data
+      }
+      this.showPicker = false
+    },
+    getStoreList(type) {
+      this.loading = true
+      getCodeInStore({
+        storeCodeType: 2,
+        unionid: this.userInfo.unionId,
+        longitude: this.form.longitude,
+        latitude: this.form.latitude,
+        area: this.form.area,
+        tenantId: sessionStorage.getItem('tenantId'),
+      }).then((res) => {
+        if (res.code === 200) {
+          this.welcomeMsg = res.data.welcomeMsg
+          this.columns = res.data.weStoreCodes
+          if (!this.columns || this.columns.length === 0) {
+            this.currentItem = {
+              storeName: '',
+              address: '',
+            }
+            this.getNullFn()
+          } else {
+            if (type) {
+              this.currentItem = this.columns[0]
+              this.form.area = this.currentItem.area
+              let arr = splitName(this.currentItem.area)
+              if (arr[2]) {
+                this.area = [2]
               }
-              this.getNullFn()
             } else {
-              if (type) {
-                this.currentItem = this.columns[0]
-                this.form.area = this.currentItem.area
-                let arr = splitName(this.currentItem.area)
-                if (arr[2]) {
-                  this.area = [2]
-                }
-              } else {
-                this.currentItem = this.columns[0]
-              }
+              this.currentItem = this.columns[0]
             }
           }
-          this.loading = false
-        })
-      },
-      getNullFn() {
-        getCodeBase({ storeCodeType: 2, tenantId: sessionStorage.getItem('tenantId') }).then((res) => {
-          if (res.code === 200 && res.data) {
-            this.data = res.data
-          }
-        })
-      },
-      back() {
-        document.addEventListener(
-          'WeixinJSBridgeReady',
-          function () {
-            WeixinJSBridge.call('closeWindow')
-          },
-          false
-        )
-        WeixinJSBridge.call('closeWindow')
-      }
+        }
+        this.loading = false
+      })
     },
-    async mounted() {
-      await getWxCode()
-      if (getQueryValue('code') && getQueryValue('state')) {
-        this.userInfo = JSON.parse(sessionStorage.getItem('userinfo'))
-        this.getAreaList()
-        let _that = this
-        this.loading = true
-        getWxTicket(window.location.href.split('#')[0]).then((res) => {
-          if (res.code === 200) {
-            let { timestamp, nonceStr, signature } = res.data
-            wx.config({
-              beta: true,
-              // debug: true,
-              appId: sessionStorage.getItem('weAppId'),
-              timestamp, // 必填,生成签名的时间戳
-              nonceStr, // 必填,生成签名的随机串
-              signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-              jsApiList: ['getLocation'], //必填
-              success: function (res) {},
-              fail: (res) => {
-                _that.loading = false
-                alert('config失败:' + JSON.stringify(res))
-                if (res.errMsg.indexOf('function not exist') > -1) {
-                  alert('版本过低请升级')
-                }
+    getNullFn() {
+      getCodeBase({
+        storeCodeType: 2,
+        unionid: this.userInfo.unionId,
+        longitude: this.form.longitude,
+        latitude: this.form.latitude,
+        area: this.form.area,
+      }).then((res) => {
+        if (res.code === 200 && res.data) {
+          this.data = res.data
+        }
+      })
+    },
+    back() {
+      document.addEventListener(
+        'WeixinJSBridgeReady',
+        function() {
+          WeixinJSBridge.call('closeWindow')
+        },
+        false,
+      )
+      WeixinJSBridge.call('closeWindow')
+    },
+  },
+  async mounted() {
+    await getWxCode()
+    if (getQueryValue('code') && getQueryValue('state')) {
+      this.userInfo = JSON.parse(sessionStorage.getItem('userinfo'))
+      this.getAreaList()
+      let _that = this
+      this.loading = true
+      getWxTicket(window.location.href.split('#')[0]).then((res) => {
+        if (res.code === 200) {
+          let { timestamp, nonceStr, signature } = res.data
+          wx.config({
+            beta: true,
+            // debug: true,
+            appId: sessionStorage.getItem('weAppId'),
+            timestamp, // 必填,生成签名的时间戳
+            nonceStr, // 必填,生成签名的随机串
+            signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+            jsApiList: ['getLocation'], //必填
+            success: function(res) {},
+            fail: (res) => {
+              _that.loading = false
+              alert('config失败:' + JSON.stringify(res))
+              if (res.errMsg.indexOf('function not exist') > -1) {
+                alert('版本过低请升级')
               }
+            },
+          })
+          wx.ready(function() {
+            wx.getLocation({
+              type: 'wgs84', //默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
+              success: function(dd) {
+                _that.form.latitude = dd.latitude
+                _that.form.longitude = dd.longitude
+                _that.query.currentLat = dd.latitude
+                _that.query.currentLng = dd.longitude
+                _that.getStoreList('init')
+              },
+              fail: function(ff) {
+                alert('获取定位位置信息失败')
+                _that.loading = false
+                _that.back()
+              },
+              cancel: function(ff) {
+                _that.back()
+              },
             })
-            wx.ready(function () {
-              wx.getLocation({
-                type: 'wgs84', //默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
-                success: function (dd) {
-                  _that.form.latitude = dd.latitude
-                  _that.form.longitude = dd.longitude
-                  _that.query.currentLat = dd.latitude
-                  _that.query.currentLng = dd.longitude
-                  _that.getStoreList('init')
-                },
-                fail: function (ff) {
-                  alert('获取定位位置信息失败')
-                  _that.loading = false
-                  _that.back()
-                },
-                cancel: function (ff) {
-                  _that.back()
-                }
-              })
-            })
-          }
-        })
-      }
-      // else {
-      //   if (getQueryValue('state')) {
-      //     this.back()
-      //   }
-      // }
-    },
-    created() {
-      this.tenantId = this.$route.query.tenantId
-      sessionStorage.setItem('tenantId', this.tenantId)
+          })
+        }
+      })
     }
-  }
+    // else {
+    //   if (getQueryValue('state')) {
+    //     this.back()
+    //   }
+    // }
+  },
+  created() {
+    this.tenantId = this.$route.query.tenantId
+    sessionStorage.setItem('tenantId', this.tenantId)
+  },
+}
 </script>
 <style lang="less" scoped>
-  .bg {
-    background: linear-gradient(180deg, #eaf5ff 0%, rgba(253, 253, 253, 0) 100%);
-    border-radius: 0px 0px 0px 0px;
-  }
-  .tip {
-    padding: 0 20px;
-    font-size: 12px;
-    margin-top: 30px;
-    text-align: center;
-  }
-  .code_content {
-    margin-top: 10px;
-    text-align: center;
-    .code_img {
-      height: 180px;
-      width: 180px;
-      margin: 10px auto;
-    }
+.bg {
+  background: linear-gradient(180deg, #eaf5ff 0%, rgba(253, 253, 253, 0) 100%);
+  border-radius: 0px 0px 0px 0px;
+}
+.tip {
+  padding: 0 20px;
+  font-size: 12px;
+  margin-top: 30px;
+  text-align: center;
+}
+.code_content {
+  margin-top: 10px;
+  text-align: center;
+  .code_img {
+    height: 180px;
+    width: 180px;
+    margin: 10px auto;
   }
+}
 
-  .sub-des {
-    text-align: center;
-    font-size: 12px;
-    font-family: PingFangSC-Regular, PingFang SC;
-    font-weight: 400;
-    color: #999999;
-  }
+.sub-des {
+  text-align: center;
+  font-size: 12px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #999999;
+}
 </style>

+ 9 - 3
src/views/storeCode/index.vue

@@ -64,7 +64,7 @@
 <script>
 import { getWxCode, getQueryValue, baiduMapError, splitName } from '@/utils/index'
 import { getAreaList, getWxTicket } from '@/api/common'
-import { getCodeInStore, getCodeBase, recordCode } from '@/api/groupCode'
+import { getCodeInStore, getCodeBase } from '@/api/groupCode'
 export default {
   name: 'store-guide-code',
   data() {
@@ -110,7 +110,7 @@ export default {
         this.query.storeCodeId = this.currentItem.id
         this.query.unionid = this.userInfo.unionId
         this.query.tenantId = sessionStorage.getItem('tenantId')
-        recordCode(this.query)
+        // recordCode(this.query)
       }, 500)
     },
     setEnd() {
@@ -169,7 +169,13 @@ export default {
       })
     },
     getNullFn() {
-      getCodeBase({ storeCodeType: 1, tenantId: sessionStorage.getItem('tenantId') }).then((res) => {
+      getCodeBase({
+        storeCodeType: 1,
+        unionid: this.userInfo.unionId,
+        longitude: this.form.longitude,
+        latitude: this.form.latitude,
+        area: this.form.area,
+      }).then((res) => {
         if (res.code === 200 && res.data) {
           this.data = res.data
         }

+ 249 - 247
src/views/task/process.vue

@@ -1,65 +1,68 @@
 <script>
-  import { getDetailFissionProgress } from '@/api/task'
-  export default {
-    name: '',
-    components: {},
-    data() {
-      return {
-        dialog: false,
-        poster: '',
-        completeNum: 0,
-        form: {
-          exchangeTip: 0, //兑奖条件(N人)
-          weFissionInviterRecordSubList: [], //邀请记录
-          exchangeContent: {
-            //任务奖励,为空,则任务未完成
-            redemptionLink: '', //兑奖链接
-            redemptionRule: '', //兑奖规则
-            weUserId: '', //兑奖客服员工id
-            customerServiceCodeUrl: '' //兑奖客服员工活码(非微信客服,当前指代员工活码)
-          }
-        }
+import { getDetailFissionProgress } from '@/api/task'
+export default {
+  name: '',
+  components: {},
+  data() {
+    return {
+      dialog: false,
+      poster: '',
+      completeNum: 0,
+      form: {
+        exchangeTip: 0, //兑奖条件(N人)
+        weFissionInviterRecordSubList: [], //邀请记录
+        exchangeContent: {
+          //任务奖励,为空,则任务未完成
+          redemptionLink: '', //兑奖链接
+          redemptionRule: '', //兑奖规则
+          weUserId: '', //兑奖客服员工id
+          customerServiceCodeUrl: '', //兑奖客服员工活码(非微信客服,当前指代员工活码)
+        },
+      },
+    }
+  },
+  computed: {},
+  watch: {},
+  mounted() {
+    this.$toast.loading()
+    let query = this.$route.query
+    this.poster = query.poster
+    getDetailFissionProgress(query)
+      .then(({ data }) => {
+        this.form = data
+        this.completeNum = Number(this.form.exchangeTip) - this.form.weFissionInviterRecordSubList.length
+        this.$forceUpdate()
+        this.$toast.clear()
+      })
+      .catch(() => {
+        this.$toast.clear()
+      })
+  },
+  created() {},
+  methods: {
+    gotoNext() {
+      if (this.form.exchangeTip <= this.form.weFissionInviterRecordSubList.length) {
+        this.dialog = true
       }
     },
-    computed: {},
-    watch: {},
-    mounted() {
-      this.$toast.loading()
-      let query = this.$route.query
-      this.poster = query.poster
-      getDetailFissionProgress(query)
-        .then(({ data }) => {
-          this.form = data
-          this.completeNum = Number(this.form.exchangeTip) - this.form.weFissionInviterRecordSubList.length
-          this.$forceUpdate()
-          this.$toast.clear()
-        })
-        .catch(() => {
-          this.$toast.clear()
-        })
-    },
-    created() {},
-    methods: {
-      gotoNext() {
-        if (this.form.exchangeTip <= this.form.weFissionInviterRecordSubList.length) {
-          this.dialog = true
-        }
-      },
-      getLink() {
-        if (this.form.exchangeContent.redemptionLink) {
-          window.location.href = this.form.exchangeContent.redemptionLink
-        }
+    getLink() {
+      if (this.form.exchangeContent.redemptionLink) {
+        window.location.href = this.form.exchangeContent.redemptionLink
       }
-    }
-  }
+    },
+  },
+}
 </script>
 
 <template>
   <div class="content">
     <img class="bg" src="../../assets/vite.svg" alt="" />
     <div class="top">
-      已邀请 <span class="num">{{ form.weFissionInviterRecordSubList.length }}</span> 人,还差
-      <span class="num">{{ completeNum < 0 ? 0 : completeNum }}</span> 人,即可领奖
+      已邀请
+      <span class="num">{{ form.weFissionInviterRecordSubList.length }}</span>
+      人,还差
+      <span class="num">{{ completeNum < 0 ? 0 : completeNum }}</span>
+      人,即可领奖
     </div>
     <div class="poster">
       <img class="poster_img" :src="poster" alt="" />
@@ -67,7 +70,7 @@
         class="button"
         :class="{
           disable: form.exchangeTip > form.weFissionInviterRecordSubList.length ? true : false,
-          active: form.exchangeTip <= form.weFissionInviterRecordSubList.length ? true : false
+          active: form.exchangeTip <= form.weFissionInviterRecordSubList.length ? true : false,
         }"
         @click="gotoNext()"
       >
@@ -120,29 +123,80 @@
 </template>
 
 <style lang="less" scoped>
-  .des {
-    margin-top: 16px;
-    font-size: 16px;
-    font-weight: 700;
-    color: #1d2129;
-  }
-  .dialog_title {
-    margin-top: 21px;
-    font-size: 16px;
-    font-weight: 600;
-    color: #222222;
-    text-align: center;
+.des {
+  margin-top: 16px;
+  font-size: 16px;
+  font-weight: 700;
+  color: #1d2129;
+}
+.dialog_title {
+  margin-top: 21px;
+  font-size: 16px;
+  font-weight: 600;
+  color: #222222;
+  text-align: center;
+}
+.dialog_content {
+  margin-bottom: 75px;
+  max-height: 280px;
+  overflow-y: scroll;
+  padding: 16px;
+}
+.dialog_bottom {
+  background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
+  position: absolute;
+  bottom: 24px;
+  left: 50%;
+  transform: translateX(-50%);
+  width: 246px;
+  height: 48px;
+  line-height: 48px;
+  border-radius: 16px 16px 16px 16px;
+  font-size: 18px;
+  text-align: center;
+  color: #fff;
+}
+.page {
+  background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
+}
+.content {
+  padding: 16px;
+}
+.bg {
+  position: fixed;
+  right: 0;
+  top: 0;
+}
+.top {
+  text-align: center;
+  margin-top: 24px;
+  font-size: 20px;
+  font-family: Alimama ShuHeiTi-Bold, Alimama ShuHeiTi;
+  font-weight: 700;
+  color: #ffffff;
+  line-height: 25px;
+  text-shadow: 0px 4px 16px rgba(0, 153, 73, 0.8);
+  .num {
+    color: #fdf100;
+    font-size: 32px;
   }
-  .dialog_content {
-    margin-bottom: 75px;
-    max-height: 280px;
-    overflow-y: scroll;
-    padding: 16px;
+}
+.poster {
+  position: relative;
+  margin-top: 24px;
+  height: 180px;
+  background: #fff;
+  border-radius: 16px 16px 16px 16px;
+  padding: 2px;
+  overflow: hidden;
+  .poster_img {
+    width: 100%;
+    border-radius: 16px;
+    object-fit: cover;
+    height: 100%;
   }
-  .dialog_bottom {
-    background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
-    position: absolute;
-    bottom: 24px;
+  .button {
+    margin-top: 15px;
     left: 50%;
     transform: translateX(-50%);
     width: 246px;
@@ -153,193 +207,141 @@
     text-align: center;
     color: #fff;
   }
-  .page {
-    background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
-  }
-  .content {
-    padding: 16px;
+  .disable {
+    background: #cccccc;
   }
-  .bg {
-    position: fixed;
-    right: 0;
-    top: 0;
+  .active {
+    background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
   }
-  .top {
-    text-align: center;
-    margin-top: 24px;
-    font-size: 20px;
-    font-family: Alimama ShuHeiTi-Bold, Alimama ShuHeiTi;
+}
+.record {
+  margin-top: 16px;
+  padding: 16px;
+  background: #fff;
+  border-radius: 16px 16px 16px 16px;
+  .title {
+    font-size: 17px;
     font-weight: 700;
-    color: #ffffff;
-    line-height: 25px;
-    text-shadow: 0px 4px 16px rgba(0, 153, 73, 0.8);
-    .num {
-      color: #fdf100;
-      font-size: 32px;
-    }
-  }
-  .poster {
-    position: relative;
-    margin-top: 24px;
-    height: 180px;
-    background: #fff;
-    border-radius: 16px 16px 16px 16px;
-    padding: 2px;
-    overflow: hidden;
-    .poster_img {
-      width: 100%;
-      border-radius: 16px;
-      object-fit: cover;
-      height: 100%;
-    }
-    .button {
-      position: absolute;
-      bottom: 24px;
-      left: 50%;
-      transform: translateX(-50%);
-      width: 246px;
-      height: 48px;
-      line-height: 48px;
-      border-radius: 16px 16px 16px 16px;
-      font-size: 18px;
-      text-align: center;
-      color: #fff;
-    }
-    .disable {
-      background: #cccccc;
-    }
-    .active {
-      background: linear-gradient(90deg, #07c160 0%, #90de45 99%);
-    }
+    color: #1d2129;
   }
-  .record {
-    margin-top: 16px;
-    padding: 16px;
-    background: #fff;
-    border-radius: 16px 16px 16px 16px;
-    .title {
-      font-size: 17px;
-      font-weight: 700;
-      color: #1d2129;
-    }
-    .list {
-      margin-top: 8px;
-      text-align: center;
-      .list_item {
-        padding: 16px 0;
-        display: flex;
-        align-items: center;
-        .avator {
-          width: 48px;
-          height: 48px;
-          border-radius: 16px 16px 16px 16px;
-        }
-        .name {
-          font-size: 16px;
-          font-weight: 500;
-          color: #1d2129;
-          margin-left: 8px;
-        }
-        .time {
-          margin-left: auto;
-          font-size: 14px;
-          font-weight: 400;
-          color: #86909c;
-        }
-        &:not(:last-child) {
-          border-bottom: 1px solid #e5e6eb;
-        }
+  .list {
+    margin-top: 8px;
+    text-align: center;
+    .list_item {
+      padding: 16px 0;
+      display: flex;
+      align-items: center;
+      .avator {
+        width: 48px;
+        height: 48px;
+        border-radius: 16px 16px 16px 16px;
+      }
+      .name {
+        font-size: 16px;
+        font-weight: 500;
+        color: #1d2129;
+        margin-left: 8px;
+      }
+      .time {
+        margin-left: auto;
+        font-size: 14px;
+        font-weight: 400;
+        color: #86909c;
+      }
+      &:not(:last-child) {
+        border-bottom: 1px solid #e5e6eb;
       }
     }
   }
+}
 
-  .generalFont {
-    color: #909399;
-    font-size: 12px;
-    padding: 0 18px;
-    padding-bottom: 8px;
-  }
-  .container > .generalFont {
-    background-color: #fff;
+.generalFont {
+  color: #909399;
+  font-size: 12px;
+  padding: 0 18px;
+  padding-bottom: 8px;
+}
+.container > .generalFont {
+  background-color: #fff;
+}
+
+.listMsg {
+  display: flex;
+  align-items: center;
+  margin: 20px 0;
+}
+.listMsg .generalFont {
+  flex: none;
+  width: 56px;
+  margin-right: 30px;
+  text-align: right;
+}
+.codeDetail {
+  font-size: 12px;
+  color: #333;
+  word-break: break-all;
+  overflow: hidden;
+}
+.generalContent {
+  position: relative;
+  background-color: rgb(246, 246, 249);
+  margin-bottom: 15px;
+  border: 18px solid #fff;
+  border-top: 0;
+  padding: 0 8px;
+  overflow: auto;
+  .tip {
+    background: rgba(69, 63, 63, 81%);
+    padding: 6px;
+    border-radius: 5px;
+    color: #fff;
+    white-space: nowrap;
   }
+}
+.codeImg {
+  height: 50px;
+}
+.customersList {
+  display: flex;
+  align-items: center;
+  font-size: 15px;
+  background-color: rgb(246, 246, 249);
+  padding: 8px;
 
-  .listMsg {
-    display: flex;
-    align-items: center;
-    margin: 20px 0;
+  .customersImg {
+    height: 37px;
+    border-radius: 50%;
+    margin-right: 8px;
   }
-  .listMsg .generalFont {
-    flex: none;
-    width: 56px;
-    margin-right: 30px;
-    text-align: right;
+  .name {
+    font-size: 13px;
+    font-weight: 500;
+    margin-right: 8px;
   }
-  .codeDetail {
+  .time {
+    color: #909399;
     font-size: 12px;
-    color: #333;
-    word-break: break-all;
-    overflow: hidden;
-  }
-  .generalContent {
-    position: relative;
-    background-color: rgb(246, 246, 249);
-    margin-bottom: 15px;
-    border: 18px solid #fff;
-    border-top: 0;
-    padding: 0 8px;
-    overflow: auto;
-    .tip {
-      background: rgba(69, 63, 63, 81%);
-      padding: 6px;
-      border-radius: 5px;
-      color: #fff;
-      white-space: nowrap;
-    }
-  }
-  .codeImg {
-    height: 50px;
   }
-  .customersList {
-    display: flex;
-    align-items: center;
-    font-size: 15px;
-    background-color: rgb(246, 246, 249);
-    padding: 8px;
-
-    .customersImg {
-      height: 37px;
-      border-radius: 50%;
-      margin-right: 8px;
-    }
-    .name {
-      font-size: 13px;
-      font-weight: 500;
-      margin-right: 8px;
-    }
-    .time {
-      color: #909399;
-      font-size: 12px;
-    }
-    .customersSuccess {
-      flex: 1;
-      font-size: 13px;
-      text-align: right;
-      color: #06c160;
-    }
-  }
-  .customersBox {
-    padding: 18px;
-    background-color: #fff;
+  .customersSuccess {
+    flex: 1;
+    font-size: 13px;
+    text-align: right;
+    color: #06c160;
   }
+}
+.customersBox {
+  padding: 18px;
+  background-color: #fff;
+}
 
-  .activityPoster {
-    padding: 18px;
-    font-size: 18px;
-    background-color: #fff;
-    margin-top: 18px;
-  }
-  .activityPosterImg {
-    width: 100%;
-    margin-top: 18px;
-  }
+.activityPoster {
+  padding: 18px;
+  font-size: 18px;
+  background-color: #fff;
+  margin-top: 18px;
+}
+.activityPosterImg {
+  width: 100%;
+  margin-top: 18px;
+}
 </style>

+ 15 - 6
vue.config.js

@@ -48,7 +48,7 @@ let pages = {
 }
 let setting = {
   publicPath: env.BASE_URL || '/',
-  outputDir: 'h5', // 打包名称
+  outputDir: 'dist', // 打包名称
   // 打包时不生成.map文件
   productionSourceMap: false,
   pages,
@@ -167,18 +167,27 @@ let setting = {
 
       config.optimization.splitChunks({
         chunks: 'all',
+        // minSize: 60 * 1024,
+        // maxSize: 1024 * 1024,
         cacheGroups: {
+          alioss: {
+            name: 'chunk-ali-oss', // split vant into a single package
+            priority: 30, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+            test: /[\\/]node_modules[\\/]_?ali-oss(.*)/, // in order to adapt to cnpm
+          },
+          vant: {
+            name: 'chunk-vant', // split vant into a single package
+            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+            test: /[\\/]node_modules[\\/]_?vant(.*)/, // in order to adapt to cnpm
+          },
           libs: {
             name: 'chunk-libs',
             test: /[\\/]node_modules[\\/]/,
             priority: 10,
             chunks: 'initial', // only package third parties that are initially dependent
+            enforce: true,
           },
-          elementUI: {
-            name: 'chunk-vant', // split vant into a single package
-            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-            test: /[\\/]node_modules[\\/]_?vant(.*)/, // in order to adapt to cnpm
-          },
+
           // commons: {
           //   name: 'chunk-commons',
           //   test: resolve('src/components'), // can customize your rules

Some files were not shown because too many files changed in this diff