Commit 8c8e281e by zhangzhen

功能开发优化

parent c43fb4b1
const CONFIG = {
// 开发环境配置
development: {
// assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
assetsPath: 'http://coujiao.pseer.com:8888/wechat_static', // 静态资源路径
// assetsPath: 'http://10.24.5.63:8211/static', // 静态资源路径
assetsPath: 'http://10.24.5.63:8211/static', // 静态资源路径
// baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
// hostUrl: 'http://coujiao.pseer.com:8888/prod-api', // H5地址(前端运行地址)
......
......@@ -630,6 +630,7 @@
}
console.log(this.userInfo,999999)
uni.setStorageSync('userInfo', this.userInfo)
this.$forceUpdate();
this.onGetOrderInfo();
}
})
......
<template>
<view class="user-share">
<view class="header-part">
<view v-if="loginStatus" class="flex-between">
<view class="flex-row user-info">
<image class="avatar-img" :src="userInfo.avatar|| assetsPath+'/logo_icon.png'" mode="scaleToFill">
</image>
<view class="">
<text>{{userInfo.nickName || '凑角会员_'+userName}}</text>
</view>
</view>
</view>
<view v-else class="logo-box">
<button class="cu-btn round bg-pink sm margin-left-sm" @tap.stop="onNavToLogin">立即授权绑定</button>
</view>
</view>
<view v-if="loginStatus" class="share-qrcode">
<view class="qrcode-box">
<tki-qrcode ref="qrcode" :cid="cid" :val="text" :size="size" unit="upx"
icon="../../static/logo_icon.png" :iconSize="iconSize" :onval="true" :loadMake="loadMake"
:showLoading="true" @result="qrR" />
</view>
<view class="part-bottom">
<button class="btn cu-btn bg-white" @tap="onSaveImg">
<image src="../../static/icon_album.png" mode="widthFix"></image>
<text>保存到相册</text>
</button>
<button open-type="share" class="btn cu-btn bg-blue">
<image src="../../static/share_icon_2.png" mode="widthFix"></image>
<text>分享邀请</text>
</button>
</view>
</view>
<view class="tip-rule">
<view class="flex-col">
<text class="text-black text-lg text-bold">活动介绍:</text>
<view class="margin-top-sm padding-sm">
<text>
已授权并注册过的用户,可通过此页面的分享按钮进行分享小程序,或页面内提供的二维码让新用户扫码,授权并注册成功后,分享该小程序的用户即可获得1小时时长,可在房间下单时进行抵扣;
</text>
</view>
</view>
</view>
<LoginPop ref="loginPop" @success="onSuccess" />
</view>
</template>
<script>
import LoginPop from "@/components/login/login"
import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
import config from "@/config/index.config";
import {
getUserInfo
} from "@/api/index.js"
export default {
components: {
LoginPop,
tkiQrcode
},
data() {
return {
cid: "qrCode",
qrPath: '',
text: '生成中',
size: 520,
iconSize: 52,
colorDark: '#000000',
loadMake: false,
qrPath: '',
assetsPath: config.assetsPath,
loginStatus: uni.getStorageSync('loginStatus') == 'login' ? true : false,
userInfo: '',
userName: ''
};
},
onLoad(query) {
if (query.q) {
const q = decodeURIComponent(query.q)
// let q = 'https://www.coujio.com/userShare?uid=8&act=0'
let d = q.split('?')
let c = d[1].split('&')
let obj = {};
c.forEach(item => {
let l = item.split('=');
obj[l[0]] = l[1];
})
if (obj.uid) {
uni.setStorageSync("shareUserId", obj.uid)
}
}
if (query.uid) {
uni.setStorageSync("shareUserId", query.uid)
}
if (this.loginStatus) {
this.onGetUserInfo();
}
},
onShareAppMessage() {
return {
title: "邀请扫码注册",
path: `/pages/userShare/userShare?uid=${this.userInfo.id}`,
imageUrl: this.qrPath
}
},
methods: {
onGetUserInfo() {
getUserInfo().then(res => {
if (res.data.code == 200) {
this.userInfo = {
...res.data.data,
consumerWallet: res.data.data.consumerWallet ? res.data.data.consumerWallet : {
remainingIntegral: 0
}
}
if (this.userInfo && this.userInfo.phone) {
this.userName = this.userInfo.phone.slice(-4);
}
this.text = `https://www.coujio.com/userShare?uid=${this.userInfo.id}&act=0`;
this.loadMake = true;
}
})
},
onSaveImg() {
uni.saveImageToPhotosAlbum({
filePath: this.qrPath,
success: () => {
uni.showToast({
icon: 'none',
title: '保存成功'
})
},
fail: (err) => {
console.log(err, 999)
}
})
},
qrR(r) {
console.log(r, "二维码路径")
this.qrPath = r;
},
onNavToLogin() {
this.$refs.loginPop.open();
},
onSuccess(){
uni.showToast({
icon:"none",
title:"授权登录成功"
})
this.loginStatus = uni.getStorageSync('loginStatus') == 'login' ? true : false;
this.onGetUserInfo();
}
}
}
</script>
<style lang="scss" scoped>
.user-share {
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
min-height: 100vh;
overflow-x: hidden;
background: linear-gradient(140deg, rgba(228, 5, 131, 0.16) 0%, #f1f1f1 32%, #f1f1f1 72%, rgba(228, 5, 131, 0.16) 100%);
}
.tip-rule {
display: flex;
flex: 1;
padding: 20upx 30upx;
.flex-col {
align-self: flex-end;
margin-bottom: 24upx;
}
}
.header-part {
width: 100%;
.flex-between {
display: flex;
justify-content: center;
padding: 30upx;
align-items: center;
}
.user-info {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 12upx;
}
.avatar-img {
width: 40px;
height: 40px;
border-radius: 50%;
box-shadow: 0 0 6upx #ff00ff;
margin-right: 12upx;
}
}
.qrcode-box {
width: 580upx;
background-color: #ffffff;
border-radius: 12upx;
box-shadow: 0 0 12upx #ff00ff;
padding: 20upx;
margin-top: 24upx;
}
.share-qrcode {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
.part-bottom {
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 24upx;
width: 100%;
.btn {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex: 1;
height: 88upx;
border-radius: 20upx;
margin: 0 20upx;
image {
display: block;
width: 46upx;
height: auto;
margin-right: 6upx;
}
text {
font-size: 26*1.2upx;
}
}
}
}
.logo-box {
display: flex;
justify-content: center;
align-items: center;
padding: 20upx 0;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment