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

活动首页接口联调

上级 38101a67
<template>
<div class="detail-list br">
<ul v-show="!dataList.length">
<li class="list" v-for="(item, index) in dataList" :key="index">
<img src="../../assets/type-2.png" alt="">
<ul class="desc">
<li class="text">邀请居民做健康排查</li>
<li class="time">2019.12.15 10:35</li>
</ul>
<span class="score"><span>+5</span>勤奋分</span>
</li>
</ul>
<div v-show="dataList.length" class="no-content">
<div v-if="dataList.length">
<ul>
<li class="list" v-for="(item, index) in dataList" :key="index">
<!-- 1.课程 2.考试 3.调查问卷 4.患者招募 5.宣教漫画 6.打卡 7.邀请 8.任务排查 9.绑定居民到微信-->
<img v-if="item.resourceType == 1" src="../../static/images/task-two.png" />
<img v-if="item.resourceType == 3" src="../../static/images/task-five.png" />
<img v-if="item.resourceType == 7" src="../../static/images/task-one.png" />
<img v-if="item.resourceType == 8" src="../../static/images/task-three.png" />
<img v-if="item.resourceType == 9" src="../../static/images/task-four.png" />
<img v-if="item.resourceType == 10" src="../../static/images/task-six.png" />
<ul class="desc">
<li class="text">{{item.taskName}}</li>
<li class="time">{{item.sortFinishTime}}</li>
</ul>
<span class="score"><span>+{{getRewardType(item.timsRewardResp)}}</span>勤奋分</span>
</li>
</ul>
<DetailBtn
style="margin-top: 30px;"
btnText="获得更多勤奋分"
:isFixed="!isFixed"
:needBT="needBT"
btnWidth="100%" />
</div>
<div v-if="!dataList.length" class="no-content">
<img src="../../assets/no-content.png" alt="">
<div class="text">暂无记录,您还没有参加活动</div>
<DetailBtn style="margin-top: 30px;" btnText="立即参加" :isFixed="isFixed" btnWidth="50%"></DetailBtn>
<DetailBtn
style="margin-top: 30px;"
btnText="立即参加"
:isFixed="isFixed"
btnWidth="50%" />
</div>
</div>
</template>
......@@ -26,14 +44,30 @@ export default {
props: {
dataList: {
type: Array,
default: () => [0, 1, 3,0, 1, 3,0, 1, 3,0, 1, 3, 4]
default: () => []
}
},
data() {
return {
needBT: true,
isFixed: false
}
},
created() {
},
methods: {
getRewardType(data) {
if(data && data.length > 0) {
for(let i = 0;i < data.length;i++) {
if(data[i].rewardType == 3) {
return data[i].rewardQuantity;
}
}
}
}
}
}
</script>
<style lang="less">
......
......@@ -33,10 +33,6 @@ export default {
type: Number | String,
default: 300
},
// isLogin: {
// type: Boolean | String,
// default: true
// },
statusTextList: {
type: Array,
default: () => ['100勤奋分', '200勤奋分', '300勤奋分']
......@@ -50,6 +46,11 @@ export default {
userMobile(n, o) {
this.isLogin = n ? true : false;
this.init();
},
minValue(n, o) {
if(n) {
this.init();
}
}
},
data() {
......@@ -67,10 +68,8 @@ export default {
init() {
let htmlText = '登录后完成任务,就能获得瓜分云鹊豆的资格啦!';
if(!this.isLogin) return htmlText;
let minValue = this.minValue, activeNum = 0, activeWidth;
if(minValue <= 50) {
htmlText = `已经获得<span style="color: #FFE8A5">${minValue}</span>勤奋分啦,继续努力就能瓜分100万云鹊豆!`
} else if(minValue < 100 ) {
let minValue = this.minValue, activeNum = 0, activeWidth;
if(minValue < 100 ) {
htmlText = `还差<span style="color">${100 - minValue}</span>分,就有资格瓜分<span style="color: #FFE8A5">100</span>万云鹊豆啦!`
} else if(minValue < 200) {
htmlText = `已经有资格瓜分<span style="color: #FFE8A5">100</span>万云鹊豆啦,继续努力还能瓜分<span style="color: #FFE8A5">200</span>万!`
......
......@@ -23,6 +23,10 @@ import './index.less';
export default {
name: 'Header',
props: {
isWeb: {
type: Boolean,
default: false
},
isScroll: {
type: Boolean,
default: false
......@@ -35,10 +39,6 @@ export default {
type: String,
default: ''
},
isInNotice: {
type: Boolean,
default: false
},
token: {
type: String,
default: ''
......@@ -75,15 +75,16 @@ export default {
let shareUrl = '';
const { NUXT_ENV_APP } = process.env;
const { tempId, token, shareTitle1, shareTitle2, shareIconUrl } = this;
shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/template_v2/?id=' + tempId + '&token=' + token;
const h5title = encodeURIComponent(shareTitle1);
const h5desc = encodeURIComponent(shareTitle2);
const { id } = this.$route.query;
this.$sendBuriedData({
component_tag: `200#400089#${id}#${shareTitle1}`
});
//shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/compaign_ssr/?id=' + tempId + '&token=' + token;
shareUrl = 'http://10.177.10.217:3000/compaign_ssr/login-point?id=' + tempId + '&token=' + token;
// const { id } = this.$route.query;
// this.$sendBuriedData({
// class_name: '',
// component_tag: `200#400089#${id}#${shareTitle1}`
// });
this.$rocNative.shareWechat({
type: 7,
type: 6,
shareId: 0,
shareUrl: shareUrl,
title1: shareTitle1,
......
......@@ -65,6 +65,10 @@ export default {
userMobile: {
type: String,
default: ''
},
isWeb: {
type: Boolean,
default: false
}
},
watch: {
......@@ -89,7 +93,7 @@ export default {
},
methods: {
linkPage(item) {
if(!this.userMobile || !this.tokenFlag) {
if(!this.userMobile) {
this.$rocNative.gotoLogin();
}else {
// let flag = item.timeStatus == 1 && ((item.finishFrequency == item.doctorFinishFrequency) && item.resourceType != 8);
......@@ -97,8 +101,8 @@ export default {
// if(item.timeStatus == 2 || flag || flag1) { // 已结束 、 已完成不可点击
// return;
// }else {
if(!this.clickFlag) return;
if(!this.isWeb) { this.clickFlag = false; }
// if(!this.clickFlag) return;
// if(!this.isWeb) { this.clickFlag = false; }
let data = {
id: item.id,
href: item.linkId,
......@@ -116,7 +120,7 @@ export default {
if(self.isWeb) {
req = {
id: acTempId,
token: getCookie('token') || '2B7FA4D845C74D7EA3183F9E316630C6'
token: cookies.get('token') || '2B7FA4D845C74D7EA3183F9E316630C6'
}
}else {
req = {
......@@ -126,12 +130,12 @@ export default {
}
getNewActivityDesc({ id: req.id, token: req.token }).then(res => {
if(res.code == '000000') {
if(res.data.loginStatus == 2) { // 未登录 或者token失效
cookies.remove('token');
this.tokenFlag = false;
}else {
this.tokenFlag = true;
}
// if(res.data.loginStatus == 2) { // 未登录 或者token失效
// cookies.remove('token');
// this.tokenFlag = false;
// }else {
// this.tokenFlag = true;
// }
this.taskList = res.data.taskRuleData;
for(let i = 0; i < this.taskList.length; i++) {
if(this.taskList[i].resourceType == 7 && this.taskList[i].resourceId == 2) {
......
......@@ -2769,6 +2769,11 @@
"schema-utils": "^1.0.0"
}
},
"callapp-lib": {
"version": "2.1.8",
"resolved": "http://192.168.110.93:4873/callapp-lib/-/callapp-lib-2.1.8.tgz",
"integrity": "sha512-9FUmTz0LCCF43LhiMEN3CJ4RuLGppu8hOn0u9UzUFyd7TU7AXW82Zc9qTq4Mfes36yOGqNYO1v8DJdkQY7+7rA=="
},
"caller-callsite": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
......@@ -9230,6 +9235,33 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
"pica-call-app": {
"version": "1.0.42",
"resolved": "http://192.168.110.93:4873/pica-call-app/-/pica-call-app-1.0.42.tgz",
"integrity": "sha512-SV1Ipa02GU3lT1cPC1qVD1GfiqHdFvXUA2TdxdncqTVUbqfJ27FlT+Beu3eWu9GdqDI5nRnu0sGk+pwH0QcsIA==",
"requires": {
"callapp-lib": "^2.1.7",
"vant": "^1.4.2"
},
"dependencies": {
"@vant/icons": {
"version": "1.1.7",
"resolved": "http://192.168.110.93:4873/@vant%2ficons/-/icons-1.1.7.tgz",
"integrity": "sha1-KVYa3/+mp1DSedzNvpppt0OTTz8="
},
"vant": {
"version": "1.6.28",
"resolved": "http://192.168.110.93:4873/vant/-/vant-1.6.28.tgz",
"integrity": "sha512-yGiQFPA7tmvlA05ezWg2MnknDK2OKlHmJurvHm2mWt1zdjfiVDJj+XFh6xMY8jZUsBZMWqdBSc+gAKzII8fOqg==",
"requires": {
"@babel/runtime": "^7.4.3",
"@vant/icons": "1.1.7",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.3",
"vue-lazyload": "1.2.3"
}
}
}
},
"picomatch": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz",
......
......@@ -18,7 +18,8 @@
"nuxt": "^2.0.0",
"vant": "^2.0.9",
"vconsole": "^3.3.4",
"web-buried-point": "^v2.1.0"
"web-buried-point": "^v2.1.0",
"pica-call-app": "^1.0.42"
},
"devDependencies": {
"@nuxtjs/axios": "^5.5.4",
......
<template>
<div class="container">
<Header
:isWeb="isWeb"
:token="token"
:is-scroll="isScroll"
:share-title1="shareTitle1"
......@@ -16,8 +17,8 @@
<div class="progress-container">
<div class="score-info">
<div v-if="userMobile" class="text">
<img src="../static/images/task-four.png" />
<span class="tc">我的勤奋分<span>{{12345}}</span></span>
<img :src="myAvatarl" />
<span class="tc">我的勤奋分<span>{{myScore}}</span></span>
<span class="bt" @click="selfInfo">个人明细 ></span>
</div>
<div v-if="!userMobile" class="text">
......@@ -28,7 +29,7 @@
<status-bar
class="progress-bar"
:userMobile="userMobile"
:minValue="minValue"
:minValue="myScore"
:maxValue="maxValue"/>
</div>
</div>
......@@ -44,6 +45,7 @@
:stepText="stepText1"
:stepTime="stepTime1"/>
<task-activity
:isWeb="isWeb"
:acToken="token"
:userMobile="userMobile"
:acTempId="activityId"
......@@ -73,7 +75,12 @@ import TaskActivity from '../components/task-activity';
import Header from '../components/header/index';
import Step from '../components/step';
import StatusBar from '../components/bussiness/status-bar';
import { checkToken, selectAppModuleParam } from "@/service";
import {
checkToken,
selectAppModuleParam,
getSelfAllScore } from "@/service";
import { setEventByModuleCode } from "@/utils"
import { ENV_CONFIG } from '@/utils/enumerate';
const cookies = require('cookie-universal')();
export default {
......@@ -89,7 +96,7 @@ export default {
isLogin: false,
userMobile: '',
stepFlag: true,
isWeb: true,
isWeb: false,
activityId: 0,
token: '',
shareTitle1: '',
......@@ -108,8 +115,9 @@ export default {
numText3: 3,
stepText3: '公布排名获奖名单',
stepTime3:'4月3日10:00-4月7日16:00',
minValue: 50,
maxValue: 200
maxValue: 200,
myAvatarl: '',
myScore: 0
}
},
async asyncData({ $axios }) {
......@@ -122,10 +130,14 @@ export default {
let _this = this;
if (process.client) {
_this.activityId = _this.$route.query.id || 9;
_this.isWeb = _this.$rocNative.isWeb;
window.__refresh = function() {
_this.getUserInfo();
}
}
if(!_this.isWeb && _this.$rocNative.appInit()){
_this.getUserInfo();
};
},
methods: {
getUserInfo() {
......@@ -143,10 +155,19 @@ export default {
}else {
_this.userMobile = params.userMobile;
cookies.set('token', _this.token);
_this.getSelfAllScore();
}
})
});
},
},
// 获取个人信息
getSelfAllScore() {
let _this = this;
getSelfAllScore({ id: this.activityId, token: this.token }).then(res => {
_this.myAvatarl = res.data.avatarImageUrl;
_this.myScore = res.data.totalScore;
})
},
// 查看活动规则
ruleDetail() {
this.$router.push({path: "/login-point/point-result",query: {}});
......@@ -161,13 +182,31 @@ export default {
},
// 查看个人明细
selfInfo() {
this.$router.push({path: "/perdetails",query: {}});
let queryData = {
id: this.activityId,
avatarImage: this.myAvatarl,
score: this.myScore,
token: this.token
};
this.$router.push({path: "/perdetails",query: queryData});
},
// 活动任务
activityTaskJump(data) {
if(data.resourceType == 7) { // 去邀请
}else if(data.resourceType == 8) { // 绑定居民微信
if(data.resourceType == 7) { // 邀请好友点赞
let shareUrl = '';
const { NUXT_ENV_APP } = process.env;
const { tempId, token, 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?id=' + tempId + '&token=' + token;
this.$rocNative.shareWechat({
type: 6,
shareId: 0,
shareUrl: shareUrl,
title1: shareTitle1,
title2: shareTitle2,
shareImageUrl: shareIconUrl || 'https://file.yunqueyi.com/logo.png?version=' + new Date().getTime()
});
}else if(data.resourceType == 9) { // 绑定居民微信
}else {
this.jumpPage(data.href, data.id);
......@@ -187,7 +226,6 @@ export default {
if(loginFlag){
_this.$rocNative.getToken().then(res => {
const { userToken } = res;
// alert('APP拿到的token=:'+userToken)
checkToken({ token: userToken }).then(res=>{
if(res.code == '200000' || res.code == '200006') {
_this.$rocNative.gotoLogin();
......@@ -203,10 +241,8 @@ export default {
},
// 原先的点击图片跳转逻辑
oldJumpHandle(itemData, token){
// 不改动原先逻辑
if (itemData.code == 'M301') {
itemData.code = 'M300';
//鉴权 自己调用token
this.$rocNative.getToken().then(res => {
const { userToken } = res;
setCookie('token', userToken);
......
......@@ -51,7 +51,7 @@ export default {
},
getCourse() {
this.$router.push({path: "/login-point/point-result",query: {}});
}
}
}
......
......@@ -54,10 +54,12 @@ export default {
},
methods: {
openApp() {
// let path = window.location.origin + window.location.hash;
let path = "http://10.177.10.217:3000/compaign_ssr/";
this.$callApp(path);
},
downloadApp() {
window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque';
}
}
}
......
......@@ -9,27 +9,28 @@
<article class="user">
<img class="user-img" src="../../assets/user-header.png" alt="">
<div class="profile">
<img src="../../assets/user-header.png" alt="">
<img :src="avatalImage" alt="">
<div class="desc">
<span class="score">22345</span>
<span class="score">{{allScore}}</span>
<span class="text">我的勤奋分</span>
</div>
</div>
</article>
<DetailList></DetailList>
<DetailBtn v-show="false" needBT=true @btnClick="goBack"></DetailBtn>
<DetailList :dataList="taskDataList"></DetailList>
<!-- <DetailBtn v-show="false" needBT=true @btnClick="goBack"></DetailBtn> -->
</section>
</section>
</template>
<script>
import DetailList from '@/components/bussiness/detail-list';
import DetailBtn from '@/components/bussiness/detail-btn';
// import DetailBtn from '@/components/bussiness/detail-btn';
import Header from '../../components/header';
import { getSelfActivity } from "@/service";
export default {
components: {
Header,
DetailList,
DetailBtn
// DetailBtn
},
data() {
return {
......@@ -37,9 +38,21 @@ export default {
shareTitle1: '个人明细',
shareTitle2: '',
shareIconUrl: '',
isScroll: true,
isScroll: true,
activityId: 0,
avatalImage: '',
allScore: 0,
token: '',
taskDataList: []
}
},
created() {
this.activityId = this.$route.query.id;
this.avatalImage = this.$route.query.avatarImage;
this.allScore = this.$route.query.score;
this.token = this.$route.query.token;
this.getSelfActivity();
},
methods: {
goBack() {
if(this.$rocNative.isWeb) {
......@@ -48,7 +61,15 @@ export default {
this.$rocNative.goBack();
}
},
},
// 获取个人明细列表
getSelfActivity() {
getSelfActivity({id: this.activityId, token: this.token}).then(res => {
if(res.data.personalDetails && res.data.personalDetails.length > 0) {
this.taskDataList = res.data.personalDetails;
}
})
}
}
}
</script>
<style lang="less">
......
......@@ -2,6 +2,7 @@ import Vue from 'vue';
import { BASE_URL } from '@/utils/enumerate';
import rocNative from '@/utils/jsbridge';
import WebBuriedPoint, { sendBuriedData } from 'web-buried-point';
import { callApp } from 'pica-call-app'; // H5唤起APP组件
import VConsole from 'vconsole/dist/vconsole.min.js'
const { name } = require('../package.json');
......@@ -16,6 +17,9 @@ if(!(process.env.NODE_ENV === 'uat' || process.env.NODE_ENV === 'pro')) {
Vue.prototype.$cookies = cookies;
Vue.prototype.$rocNative = new rocNative();
Vue.prototype.$sendBuriedData = sendBuriedData;
Vue.prototype.$callApp = callApp;
// Vue.use(PicaCallApp);
if (name === 'nuxt_ssr') throw Error('需要给当前项目起一个有意义的名称,多英文单词用 _ 拼接,不能有空格。修改文件:package.json (name)');
// Vue.use(WebBuriedPoint, {
......
......@@ -36,3 +36,25 @@ export const selectAppModuleParam = async ({id, token }) => {
});
}
// 活动首页个人信息
export const getSelfAllScore = async (data) => {
const { id, token } = data;
return request({
url: `/campaign/tims/getCumulativeReward?activityId=${id}&token=${token}&setEntry=true`,
headers: {
token
}
});
}
// 个人明细
export const getSelfActivity = async (data) => {
const { id, token } = data;
return request({
url: `/campaign/tims/personalDetails?activityId=${id}&token=${token}&setEntry=true`,
headers: {
token
}
});
}
......@@ -62,6 +62,43 @@ export const delCookie = (cname) => {
}
}
export const setEventByModuleCode = (itemData, token) => {
let modeCode = itemData.code || '';
let paramList = itemData.paramList ? itemData.paramList : '';
if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = '';
} else if (
modeCode === 'M100' ||
modeCode === 'M300' ||
modeCode === 'M500' || modeCode === 'M301'
) {
let urlPara = getUrlParmByCode(paramList, token);
paramList[0] && (paramList[0].value += urlPara);
// 前端拼接了数据,原生不用再拼接
paramList = paramList.slice(0, 1)
}
if (typeof paramList === 'string' && !paramList) {
paramList = [];
}
return paramList;
}
function getUrlParmByCode(paramList, token) {
if (paramList.length <= 1) return `?token=${token}`;
let dataStr = '', list = [];
let str = paramList.length > 0 && paramList[0].value.indexOf('?') > -1 ? '&' : '?';
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + encodeURI(paramList[i].value));
}
dataStr = list.join('&');
if (dataStr !== '') return `${str}${dataStr}&token=${token}`;
return `${str}token=${token}`;
}
export const getConfigByEvtType = key => {
return ENV_CONFIG[NUXT_ENV_APP][key];
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册