Browse Source

上传代码

v1
前端-胡立永 9 months ago
parent
commit
7ebb4cf0c5
5 changed files with 74 additions and 40 deletions
  1. +23
    -8
      components/showLogin/showLogin.vue
  2. +19
    -11
      pages/center/center.vue
  3. +15
    -14
      pages/login/wxUserInfo.vue
  4. +11
    -4
      pages/payment/payment.vue
  5. +6
    -3
      store/store.js

+ 23
- 8
components/showLogin/showLogin.vue View File

@ -1,5 +1,7 @@
<template>
<uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0">
<uv-popup ref="popup"
:safeAreaInsetBottom="false"
type="bottom" round="30rpx">
<view class="toast">
<view class="title">
提示
@ -7,16 +9,13 @@
<view class="content">
本小程序需要登录之后才可以正常使用
</view>
<view class="btnstwo">
<view class="btn c" @click="cancel">
取消
</view>
<view class="btn c" @click="$store.commit('login')">
<view class="btns">
<view class="btn c" @click="login">
登录
</view>
</view>
</view>
</uni-popup>
</uv-popup>
</template>
<script setup>
@ -37,6 +36,10 @@
cancel() {
this.$refs.popup.close('center')
},
login(){
this.$store.commit('login')
this.$refs.popup.close('center')
}
}
}
@ -57,12 +60,24 @@
.content {
font-size: 28rpx;
min-height: 300rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.btns{
display: flex;
padding: 30rpx;
.btn{
flex: 1;
background: #00aaff;
border-radius: 20rpx;
color: #fff;
padding: 20rpx 0;
text-align: center;
}
}
.btnstwo {
display: flex;


+ 19
- 11
pages/center/center.vue View File

@ -4,11 +4,21 @@
<view class="content">
<view class="topBox">
<view class="users">
<view class="u-top">
<view class="u-top" v-if="userInfo.appletOpenid">
<image
:src="userInfo.headImage"
mode=""></image>
<view class="tit"
>
{{ userInfo.nickName }}
</view>
</view>
<view class="u-top" v-else>
<image
src="https://img2.baidu.com/it/u=2953585264,744730101&fm=253&fmt=auto&app=138&f=JPEG?w=360&h=360"
mode=""></image>
<view class="tit">
<view class="tit"
>
登录 / 注册
</view>
</view>
@ -49,25 +59,23 @@
<script>
import showLogin from '../../components/showLogin/showLogin.vue'
import { mapState } from 'vuex'
export default {
name : 'Center',
components : { showLogin },
computed : {
...mapState(['userInfo']),
},
data() {
return {}
},
onShow(){
this.getUserInfo()
if (!this.$refs.login.checkLogin()) {
this.$store.commit('getUserInfo')
}
},
methods: {
//
getUserInfo(){
this.$api('infoGetInfo', res => {
console.log(res);
})
}
}
}
</script>


+ 15
- 14
pages/login/wxUserInfo.vue View File

@ -66,20 +66,21 @@
.exec((res) => {
const nickName = res?.[0]?.value
self.userInfo.nickName = nickName
if (self.$utils.verificationAll(self.userInfo, {
headImage: '请选择头像',
nickName: '请填写昵称',
})) {
return
}
self.$api('infoUpdateInfo', self.userInfo, res => {
if (res.code == 200) {
uni.navigateBack(-1)
}
})
})
if (this.$utils.verificationAll(this.userInfo, {
headImage: '请选择头像',
nickName: '请填写昵称',
})) {
return
}
this.$api('infoUpdateInfo', this.userInfo, res => {
if (res.code == 200) {
uni.navigateBack(-1)
}
})
},
}
}
@ -118,7 +119,7 @@
.btn {
// background: $uni-linear-gradient-btn-color;
background: lightblue;
background: #00aaff;
color: #fff;
width: 80%;
padding: 20rpx 0;


+ 11
- 4
pages/payment/payment.vue View File

@ -20,9 +20,13 @@
</view>
<view v-if="form.money" class="tip">
折后共计{{ form.money * 0.99 }}
折后共计{{
form.money *
(configList.preferential ?
configList.preferential.keyCentent
: 1)
}}
</view>
<view class="select-money">
<view v-for="(item, index) in rechargeList" class="money-item" :key="index">
<view @click="selectMoney(item.price,index)" :class="{ 'active-money' : currentIndex == index }"
@ -49,13 +53,16 @@
<script setup>
import PrivacyAgreementPoup from "../../components/PrivacyAgreementPoup/PrivacyAgreementPoup.vue";
import showLogin from "../../components/showLogin/showLogin.vue";
import { mapState } from 'vuex'
export default {
name: 'Payment',
component: {
PrivacyAgreementPoup,
showLogin
},
computed : {
...mapState(['configList']),
},
data() {
return {
form: {
@ -88,7 +95,7 @@
this.getRechargePage()
},
methods: {
//
selectMoney(money, item) {
this.form.money = money


+ 6
- 3
store/store.js View File

@ -9,12 +9,13 @@ import api from '@/api/api.js'
const store = new Vuex.Store({
state: {
configList: {}, //配置对象
userInfo : {},
},
getters: {},
mutations: {
// 初始化配置
initConfig(state) {
let config = ['discount', 'wx']
let config = ['preferential', 'wx']
config.forEach(k => {
api('getConfig', {
keyValue : k
@ -53,9 +54,11 @@ const store = new Vuex.Store({
}
})
},
getUserInfo() {
getUserInfo(state) {
api('infoGetInfo', res => {
console.log(res);
if(res.code == 200){
state.userInfo = res.result
}
})
},
},


Loading…
Cancel
Save