提交 a837f7e3 编写于 作者: huangwensu's avatar huangwensu

联调绑定居民微信

上级 ca07c0d9
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
<script> <script>
// asyncData fetch 在组件中无效 // asyncData fetch 在组件中无效
import { getNewActivityDesc } from '@/service'; import { getNewActivityDesc } from '@/service';
const cookies = require('cookie-universal')(); // const cookies = require('cookie-universal')();
import { setCookie, getCookie, delCookie } from '@/utils/index';
export default { export default {
name: 'TaskActivity', name: 'TaskActivity',
props: { props: {
...@@ -120,7 +121,7 @@ export default { ...@@ -120,7 +121,7 @@ export default {
if(self.isWeb) { if(self.isWeb) {
req = { req = {
id: acTempId, id: acTempId,
token: cookies.get('token') || '2B7FA4D845C74D7EA3183F9E316630C6' token: getCookie('token') || '2B7FA4D845C74D7EA3183F9E316630C6'
} }
}else { }else {
req = { req = {
...@@ -144,6 +145,9 @@ export default { ...@@ -144,6 +145,9 @@ export default {
if(this.taskList[i].resourceType == 7 && this.taskList[i].resourceId == 1) { if(this.taskList[i].resourceType == 7 && this.taskList[i].resourceId == 1) {
this.$emit('getTaskId',{taskId: this.taskList[i].id}); this.$emit('getTaskId',{taskId: this.taskList[i].id});
} }
if(this.taskList[i].resourceType == 10 && this.userMobile) {
this.$emit('firstEnterActivity',{taskId: this.taskList[i].id});
}
} }
} }
}) })
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
:userMobile="userMobile" :userMobile="userMobile"
:acTempId="activityId" :acTempId="activityId"
@activityTaskJump="activityTaskJump" @activityTaskJump="activityTaskJump"
@getTaskId="getTaskId" /> @getTaskId="getTaskId"
@firstEnterActivity="firstEnterActivity"/>
</div> </div>
<div class="step bt"> <div class="step bt">
<step <step
...@@ -101,11 +102,12 @@ import FirstEnterDialog from '../components/first-enter-dialog'; ...@@ -101,11 +102,12 @@ import FirstEnterDialog from '../components/first-enter-dialog';
import { import {
checkToken, checkToken,
selectAppModuleParam, selectAppModuleParam,
getSelfAllScore } from "@/service"; getSelfAllScore,
getEncryptId } from "@/service";
import { setEventByModuleCode } from "@/utils" import { setEventByModuleCode } from "@/utils"
import { ENV_CONFIG } from '@/utils/enumerate'; import { ENV_CONFIG } from '@/utils/enumerate';
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
const cookies = require('cookie-universal')(); import { setCookie, getCookie, delCookie } from '@/utils/index';
export default { export default {
components: { components: {
...@@ -152,6 +154,7 @@ export default { ...@@ -152,6 +154,7 @@ export default {
userName: '', userName: '',
taskId: '', taskId: '',
origin: 'tims', origin: 'tims',
encryptId: '',
showFirstEnter: false, //是否展示第一次进入获得勤奋分弹框 showFirstEnter: false, //是否展示第一次进入获得勤奋分弹框
} }
}, },
...@@ -179,6 +182,10 @@ export default { ...@@ -179,6 +182,10 @@ export default {
}; };
}, },
methods: { methods: {
// 首次进入活动页面
firstEnterActivity() {
this.showFirstEnter = true;
},
getUserInfo() { getUserInfo() {
this.$rocNative this.$rocNative
.getUserInfo() .getUserInfo()
...@@ -186,19 +193,28 @@ export default { ...@@ -186,19 +193,28 @@ export default {
let _t = params.userToken; let _t = params.userToken;
let _this = this; let _this = this;
_this.token = params.userToken; _this.token = params.userToken;
cookies.set('token', _this.token); setCookie('token', _this.token);
checkToken({ _t }).then(res => { checkToken({ _t }).then(res => {
if(res.code == '200000' || res.code == '200006') { if(res.code == '200000' || res.code == '200006') {
_this.userMobile = ''; _this.userMobile = '';
cookies.remove('token'); delCookie('token');
}else { }else {
_this.userMobile = params.userMobile; _this.userMobile = params.userMobile;
cookies.set('token', _this.token); setCookie('token', _this.token);
_this.getSelfAllScore(); _this.getSelfAllScore();
_this.getEncryptId();
} }
}) })
}); });
}, },
// 获取加密后的doctorId
getEncryptId() {
getEncryptId().then(res => {
if( res && res.code && res.code == '000000' ){
this.encryptId = res.data;
}
})
},
// 获取个人信息 // 获取个人信息
getSelfAllScore() { getSelfAllScore() {
let _this = this; let _this = this;
...@@ -246,9 +262,9 @@ export default { ...@@ -246,9 +262,9 @@ export default {
let shareUrl = ''; let shareUrl = '';
const { NUXT_ENV_APP } = process.env; const { NUXT_ENV_APP } = process.env;
if(data.resourceType == 7) { // 邀请好友点赞 if(data.resourceType == 7) { // 邀请好友点赞
const { tempId, token, userId, userName, myAvatarl, shareTitle1, shareTitle2, shareIconUrl } = this; const { tempId, token, encryptId, userName, myAvatarl, shareTitle1, shareTitle2, shareIconUrl } = this;
//shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/compaign_ssr/?id=' + tempId + '&token=' + token; //shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/compaign_ssr/?id=' + tempId + '&token=' + token;
shareUrl = `http://10.177.10.217:3000/compaign_ssr/login-point?activityId=${tempId}&taskId=${data.id}&id=${userId}&name=${userName}&avatar=${myAvatarl}`; shareUrl = `http://10.177.10.217:3000/compaign_ssr/login-point?activityId=${tempId}&taskId=${data.id}&id=${encryptId}&name=${userName}&avatar=${myAvatarl}`;
this.$rocNative.shareWechat({ this.$rocNative.shareWechat({
type: 6, type: 6,
shareId: 0, shareId: 0,
...@@ -259,7 +275,8 @@ export default { ...@@ -259,7 +275,8 @@ export default {
}); });
}else if(data.resourceType == 9) { // 绑定居民微信 }else if(data.resourceType == 9) { // 绑定居民微信
const { userId, origin, activityId, shareTitle3, shareTitle4, shareIconUrl } = this; const { userId, origin, activityId, shareTitle3, shareTitle4, shareIconUrl } = this;
shareUrl = `${ENV_CONFIG[NUXT_ENV_APP]['shareUrl']}/active_news/activity/qrcode?doctorId=${userId}&origin=${origin}&activity=${activityId}`; let doctorId = Base64.encode(userId);
shareUrl = `${ENV_CONFIG[NUXT_ENV_APP]['shareUrl']}/active_news/activity/qrcode?doctorId=${doctorId}&origin=${origin}&activityId=${activityId}`;
this.$rocNative.shareWechat({ this.$rocNative.shareWechat({
type: 6, type: 6,
shareId: 0, shareId: 0,
......
import Axios from 'axios'; import Axios from 'axios';
import { Toast } from 'vant'; import { Toast } from 'vant';
import { API_CONFIG, REPONSE_CODE } from '@/utils/enumerate'; import { API_CONFIG, REPONSE_CODE } from '@/utils/enumerate';
import { setCookie, getCookie, delCookie } from '@/utils/index';
const { VUE_ENV } = process.env; // server or client const { VUE_ENV } = process.env; // server or client
const cookies = require('cookie-universal')(); // const cookies = require('cookie-universal')();
Axios.interceptors.request.use( Axios.interceptors.request.use(
config => { config => {
...@@ -13,7 +14,7 @@ Axios.interceptors.request.use( ...@@ -13,7 +14,7 @@ Axios.interceptors.request.use(
const method = config.method.toLocaleLowerCase(); const method = config.method.toLocaleLowerCase();
if (method === 'post' || method === 'put' || method === 'delete') {} if (method === 'post' || method === 'put' || method === 'delete') {}
if (config.withCredentials) { if (config.withCredentials) {
config.headers.token = cookies.get('token'); config.headers.token = getCookie('token');
} }
return config; return config;
}, },
......
...@@ -84,3 +84,12 @@ export const getAuthCode = ({ mobilePhone, flag, captchaToken, captchaAnswer }) ...@@ -84,3 +84,12 @@ export const getAuthCode = ({ mobilePhone, flag, captchaToken, captchaAnswer })
}, },
}) })
} }
// 获取加密过后的id
export const getEncryptId = () => {
return request({
url: `campaign/inviteDetail/vinci`,
method: 'get',
withCredentials: true,
})
}
\ No newline at end of file
const { NUXT_ENV_APP } = process.env;
export const getSearchByName = name => { export const getSearchByName = name => {
const match = RegExp(`[?&]${name}=([^&]*)`).exec(window.location.href); const match = RegExp(`[?&]${name}=([^&]*)`).exec(window.location.href);
return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
...@@ -32,14 +33,14 @@ export const removeItem = name => { ...@@ -32,14 +33,14 @@ export const removeItem = name => {
export const setCookie = (cname,cvalue, exdays = 7, domain = '.yunqueyi.com') => { //yunqueyi.com export const setCookie = (cname,cvalue, exdays = 7, domain = '.yunqueyi.com') => { //yunqueyi.com
let d = new Date(), expires = ''; let d = new Date(), expires = '';
 
if (NUXT_ENV_APP === 'dev') { if (NUXT_ENV_APP === 'dev') {
domain = window.location.hostname; domain = window.location.hostname;
} }
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
expires = `expires=${d.toUTCString()}`; expires = `expires=${d.toUTCString()}`;
   
document.cookie = `${cname}=${cvalue};path=/;${expires};domain=${domain}`; document.cookie = `${cname}=${cvalue};path=/;${expires};domain=${domain}`;
} }
export const getCookie = (cname) => { export const getCookie = (cname) => {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册