|
|
@@ -8,9 +8,8 @@
|
|
|
mode="widthFix"></image>
|
|
|
<image class="activity_yh_left" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_yh_left.png"
|
|
|
mode="widthFix"></image>
|
|
|
- <image class="activity_title" v-if="collectType!=2&&isExpiry"
|
|
|
- src="https://cdn.his.cdwjyyh.com/minapp/course/activity_title.png" mode="widthFix"></image>
|
|
|
- <view class="activity_title2" v-if="!isExpiry==1&&collectType==2">
|
|
|
+ <image class="activity_title" v-if="collectType!=1&&isExpiry" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_title.png" mode="widthFix"></image>
|
|
|
+ <view class="activity_title2" v-if="!isExpiry&&collectType!=1">
|
|
|
福袋已经失效了~
|
|
|
</view>
|
|
|
<template v-if="collectType==1">
|
|
|
@@ -25,12 +24,12 @@
|
|
|
<view class="ybg"></view>
|
|
|
<image class="activity_lucky_bag" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_lucky_bag.png"
|
|
|
mode="heightFix"></image>
|
|
|
- <image class="activity_ysx" v-show="!isExpiry==1&&collectType==2"
|
|
|
+ <image class="activity_ysx" v-show="!isExpiry&&collectType!=1"
|
|
|
src="https://cdn.his.cdwjyyh.com/minapp/course/activity_ysx.png" mode="widthFix"></image>
|
|
|
<image class="activity_ylq" v-show="collectType==1"
|
|
|
src="https://cdn.his.cdwjyyh.com/minapp/course/activity_ylq.png" mode="widthFix"></image>
|
|
|
</view>
|
|
|
- <view class="activity_btn animation" v-if="collectType!=2&&isExpiry" @click="handleReceive">
|
|
|
+ <view class="activity_btn animation" v-if="collectType!=1&&isExpiry" @click="handleReceive">
|
|
|
<view class="btn">领取福袋</view>
|
|
|
<image src="https://cdn.his.cdwjyyh.com/minapp/course/activity_btn.png" mode="heightFix"></image>
|
|
|
<view class="exsct"></view>
|
|
|
@@ -58,6 +57,59 @@
|
|
|
<view class="popup-tips" style="color: #FFC05C;text-decoration-line: underline;" @click="navTo">如何下载芳华未来APP?
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
+ <u-popup :show="userlogo" mode="bottom" round='12'>
|
|
|
+ <view class="userlogo column">
|
|
|
+ <view class="mtb30 justify-start align-center ml20">
|
|
|
+ <u-avatar src="/static/logo.png" size="50"></u-avatar>
|
|
|
+ <view class="bold mlr20">丝路佳选</view>
|
|
|
+ <view>申请</view>
|
|
|
+ </view>
|
|
|
+ <view class="bold fs36 ml20">授权你的昵称头像信息</view>
|
|
|
+ <view class="mtb20 justify-between align-center plr20">
|
|
|
+ <view class="justify-start align-center">
|
|
|
+ <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
|
|
|
+ <view v-if="userinfos.nickname">
|
|
|
+ <u-icon name="checkbox-mark" color="#00aa00" size="22"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="ml20">
|
|
|
+ <view class="base-color-3 bold">第一步</view>
|
|
|
+ <view class="fs32 base-color-9">请点击授权微信昵称</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="button-container">
|
|
|
+ <input
|
|
|
+ type="nickname"
|
|
|
+ class="hidden-input"
|
|
|
+ @blur="onNickNameInput"
|
|
|
+ @input="onNickNameInput"
|
|
|
+ />
|
|
|
+ <button class="custom-button" :class="nameuser==''?'subname':'subavt'">{{nameuser?"已授权":'允许授权'}}</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- <view class="mtb20 justify-between align-center plr20 mt40">
|
|
|
+ <view class="justify-start align-center">
|
|
|
+ <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
|
|
|
+ <view v-if="userinfos.avatar">√</view>
|
|
|
+ </view>
|
|
|
+ <view class="ml20">
|
|
|
+ <view class="base-color-3 bold">第二步</view>
|
|
|
+ <view class="fs32 base-color-9">请点击授权微信头像</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="button-container">
|
|
|
+ <button open-type="chooseAvatar" @chooseavatar="onChooseAvatar" class="hidden-input"
|
|
|
+ v-if="nameuser">
|
|
|
+ 允许授权
|
|
|
+ </button>
|
|
|
+ <button class="custom-button sub" @click="shouquan" v-if="nameuser==''">允许授权</button>
|
|
|
+ <button class="custom-button " :class="avataruser==''?'subname':'subavt'"
|
|
|
+ v-else>{{avataruser?"已授权":'允许授权'}}</button>
|
|
|
+ </view>
|
|
|
+ </view> -->
|
|
|
+ <view class="submitname" @click="confimrname" :class="nameuser&&avataruser?'subact':'sub'">确定</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -65,10 +117,7 @@
|
|
|
import {
|
|
|
mapGetters
|
|
|
} from 'vuex';
|
|
|
- import {
|
|
|
- getLuckyBagInfo,
|
|
|
- receiveLuckyBag
|
|
|
- } from '@/api/course.js'
|
|
|
+ import { getLuckyBagInfo, receiveLuckyBag,loginByMp,editUser}from '@/api/course.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -78,17 +127,30 @@
|
|
|
recordId: '',
|
|
|
urlOption: {},
|
|
|
sortLink: '',
|
|
|
- corpId: null,
|
|
|
isLogin: false,
|
|
|
isLoginH5: 0, // 1服务号授权
|
|
|
- collectType: -1, // 领取状态(0-已发放 1-已领取 2-已失效)
|
|
|
+ collectType: 0, // 领取状态(0-已发放 1-已领取 2-已失效)
|
|
|
isExpiry: true, // false 失效 true 有效
|
|
|
coinAmount: 0,
|
|
|
- balance: 0
|
|
|
+ balance: 0,
|
|
|
+ chatId: '',
|
|
|
+ userlogo:false,
|
|
|
+ imgname:'',
|
|
|
+ userinfos:{
|
|
|
+ nickname:"",
|
|
|
+ avatar:""
|
|
|
+ },
|
|
|
+ btnLoading: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['coureLogin']),
|
|
|
+ nameuser() {
|
|
|
+ return this.userinfos.nickname
|
|
|
+ },
|
|
|
+ avataruser() {
|
|
|
+ return this.userinfos.avatar
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
coureLogin: {
|
|
|
@@ -109,27 +171,114 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- this.recordId = option.recordId || ''
|
|
|
- this.urlOption = option.link ? JSON.parse(decodeURIComponent(option.link)) : {},
|
|
|
- this.sortLink = this.urlOption.link || ''
|
|
|
- this.corpId = this.urlOption.corpId
|
|
|
+ this.urlOption = option.link ? JSON.parse(decodeURIComponent(option.link)) : {};
|
|
|
+ this.sortLink = this.urlOption.link || ''
|
|
|
+ this.chatId = this.urlOption.chatId || ''
|
|
|
+ this.recordId =this.urlOption.recordId || ''
|
|
|
console.log(this.sortLink)
|
|
|
+ uni.$on('usercode',(data)=>{
|
|
|
+ if(data) {
|
|
|
+ this.goLogin(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getLuckyBagInfo()
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ uni.$off('usercode')
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ uni.$off('usercode')
|
|
|
},
|
|
|
methods: {
|
|
|
- goBack() {
|
|
|
- uni.navigateBack();
|
|
|
+ //修改用户昵称以及头像
|
|
|
+ editUserA(){
|
|
|
+ this.userinfos=uni.getStorageSync('userinfos')?uni.getStorageSync('userinfos'):this.userinfos
|
|
|
+ const data={
|
|
|
+ nickName:this.userinfos.nickname,
|
|
|
+ // avatar:this.userinfos.avatar,
|
|
|
+ }
|
|
|
+ editUser(data).then(res=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.isLogin = true
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:'修改成功!',
|
|
|
+ });
|
|
|
+ setTimeout(()=>{
|
|
|
+ // this.getIsAddKf()
|
|
|
+ this.getAddCompanyUser()
|
|
|
+ },100)
|
|
|
+ }else{
|
|
|
+ uni.removeStorageSync('userinfos')
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title:res.msg+'请重新领取福袋',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ shouquan(){
|
|
|
+ if(this.userinfos.nickname==''){
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title: "请先授权微信昵称",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confimrname(){
|
|
|
+ if(this.userinfos.nickname==''){
|
|
|
+ uni.showToast({
|
|
|
+ icon:'none',
|
|
|
+ title: "请授权微信昵称",
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // if(this.userinfos.avatar==''){
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title: "请授权微信头像",
|
|
|
+ // });
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ uni.setStorageSync('userinfos',this.userinfos)
|
|
|
+ this.editUserA()
|
|
|
+ this.userlogo=false
|
|
|
+ },
|
|
|
+ onNickNameInput(e){
|
|
|
+ console.log(e)
|
|
|
+ this.userinfos.nickname=e.detail.value
|
|
|
+ },
|
|
|
+ onChooseAvatar(e){
|
|
|
+ this.userinfos.avatar=e.detail.avatarUrl
|
|
|
+ uni.uploadFile({
|
|
|
+ url: 'https://h5api.his.cdwjyyh.com'+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
|
|
|
+ filePath: e.detail.avatarUrl,
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ 'user': 'test' // 上传附带参数
|
|
|
+ },
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+ console.log(uploadFileRes)
|
|
|
+ // 根据接口具体返回格式 赋值具体对应url
|
|
|
+ var data=JSON.parse(uploadFileRes.data)
|
|
|
+ this.headImg=uni.getStorageSync('requestPath')+data.fileName
|
|
|
+ this.userinfos.avatar=data.url
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
handleReceive() {
|
|
|
+ console.log("===",this.isLoginH5)
|
|
|
if (this.isLoginH5 == 0) {
|
|
|
this.utils.isLoginCourse().then(
|
|
|
isLogin => {
|
|
|
this.isLogin = isLogin
|
|
|
+ console.log("==isLogin=",this.isLogin)
|
|
|
if (this.isLogin) {
|
|
|
// this.editUserA()
|
|
|
- if (this.chatId != '' || this.chatId) {
|
|
|
+ if (this.chatId) {
|
|
|
this.userlogo = true
|
|
|
} else {
|
|
|
- this.receiveLuckyBag(1)
|
|
|
+ this.receiveLuckyBag()
|
|
|
}
|
|
|
} else {
|
|
|
this.goLogin()
|
|
|
@@ -142,7 +291,7 @@
|
|
|
isLogin => {
|
|
|
this.isLogin = isLogin
|
|
|
if (this.isLogin) {
|
|
|
- this.receiveLuckyBag(1)
|
|
|
+ this.receiveLuckyBag()
|
|
|
} else {
|
|
|
this.goLogin()
|
|
|
}
|
|
|
@@ -150,18 +299,24 @@
|
|
|
rej => {}
|
|
|
);
|
|
|
}
|
|
|
- this.show = true
|
|
|
},
|
|
|
- receiveLuckyBag(type) {
|
|
|
+ receiveLuckyBag() {
|
|
|
+ if(this.btnLoading) {
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.showToast({
|
|
|
title: '领取中...',
|
|
|
icon: 'loading'
|
|
|
});
|
|
|
+ this.btnLoading = true
|
|
|
+ console.log("this.urlOption=",this.urlOption)
|
|
|
receiveLuckyBag({...this.urlOption}).then(res => {
|
|
|
uni.hideLoading()
|
|
|
+ this.btnLoading = false
|
|
|
if(res.code == 200) {
|
|
|
- this.coinAmount = 0
|
|
|
- this.balance = 0
|
|
|
+ this.coinAmount = res.data.coinAmount || 0
|
|
|
+ this.balance = res.data.balance || 0
|
|
|
+ this.collectType = 1
|
|
|
this.show = true
|
|
|
} else {
|
|
|
uni.showModal({
|
|
|
@@ -177,6 +332,8 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ }).catch(()=>{
|
|
|
+ this.btnLoading = false
|
|
|
})
|
|
|
},
|
|
|
navTo() {
|
|
|
@@ -190,7 +347,7 @@
|
|
|
recordId: this.recordId
|
|
|
}).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.collectType = res.data.collectType; //领取状态(0-已发放 1-已领取 2-已失效)
|
|
|
+ this.collectType = res.data.collectType || 0; //领取状态(0-已发放 1-已领取 2-已失效)
|
|
|
this.isExpiry = res.data.isExpiry; //false 失效 true 有效
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
@@ -202,7 +359,7 @@
|
|
|
},
|
|
|
goLogin(data) {
|
|
|
if (this.isLoginH5 == 0) {
|
|
|
- this.goWXLogin()
|
|
|
+ this.goWXLogin(1)
|
|
|
return
|
|
|
}
|
|
|
},
|
|
|
@@ -239,12 +396,11 @@
|
|
|
uni.setStorageSync('auto_userInfo',
|
|
|
JSON.stringify(res.user));
|
|
|
this.isLogin = true
|
|
|
- // if(this.chatId!=''||this.chatId){
|
|
|
- // this.userlogo=true
|
|
|
- // }else{
|
|
|
- // this.getLuckyBagInfo()
|
|
|
- // }
|
|
|
- this.receiveLuckyBag()
|
|
|
+ if(this.chatId){
|
|
|
+ this.userlogo=true
|
|
|
+ }else{
|
|
|
+ this.receiveLuckyBag()
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
@@ -269,6 +425,72 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+ .subname{
|
|
|
+ background-color: #00aa00;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .subavt{
|
|
|
+ background-color: #fff;
|
|
|
+ border: 2rpx #0a0 solid;
|
|
|
+ color: #00aa00;
|
|
|
+ }
|
|
|
+ .boxweixin{
|
|
|
+ width: 44rpx;
|
|
|
+ height: 44rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 34rpx;
|
|
|
+ color: #0a0;
|
|
|
+ }
|
|
|
+ .boxnosel{
|
|
|
+ border: #757575 4rpx solid;
|
|
|
+ }
|
|
|
+ .boxsel{
|
|
|
+ border: #0a0 4rpx solid;
|
|
|
+ }
|
|
|
+ .button-container {
|
|
|
+ position: relative;
|
|
|
+ width: 240rpx;
|
|
|
+ }
|
|
|
+ .hidden-input {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ opacity: 0;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
+ .custom-button {
|
|
|
+ position: relative;
|
|
|
+ z-index: 1;
|
|
|
+ /* 其他样式 */
|
|
|
+ width:100%;
|
|
|
+ margin: 0 auto;
|
|
|
+ height: 80rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ padding: 10rpx 20rpx;
|
|
|
+ }
|
|
|
+ .submitname{
|
|
|
+ width: 90%;
|
|
|
+
|
|
|
+ margin: 0 auto;
|
|
|
+ text-align: center;
|
|
|
+ padding: 30rpx;
|
|
|
+ margin-top: 40rpx;
|
|
|
+ }
|
|
|
+ .sub{
|
|
|
+ background-color: #f0f0f0;
|
|
|
+ color: #0a0;
|
|
|
+ }
|
|
|
+ .subact{
|
|
|
+ background-color: #0a0;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .userlogo{
|
|
|
+ height: 760rpx;
|
|
|
+ }
|
|
|
.exsct {
|
|
|
height: 92rpx;
|
|
|
width: 437rpx;
|