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

联调绑定居民微信

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