创建小程序
This commit is contained in:
@@ -0,0 +1,389 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<image class="headimg" src="/static/image/minebg.png" mode=""></image>
|
||||
<view class="content">
|
||||
<view class="contop">
|
||||
<view class="">
|
||||
<!-- <image class="userimg" :src="userinfo.avatar_pull" mode="" @tap="getUserProfile"></image> -->
|
||||
<image class="userimg" :src="userinfo.avatar_pull" mode="" @click="changinfo"></image>
|
||||
<!-- <image class="userimg" src="/static/image/mine/user.png" mode=""></image> -->
|
||||
</view>
|
||||
<view class="right" @click="changinfo">
|
||||
{{userinfo.nickname}}
|
||||
|
||||
</view>
|
||||
<image class="lineimg" src="/static/image/mine/line.png" mode=""></image>
|
||||
</view>
|
||||
<view class="bottomCon">
|
||||
<view class="sonContent" @click="navTo('/pages/mine/my_favorites')">
|
||||
<!-- <image class="son-img-bg" src="/static/image/mine/icon1.png"></image> -->
|
||||
<span>我的发布</span>
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
<view class="sonContent" @click="navTo('/pages/mine/my_release')">
|
||||
<!-- <image class="son-img-bg" src="/static/image/mine/icon2.png"></image> -->
|
||||
<span>我的收藏</span>
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
<view class="sonContent" @click="navTo('/pages/mine/my_newmsg')">
|
||||
<!-- <image class="son-img-bg" src="/static/image/mine/icon3.png"></image> -->
|
||||
<span>最新消息</span>
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="foots">
|
||||
<view class="btns" @click="goout()">退出登录</view>
|
||||
</view>
|
||||
<view>
|
||||
<u-popup :show="show" :closeOnClickOverlay="false" :round="20" mode="center">
|
||||
<view class="popupcontent">
|
||||
<image class="log1" src="/static/image/log1.png"></image>
|
||||
<view class="title">{{$t('home.loginmsg')}}</view>
|
||||
<view class="yhxy">
|
||||
<checkbox-group name="" style="width: 28px;display: inline-block;">
|
||||
<label @tap="selfChangde()">
|
||||
<checkbox :checked="selfChecked" activeBackgroundColor="#3F435B" style="transform:scale(0.7);border-radius: 50%"/>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
{{$t('home.argin')}}<text class="xy" @click="gouser">{{$t('home.UserAgreement')}}</text>{{$t('home.and')}}<text class="xy" @click="goprivacy">{{$t('home.Privacy')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cent">
|
||||
<button class="btn1" @click="show = !show">{{$t('cancel')}}</button>
|
||||
<button v-if="selfChecked" class="btn" open-type="getPhoneNumber" @click="show = !show" @getphonenumber="getPhoneNumber">{{$t('login')}}</button>
|
||||
<button v-else class="btn" @click="loginbtn">{{$t('login')}}</button>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userinfo:'',
|
||||
selfChecked: false,
|
||||
is_login:uni.getStorageSync('is_login'),
|
||||
show: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
onShow() {
|
||||
uni.setTabBarItem({ index:0, text:this.$t('tabbar.home') })
|
||||
uni.setTabBarItem({ index:1, text:this.$t('tabbar.square') })
|
||||
uni.setTabBarItem({ index:2, text:this.$t('tabbar.publish') })
|
||||
uni.setTabBarItem({ index:3, text:this.$t('tabbar.mine') })
|
||||
this.getinfo()
|
||||
uni.removeStorageSync('carlistinfo')
|
||||
uni.removeStorageSync('newcarinfo')
|
||||
uni.removeStorageSync('edtcarinfo')
|
||||
},
|
||||
methods: {
|
||||
getUserProfile() {
|
||||
uni.getUserProfile({
|
||||
desc: '用于完善资料',
|
||||
success: res => {
|
||||
this.bcFn(res.userInfo)
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '用户拒绝授权',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
bcFn(userInfo){
|
||||
request({
|
||||
url:'common/user/update',
|
||||
method:'POST',
|
||||
data:{
|
||||
nickname:userInfo.nickName,
|
||||
avatar:userInfo.avatarUrl
|
||||
}
|
||||
}).then(res => {
|
||||
this.getinfo()
|
||||
})
|
||||
},
|
||||
goprivacy(){
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/agreement',// 替换为你要跳转的页面路径
|
||||
});
|
||||
},
|
||||
gouser(){
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/agreementuser',// 替换为你要跳转的页面路径
|
||||
});
|
||||
},
|
||||
getinfo(){
|
||||
request({
|
||||
url:'common/user/info',
|
||||
method:'POST',
|
||||
}).then(res => {
|
||||
this.userinfo=res.data.data.user
|
||||
})
|
||||
},
|
||||
selfChangde(e) {
|
||||
this.selfChecked = !this.selfChecked;
|
||||
},
|
||||
loginbtn(){
|
||||
if(!this.selfChecked){
|
||||
uni.showToast({
|
||||
title:this.$t('home.arginimg'),
|
||||
icon: 'none'
|
||||
});
|
||||
return false
|
||||
}
|
||||
},
|
||||
getPhoneNumber(e) {
|
||||
let that = this;
|
||||
request({
|
||||
url:'miniapp/phone',
|
||||
method:'POST',
|
||||
data:{
|
||||
phone_code: e.detail.code,
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.code == -1) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
} else if (res.data.code == 200) {
|
||||
//返回数据接收成功
|
||||
uni.showToast({
|
||||
title:this.$t('messagesucc'),
|
||||
icon: 'none'
|
||||
});
|
||||
uni.setStorageSync('is_login', true);
|
||||
setTimeout(function () {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
leftClick(){
|
||||
uni.navigateBack({})
|
||||
},
|
||||
changinfo(){
|
||||
if(uni.getStorageSync('is_login')){
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/changinfo'
|
||||
});
|
||||
}else{
|
||||
this.show = true
|
||||
}
|
||||
|
||||
},
|
||||
navTo(url) {
|
||||
if(uni.getStorageSync('is_login')){
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
}else{
|
||||
this.show = true
|
||||
}
|
||||
},
|
||||
goout(){
|
||||
uni.clearStorageSync();
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.headimg{
|
||||
width: 100%;
|
||||
height: 276rpx;
|
||||
}
|
||||
.content{
|
||||
padding: 12px;
|
||||
margin-top: -180rpx;
|
||||
.contop{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 25px;
|
||||
font-size: 34rpx;
|
||||
color: white;
|
||||
.right{
|
||||
margin-left: 15px;
|
||||
max-width: 50%;
|
||||
font-size: 28rpx;
|
||||
color: #6B7280;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
.conbot{
|
||||
position: relative;
|
||||
color: #F4C493;
|
||||
font-size: 32rpx;
|
||||
.logimg{
|
||||
position: absolute;
|
||||
top: 60rpx;
|
||||
left: 57rpx;
|
||||
image{
|
||||
width: 100rpx;
|
||||
height:100rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.company{
|
||||
position: absolute;
|
||||
top: 24%;
|
||||
left: 300rpx;
|
||||
}
|
||||
.tel{
|
||||
position: absolute;
|
||||
top: 57%;
|
||||
left: 300rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.foots{
|
||||
margin-top: 100rpx;
|
||||
position: fixed;
|
||||
bottom: 40px;
|
||||
width: 100%;
|
||||
}
|
||||
.btns{
|
||||
background: #ccc;
|
||||
text-align: center;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 20px;
|
||||
margin: 0px 12px;
|
||||
}
|
||||
.slot-image {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
/* #endif */
|
||||
margin-right: 10px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.userimg{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.lineimg{
|
||||
width: 30px;
|
||||
height:22px;
|
||||
}
|
||||
.timg{
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
}
|
||||
.bottomCon {
|
||||
margin-top: 40rpx;
|
||||
color: #000;
|
||||
font-weight: 400;
|
||||
// padding: 0 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
// border-radius: 22rpx;
|
||||
// background: #FFFFFF;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: column;
|
||||
|
||||
.sonTitle {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 36rpx;
|
||||
border-bottom: 2rpx solid #F3F3F3;
|
||||
}
|
||||
.sonContent {
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
padding: 32rpx 28rpx;
|
||||
color: #000;
|
||||
margin-bottom: 10px;
|
||||
.son-img-bg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -20rpx;
|
||||
left: 12;
|
||||
}
|
||||
span {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.popupcontent{
|
||||
// background: url(/static/image/log0.png);
|
||||
background-size: 100% 100%;
|
||||
padding: 26px 15px;
|
||||
text-align: center;
|
||||
background-repeat: no-repeat;
|
||||
.title{
|
||||
color: #333333;
|
||||
font-size: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
.log1{
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
}
|
||||
.yhxy{
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
margin-bottom: 5px;
|
||||
.xy{
|
||||
color: #297EFF;
|
||||
}
|
||||
}
|
||||
.qxbtn{
|
||||
width: 99%;
|
||||
}
|
||||
.cent{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
padding: 0px 10px 20px;
|
||||
.btn1{
|
||||
background-color: #fff;
|
||||
border: 1px solid #3F435B;
|
||||
color: #3F435B;
|
||||
border-radius: 50px;
|
||||
width: 46%;
|
||||
margin: 10px 0px 20px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
.btn{
|
||||
background-color: #3F435B;
|
||||
color: white;
|
||||
border-radius: 50px;
|
||||
width: 46%;
|
||||
margin: 10px 0px 20px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user