提交 f8451bb8 编写于 作者: wensu.huang's avatar wensu.huang

Merge branch 'dev-new-campaign-0302' into 'release'

新活动需求开发  code reviewer : 张平

新活动需求开发  code reviewer : 张平

See merge request !1
# ASSETS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
# COMPONENTS
**This directory is not required, you can delete it if you don't want to use it.**
The components directory contains your Vue.js Components.
_Nuxt.js doesn't supercharge these components._
<template>
<div class="about-container">
about nuxtjs ssr
<StatusBar :isLogin=true :minValue=80></StatusBar>
<StatusBar :isLogin=true :minValue=180></StatusBar>
<StatusBar :isLogin=false minValue=0></StatusBar>
</div>
</template>
<script>
// asyncData fetch 在组件中无效
import StatusBar from '../components/bussiness/status-bar';
export default {
components: {
StatusBar
},
data() {
return {
name: 'about'
......
<template>
<div class="common-loader loader--style3" title="2">
<div class="loader-mask"></div>
<svg
version="1.1"
id="loader-1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
width="80"
height="80"
viewBox="0 0 60 60"
style="enable-background:new 0 0 80 80;"
xml:space="preserve"
>
<path
fill="#000"
d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"
>
<animateTransform
attributeType="xml"
attributeName="transform"
type="rotate"
from="0 25 25"
to="360 25 25"
dur="0.6s"
repeatCount="indefinite"
/>
</path>
</svg>
</div>
</template>
<style lang="less" scoped>
.common-loader {
.loader-mask {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1000000020;
background: rgba(0, 0, 0, 0.1);
}
svg {
position: fixed;
top: 300px;
left: 172px;
z-index: 1000000021;
}
}
svg path,
svg rect {
fill: #aaa;
}
</style>
<template>
<div :class="{fixed: isFixed}">
<div class="detail-btn" :class="{bt: needBT}">
<span @click="btnClick" :style="{width: btnWidth}">{{btnText}}</span>
</div>
</div>
</template>
<script>
export default {
props: {
isFixed: {
type: Boolean | String,
default: true,
},
btnWidth: {
type: String,
default: '100%'
},
btnText: {
tpye: String,
default: '获得更多勤奋分'
},
needBT: {
type: Boolean | String,
default: false
}
},
methods: {
btnClick() {
this.$emit('btnClick');
}
},
}
</script>
<style lang="less">
.fixed {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
z-index: 3;
background: #fff;
}
.detail-btn {
display: flex;
flex-direction: row;
height: 50px;
line-height: 50px;
padding: 0 15px;
align-items: center;
text-align: center;
&.bt {
border-top: 1px solid #EDEDED;
}
span {
height: 40px;
line-height: 40px;
margin: 0 auto;
width: 100%;
text-align: center;
font-size: 15px;
font-weight: 700;
background:linear-gradient(90deg,rgba(241,104,57,1) 0%,rgba(220,49,81,1) 100%);
border-radius: 20px;
color: #fff;
}
}
</style>
\ No newline at end of file
<template>
<div class="detail-list br">
<div v-if="dataList.length">
<ul>
<div v-for="(item, index) in dataList" :key="index">
<li class="list" v-if="item.timsRewardResp[0].rewardType == 3">
<!-- 1.课程 2.考试 3.调查问卷 4.患者招募 5.宣教漫画 6.打卡 7.邀请 8.任务排查 9.绑定居民到微信 10.首次进入 11.邀请点赞-->
<img v-if="item.resourceType == 1" src="../../static/images/task-two-new.png" />
<img v-if="item.resourceType == 4" src="../../static/images/task-five-new.png" />
<img v-if="item.resourceType == 11" src="../../static/images/task-one-new.png" />
<img v-if="item.resourceType == 8" src="../../static/images/task-three-new.png" />
<img v-if="item.resourceType == 9" src="../../static/images/task-four-new.png" />
<img v-if="item.resourceType == 10" src="../../static/images/task-six-new.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>
</div>
</ul>
<DetailBtn
style="margin-top: 30px;"
btnText="获得更多勤奋分"
:isFixed="!isFixed"
:needBT="needBT"
btnWidth="100%"
v-bp="{ component_tag: '364#360018' }"
@btnClick="btnClick"/>
</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%"
@btnClick="btnClick"/>
</div>
</div>
</template>
<script>
import DetailBtn from '@/components/bussiness/detail-btn';
export default {
components: {
DetailBtn
},
props: {
dataList: {
type: Array,
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;
}
}
}
},
btnClick() {
this.$router.go(-1);
}
}
}
</script>
<style lang="less">
.detail-list {
font-size: 16px;
&.br {
border-radius: 20px 20px 0 0;
margin-top: -24px;
position: relative;
top: 0;
left: 0;
z-index: 3;
background: #fff;
}
.list {
display: flex;
flex-direction: row;
height: 79px;
// line-height: 79px;
align-content: space-between;
align-items: center;
margin: 0 15px;
border-bottom: 1px solid #F8F9FA;
img {
width: 50px;
height: 50px;
border-radius: 25px;
}
.desc {
flex: 1;
display: flex;
flex-direction: column;
margin-left: 15px;
.text {
height: 16px;
line-height: 16px;
font-size: 16px;
font-weight: 700;
color: #373839;
}
.time {
margin-top: 8px;
height: 13px;
line-height: 13px;
font-size: 13px;
font-size: 13px;
font-weight: 400;
color: #676869;
}
}
.score {
height: 13px;
line-height: 13px;
font-size: 13px;
font-weight: 700;
color: #373839;
span {
color: #FD5A2F;
}
}
}
.no-content {
padding-top: 100px;
text-align: center;
.text {
font-size: 15px;
color: #999999;
}
img {
width: 150px;
height: 150px;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="status-wrapper">
<div class="status-text">
<span :class="{'no-login': !isLogin}" v-html="statusText"></span>
</div>
<div class="status-bar-wrapper">
<div class="line"></div>
<div class="line-2" :style="{'width': activeWidth}"></div>
<div class="circle-wrapper">
<div class="circle">
<div>
<span class="score-text">勤奋值</span>
</div>
<div v-for="(item, index) in statusTextList" :key="index">
<span class="circle" :class="{'active': activeNum >= (index + 1)}"></span>
<span class="score" :class="{'active': activeNum >= (index + 1)}">{{item}}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
minValue: {
type: Number | String,
default: 0
},
maxValue: {
type: Number | String,
default: 300
},
isLogin: {
type: Boolean | String,
default: true
},
statusTextList: {
type: Array,
default: () => ['100勤奋分', '200勤奋分', '300勤奋分']
}
},
data() {
return {
activeNum: 0,
activeWidth: '0%',
}
},
computed: {
statusText() {
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 ) {
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>万!`
} else if(minValue < 300) {
htmlText = `已经有资格瓜分<span style="color: #FFE8A5">300</span>万云鹊豆啦,继续努力还能瓜分<span style="color: #FFE8A5">200</span>万!`
} else {
htmlText = `天啦撸,你有资格瓜分500万云鹊豆哦!`
}
activeNum = Math.floor(minValue / 100);
if(activeNum <= 0) {
activeNum = 0;
} else if(activeNum >= 3) {
activeNum = 3
}
this.activeNum = activeNum;
activeWidth = (this.minValue * 100 / this.maxValue).toFixed(2);
if(activeWidth >= 100) {
activeWidth = 100;
}
this.activeWidth = activeWidth + '%';
return htmlText;
}
},
mounted() {
},
}
</script>
<style lang="less" scoped>
.status-wrapper {
background: #9A1F36;
height: 88px;
.status-text {
text-align: center;
font-size: 12px;
padding: 10px 0 13px;
color: #fff;
.no-login {
color: #FFE8A5
}
}
.status-bar-wrapper {
position: relative;
top: 0;
left: 0;
width: 90%;
display: flex;
flex-direction: column;
.line {
width: 100%;
height: 3px;
background:rgba(115,15,33,1);
border-radius: 1.5px;
}
.line-2 {
position: absolute;
top: 0;
left: 0;
width: 30%;
height: 3px;
background:linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
border-radius: 1.5px;
}
.circle-wrapper {
position: relative;
top: -10px;
left: 0;
// margin-right: 80px;
.circle {
display: flex;
flex-direction: row;
justify-content: space-between;
div {
position: relative;
top: 0;
left: 0;
.circle {
// position: relative;
width: 10px;
height: 10px;
border: 4px solid #730F21;
border-radius: 10px;
background: #9A1F36;
}
.score-text {
display: inline-block;
width: 60px;
position: absolute;
top: 26px;
left: 0;
font-size: 12px;
color: #730F21;
}
.score {
position: absolute;
top: 23px;
left: -29px;
width: 70px;
height: 20px;
line-height: 20px;
font-size: 12px;
text-align: center;
// background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
border-radius: 10px;
border: 1px solid rgba(115,15,33,1);
color: #730F21;
&.active {
color: #730F21;
background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
}
}
}
.circle.active {
border: 4px solid #FFE8A5;
// background: rgba(255, 200, 100, 1);
background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
}
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="status-wrapper">
<div class="status-text">
<span :class="{'no-login': !isLogin}" v-html="htmlText"></span>
</div>
<div class="status-bar-wrapper">
<div class="line"></div>
<div class="line-2" :style="{'width': activeWidth}"></div>
<div class="circle-wrapper">
<div class="circle">
<div>
<span class="score-text">勤奋值</span>
</div>
<div v-for="(item, index) in statusTextList" :key="index">
<span class="circle" :class="{'active': activeNum >= (index + 1)}"></span>
<span class="score" :class="{'active': activeNum >= (index + 1)}">{{item}}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'StatusBar',
props: {
minValue: {
type: Number | String,
default: 0
},
maxValue: {
type: Number | String,
default: 300
},
statusTextList: {
type: Array,
default: () => ['100勤奋分', '200勤奋分', '300勤奋分']
},
userMobile: {
type: String,
default: ''
}
},
watch: {
userMobile(n, o) {
this.isLogin = n ? true : false;
this.init();
},
minValue(n, o) {
if(n) {
this.init();
}
}
},
data() {
return {
isLogin: false,
activeNum: 0,
activeWidth: '0%',
htmlText: '登录后完成任务,就能获得瓜分云鹊豆的资格啦!'
}
},
mounted() {
this.init();
},
methods: {
init() {
let htmlText = '登录后完成任务,就能获得瓜分云鹊豆的资格啦!';
if(!this.isLogin) return htmlText;
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>万云鹊豆啦,</br>继续努力还能瓜分<span style="color: #FFE8A5">200</span>万!`
} else if(minValue < 300) {
htmlText = `已经有资格瓜分<span style="color: #FFE8A5">300</span>万云鹊豆啦,</br>继续努力还能瓜分<span style="color: #FFE8A5">200</span>万!`
} else {
htmlText = `天啦撸,你有资格瓜分500万云鹊豆哦!`
}
activeNum = Math.floor(minValue / 100);
if(activeNum <= 0) {
activeNum = 0;
} else if(activeNum >= 3) {
activeNum = 3
}
this.activeNum = activeNum;
activeWidth = (this.minValue * 100 / this.maxValue).toFixed(2);
if(activeWidth >= 100) {
activeWidth = 100;
}
this.activeWidth = activeWidth + '%';
this.htmlText = htmlText;
}
},
}
</script>
<style lang="less" scoped>
.status-wrapper {
background: #9A1F36;
height: 100px;
.status-text {
text-align: center;
font-size: 12px;
padding: 10px 0 13px;
color: #fff;
height: 35px;
.no-login {
color: #FFE8A5
}
}
.status-bar-wrapper {
position: relative;
top: 0;
left: 0;
width: 90%;
display: flex;
flex-direction: column;
.line {
width: 100%;
height: 3px;
background:rgba(115,15,33,1);
border-radius: 1.5px;
}
.line-2 {
position: absolute;
top: 0;
left: 0;
width: 30%;
height: 3px;
background:linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
border-radius: 1.5px;
}
.circle-wrapper {
position: relative;
top: -10px;
left: 0;
// margin-right: 80px;
.circle {
display: flex;
flex-direction: row;
justify-content: space-between;
div {
position: relative;
top: 0;
left: 0;
.circle {
// position: relative;
width: 10px;
height: 10px;
border: 4px solid #730F21;
border-radius: 10px;
background: #9A1F36;
}
.score-text {
display: inline-block;
width: 60px;
position: absolute;
top: 26px;
left: 0;
font-size: 12px;
color: #730F21;
}
.score {
position: absolute;
top: 23px;
left: -29px;
width: 70px;
height: 20px;
line-height: 20px;
font-size: 12px;
text-align: center;
// background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
border-radius: 10px;
border: 1px solid rgba(115,15,33,1);
color: #730F21;
&.active {
color: #730F21;
background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
border: none;
font-weight: 700;
}
}
}
.circle.active {
border: 4px solid #FFE8A5;
// background: rgba(255, 200, 100, 1);
background: linear-gradient(360deg,rgba(255,160,33,1) 0%,rgba(255,232,165,1) 100%);
}
}
}
}
}
</style>
\ No newline at end of file
<template>
<section class="carve-up-wrap" @touchmove.prevent @click.prevent>
<div class="inter-content carve-container" v-if="isFirstCarve">
<img
class="main-bg"
src="~/assets/carve-up/main-bg.png"
v-bp="{ component_tag: '363#360013'}"
@click="openBag"
>
<img
class="cancel"
src="~/assets/icon-dialog-cancel.png"
@click="knowFn"
v-bp="{ component_tag: '363#360015'}"
>
</div>
<div class="success-content carve-container" v-if="!isFirstCarve && hasQualification ">
<div class="success-bg">
<p class="title">
<span class="line1"></span>
<span class="text">恭喜您瓜分</span>
<span class="line2"></span>
</p>
<p class="awards-num">{{beanCarveCount}}<span>云鹊豆</span></p>
<p class="tips">所获云鹊豆将在1分钟内到账</p>
<div class="btn-content">
<div
class="btn btn1"
@click="goToBeanCenter"
v-bp="{ component_tag: '363#360014'}"
>
去兑换
</div>
<div class="btn btn2" @click="knowFn">查看排名</div>
</div>
</div>
<img
class="cancel"
src="~/assets/icon-dialog-cancel.png"
@click="knowFn"
v-bp="{ component_tag: '363#360015'}"
>
</div>
<div class="defeat-content carve-container" v-if="!isFirstCarve && !hasQualification" >
<div class="defeat-bg">
<div class="content content2" v-show="unableReason == 4">
<p class="title">您未参加本次活动</p>
</div>
<div class="content content1" v-show="unableReason == 3">
<p class="title">很遗憾</p>
<p class="text">您的勤奋分小于100不能瓜分云鹊豆</p>
</div>
<div
class="know-btn"
@click="knowFn"
v-bp="{ component_tag: '363#360016'}"
>
我知道了
</div>
</div>
<img
class="cancel"
src="~/assets/icon-dialog-cancel.png"
@click="knowFn"
v-bp="{ component_tag: '363#360015'}"
>
</div>
</section>
</template>
<script>
import {ENV_CONFIG} from '../../utils/enumerate'
const { NUXT_ENV_APP } = process.env;
export default {
name: "index",
props: {
isFirstCarve: { //红包是否是未拆状态
type: Boolean,
default() {
return true;
}
},
hasQualification: { //是否可瓜分云鹊豆
type: Boolean,
default() {
return true
}
},
beanCarveCount: { //可瓜分云鹊豆数量
type: Number,
default() {
return 0
}
},
unableReason: { //3分数不够,4未参加
type: Number,
default() {
return 0
}
},
},
data() {
return {
joinStatus: 2
}
},
methods: {
knowFn() {
window.location.replace('https://phome.yunqueyi.com/template_v2/?id=636')
},
goToBeanCenter() { //跳转至云鹊豆中心
this.$rocNative.dispatchEventByModuleCode({
modeCode: 'M300',
jsonString: [
{
"key":"pageUrl",
"value": ENV_CONFIG[NUXT_ENV_APP].beanCenterUrl
}
]
});
},
openBag() {
this.$emit('openBag')
}
}
}
</script>
<style lang="less" scoped>
.carve-up-wrap {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
background:rgba(0,0,0,0.5);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
.carve-container {
display: flex;
flex-flow: column;
align-items: center;
img.cancel {
width: 30px;
height: 30px;
}
}
.inter-content {
img.main-bg {
width: 295.5px;
height: 318.5px;
}
img.cancel {
margin-top: 10px;
}
}
.success-content {
.success-bg {
display: flex;
flex-flow: column;
align-items: center;
width: 300px;
height: 320px;
background: url("../../assets/carve-up/success-bg.png") no-repeat;
background-size: cover;
.title {
display: flex;
align-items: center;
margin-top: 44.5px;
.line1,.line2 {
display: inline-block;
width: 20px;height: 1px;
border-radius: .5px;
}
.line1 {
background:linear-gradient(135deg,rgba(233,210,206,0) 0%,rgba(199,136,140,1) 100%);
}
.line2 {
background:linear-gradient(270deg,rgba(233,210,206,0) 0%,rgba(199,136,140,1) 100%);
}
.text {
color: #7B1A20;
font-size: 13px;
line-height: 13px;
font-weight: 700;
margin: 0 4px;
}
}
.awards-num {
color: #BC1C34;
font-weight: 700;
font-size: 40px;
line-height: 40px;
margin-top: 8px;
display: flex;
align-items: center;
span {
font-size: 14px;
height: 14px;
line-height: 14px;
align-self: flex-end;
margin-bottom: 5.5px;
margin-left: 3px;
}
}
.tips {
color: #fff;
font-size: 13px;
line-height: 13px;
margin-top: 62px;
}
.btn-content {
width: 200px;
margin-top: auto;
margin-bottom: 20px;
.btn {
width: 100%;
height: 44px;
margin: 0 auto;
border-radius: 25.5px;
text-align: center;
font-size: 18px;
line-height: 44px;
font-weight: 700;
}
.btn1 {
color: #7B1A20;
background:linear-gradient(360deg,rgba(245,189,94,1) 0%,rgba(255,224,181,1) 100%);
box-shadow:0px 2px 10px 0px rgba(159,23,35,1);
}
.btn2 {
color: #fff;
position: relative;
margin-top: 10px;
}
.btn2:after {
position: absolute;
content: " ";
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 200%;
height:200%;
border: 1PX solid #FFFFFF;
border-radius: 51px;
color: #FFFFFF;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scale(.5, .5);
transform: scale(.5, .5);
}
}
}
img.cancel {
margin-top: 20px;
}
}
.defeat-content {
.defeat-bg {
width: 250px;
height: 275px;
background: url("../../assets/carve-up/defeat-bg.png") no-repeat;
background-size: cover;
display: flex;
flex-flow: column;
align-items: center;
.content {
p {
text-align: center;
}
.title {
color: #373839;
font-size: 18px;
line-height: 18px;
font-weight: 700;
}
.text {
color: #666666;
font-size: 14px;
line-height: 19px;
margin-top: 8px;
}
}
.content1 {
margin-top: 137px;
}
.content2 {
margin-top: 143px;
}
.know-btn {
width: 200px;
height: 44px;
background: linear-gradient(90deg,rgba(241,104,57,1) 0%,rgba(220,49,81,1) 100%);
border-radius: 25.5px;
font-size: 18px;
font-weight: 700;
line-height: 44px;
text-align: center;
color: #fff;
margin-top: auto;
margin-bottom: 30px;
}
}
img.cancel {
margin-top: 20px;
}
}
}
</style>
\ No newline at end of file
<template>
<section class="first-enter-wrap" @touchmove.prevent @click.prevent>
<div class="first-enter-container">
<div class="bg-content">
<p class="title">恭喜您</p>
<p class="awards">参与活动奖励您<span>{{beanNum}}</span>勤奋分</p>
<p class="tips">奖励发放可能会有延迟</p>
<div class="know-btn" @click="cancel">我知道了</div>
</div>
<img
class="cancel"
src="~/assets/icon-dialog-cancel.png"
@click="cancel"
>
</div>
</section>
</template>
<script>
export default {
name: "index",
props: {
beanNum: {
type: Object,
default() {
return 0
}
}
},
methods: {
cancel() {
this.$emit('handlerCancel',false)
}
}
}
</script>
<style scoped lang="less">
.first-enter-wrap {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
background:rgba(0,0,0,0.5);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
.first-enter-container {
.bg-content {
width: 250px;
height: 275px;
background: url("../../assets/first-enter/first-enter-bg.png") no-repeat;
background-size: cover;
display: flex;
flex-flow: column;
.know-btn {
width: 200px;
height: 44px;
background: linear-gradient(90deg,rgba(241,104,57,1) 0%,rgba(220,49,81,1) 100%);
border-radius: 25.5px;
text-align: center;
line-height: 44px;
color: #fff;
font-size: 18px;
font-weight: 700;
margin: auto auto 30px auto;
}
p {
text-align: center;
}
.title {
color: #FD5A2F;
font-size: 18px;
font-weight: 700;
line-height: 18px;
margin: 127.5px auto 8px auto;
}
.awards {
color: #666666;
font-size: 14px;
line-height: 19px;
span {
color: #FD5A2F;
}
}
.tips {
color: #ACACAC;
font-size: 12px;
line-height: 19px;
}
}
.cancel {
display: block;
width: 30px;
height: 30px;
margin: 20px auto 0 auto;
}
}
}
</style>
\ No newline at end of file
.xb-header-container {
position: fixed;
width: 100%;
z-index: 999;
.top-header {
background: transparent;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
margin-top: 25px;
padding: 5px 0 5px;
}
.top-header.active {
background-color: #fff;
}
.top-header .left-icon {
padding: 5px 5px 5px 10px;
}
.top-header .title {
width: 206px;
height: 18px;
line-height: 18px;
margin-left: 50px;
text-align: center;
color: #fff;
font-size: 18px;
overflow: hidden;
span {
display: none;
}
}
.top-header .title.active {
color: #000;
span {
display: block;
}
}
.top-header .right-icon {
margin-left: 20px;
padding: 5px 10px 5px 25px;
}
.top-header .left-icon img,
.top-header .right-icon img {
display: block;
width: 25px;
height: 25px;
}
}
.xb-header-container.active {
background-color: #fff;
}
.home-page {
width: 100% !important;
margin-left: 0 !important;
}
\ No newline at end of file
<template>
<div :class="{ active: isScroll }" class="xb-header-container">
<div :class="{ active: isScroll }" class="top-header">
<div class="content left-icon" @click="goBack">
<img :src="headerLeftIcon" />
</div>
<div :class="{ active: isScroll }" class="content title">
<span>国际医生节特辑活动</span>
</div>
<div
v-show="isShowRightIcon"
class="content right-icon"
@click="share"
v-bp="{ component_tag: '360#360001'}">
<img :src="headerRightIcon" />
</div>
</div>
</div>
</template>
<script>
import { setCookie, getCookie, delCookie } from '@/utils/index';
import { getShareUrl } from '@/utils';
import { ENV_CONFIG } from '@/utils/enumerate';
import './index.less';
export default {
name: 'Header',
props: {
prePage: {
type: Boolean,
default: false
},
isWeb: {
type: Boolean,
default: false
},
isScroll: {
type: Boolean,
default: false
},
shareTitle1: {
type: String,
default: ''
},
shareTitle2: {
type: String,
default: ''
},
token: {
type: String,
default: ''
},
shareIconUrl: {
type: String
},
isShowRightIcon: {
type: Boolean,
default: false
},
tempId: {
type: String | Number,
default: ''
},
encryptId: {
type: String | Number,
default: ''
},
userName: {
type: String,
default: ''
},
avatarl: {
type: String,
default: ''
},
taskId: {
type: String | Number,
default: 7
}
},
computed: {
headerLeftIcon() {
return !!this.isScroll ?
'https://file.yunqueyi.com/gpranking/left-icon.png' :
'https://file.yunqueyi.com/2019/04/template/left-array.png'
},
headerRightIcon() {
return !!this.isScroll ?
'https://file.yunqueyi.com/gpranking/right-icon.png' :
'https://file.yunqueyi.com/2019/04/template/share-icon.png'
}
},
methods: {
goBack() {
if(this.prePage) {
this.$router.go(-1);
} else {
this.$rocNative.goBack();
}
},
share() {
if(!getCookie('token')) {
this.$rocNative.gotoLogin();
}else {
let shareUrl = '';
const { NUXT_ENV_APP } = process.env;
const { tempId, taskId, userName, encryptId, avatarl, token, shareTitle1, shareTitle2, shareIconUrl } = this;
shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + `/campaign_ssr/login-point?activityId=${tempId}&taskId=${taskId}&id=${encryptId}&name=${userName}&avatar=${avatarl}`;
//shareUrl = `http://10.177.10.217:3000/campaign_ssr/login-point?activityId=${tempId}&taskId=${taskId}&id=${encryptId}&name=${userName}&avatar=${avatarl}`;
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()
});
}
}
},
}
</script>
<template>
<section class="loading-wrap" @touchstart.prevent>
<div class="loading-content">
<van-loading type="spinner" color="#fff" />
</div>
</section>
</template>
<script>
export default {
data() {
return {
name: 'about'
}
}
}
</script>
<style lang="less" scoped>
.loading-wrap {
background:rgba(0,0,0,0.5);
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
.loading-content {
display: flex;
align-items: center;
justify-content: center;
}
}
</style>
\ No newline at end of file
<template>
<div class="step-container">
<span class="step-num">{{numText}}</span>
<div class="step-content">
<div class="step-text">{{stepText}}</div>
<div class="step-time">{{stepTime}}</div>
</div>
<img :class="{'img-style':stepFlag}" :src="imgSrc"/>
</div>
</template>
<script>
export default {
props: {
stepFlag: {
type: Boolean,
default: false
},
imgSrc: {
type: String,
default: ''
},
numText: {
type: Number,
default: 0
},
stepText: {
type: String,
default: ''
},
stepTime: {
type: String,
default: ''
}
}
}
</script>
<style lang="less" scoped>
.step-container {
position: relative;
display: flex;
flex-direction: row;
padding: 20px 10px 20px 0px;
.step-num {
display: inline-block;
margin-top: 7px;
font-size: 20px;
line-height: 30px;
color: #FFE8A5;
width: 30px;
height: 30px;
border: 1px solid rgba(255,232,165,0.5);
border-radius: 50%;
text-align: center;
font-weight: 700;
}
.step-content {
padding-left: 10px;
color: #FFE8A5;
.step-text {
font-size: 18px;
font-weight: 700;
padding-bottom: 8px;
}
.step-time {
font-size: 13px;
}
}
img {
width: 40px;
height: 40px;
margin-left: 70px;
}
img.img-style {
position: absolute;
right: 10px;
top: 0px;
width: 65px;
height: 65px;
}
}
</style>
\ No newline at end of file
<template>
<div class="task-activity">
<div class="task-content" v-for="(item,index) in taskList" :key="index">
<!-- timeStatus 1 进行中 2 结束 3未开始 hideEndFlag 1 结束后隐藏 2结束后不隐藏 -->
<div class="task-con" v-if="(item.timeStatus == 1 || (item.timeStatus == 2 && item.hideEndFlag == 2)) && item.resourceType != 10 && (item.resourceType != 11 || (item.resourceType == 11 && item.resourceId != 2))">
<img :src="item.defaultBackgroundImage"/>
<div class="task-item" @click="linkPage(item)">
<!-- 1.课程 2.考试 3.调查问卷 4.患者招募 5.宣教漫画 6.打卡 7.邀请 8.任务排查 9.绑定居民到微信 10.首次进入页面 11.点赞和邀请进入-->
<img v-if="item.resourceType == 1" src="../static/images/task-two-new.png" />
<img v-if="item.resourceType == 4" src="../static/images/task-five-new.png" />
<img v-if="item.resourceType == 11" src="../static/images/task-one-new.png" />
<img v-if="item.resourceType == 8" src="../static/images/task-three-new.png" />
<img v-if="item.resourceType == 9" src="../static/images/task-four-new.png" />
<div class="task-l">
<div class="task-t">{{item.ruleName}}</div>
</div>
<!-- taskFrequency 单次or累计 finishFrequency 用户完成的频率 doctorFinishFrequency 当前完成次数 -->
<div class="task-r">
<div class="task-b" v-if="handleData(item.rewardJsonInfo)[0].rewardType == 1">
{{handleData(item.rewardJsonInfo)[0].rewardQuantity}}云鹊豆/人
</div>
<div class="task-b" v-if="handleData(item.rewardJsonInfo)[0].rewardType == 2">
{{handleData(item.rewardJsonInfo)[0].rewardQuantity}}元现金红包/人
</div>
<div class="task-b" v-if="handleData(item.rewardJsonInfo)[0].rewardType == 3">
<span class="score">+{{handleData(item.rewardJsonInfo)[0].rewardQuantity}}</span>
<span v-if="item.resourceType == 11 || item.resourceType == 9">勤奋分/人</span>
<span v-if="item.resourceType == 8 && item.taskFrequency == 1">勤奋分 {{item.doctorFinishFrequency}}/{{item.finishFrequency}}</span>
<span v-if="item.resourceType == 8 && item.taskFrequency == 2">勤奋分 {{item.nowCumulativeFrequency}}/{{item.cumulativeFrequency}}</span>
<span v-if="item.resourceType == 1 && item.taskFrequency == 1">勤奋分 {{item.doctorFinishFrequency}}/{{item.finishFrequency}}</span>
<span v-if="item.resourceType == 1 && item.taskFrequency == 2">勤奋分 {{item.nowCumulativeFrequency}}/{{item.cumulativeFrequency}}</span>
<span v-if="item.resourceType == 4 && item.taskFrequency == 1">勤奋分 {{item.doctorFinishFrequency}}/{{item.finishFrequency}}</span>
<span v-if="item.resourceType == 4 && item.taskFrequency == 2">勤奋分 {{item.nowCumulativeFrequency}}/{{item.cumulativeFrequency}}</span>
</div>
<div class="task-b" v-if="handleData(item.rewardJsonInfo)[0].rewardType == 4">
{{handleData(item.rewardJsonInfo)[0].rewardQuantity}}条短信额度/人
</div>
<span class='has-bg' v-if="item.resourceType == 1 && !item.isFinish">去学习</span>
<span class='has-bg finish' v-if="(item.resourceType == 1 || item.resourceType == 8) && item.isFinish">已完成</span>
<span class='has-bg' v-if="item.resourceType == 4">去参加</span>
<span class='has-bg' v-if="item.resourceType == 11 || (item.resourceType == 8 && !item.isFinish)">去邀请</span>
<span class='has-bg' v-if="item.resourceType == 9">去绑定</span>
<!-- <div class="task-b" v-if="item.taskFrequency == 2 && (item.cumulativeFrequency > item.nowCumulativeFrequency)">进度 {{item.nowCumulativeFrequency}}/{{item.cumulativeFrequency}}</div>
<span v-if="item.taskFrequency == 2 && item.timeStatus == 1 && (item.cumulativeFrequency == item.nowCumulativeFrequency)">已完成</span>
<span class='has-bg' v-if="item.taskFrequency == 2 && item.timeStatus == 1 && (item.cumulativeFrequency > item.nowCumulativeFrequency) && item.nowCumulativeFrequency">继续完成</span>
<span class='has-bg' v-if="item.taskFrequency == 2 && item.timeStatus == 1 && !item.nowCumulativeFrequency">去完成</span> -->
</div>
</div>
</div>
</div>
<loading v-if="loadingFlag"></loading>
</div>
</template>
<script>
// asyncData fetch 在组件中无效
import { getNewActivityDesc } from '@/service';
// const cookies = require('cookie-universal')();
import { setCookie, getCookie, delCookie } from '@/utils/index';
import loading from '../components/bussiness/common-loading';
export default {
name: 'TaskActivity',
components: {
loading
},
props: {
acTempId: {
type: Number | String,
default: 0
},
acToken: {
type: String,
default: ''
},
userMobile: {
type: String,
default: ''
},
isWeb: {
type: Boolean,
default: false
}
},
watch: {
acTempId(n,o) {
if(n != o) {
this.getNewActivityDesc();
}
},
userMobile(n,o) {
if(n != o) {
this.getNewActivityDesc();
}
}
},
data() {
return {
loadingFlag: false,
taskList: [],
status: true,
statusText: '去完成',
tokenFlag: false,
textFlag: true,
clickFlag: true
}
},
created() {
// this.getNewActivityDesc();
},
methods: {
linkPage(item) {
if(!this.userMobile) {
this.$rocNative.gotoLogin();
}else {
// let flag = item.timeStatus == 1 && ((item.finishFrequency == item.doctorFinishFrequency) && item.resourceType != 8);
// let flag1 = item.timeStatus == 1 && ((item.finishFrequency == item.doctorFinishFrequency) && item.resourceType == 8 && item.resourceId == 1);
// if(item.timeStatus == 2 || flag || flag1) { // 已结束 、 已完成不可点击
// return;
// }else {
// if(!this.clickFlag) return;
// if(!this.isWeb) { this.clickFlag = false; }
let data = {
id: item.id,
href: item.linkId,
resourceType: item.resourceType
};
this.$emit('activityTaskJump', data);
// }
if(item.resourceType == 11) {
this.$sendBuriedData({
action: '分享任务',
component_tag: '360#360004'
});
}else if(item.resourceType == 1) {
this.$sendBuriedData({
action: '课程学习任务',
component_tag: '360#360005'
});
}else if(item.resourceType == 8) {
this.$sendBuriedData({
action: '排查任务',
component_tag: '360#360006'
});
}else if(item.resourceType == 9) {
this.$sendBuriedData({
action: '居民绑定任务',
component_tag: '360#360007'
});
}else if(item.resourceType == 4) {
this.$sendBuriedData({
action: 'SMO任务',
component_tag: '360#360008'
});
}
}
},
// 活动详情
getNewActivityDesc() {
this.loadingFlag = true;
let req = null;
let {acTempId, acToken} = this;
req = {
id: acTempId,
token: getCookie('token')
}
getNewActivityDesc({ id: req.id, token: req.token }).then(res => {
this.loadingFlag = false;
if(res.code == '000000') {
if(res.data.loginStatus == 2) { // 未登录 或者token失效
delCookie('token');
}
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) {
// this.taskList.splice(i,1);
// }
if(this.taskList[i].resourceType == 11 && this.taskList[i].resourceId == 1) {
this.$emit('getTaskId',{taskId: this.taskList[i].id});
}
if(this.taskList[i].resourceType == 11 && this.taskList[i].resourceId == 2) {
this.$emit('getNewTaskId',{taskId: this.taskList[i].id});
}
if(this.taskList[i].resourceType == 10) {
let score = JSON.parse(this.taskList[i].rewardJsonInfo)[0].rewardQuantity;
this.$emit('firstEnterActivity',{firstEnterScore: score});
}
}
}
})
},
// 处理数据
handleData(data) {
return JSON.parse(data)
}
}
}
</script>
<style lang="less" scoped>
.task-activity {
.task-con {
position: relative;
padding-bottom: 5px;
img {
width: 100%;
}
.task-item {
position: absolute;
left: 0;
top: 0;
width: 94%;
height: 90%;
padding: 0px 10px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
img {
width: 50px;
height: 50px;
}
.task-l {
width: 167px;
.task-t {
padding-bottom: 25px;
font-size: 16px;
color: #373839;
font-weight: 700;
}
}
.task-r {
text-align: right;
// height: 39px;
span.has-bg {
display: inline-block;
font-size: 11px;
color: #fff;
font-weight: 500;
line-height: 25px;
width: 57px;
height: 25px;
background: #C7C8C9;
border-radius: 25px;
text-align: center;
margin-top: 5px;
background:linear-gradient(270deg,rgba(255,88,36,1) 0%,rgba(254,163,86,1) 100%);
border-radius:35px;
}
span.finish {
color: #F68367;
background: rgba(253,234,228,1);
}
.task-b {
text-align: center;
font-size: 12px;
color: #979899;
span.score {
display: inline-block;
color: #CC2646;
}
// padding-top: 5px;
}
}
}
}
}
</style>
\ No newline at end of file
# LAYOUTS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Application Layouts.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
......@@ -7,7 +7,7 @@
<script>
export default {
mounted() {
this.$rocNative.appInit();
!this.$rocNative.isWeb &&this.$rocNative.appInit();
},
}
</script>
# MIDDLEWARE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your application middleware.
Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
......@@ -4,7 +4,7 @@ module.exports = {
** Headers of the page
*/
head: {
title: '云鹊医-赋能基层医生',
title: '医生节活动',
meta: [
{ charset: 'utf-8' },
// { name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui' },
......@@ -58,7 +58,7 @@ module.exports = {
** Build configuration
*/
router: {
// base: '/nuxt_ssr/' //上下文根据自己的需求自行打开修改
base: '/campaign_ssr/'
},
build: {
postcss: {
......
因为 它太大了无法显示 源差异 。您可以改为 查看blob
{
"name": "nuxt_ssr",
"name": "campaign_ssr",
"version": "1.0.0",
"description": "nuxt ssr layout",
"author": "souse",
"private": true,
"scripts": {
"test": "jest",
"dev": "cross-env NODE_ENV=development NUXT_ENV_APP=dev PORT=3000 nodemon server/index.js --watch server",
"dev": "cross-env NODE_ENV=development NUXT_ENV_APP=dev HOST=0.0.0.0 PORT=3000 nodemon server/index.js --watch server",
"build": "NUXT_ENV_APP=${ENV} nuxt build",
"start": "cross-env NUXT_ENV_APP=${ENV} HOST=0.0.0.0 PORT=3010 NODE_ENV=production node server/index.js",
"start": "cross-env NUXT_ENV_APP=${ENV} HOST=0.0.0.0 PORT=3016 NODE_ENV=production node server/index.js",
"generate": "nuxt generate"
},
"dependencies": {
"cookie-universal": "^2.0.16",
"cross-env": "^5.2.0",
"js-base64": "^2.5.1",
"jsencrypt": "^3.0.0-rc.1",
"koa": "^2.6.2",
"nuxt": "^2.0.0",
"pica-call-app": "^1.0.42",
"vant": "^2.0.9",
"web-buried-point": "^2.0.0"
"vconsole": "^3.3.4",
"web-buried-point": "^v2.1.0"
},
"devDependencies": {
"@nuxtjs/axios": "^5.5.4",
......
# PAGES
This directory contains your Application Views and Routes.
The framework reads all the `*.vue` files inside this directory and creates the router of your application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
<template>
<div class="container">
<h1>nuxt-ssr</h1>
<about />
<Header
:isWeb="isWeb"
:token="token"
:is-scroll="isScroll"
:share-title1="shareTitle1"
:share-title2="shareTitle2"
:share-icon-url="shareIconUrl"
:isShowRightIcon="isShowRightIcon"
:tempId="activityId"
:userName="userName"
:encryptId="encryptId"
:avatarl="myAvatarl"
:taskId="taskId"
/>
<!-- 顶部 -->
<div class="top-container">
<img class="rule" @click="ruleDetail" src="../static/images/rule.png" />
<img class="rank" @click="gotoRank" src="../static/images/rank.png" />
<!-- 勤奋分进度 -->
<div class="progress-container">
<div class="score-info">
<div v-if="userMobile" class="text">
<img :src="myAvatarl" />
<span class="tc">我的勤奋分<span>{{myScore}}</span></span>
<span class="bt" @click="selfInfo" v-bp="{ component_tag: '360#360002'}">个人明细<img src="../static/images/right_bg.png"/></span>
</div>
<div v-if="!userMobile" class="text">
<span class="tc">登录可参加活动</span>
<span class="bt" @click="goToLogin">去登录<img src="../static/images/right_bg.png"/></span>
</div>
</div>
<status-bar
class="progress-bar"
:userMobile="userMobile"
:minValue="myScore"
:maxValue="maxValue"/>
</div>
</div>
<!-- 活动阶段 -->
<img class="title-text st" src="../static/images/step-title.png"/>
<div class="activity-step">
<div class="step bt">
<step
:stepFlag="stepFlag"
:imgSrc="imgSrc1"
:numText="numText1"
:stepText="stepText1"
:stepTime="stepTime1"/>
<task-activity
:isWeb="isWeb"
:acToken="token"
:userMobile="userMobile"
:acTempId="activityId"
@activityTaskJump="activityTaskJump"
@getTaskId="getTaskId"
@getNewTaskId="getNewTaskId"
@firstEnterActivity="firstEnterActivity"/>
</div>
<div class="step bt">
<step
:imgSrc="imgSrc2"
:numText="numText2"
:stepText="stepText2"
:stepTime="stepTime2"/>
</div>
<div class="step">
<step
:imgSrc="imgSrc3"
:numText="numText3"
:stepText="stepText3"
:stepTime="stepTime3"/>
</div>
</div>
<img class="title-text" src="../static/images/award.png"/>
<!--瓜分云鹊豆模块———start-->
<carve-up
v-if="showCarveUp"
:isFirstCarve="isFirstCarve"
:hasQualification="hasQualification"
:beanCarveCount="beanCarveCount"
:unableReason="unableReason"
@openBag="getCarveStatus"
>
</carve-up>
<!--瓜分云鹊豆模块 ————end-->
<!--首次进入活动任务弹框———start-->
<first-enter-dialog
v-if="showFirstEnter"
:beanNum="beanNum"
@handlerCancel="cancelFirstEnter"
>
</first-enter-dialog>
<!--首次进入活动任务弹框———end-->
<!--loading动画-->
<no-ssr>
<this-loading v-if="showLoading">
</this-loading>
</no-ssr>
</div>
</template>
<script>
import request from '@/service/api'
import { getHospital } from '@/service';
import About from '../components/about';
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 CarveUp from '../components/carve-up';
import FirstEnterDialog from '../components/first-enter-dialog';
import ThisLoading from '../components/loading';
import {
checkToken,
selectAppModuleParam,
getSelfAllScore,
checkFirstEnter,
getEncryptId,
getActivityTime,
inviteFirstEnter,
getCarveStatus,
getRedPacketsLog } from "@/service";
import { setEventByModuleCode } from "@/utils"
import { ENV_CONFIG } from '@/utils/enumerate';
import { Base64 } from 'js-base64';
import { setCookie, getCookie, delCookie } from '@/utils/index';
export default {
components: {
About
},
async asyncData({ $axios }) {
console.log('index page async data');
const { data } = await request({
baseURL: 'https://sc.yunqueyi.com',
url: '/contents/template/116/widgetList?token=55122B14EAD64B77B4D65E083C994979&setEntry=true'
});
return { hos: data.model.widgetList }
TaskActivity,
Header,
Step,
StatusBar,
CarveUp,
FirstEnterDialog,
ThisLoading
},
fetch() {
console.log('index page fetch');
data() {
return {
fetch: 'fetch'
// taskTimeFlag: true, // 任务在有效时间内
isShowRightIcon: true, // 是否显示分享按钮
isLogin: false,
userMobile: '',
stepFlag: true,
isWeb: false,
activityId: 0,
token: '',
shareTitle1: '',
shareTitle2: '做任务瓜分500W云鹊豆,点一下你也能获得75分哦',
shareTitle3: '',
shareTitle4: '绑定专属医生,随时接收医生的信息和问诊资讯。',
shareIconUrl: 'https://file.yunqueyi.com/h5/images/commons/share_hd1.png',
isScroll: false,
imgSrc1: require('@/static/images/score.png'),
numText1: 1,
stepText1: '做任务拿勤奋分',
stepTime1:'3月25日10:00-4月6日24:00',
imgSrc2: require('@/static/images/beans.png'),
numText2: 2,
stepText2: '瓜分云鹊豆',
stepTime2:'4月7日17:00-4月11日24:00',
imgSrc3: require('@/static/images/get-award.png'),
numText3: 3,
stepText3: '公布排名获奖名单',
stepTime3:'4月7日17:00-4月11日24:00',
maxValue: 300,
myAvatarl: '',
myScore: 0,
showCarveUp: false, //是否展示瓜分弹框
userId: '',
userName: '',
taskId: 0,
origin: 'tims',
encryptId: '',
showFirstEnter: false, //是否展示第一次进入获得勤奋分弹框
beanNum: 0, //第一次进入奖励弹框的奖励额度
isFirstCarve: true, //红包是否是未拆状态
hasQualification: true, //是否有资格瓜分
beanCarveCount: 0, //可瓜分云鹊豆数量
unableReason: 0, //3分数不够,4未参加
isCarveTime: false, //是否是瓜分阶段
isFirstRefresh: true, //是否没有掉refresh方法
showLoading: false //是否展示loading动画
}
},
async asyncData({ $axios }) {
},
created() {
// this.$store.dispatch('searchHospital', { name: '测试' });
},
async mounted() {
let _this = this;
if (process.client) {
_this.activityId = parseInt(_this.$route.query.id) || 9;
_this.isWeb = _this.$rocNative.isWeb;
window.__refresh = function() {
_this.isFirstRefresh = false;
_this.getUserInfo();
}
}
/*判断是否是瓜分阶段*/
await _this.getCarveTime()
if(!_this.isWeb && _this.$rocNative.appInit()){
_this.getUserInfo();
};
let timeOutId = null;
window.addEventListener(
'scroll',
() => {
if (timeOutId) {
clearTimeout(timeOutId);
}
timeOutId = setTimeout(this.handleScroll, 50);
},
false
);
_this.$sendBuriedData({
action: '查看量',
component_tag: '360#360000'
});
},
mounted() {}
methods: {
handleScroll() {
// const contentDiv = document.getElementsByClassName('content-box')[1];
var scrollTop =
window.pageYOffset ||
document.documentElement.scrollTop ||
document.body.scrollTop;
// console.log(scrollTop)
if (scrollTop > 25) {
this.isScroll = true;
} else {
this.isScroll = false;
}
},
// 获取服务器当前时间
getActivityTime() {
getActivityTime().then(res => {
if(res.code == '000000') {
let nowTime = res.data;
// let lastTime = (new Date("2020/04/06 24:00:00")).getTime();
// if(lastTime < nowTime) {
// this.taskTimeFlag = false;
// }
}
});
},
async getCarveTime() {
await getActivityTime().then(res => {
if(res.code == '000000') {
let nowTime = res.data;
// let lastTime = (new Date("2020/04/06 24:00:00")).getTime();
// if(lastTime < nowTime) {
// this.taskTimeFlag = false;
// }
//判断是否到瓜分云鹊豆的时间
let carveTime = (new Date("2020/04/17 17:00:00")).getTime();//"2020/04/07 17:00:00"
if (carveTime <= nowTime) {
this.isCarveTime = true;
this.showLoading = true;
} else {
this.isCarveTime = false;
this.showLoading = false;
}
}
});
},
// 首次进入活动页面
firstEnterActivity(data) {
if(getCookie('token')) {
checkFirstEnter({
activityId: this.activityId
}).then(res => {
if(res.data == 1) { //0未知,1第一次 2非第一次
this.beanNum = data.firstEnterScore;
this.showFirstEnter = true;
}
})
}
},
getUserInfo() {
this.$rocNative
.getUserInfo()
.then(params => {
let _t = params.userToken;
let _this = this;
_this.token = params.userToken;
delCookie('token');
setCookie('token', _this.token);
checkToken({ _t }).then(res => {
if(res.code == '200000' || res.code == '200006') {
_this.userMobile = '';
delCookie('token');
if(_this.isCarveTime) { //瓜分阶段未登录先去登录
if(_this.isFirstRefresh) {
_this.$rocNative.gotoLogin();
} else {
_this.$rocNative.goBack();
}
}
}else {
_this.userMobile = params.userMobile;
delCookie('token');
setCookie('token', _this.token);
_this.getSelfAllScore();
_this.getEncryptId();
if(_this.isCarveTime) { //是瓜分阶段的话,获取用户瓜分状态及结果
_this.getRedPacketsLog();
}
}
})
});
},
// 获取加密后的doctorId
getEncryptId() {
getEncryptId().then(res => {
if( res.code == '000000' ){
this.encryptId = res.data;
}
})
},
// 获取个人信息
getSelfAllScore() {
let _this = this;
getSelfAllScore({ id: this.activityId, token: this.token }).then(res => {
if(res.code == '000000') {
_this.myAvatarl = res.data.avatarImageUrl;
_this.myScore = res.data.totalScore;
_this.userId = res.data.id;
_this.userName = res.data.name;
_this.shareTitle1 = `${_this.userName}医生邀请您为他助力`;
_this.shareTitle3 = `${_this.userName}医生邀请您绑定`;
}
})
},
// 查看活动规则
ruleDetail() {
const { NUXT_ENV_APP } = process.env;
let url = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/template_v2/?id=701';
let itemData={
"title":"",
"imageUrl":"",
"appModuleInfo":{
"code":"M300",
"type":4,
"name":"wwww",
"paramFlag":1,
"paramList":[
{
"key":"pageUrl",
"value": url,
"type":4,
"seqNo":1
}
]
}
};
rocNative.dispatchEventByModuleCode({
modeCode: itemData.appModuleInfo.code,
jsonString: itemData.appModuleInfo.paramList
})
},
// 查看排名
gotoRank() {
if(!getCookie('token')) {
this.$rocNative.gotoLogin();
}else {
let queryData = {
id: this.activityId,
token: this.token
};
this.$router.push({path: "/ranks",query: queryData});
}
this.$sendBuriedData({
action: '查看排名',
component_tag: '360#360003'
});
},
// 去登录
goToLogin() {
this.$rocNative.gotoLogin();
},
// 查看个人明细
selfInfo() {
let queryData = {
id: this.activityId,
avatarImage: this.myAvatarl,
score: this.myScore,
token: this.token
};
this.$router.push({path: "/perdetails",query: queryData});
},
// 获取点赞任务id
getTaskId(data) {
this.taskId = data.taskId;
},
// 邀请进入
getNewTaskId(data) {
this.inviteFirstEnter(data.taskId)
},
// 点赞后进入活动主页
inviteFirstEnter(a) {
inviteFirstEnter({taskId: a, activityId: this.activityId}).then(res => {});
},
// 活动任务
activityTaskJump(data) {
let shareUrl = '';
const { NUXT_ENV_APP } = process.env;
if(data.resourceType == 11) { // 邀请好友点赞
const { activityId, token, encryptId, userName, myAvatarl, shareTitle1, shareTitle2, shareIconUrl } = this;
shareUrl = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + `/campaign_ssr/login-point?activityId=${activityId}&taskId=${data.id}&id=${encryptId}&name=${userName}&avatar=${myAvatarl}`;
//shareUrl = `http://10.177.10.217:3000/campaign_ssr/login-point?activityId=${activityId}&taskId=${data.id}&id=${encryptId}&name=${userName}&avatar=${myAvatarl}`;
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) { // 绑定居民微信
const { userId, origin, activityId, shareTitle3, shareTitle4, shareIconUrl } = this;
// let doctorId = Base64.encode(userId);
shareUrl = `${ENV_CONFIG[NUXT_ENV_APP]['shareUrl']}/active_news/activity/qrcode?doctorId=${userId}&origin=${origin}&activityId=${activityId}&taskId=${data.id}`;
this.$rocNative.shareWechat({
type: 6,
shareId: 0,
shareUrl: shareUrl,
title1: shareTitle3,
title2: shareTitle4,
shareImageUrl: shareIconUrl || 'https://file.yunqueyi.com/logo.png?version=' + new Date().getTime()
});
}else {
this.jumpPage(data.href, data.id);
}
},
async jumpPage(url, id) {
const _this = this;
if (!!url) { // 判断是否有跳转
const { token, isWeb } = _this;
const { data } = await selectAppModuleParam({
id: url,
token
});
const itemData = data.model;
// 增加点击图片时候,是否有loginFlag参数,有,则校验并登录。如未登录去登录,已登录,老逻辑。
const loginFlag = this.checkLoginFlag(itemData.paramList);
if(loginFlag){
_this.$rocNative.getToken().then(res => {
const { userToken } = res;
checkToken({ token: userToken }).then(res=>{
if(res.code == '200000' || res.code == '200006') {
_this.$rocNative.gotoLogin();
}else{
_this.oldJumpHandle(itemData, userToken);
}
})
});
}else{
_this.oldJumpHandle(itemData, _this.token);
}
}
},
// 原先的点击图片跳转逻辑
oldJumpHandle(itemData, token){
if (itemData.code == 'M301') {
itemData.code = 'M300';
this.$rocNative.getToken().then(res => {
const { userToken } = res;
setCookie('token', userToken);
});
} else {
const paramList = setEventByModuleCode(
itemData,
token
);
this.$rocNative.dispatchEventByModuleCode({
modeCode: itemData.code,
jsonString: paramList
});
}
},
// 增加一个点击图片请求selectAppModuleParam这个接口时候的 loginFlag 字段校验
checkLoginFlag(paramList){
let flag = false;
for(let i=0;i<paramList.length;i++){
if(paramList[i].key === 'loginFlag' && paramList[i].value === '1'){
flag = true;
break;
}
}
return flag;
},
cancelFirstEnter(val) { //关闭首次进入活动奖励弹框
this.showFirstEnter = val;
//关闭后重新获取用户勤奋分
this.getSelfAllScore();
},
getCarveStatus() { //第一次拆红包
getCarveStatus({
activityId: this.activityId
}).then(res => {
this.isFirstCarve = false;
this.hasQualification = true;
this.beanCarveCount = res.data.score;
})
},
getRedPacketsLog() { //判断瓜分红包状态
getRedPacketsLog({
activityId: this.activityId
}).then(res => {
this.showLoading = false;
if(res.data.status == 1) { //红包未拆
this.isFirstCarve = true;
} else {
this.isFirstCarve = false;
if(res.data.status == 2) {
this.hasQualification = true;
this.beanCarveCount = res.data.totalBonus;
} else { //3分数不够,4未参加
this.hasQualification = false;
this.unableReason = res.data.status;
}
}
this.showCarveUp = true;//展示瓜分组件
})
}
}
}
</script>
......@@ -41,18 +538,92 @@ export default {
.container {
margin: 0 auto;
min-height: 100vh;
h1 {
font-size: 36px;
text-align: center;
background: #B72541;
.top-container {
position: relative;
width: 100%;
height: 264px;
background-image:url('../static/images/head_bg_new.png');
background-size: 100% 100%;
.rule {
position: absolute;
top: 75px;
right: 0px;
width: 69px;
height: 25px;
}
.rank {
position: absolute;
top: 115px;
right: 15px;
width: 40px;
}
.progress-container {
position: absolute;
left: 0;
top: 190px;
width: 94%;
margin: 0px 10px 15px;
.score-info {
padding: 0px 5px 0px 15px;
height: 48px;
background:linear-gradient(180deg,rgba(214,86,53,1) 0%,rgba(189,38,65,1) 100%);
border-radius:10px 10px 0px 0px;
.text {
line-height: 48px;
img {
float: left;
width: 30px;
height: 30px;
padding: 10px 10px 0px 0px;
}
span.tc {
font-size: 14px;
font-weight: 700;
color: #fff;
span {
padding-left: 8px;
font-size: 18px;
color: #FFE8A5;
}
}
span.bt {
font-size: 12px;
float: right;
color:#FFE8A5;
img {
float: right;
width: 10px;
height: 10px;
margin-top: 9px;
margin-left: 3px;
}
}
}
}
.progress-bar {
padding: 5px 17px;
border-radius: 0px 0px 10px 10px;
}
}
}
.m1 {
.title-text {
width: 100%;
> div {
width: 100%;
}
.title-text.st {
margin-top: 90px;
}
.activity-step {
margin: 0 10px 15px;
border-radius: 5px;
background: #9A1F36;
.step {
margin: 0 10px;
}
img {
width: 100%;
.step.bt {
border-bottom: 1PX solid rgba(255,232,165,0.2);
}
}
}
</style>
<template>
<div class="point-container">
<img class="bg-img" src="../../static/images/background.png"/>
<div class="info-text">
<img :src="avatarl" />
<p class="info-name">{{name}}邀请您助力 为他点赞</p>
<p class="info-award">做任务瓜分500万云鹊豆</p>
</div>
<div class="form-info">
<div class="field-wrap">
<label for="tel">联系方式</label>
<input id="tel" v-model="mobilePhone" type="tel" maxlength="11" placeholder="请输入手机号">
</div>
<div class="field-wrap">
<label for="captcha">图形验证码</label>
<input id="captcha" v-model="captchaAnswer" type="text" maxlength="6" placeholder="请输入">
<div class="cap-box"><img :src="captchaImg" @click="getCaptcha"></div>
</div>
<div class="field-wrap">
<label for="auth">短信验证码</label>
<input id="auth" v-model="authCode" type="tel" maxlength="6" placeholder="请输入">
<button v-if="notSend" @click="sendSms">{{btnMsg}}</button>
<van-count-down v-if="!notSend" :time="time" @finish="finishCount" :format="'ss' + 's'" />
</div>
<button class="btn-post" @click="gotoPoint" v-bp="{ component_tag: '361#360009'}">登录点赞 助力好友</button>
<loading v-if="loadingFlag"></loading>
</div>
</div>
</template>
<script>
import loading from '../../components/bussiness/common-loading';
import { getCaptchaGet, getAuthCode, pointResult, getPublicKey } from '@/service';
import { CryptoJS } from '../../utils/aes';
import { ENV_CONFIG } from '@/utils/enumerate';
const { NUXT_ENV_APP } = process.env;
const TIMEALL = 60000; // 倒计时常量 60 秒
export default {
components: {
loading
},
data() {
return {
loadingFlag: false,
notSend: true,
regMobile: /^1[3456789]\d{9}$/,
mobilePhone: '',
captchaAnswer: '', // 输入的图形验证码
captchaImg: '', // 图形验证码图片字段
authCode: '', // 短信验证码
btnMsg: '点击获取',
avatarl: '',
name: '',
userId: '',
taskId: '',
activityId: '',
captchaImg: '',
captchaToken: '',
flag: 0,
time: TIMEALL,
pubKey: ''
}
},
created() {},
mounted() {
this.activityId = parseInt(this.$route.query.activityId);
this.taskId = parseInt(this.$route.query.taskId);
this.userId = this.$route.query.id;
this.name = this.$route.query.name;
this.avatarl = this.$route.query.avatar;
this.getCaptchaGet();
this.getPublicKey();
},
methods: {
// 获取公钥
getPublicKey() {
getPublicKey().then(res => {
if(res.code == '000000') {
this.pubKey = res.data;
}
})
},
// 获取图形验证码
getCaptchaGet() {
getCaptchaGet().then(res => {
if(res.code === '000000'){
this.captchaImg = `data:image/png;base64,${res.data.content}`;
this.captchaToken = res.data.token;
}
});
},
// 点击刷新图形验证码
getCaptcha(){
getCaptchaGet().then(res=>{
if(res.code === '000000'){
this.captchaImg = `data:image/png;base64,${res.data.content}`;
this.captchaToken = res.data.token;
}else{
this.$toast(res.message);
}
})
},
// 发送获取短信验证码
sendSms(){
const { regMobile, mobilePhone, flag, captchaToken, captchaAnswer } = this;
const mobileTrue = regMobile.test(mobilePhone);
if(!mobilePhone) {
this.$toast('请填写手机号码');
return;
}
if(!mobileTrue){
this.$toast('手机号码不合法');
return;
}
// 校验图形验证码
if(this.captchaAnswer == ''){
this.$toast('请填写图形验证码');
return;
}
let data = {mobile: mobilePhone, flag, captchaToken, captchaAnswer};
let req = this.formatContent(JSON.stringify(data), this.pubKey);
getAuthCode(req).then(res=>{
// 发送成功
if(res.code === '000000'){
this.notSend = false;
}else{
this.$toast(res.message);
this.getCaptcha();
}
})
},
formatContent(content, pubKey) { // obj为具体的json传参
let aesKey = this.getAesKey(16);
let params = {
key: '',
content: ''
};
params.content = this.aesEncrypt(content, aesKey);
params.key = this.rsaEncrypt(aesKey, pubKey);
return params;
},
aesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
return encrypted.toString();
},
rsaEncrypt(aesKey, pubKey){
let _encrypt = new JSEncrypt();
let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key);
let encrypted = _encrypt.encrypt(aesKey);
return encrypted;
},
getAesKey(len) {
let aesKey = "";
let strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let strLen = strList.length;
for(let i=0; i < len; i++){
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) );
};
return aesKey;
},
// 倒计时结束
finishCount(){
this.time = TIMEALL;
this.notSend = true;
this.btnMsg = '重新获取';
},
// 点赞登录
gotoPoint() {
if(!this.mobilePhone) {
this.$toast('请填写手机号码');
return;
}
this.loadingFlag = true;
let param = {
mobile: this.mobilePhone,
authCode: this.authCode,
id: this.userId.replace(/\s/g,'+'),
taskId: this.taskId,
activityId: this.activityId
};
pointResult(param).then(res => {
this.loadingFlag = false;
if(res.code == '000000') {
if(res.data == '900001') {
this.$toast('不能给自己点赞哦');
}else {
//this.$router.push({path: "/point-result",query: {code: res.data}});
let routeData = this.$router.resolve({path: "/point-result",query: {code: res.data}});
let url = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + routeData.href
location.href = url;
}
}else if(res.code == '300000') {
this.$toast(res.message);
this.captchaAnswer = '';
this.getCaptcha();
}else {
this.$toast(res.message);
}
})
}
}
}
</script>
<style lang="less" scoped>
.point-container {
// position: fixed;
// top: 0;
// left: 0;
// background-image: url('../../static/images/background.png');
// width: 100%;
// height: auto;
// min-height: 100%;
// background-size: 100% 100%;
.bg-img {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: auto;
min-height: 100%;
}
.info-text {
position: absolute;
left: 9%;
top: 0px;
padding: 30px 0;
text-align: center;
width: 80%;
img {
display: inline-block;
width: 50px;
height: 50px;
}
.info-name {
padding: 14px 0 8px;
font-size: 20px;
font-weight: 700;
color: #fff;
text-shadow:0px 2px 10px rgba(222,77,16,1);
}
.info-award {
font-size: 13px;
color:#fff;
text-shadow:0px 2px 10px rgba(231,93,48,1);
}
}
.form-info {
position: absolute;
left: 0px;
top: 180px;
padding: 15px;
margin: 0 15px;
height: 250px;
background: #fff;
border-radius: 6px;
box-sizing: border-box;
.field-wrap{
display: flex;
justify-content: flex-start;
width: 315px;
height: 45px;
line-height: 45px;
padding: 0 20px;
box-sizing: border-box;
background:rgba(248,249,250,1);
border-radius:22.5px;
margin-bottom: 10px;
position: relative;
.cap-box{
width: 90px;
height: 35px;
top: 5px;
right: 5px;
position: absolute;
background: #D8D8D8;
border-radius: 23px;
img {
width: 100%;
height: 100%;
display: block;
border-radius:22.5px;
}
}
button {
width:60px;
height:40px;
top: 2.5px;
right: 20px;
position: absolute;
font-size:14px;
color:rgba(151,152,153,1);
line-height:40px;
background: none;
border: none;
}
label{
margin-top: 2.5px;
font-size:14px;
font-weight:700;
display: block;
width: 112px;
height: 40px;
line-height: 40px;
color:rgba(55,56,57,1);
}
input{
margin-top: 2.5px;
font-size:14px;
width: 130px;
height: 40px;
line-height:40px;
background: none;
border: none;
}
.num {
line-height: 45;
}
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color:rgba(199,200,201,1);
height: 40px;
line-height:40px;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color:rgba(199,200,201,1);
height: 40px;
line-height:40px;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color:rgba(199,200,201,1);
height: 40px;
line-height:40px;
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
color:rgba(199,200,201,1);
height: 40px;
line-height:40px;
}
}
.btn-post{
width: 315px;
height: 45px;
margin-top: 10px;
background:linear-gradient(90deg,rgba(241,104,57,1) 0%,rgba(220,49,81,1) 100%);
border-radius:22.5px;
font-size:15px;
font-weight:700;
color:rgba(255,255,255,1);
line-height:15px;
border: none;
}
}
.van-count-down, .van-divider {
line-height: 45px !important;
}
}
</style>
\ No newline at end of file
<template>
<section class="personal-detail">
<Header
:is-scroll="isScroll"
:share-title1="shareTitle1"
:share-title2="shareTitle2"
:prePage="prePage"
/>
<section class="personal-details-wrapper">
<article class="user">
<img class="user-img" src="../../assets/user-header.png" alt="">
<div class="profile">
<img :src="avatalImage" alt="">
<div class="desc">
<span class="score">{{allScore}}</span>
<span class="text">我的勤奋分</span>
</div>
</div>
</article>
<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 Header from '../../components/header';
import { getSelfActivity } from "@/service";
export default {
components: {
Header,
DetailList,
// DetailBtn
},
data() {
return {
prePage: true,
token: '222',
shareTitle1: '个人明细',
shareTitle2: '',
shareIconUrl: '',
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();
},
mounted() {
this.$sendBuriedData({
action: '查看量 ',
component_tag: '364#360017'
});
},
methods: {
goBack() {
if(this.$rocNative.isWeb) {
this.$router.go(-1);
} else {
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">
.personal-details-wrapper {
padding: 70px 0 60px;
.user {
position: relative;
top: 0;
left: 0;
z-index: 1;
&-img {
// width: 100%;
height: 114px;
}
.profile {
position: absolute;
top: 0;
left: 0;
z-index: 2;
display: flex;
flex-direction: row;
height: 90px;
margin: 0 15px;
align-items: center;
img {
width: 50px;
height: 50px;
border-radius: 25px;
}
.desc {
// flex: 1;
width: 80px;
display: flex;
flex-direction: column;
margin-left: 8px;
text-align: left;
.score {
height: 18px;
line-height: 18px;
font-size: 24px;
font-weight: 700;
color: rgba(255,232,165, 1);
}
.text {
height: 18px;
line-height: 18px;
margin-top: 6px;
font-size: 12px;
font-weight: 400;
color: #FFE8A5;
border: 1px solid rgba(255,232,165, 0.8);
border-radius: 9px;
text-align: center;
}
}
}
}
// .user-img {
// width: 100%;
// height: 114px;
// }
}
</style>
\ No newline at end of file
<template>
<section class="point-container">
<div class="point-bg">
<div class="point-status">
<img v-if="status == 1 || status == 3" src="../static/images/point-success-nobg.png" />
<img v-if="status == 2" src="../static/images/point-fail.png" />
</div>
<div class="status-text">
<p class="fw">{{pointText1}}</p>
<p class="fw">{{pointText2}}</p>
</div>
<div class="point-award">
<div v-if="status != 3" class="award-con">
<img src="../static/images/point-award-new.png" />
</div>
</div>
<div class="btn">
<button @click="openApp" v-bp="{ component_tag: '361#360010'}">{{btnText}}</button>
<button @click="downloadApp">下载APP</button>
</div>
</div>
</section>
</template>
<script>
import { ENV_CONFIG } from '@/utils/enumerate';
import { browser } from '@/utils/index';
export default {
data() {
return {
pointText1: "",
pointText2: "",
btnText: "",
code: '',
status: 1,
isWeb: false,
isWeixinWeb: false
}
},
created() {
this.code = this.$route.query.code;
if(this.code == '900002'){
this.status = 1;
this.pointText1 = "点赞成功";
this.pointText2 = "登陆云鹊医APP,您也可获得75勤奋分";
this.btnText = "打开APP参与瓜分云鹊豆";
}else if(this.code == '900008') {
this.status = 1;
this.pointText1 = "点赞成功,感谢您为TA拿下5勤奋分";
this.pointText2 = "登陆云鹊医APP,参加活动瓜分云鹊豆";
this.btnText = "打开APP参与瓜分云鹊豆";
}else if(this.code == '900004') {
this.status = 1;
this.pointText1 = "点赞成功,感谢您为TA拿下5勤奋分";
this.pointText2 = "登陆云鹊医APP,您也可获得75勤奋分";
this.btnText = "打开APP参与瓜分云鹊豆";
}else if(this.code == '900005') {
this.status = 2;
this.pointText1 = "抱歉!您的点赞次数已达3次上限!";
this.pointText2 = "登陆云鹊医APP,您也可获得75勤奋分";
this.btnText = "打开APP参与瓜分云鹊豆";
}else if(this.code == '900006') {
this.status = 3;
this.pointText1 = "该活动已结束";
this.pointText2 = "登陆云鹊医APP,查看更多精彩内容";
this.btnText = "打开APP";
}else if(this.code == '900007') {
this.status = 2;
this.pointText1 = "抱歉!您的点赞次数已达3次上限!";
this.pointText2 = "登陆云鹊医APP,参加活动瓜分云鹊豆";
this.btnText = "打开APP参与瓜分云鹊豆";
}else {
this.status = 1;
this.pointText1 = "点赞成功";
this.pointText2 = "登陆云鹊医APP,参加活动瓜分云鹊豆";
this.btnText = "打开APP参与瓜分云鹊豆";
}
},
mounted() {
this.isWeb = this.$rocNative.isWeb;
this.isWeixinWeb = browser();
if(this.isWeb && !this.isWeixinWeb) {
this.openApp();
}
},
methods: {
openApp() {
// let path = window.location.origin + window.location.hash;
const { NUXT_ENV_APP } = process.env;
let path = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + `/campaign_ssr/`;
this.$callApp(path);
},
downloadApp() {
window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque';
}
}
}
</script>
<style lang="less" scoped>
.point-container {
.point-bg {
width: 100%;
height: 100vh;
background-image:url('../static/images/result-bg.png');
background-size: 100% 100%;
}
.point-status {
padding: 35px 0 12px;
text-align: center;
img {
width: 60px;
height: 55px;
}
}
.status-text {
padding: 0px 0px 35px;
text-align: center;
p {
font-size: 18px;
line-height: 28px;
font-weight: 700;
color:#373839
}
p.fw {
color: #fff;
}
}
.point-award {
.award-con {
// background: #fff;
border-radius: 20px 20px 0px 0px;
padding: 0px 18px;
// div {
// padding: 14px;
// font-size: 15px;
// color: #DD364F;
// text-align: center;
// font-weight: 700;
// }
img {
width: 100%;
}
}
}
.btn {
text-align: center;
// background: #fff;
padding: 40px 0px 0px;
margin-top: -1px;
button {
display: inline-block;
width: 335px;
height: 40px;
border-radius: 23px;
background: none;
color: gba(255,255,255,1);
font-size: 14px;
border: none;
font-weight: 700;
}
button:first-child {
background: linear-gradient(180deg,#FFD4A7 0%,#FF6B24 100%);
color: #900822;
margin-bottom: 12px;
}
button:last-child {
color: #fff;
border: 1px solid #fff;
}
}
}
</style>
\ No newline at end of file
<template>
<section class="rank-container">
<Header
:is-scroll="isScroll"
:share-title1="shareTitle1"
:share-title2="shareTitle2"
:prePage="prePage"
/>
<!-- 我的排名 -->
<div class="rank-info">
<div class="info-text">
<div class="info-detail">
<img :src="avatarImage" />
<div class="info-name">
<span class="ft">{{name}}</span>
<span><span class="cl">{{allScore}}</span>勤奋分</span>
</div>
</div>
<div class="info-score">
<p>{{rankNum}}<span v-if="rank > 100">+</span></p>
<span class="text">我的排名</span>
</div>
</div>
<div class="rank-detail">
<div class="rank-num" v-if="firstScore">
<span class="dlot" v-if="firstScore && lastScore"></span>
<span class="num">前一名:<span class="score">{{firstScore}}</span>勤奋分</span>
</div>
<div class="line" v-if="firstScore && lastScore"></div>
<div class="rank-num" v-if="lastScore">
<span class="dlot" v-if="firstScore && lastScore"></span>
<span class="num">后一名:<span class="score">{{lastScore}}</span>勤奋分</span>
</div>
</div>
</div>
<!-- 排行榜 -->
<div class="main-content">
<div class="description"><span>排行榜</span>排名每5分钟更新1次</div>
<div class="ranking-title">
<span>TOP10</span>
<span class="marginL">用户名称</span>
<span class="marginAuto">勤奋分</span>
</div>
<div class="ranking-list">
<div class="item" v-for="(item,index) in topRankList" :key="index">
<img v-if="index<=2" :src="dealRankIcon(index)" alt="" class="ranking-icon">
<p v-else class="icon-num" >{{index+1}}</p>
<p class="doctor-name">{{item.name}}</p>
<p class="num">{{item.score}}</p>
</div>
</div>
</div>
<!-- 奖品 -->
<div class="award-container">
<div class="award-title">
<div>排名前10名奖品</div>
<span @click="allAward">全部奖品<img src="../../static/images/right.png"/></span>
</div>
<div class="awards"><img src="../../static/images/all-award.png" /></div>
</div>
<DetailBtn
v-show="true"
:needBT="needBT"
@btnClick="goBack" />
</section>
</template>
<script>
import Header from '../../components/header';
import DetailBtn from '../../components/bussiness/detail-btn';
import { ENV_CONFIG } from '@/utils/enumerate';
import { getRankData, getSelfAllScore } from '@/service';
export default {
components: {
Header,
DetailBtn
},
data() {
return {
prePage: true,
token:'',
needBT: false,
shareTitle1: '我的排名',
shareTitle2: '',
isScroll: true,
topRankList: [],
activityId: '',
avatarImage: '',
name: '',
allScore: 0,
rank: 0,
rankNum: 0,
firstScore: 0,
lastScore: 0
}
},
created() {
this.activityId = this.$route.query.id;
this.token = this.$route.query.token;
this.getRankData();
this.getSelfAllScore();
},
mounted() {
this.$sendBuriedData({
action: '查看量',
component_tag: '362#360011'
});
},
methods: {
// 获取个人信息
getSelfAllScore() {
getSelfAllScore({ id: this.activityId, token: this.token }).then(res => {
this.avatarImage = res.data.avatarImageUrl;
this.allScore = res.data.totalScore;
this.userId = res.data.id;
this.name = res.data.name;
this.rankNum = res.data.rank > 100 ? 100 : res.data.rank;
this.rank = res.data.rank;
this.firstScore = res.data.firstScore;
this.lastScore = res.data.lastScore;
})
},
// 获取排行榜数据
getRankData() {
getRankData({id: this.activityId}).then(res => {
if(res.code == '000000') {
this.topRankList = res.data;
}
})
},
dealRankIcon(index) {
if(index == 0) {
return require('../../static/images/icon-gold.png')
} else if(index == 1) {
return require('../../static/images/icon-silver.png')
} else if(index == 2) {
return require('../../static/images/icon-copper.png')
}
},
// 全部奖品
allAward(){
const { NUXT_ENV_APP } = process.env;
let url = ENV_CONFIG[NUXT_ENV_APP]['shareUrl'] + '/template_v2/?id=701';
let itemData={
"title":"",
"imageUrl":"",
"appModuleInfo":{
"code":"M300",
"type":4,
"name":"wwww",
"paramFlag":1,
"paramList":[
{
"key":"pageUrl",
"value": url,
"type":4,
"seqNo":1
}
]
}
};
rocNative.dispatchEventByModuleCode({
modeCode: itemData.appModuleInfo.code,
jsonString: itemData.appModuleInfo.paramList
})
},
goBack() {
this.$sendBuriedData({
action: '更多勤奋分按钮',
component_tag: '362#360012'
});
this.$router.go(-1);
// if(this.$rocNative.isWeb) {
// this.$router.go(-1);
// } else {
// this.$rocNative.goBack();
// }
},
}
}
</script>
<style lang="less" scoped>
.rank-container {
.rank-info {
padding-top: 70px;
height: 150px;
background-image:url('../../static/images/rank_head.png');
background-size: 100% 100%;
.info-text {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 15px 30px 13px 15px;
.info-detail {
img {
float: left;
width: 50px;
height: 50px;
}
.info-name {
display: inline-block;
padding: 7px 9px;
font-size: 14px;
color: #fff;
span {
display: block;
}
span.ft {
font-weight: 700;
padding-bottom: 2px;
}
span.cl {
display: inline-block;
color: #FFE8A5;
}
}
}
.info-score {
color: #FFE8A5;
p {
position: relative;
font-size: 26px;
text-align: center;
font-weight: 700;
span {
position: absolute;
right: 0;
top: 0;
font-size: 14px;
}
}
span.text {
display: inline-block;
width: 68px;
height: 18px;
text-align: center;
border-radius: 9px;
border:1PX solid rgba(255,232,165,1);
}
}
}
.rank-detail {
display: flex;
flex-direction: row;
justify-content: center;
margin: 0 15px 15px;
height: 30px;
background: rgba(153,31,51,1);
border-radius: 15px;
.rank-num{
padding: 6px 16px;
// line-height: 31px;
font-size: 13px;
color: #fff;
span.num {
padding-left: 3px;
}
span.dlot {
float: left;
width: 8px;
height: 8px;
margin-top: 5px;
border-radius: 50%;
transform: scale(.5);
transform-origin: 0% center;
background: #fff;
}
span.score {
color: #FFE8A5;
}
}
.line {
margin-top: 8px;
background: #fff;
width: 1PX;
height: 15px;
}
}
}
.main-content {
margin: -20px 10px 30px;
border-radius: 12px;
background: #fff;
box-shadow:0px 2px 20px 0px rgba(0,0,0,0.15);
.description {
border-radius: 12px 12px 0px 0px;
padding-left: 15px;
height: 48px;
line-height: 48px;
color: #979899;
font-size: 12px;
background: #FFF7F2;
span {
font-size: 16px;
color: #373839;
padding-right: 6px;
font-weight: 700;
font-family: Alibaba-PuHuiTi-H,Alibaba-PuHuiTi !important;
}
}
.ranking-title {
display: flex;
align-items: center;
color: #373839;
font-size: 12px;
padding: 10px 40px 8px 30px;
border-bottom: 1px solid #F8F9FA;
.marginL {
margin-left: 40px;
}
.marginAuto {
margin-left: auto;
}
}
.ranking-list {
padding: 0 15px;
.item {
display: flex;
font-size: 12px;
align-items: center;
padding: 10px 26px;
border-bottom: 1px solid #F8F9FA;
.ranking-icon {
width: 15px;
height: 15px;
}
.icon-num {
margin-left: 4px;
width: 11px;
color: #373839;
}
.doctor-name {
color: #373839;
font-size: 12px;
margin-left: 55px;
// width: 130px;
}
.num {
color:#FD5A2F;
font-size: 12px;
margin-left: auto;
text-align: center;
width: 38px;
}
}
}
}
.award-container {
margin: 0px 0px 60px 0px;
.award-title {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0px 15px 10px;
div {
font-size: 18px;
color: #28344C;
font-weight: 700;
}
span {
font-size: 12px;
color: #979899;
img {
float: right;
margin-top: 4px;
margin-left: 2px;
width: 10px;
}
}
}
.awards {
img {
width: 100%;
}
}
}
}
</style>
\ No newline at end of file
# PLUGINS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
......@@ -2,17 +2,52 @@ 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';
import { jsencrypt } from 'jsencrypt';
import {
CountDown,
Field,
Cell,
CellGroup,
Button,
Dialog,
Toast,
Checkbox,
Popup,
CheckboxGroup,
RadioGroup,
Radio,
Progress,
ImagePreview,
Uploader,
Overlay,
Loading
} from 'vant';
const { name } = require('../package.json');
const cookies = require('cookie-universal')();
const { NUXT_ENV_APP } = process.env;
if(!(process.env.NODE_ENV === 'uat' || process.env.NODE_ENV === 'pro')) {
// if(!(process.env.BUILD_ENV === 'pro')) {
let vConsole = new VConsole() // 初始化
}
Vue.prototype.$cookies = cookies;
Vue.prototype.$rocNative = new rocNative();
Vue.prototype.$sendBuriedData = sendBuriedData;
Vue.prototype.$callApp = callApp;
Vue.prototype.$jsencrypt = jsencrypt;
// Vue.use(PicaCallApp);
Vue.use(CountDown).use(Field).use(Cell).use(CellGroup).use(Button).use(Popup).use(Checkbox).use(CheckboxGroup).use(RadioGroup).use(Radio).use(Progress).use(ImagePreview).use(Uploader).use(Overlay).use(Loading);
Vue.use(Toast)
Vue.use(Dialog)
if (name === 'nuxt_ssr') throw Error('需要给当前项目起一个有意义的名称,多英文单词用 _ 拼接,不能有空格。修改文件:package.json (name)');
Vue.use(WebBuriedPoint, {
class_name: name,
class_name: name || 'campaign_ssr',
url: `${BASE_URL[NUXT_ENV_APP]}/file/log/trace1`
});
\ No newline at end of file
});
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;
},
......
......@@ -6,4 +6,150 @@ export const getHospital = async (params) => {
const str = qs.stringify(query);
return request({ url: `/api-ws/hospitals/?${str}` });
};
\ No newline at end of file
};
// 新的任务列表查询
export const getNewActivityDesc = async (data) => {
const { id, token } = data;
return request({
url: `/campaign/tims/timsActivityInfo?activityId=${id}&token=${token}&setEntry=true`,
headers: {
token
}
});
}
// token校验
export const checkToken = async({token}) => {
return request({
url: `campaign/admin/task/checkToken?token=${token}`,
withCredentials: true
})
}
// 获取跳转链接
export const selectAppModuleParam = async ({id, token }) => {
return request({
url: `/contents/contentAppModule/selectAppModuleParam?id=${id}&token=${token}&setEntry=true`,
withCredentials: true
});
}
// 活动首页个人信息
export const getSelfAllScore = async (data) => {
const { id, token } = data;
return request({
url: `campaign/rank/getTimsRankAndScore?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
}
});
}
// 个人排行榜
export const getRankData = async (data) => {
const { id } = data;
return request({
url: `campaign/rank/getTimsRankTop?activityId=${id}&topN=10`
})
}
// 获取图形验证码
export const getCaptchaGet = async () => {
return request({
url: `account/account/captcha`,
method: 'get'
})
}
// 获取公钥
export const getPublicKey = async () => {
return request({
url: `account/cipher/key`,
method: 'get'
})
}
// 获取短信验证码
export const getAuthCode = (data) => {
return request({
url: `account/account/authCode`,
method: 'post',
data: data,
})
}
// 获取加密过后的id
export const getEncryptId = () => {
return request({
url: `campaign/inviteDetail/vinci`,
method: 'get',
withCredentials: true,
})
}
// 获取时间
export const getActivityTime = () => {
return request({
url: `campaign/tims/getTodayDate`,
method: 'get'
})
}
// 第一次进入活动接口需要调的接口
export const checkFirstEnter = ( data ) => {
return request({
url: `/campaign/homepage/firstInPage?activityId=${data.activityId}`,
method: 'post',
withCredentials: true
})
}
// 获取用户拆红包接口及插红包的结果
export const getCarveStatus = ( data ) => {
return request({
url: `/campaign/redPackets/grantRedPackets`,
method: 'post',
data: data,
withCredentials: true
})
}
// 判断用户是否已经拆红包
export const getRedPacketsLog = ( params ) => {
return request({
url: `/campaign/redPackets/getRedPacketsLog`,
params: params,
withCredentials: true
})
}
// 登录点赞
export const pointResult = ( data ) => {
return request({
url: `/campaign/like/like`,
method: 'post',
data: data,
withCredentials: true
})
}
// 点赞后进入活动主页
export const inviteFirstEnter = ( data ) => {
return request({
url: `/campaign/like/activePage `,
method: 'post',
data: data,
withCredentials: true
})
}
\ No newline at end of file
# STORE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Vuex Store files.
Vuex Store option is implemented in the Nuxt.js framework.
Creating a file in this directory automatically activates the option in the framework.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
import { getHospital } from '@/service';
// import { getHospital } from '@/service';
export const state = () => ({
hospitals: []
......@@ -14,9 +14,9 @@ export const mutations = {
export const actions = {
async searchHospital({ commit }, { name }) {
getHospital({ name }).then(res => {
commit('add', res);
return res;
});
// getHospital({ name }).then(res => {
// commit('add', res);
// return res;
// });
}
};
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(u,p){var d={},l=d.lib={},s=function(){},t=l.Base={extend:function(a){s.prototype=this;var c=new s;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
r=l.WordArray=t.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=p?c:4*a.length},toString:function(a){return(a||v).stringify(this)},concat:function(a){var c=this.words,e=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var k=0;k<a;k++)c[j+k>>>2]|=(e[k>>>2]>>>24-8*(k%4)&255)<<24-8*((j+k)%4);else if(65535<e.length)for(k=0;k<a;k+=4)c[j+k>>>2]=e[k>>>2];else c.push.apply(c,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
32-8*(c%4);a.length=u.ceil(c/4)},clone:function(){var a=t.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],e=0;e<a;e+=4)c.push(4294967296*u.random()|0);return new r.init(c,a)}}),w=d.enc={},v=w.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++){var k=c[j>>>2]>>>24-8*(j%4)&255;e.push((k>>>4).toString(16));e.push((k&15).toString(16))}return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j+=2)e[j>>>3]|=parseInt(a.substr(j,
2),16)<<24-4*(j%8);return new r.init(e,c/2)}},b=w.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++)e.push(String.fromCharCode(c[j>>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j++)e[j>>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new r.init(e,c)}},x=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(b.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return b.parse(unescape(encodeURIComponent(a)))}},
q=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=x.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,e=c.words,j=c.sigBytes,k=this.blockSize,b=j/(4*k),b=a?u.ceil(b):u.max((b|0)-this._minBufferSize,0);a=b*k;j=u.min(4*a,j);if(a){for(var q=0;q<a;q+=k)this._doProcessBlock(e,q);q=e.splice(0,a);c.sigBytes-=j}return new r.init(q,j)},clone:function(){var a=t.clone.call(this);
a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:t.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){q.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,e){return(new a.init(e)).finalize(b)}},_createHmacHelper:function(a){return function(b,e){return(new n.HMAC.init(a,
e)).finalize(b)}}});var n=d.algo={};return d}(Math);
(function(){var u=CryptoJS,p=u.lib.WordArray;u.enc.Base64={stringify:function(d){var l=d.words,p=d.sigBytes,t=this._map;d.clamp();d=[];for(var r=0;r<p;r+=3)for(var w=(l[r>>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v<p;v++)d.push(t.charAt(w>>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w<
l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
(function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return(b<<j|b>>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return(b<<j|b>>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return(b<<j|b>>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return(b<<j|b>>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878])},
_doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]),
f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f,
m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m,
E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/
4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r)})(Math);
(function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length<q;){n&&s.update(n);var n=s.update(d).finalize(r);s.reset();for(var a=1;a<p;a++)n=s.finalize(n),s.reset();b.concat(n)}b.sigBytes=4*q;return b}});u.EvpKDF=function(d,l,p){return s.create(p).compute(d,
l)}})();
CryptoJS.lib.Cipher||function(u){var p=CryptoJS,d=p.lib,l=d.Base,s=d.WordArray,t=d.BufferedBlockAlgorithm,r=p.enc.Base64,w=p.algo.EvpKDF,v=d.Cipher=t.extend({cfg:l.extend(),createEncryptor:function(e,a){return this.create(this._ENC_XFORM_MODE,e,a)},createDecryptor:function(e,a){return this.create(this._DEC_XFORM_MODE,e,a)},init:function(e,a,b){this.cfg=this.cfg.extend(b);this._xformMode=e;this._key=a;this.reset()},reset:function(){t.reset.call(this);this._doReset()},process:function(e){this._append(e);return this._process()},
finalize:function(e){e&&this._append(e);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(b,k,d){return("string"==typeof k?c:a).encrypt(e,b,k,d)},decrypt:function(b,k,d){return("string"==typeof k?c:a).decrypt(e,b,k,d)}}}});d.StreamCipher=v.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var b=p.mode={},x=function(e,a,b){var c=this._iv;c?this._iv=u:c=this._prevBlock;for(var d=0;d<b;d++)e[a+d]^=
c[d]},q=(d.BlockCipherMode=l.extend({createEncryptor:function(e,a){return this.Encryptor.create(e,a)},createDecryptor:function(e,a){return this.Decryptor.create(e,a)},init:function(e,a){this._cipher=e;this._iv=a}})).extend();q.Encryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize;x.call(this,e,a,c);b.encryptBlock(e,a);this._prevBlock=e.slice(a,a+c)}});q.Decryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize,d=e.slice(a,a+c);b.decryptBlock(e,a);x.call(this,
e,a,c);this._prevBlock=d}});b=b.CBC=q;q=(p.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,l=[],n=0;n<c;n+=4)l.push(d);c=s.create(l,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,
this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?s.create([1398893684,
1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})},
decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d,
b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}})}();
(function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1}var H=[0,1,2,4,8,
16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j<a;j++)if(j<d)e[j]=c[j];else{var k=e[j-1];j%d?6<d&&4==j%d&&(k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k}c=this._invKeySchedule=[];for(d=0;d<a;d++)j=a-d,k=d%4?e[j]:e[j-4],c[d]=4>d||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>>
8&255]]^n[l[k&255]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l)},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r<m;r++)var q=d[g>>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t=
d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n},keySize:8});u.AES=p._createHelper(d)})();
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
CryptoJS.mode.ECB=function(){var a=CryptoJS.lib.BlockCipherMode.extend();a.Encryptor=a.extend({processBlock:function(a,b){this._cipher.encryptBlock(a,b)}});a.Decryptor=a.extend({processBlock:function(a,b){this._cipher.decryptBlock(a,b)}});return a}();
export {
CryptoJS
};
......@@ -32,3 +32,44 @@ export const REPONSE_CODE = {
504: '网关超时。'
};
// 其他的域名 跳转
export const ENV_CONFIG = {
dev: {
apiUrl: 'https://dev-api.yunqueyi.com',
shareUrl: 'https://dev-phome.yunqueyi.com',
topicUrl: 'https://dev-phome.yunqueyi.com/discuss',
appId: 'wxf4e66242d31c81c2', // 用于微信授权登录(张平)
noticeUrl: 'https://dev-notice.yunqueyi.com',
agreementUrl: "https://dev-scale.yunqueyi.com",
beanCenterUrl: "https://dev-phome.yunqueyi.com/integral/#/chirpCenter"
},
test: {
apiUrl: 'https://test1-api.yunqueyi.com',
shareUrl: 'https://test1-phome.yunqueyi.com',
topicUrl: 'https://test1-phome.yunqueyi.com/discuss',
appId: 'wxebc0cc65cca7694b', // 用于微信授权登录(李军)
noticeUrl: 'https://test1-notice.yunqueyi.com',
agreementUrl: "https://test1-scale.yunqueyi.com",
beanCenterUrl: "https://test1-phome.yunqueyi.com/integral/#/chirpCenter"
},
uat: {
apiUrl: 'https://uat-api.yunqueyi.com',
shareUrl: 'https://uat-phome.yunqueyi.com',
topicUrl: 'https://uat-phome.yunqueyi.com/discuss',
appId: 'wx342ef0e5afee54a7', // 用于微信授权登录(于蛟)
noticeUrl: 'https://uat-notice.yunqueyi.com',
agreementUrl: "https://uat-scale.yunqueyi.com",
beanCenterUrl: "https://uat-phome.yunqueyi.com/integral/#/chirpCenter"
},
prod: {
apiUrl: 'https://api.yunqueyi.com',
shareUrl: 'https://phome.yunqueyi.com',
topicUrl: 'https://phome.yunqueyi.com/discuss',
appId: 'wx2c577552a2d28550', // 用于微信授权登录
noticeUrl: 'https://notice.yunqueyi.com',
agreementUrl: "https://scale.yunqueyi.com",
beanCenterUrl: "https://phome.yunqueyi.com/integral/#/chirpCenter"
}
}
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, ' '));
......@@ -28,4 +29,94 @@ export const setItem = (name, value) => {
export const removeItem = name => {
if (!name) return;
sessionStorage.removeItem(name);
};
\ No newline at end of file
};
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) => {
const reg = new RegExp('(^| )' + cname + '=([^;]*)(;|$)');
const arr = document.cookie.match(reg);
return arr ? unescape(arr[2]) : null;
}
export const delCookie = (cname) => {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = getCookie(cname);
if(cval!=null){
document.cookie = 'token=; path=/; expires=' + new Date(0).toUTCString();
document.cookie = 'token=; path=/; domain=.yunqueyi.com; expires=' + new Date(0).toUTCString();
//document.cookie= name + "="+cval+";path=/;expires="+exp.toGMTString() + ";domain=" + domain;
}
}
// 判断微信
export function browser() {
let u = navigator.userAgent, app = navigator.appVersion;
let isMobile = !!u.match(/AppleWebKit.*Mobile.*/);//是否为移动终端
if(isMobile) {
var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
if (ua.match(/MicroMessenger/i) == "micromessenger") {
//在微信中打开
return true;
}
}
return false;
}
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];
}
export const getShareUrl = url => {
return `${getConfigByEvtType('shareUrl')}${url}`;
}
\ No newline at end of file
......@@ -18,16 +18,16 @@ export const JsBridgeOptions = {
NATIVE_ANDROID_NAME: '__rocAndroid',
initMethodsWithCallBack: ['getToken', 'getUserInfo', 'getLocalData'], // value is string
initMethodsWithoutCallBack: [
'gotoLogin',
'appInit',
'goBack',
'shareWechat',
'showNativeToast',
'dispatchEventByModuleCode',
'appBuryingPointEntrust',
'webLoadSuccess',
'sendBuriedPoint',
'openErrorDebug'
'gotoLogin',
'appInit',
'goBack',
'shareWechat',
'showNativeToast',
'dispatchEventByModuleCode',
'appBuryingPointEntrust',
'webLoadSuccess',
'sendBuriedPoint',
'openErrorDebug'
] // value is string
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册