提交 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
此差异已折叠。
# 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: {
......
此差异已折叠。
{
"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>
<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
此差异已折叠。
# 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;
// });
}
};
此差异已折叠。
......@@ -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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册