Commit 4a711212 authored by LiZongLin's avatar LiZongLin

获取手机号

parent 1e86947b
...@@ -11,11 +11,22 @@ import { ...@@ -11,11 +11,22 @@ import {
// }) // })
// } // }
// export function getToken(code,token,userInfo) { // export function getToken(code,token,userInfo) {
// export function getToken(code,userInfo,token) {
// return request({
// url: `/wx/user/login/${code}`,
// method: 'post',
// data:userInfo,
// headers: {
// isToken : false,
// "token":token
// }
// })
// }
export function getToken(code,token) { export function getToken(code,token) {
return request({ return request({
url: `/wx/user/login/${code}`, url: `/wx/user/login/${code}`,
method: 'post', method: 'post',
// data:userInfo,
headers: { headers: {
isToken : false, isToken : false,
"token":token "token":token
...@@ -23,6 +34,14 @@ export function getToken(code,token) { ...@@ -23,6 +34,14 @@ export function getToken(code,token) {
}) })
} }
export function addPhone(customerWxLoginVo) {
return request({
url: `/wx/user/phone`,
method: 'post',
data:customerWxLoginVo
})
}
export function addUserInfo(userInfo) { export function addUserInfo(userInfo) {
return request({ return request({
...@@ -31,3 +50,5 @@ export function addUserInfo(userInfo) { ...@@ -31,3 +50,5 @@ export function addUserInfo(userInfo) {
data:userInfo data:userInfo
}) })
} }
<template> <template>
<view class="login-page"> <view class="content">
<view class="user-avatar"> <view class="info">
<image :src="avatarUrl"></image> <form @submit="formSubmit">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <view class="item">
<text>头像</text>
<!-- open-type="chooseAvatar"是最新加的属性用于获取微信头像 @chooseavatar是获取头像的回调-->
<button open-type="chooseAvatar" @chooseavatar="bindchooseavatar">
<image :src="userInfoForm.userPortrait" mode="aspectFill"></image>
</button> </button>
</view> </view>
<view style="margin: 0 4%;"> <view class="item">
<divider></divider> <text>昵称</text>
<view style="display: flex;justify-content: space-between;"> <!-- type="nickname"是最新加的属性用于获取微信昵称 @nicknamereview是校验昵称是否违规-->
<view style="width: 20%; height: 80rpx;line-height: 2.5;">昵称:</view> <input :value="userInfoForm.nickname" @nicknamereview="bindnicknamereview" name="nickname"
<input type="nickname" class="weui-input" placeholder="请输入昵称" v-model="nickName" @blur="onNickName" /> type="nickname" class="name" placeholder="请输入昵称">
</view> </view>
<divider></divider> <view class="" style="margin: 15rpx 0 40rpx 10rpx;color: #888;font-size: 26rpx;">昵称限2~32个字符,一个汉字为2个字符
</view>
<button :disabled="flag" type="primary" class="btn-login" form-type="submit">一键登录</button>
<button :disabled="flag" class="cancel-login" @click="gotoAbove()">返回</button>
<!-- <button class="btn" type="primary" form-type="submit">提交</button> -->
</form>
</view> </view>
<button class="btn-login" @click="uploadFilePromise">一键登录</button>
</view> </view>
</template> </template>
<script> <script>
import {
addUserInfo,
getToken
} from '@/api/login.js'
// 1. 按需导入 mapMutations 辅助函数
import {
mapMutations,
mapState
} from 'vuex'
function compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
}
const version = wx.getAppBaseInfo().SDKVersion
export default { export default {
data() { data() {
return { return {
avatarUrl: '../../static/logo.png', url: "",
nickName: '' userInfoForm: {
userPortrait: '../../static/logo.png',
nickname: '',
userName: '',
userSex: ''
}
// userInfo: {
// avatarUrl: '../../static/logo.png',
// nickName: '',
// }
} }
}, },
onLoad(options) {
this.url = options.url
if (compareVersion(version, '2.21.0') >= 0) {
console.log(compareVersion(version, '2.21.0'), "当前2.21.0大于此版本");
} else {
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
showCancel: false,
success: res => {
if (res.confirm) {
uni.navigateBack({
data: 1
})
}
}
})
}
if (uni.getStorageSync("userInfo")) {
this.userInfo = uni.getStorageSync("userInfo")
}
},
computed: {
...mapState('m_user', ['token'])
},
methods: { methods: {
onChooseAvatar(e) { // 2. 调用 mapMutations 辅助方法,把 m_user 模块中的 updateUserInfo 映射到当前组件中使用
console.log("头像", e.detail.avatarUrl); ...mapMutations('m_user', ['updateToken']),
// this.uploadFilePromise(e.detail.avatarUrl) ...mapMutations('m_user', ['updateUserInfo']),
this.avatarUrl = e.detail.avatarUrl //获取昵称回调
bindnicknamereview(e) {
console.log(e);
if (e.detail.pass) {
//处理逻辑
}
}, },
onNickName(e) { //获取头像回调
console.log("昵称", e.detail.value); bindchooseavatar(e) {
// this.uploadFilePromise(e.detail.value) console.log(e.detail.avatarUrl);
this.userInfoForm.userPortrait = e.detail.avatarUrl
// uni.setStorageSync("userInfo", this.userInfo)
}, },
// uploadFilePromise(value) { //提交事件
// uni.uploadFile({ formSubmit(e) {
// url: 'https://example.weixin.qq.com/upload', console.log(e);
// filePath: tempFilePaths[0], this.userInfoForm.nickname = e.detail.value.nickname
// name: 'file', console.log(this.userInfoForm);
// success(res) { if (this.userInfoForm.nickname && this.userInfoForm.userPortrait) {
// const data = res.data console.log(this.userInfoForm, '用户表单信息');
// //do something // uni.setStorageSync("userInfo", this.userInfo)
// completeMemberInfo(res.data.avatarUrl) //参数返回依接口而定 // this.updateUserInfo(this.userInfo)
// } // uni.showToast({
// icon: 'success',
// duration: 1500,
// title: '保存成功!'
// }) // })
// }, uni.login({
//接收 avatarUrl / nickName provider: 'weixin',
// completeMemberInfo(url) { success: res => {
// //接收 avatarUrl / nickName 调接口完善头像信息 console.log("uni.login res", res.code)
let code = res.code
// }, getToken(code, this.userInfoForm, this.token).then(res => {
console.log(res);
this.updateToken(res.data.token)
this.updateUserInfo(res.data.user)
uni.redirectTo({
url: this.url
})
// this.flag = false
})
}
});
} else {
uni.showToast({
icon: 'error',
duration: 1500,
title: '请填写完整!'
})
}
},
gotoAbove() {
uni.reLaunch({
url: '/pages_home/tjty_home_page/tjty_home_page',
})
}
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
.login-page { .content {
width: 100%; background: linear-gradient(226deg, #4a8ef5, #3b7cdd 100%);
height: 100vh; height: 100vh;
.user-avatar { .info {
height: 15%; height: 100%;
// margin-left: 4%; .item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 20rpx;
border-bottom: 1rpx solid #ebebeb;
height: 70rpx;
.avatar-label {
height: 100rpx; button {
width: 20%; margin: 0;
font-size: 36rpx; background: none;
font-family: Source Han Sans CN, Source Han Sans CN-Medium; padding: 0;
font-weight: 500; height: auto;
text-align: left; line-height: 1;
line-height: 2.5;
}
image { image {
height: 80rpx; width: 70rpx;
width: 80rpx; height: 70rpx;
margin-left: 44%; border-radius: 50%;
margin-top: 10%;
}
.avatar-wrapper {
position: fixed;
height: 80rpx;
width: 80rpx;
margin-left: 44%;
margin-top: -12%;
z-index: 1;
opacity: 0;
} }
} }
.weui-input{
height: 80rpx; button::after {
width: 60%; background: none !important;
margin: 0 4%; border: 0;
text-align: end; }
button .button-hover {
background: none !important;
color: none;
} }
.name {
width: 170rpx;
flex-flow: row-reverse;
}
}
}
// 登录按钮的样式
.btn-login { .btn-login {
width: 60%; position: relative;
border-radius: 100px; z-index: 1;
margin: 40px 20%; width: 400rpx;
background-color: #3b7cde; height: 88rpx;
background: #ffffff;
border-radius: 16px;
font-size: 18px;
font-family: Source Han Sans CN, Source Han Sans CN-Medium;
font-weight: 500;
text-align: center;
color: #3b7cde;
line-height: 88rpx;
top: 50%;
}
.cancel-login {
position: relative;
z-index: 1;
width: 400rpx;
height: 88rpx;
border: 1px solid #ffffff;
border-radius: 16px;
font-size: 18px;
font-family: Source Han Sans CN, Source Han Sans CN-Medium;
font-weight: 500;
text-align: center;
color: #ffffff; color: #ffffff;
line-height: 88rpx;
top: 56%;
background-color: transparent;
} }
// .btn {
// position: relative;
// z-index: 1;
// width: 400rpx;
// height: 88rpx;
// background: #ffffff;
// border-radius: 16px;
// font-size: 18px;
// font-family: Source Han Sans CN, Source Han Sans CN-Medium;
// font-weight: 500;
// text-align: center;
// color: #3b7cde;
// line-height: 88rpx;
// top: 50%;
// }
} }
</style> </style>
...@@ -4,10 +4,13 @@ ...@@ -4,10 +4,13 @@
<view class="logo-image"> <view class="logo-image">
<image src="../../static/login/denglu_logo.png" style="width: 88px;height: 88px;"></image> <image src="../../static/login/denglu_logo.png" style="width: 88px;height: 88px;"></image>
</view> </view>
<button :disabled="flag" type="primary" class="btn-login" @click="getWXUserCode()">一键登录</button> <button :disabled="flag" type="primary" class="btn-login" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">一键登录</button>
<!-- <button :disabled="flag" type="primary" class="btn-login" @click="getWXUserCode()">一键登录</button> -->
<button :disabled="flag" class="cancel-login" @click="gotoAbove()">返回</button> <button :disabled="flag" class="cancel-login" @click="gotoAbove()">返回</button>
<view class="logo-bottom"> <view class="logo-bottom">
<image src="../../static/login/pic_denglu.png" mode="aspectFit" style="width: 100%;height: 100%;"></image> <image src="../../static/login/pic_denglu.png" mode="aspectFit" style="width: 100%;height: 100%;">
</image>
</view> </view>
<!-- 提示登录的图标 --> <!-- 提示登录的图标 -->
<!-- <uni-icons type="contact-filled" size="100" color="#AFAFAF"></uni-icons> --> <!-- <uni-icons type="contact-filled" size="100" color="#AFAFAF"></uni-icons> -->
...@@ -30,7 +33,8 @@ ...@@ -30,7 +33,8 @@
<script> <script>
import { import {
addUserInfo, addUserInfo,
getToken getToken,
addPhone
} from '@/api/login.js' } from '@/api/login.js'
// 1. 按需导入 mapMutations 辅助函数 // 1. 按需导入 mapMutations 辅助函数
import { import {
...@@ -46,24 +50,67 @@ ...@@ -46,24 +50,67 @@
// openid: "", // openid: "",
// loginstate: "0", // loginstate: "0",
url: '', url: '',
userInfo: { userInfoForm: {
userPortrait: '', userPortrait: '',
nickName: '', nickName: '',
userName: '', userName: '',
userSex: '' userSex: ''
},
customerWxLoginVo: {
wechatId: '',
code: '',
encryptedData: '',
iv: ''
} }
} }
}, },
computed: { computed: {
...mapState('m_user', ['token']) ...mapState('m_user', ['token']),
...mapState('m_user', ['userInfo'])
}, },
methods: { methods: {
// 2. 调用 mapMutations 辅助方法,把 m_user 模块中的 updateUserInfo 映射到当前组件中使用 // 2. 调用 mapMutations 辅助方法,把 m_user 模块中的 updateUserInfo 映射到当前组件中使用
...mapMutations('m_user', ['updateToken']), ...mapMutations('m_user', ['updateToken']),
...mapMutations('m_user', ['updateUserInfo']), ...mapMutations('m_user', ['updateUserInfo']),
// 获取用户手机号
getPhoneNumber(e) {
this.getWXUserCode().then(()=>{
console.log(e);
this.flag = true
// this.customerWxLoginVo.wechartId = this.userInfo.wechartId
this.customerWxLoginVo.code = e.detail.code
this.customerWxLoginVo.iv = e.detail.iv
this.customerWxLoginVo.encryptedData = e.detail.encryptedData
// console.log(e.detail.errMsg) // 判断用户是否允许获取手机号
// console.log(e.detail.iv) // 参数 iv
// console.log(e.detail.encryptedData) // 参数encryptedData
if (e.detail.errMsg == "getPhoneNumber:ok") { // 用户允许或去手机号
//
console.log(this.userInfo);
console.log(this.customerWxLoginVo)
addPhone(this.customerWxLoginVo).then(res => {
console.log(res);
if (res.code == 200) {
uni.redirectTo({
url: this.url
})
this.flag = false
} else {
this.updateToken('')
this.updateUserInfo('')
uni.showToast({
title: '授权失败,请重试!'
})
this.flag = false
}
})
}
})
},
getWXUserCode() { getWXUserCode() {
return new Promise((resolve, reject) => {
console.log("点击了按钮"); console.log("点击了按钮");
this.flag = true
console.log(this.token); console.log(this.token);
console.log("获取登录信息") console.log("获取登录信息")
uni.login({ uni.login({
...@@ -72,16 +119,19 @@ ...@@ -72,16 +119,19 @@
console.log("uni.login res", res.code) console.log("uni.login res", res.code)
let code = res.code let code = res.code
getToken(code, this.token).then(res => { getToken(code, this.token).then(res => {
console.log(res); // console.log(res);
if (res.code == 200) {
this.updateToken(res.data.token) this.updateToken(res.data.token)
this.updateUserInfo(res.data.user) this.updateUserInfo(res.data.user)
uni.redirectTo({ this.customerWxLoginVo.wechatId = res.data.user.wechatId
url: this.url console.log("haha", this.customerWxLoginVo);
}) resolve()
// this.flag = false }
}) })
} }
}); });
})
}, },
gotoAbove() { gotoAbove() {
uni.reLaunch({ uni.reLaunch({
...@@ -103,15 +153,16 @@ ...@@ -103,15 +153,16 @@
success: res => { success: res => {
console.log("uni.login res", res.code) console.log("uni.login res", res.code)
let code = res.code let code = res.code
getToken(code, this.token, this.userInfo).then(res => { getToken(code, this.token).then(res => {
// console.log(this.userInfo); // console.log(this.userInfo);
this.updateToken(res.data.token) this.updateToken(res.data.token)
this.updateUserInfo(res.data.user) this.updateUserInfo(res.data.user)
this.customerWxLoginVo.wechartId = res.data.user
.wechartId
console.log("返回信息", res); console.log("返回信息", res);
uni.redirectTo({ uni.redirectTo({
url: this.url url: this.url
}) })
}) })
} }
}) })
...@@ -134,7 +185,6 @@ ...@@ -134,7 +185,6 @@
}) })
} }
}, },
onLoad(options) { onLoad(options) {
// this.getWXUserCode() // this.getWXUserCode()
this.url = options.url this.url = options.url
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<view class="info-content"> <view class="info-content">
<uni-forms ref="form" border :model="info" :modelValue="info"> <uni-forms ref="form" border :model="info" :modelValue="info">
<uni-forms-item label="姓名" required name="name"> <uni-forms-item label="姓名" required name="name">
<uni-easyinput :inputBorder="false" v-model="info.name" placeholder="请输入姓名" <uni-easyinput :inputBorder="false" v-model="info.name" placeholder="请输入姓名" :clearable="false"
:clearable="false" maxlength="16"></uni-easyinput> maxlength="16"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="性别" required> <uni-forms-item label="性别" required>
<picker @change="sexPickerChange" :value="sexIndex" :range="sexList" range-key="label" <picker @change="sexPickerChange" :value="sexIndex" :range="sexList" range-key="label"
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="项目分类" required name="projectId"> <uni-forms-item label="项目分类" required name="projectId">
<picker @change="projectPickerChange" :value="projectIndex" :range="projectList" range-key="projectName" <picker @change="projectPickerChange" :value="projectIndex" :range="projectList"
:disabled="projectDisable" @cancel="projectCancel"> range-key="projectName" :disabled="projectDisable" @cancel="projectCancel">
<view v-if="projectIndex ===projectList.length" class="uni-input">请选择项目 <view v-if="projectIndex ===projectList.length" class="uni-input">请选择项目
<uni-icons type="forward" size="16" color="#999999"></uni-icons> <uni-icons type="forward" size="16" color="#999999"></uni-icons>
</view> </view>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<uni-easyinput :inputBorder="false" v-model="realProjectFee" :disabled="true" :clearable="false"> <uni-easyinput :inputBorder="false" v-model="realProjectFee" :disabled="true" :clearable="false">
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="人数" > <uni-forms-item label="人数">
<uni-easyinput :inputBorder="false" v-model="people" :disabled="true" :clearable="false"> <uni-easyinput :inputBorder="false" v-model="people" :disabled="true" :clearable="false">
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
...@@ -55,11 +55,14 @@ ...@@ -55,11 +55,14 @@
</template> </template>
<script> <script>
import { import {
mapState mapState
} from 'vuex' } from 'vuex'
import { import {
getProjectInfo,addsignInInfo,addUnifiedOrder,addUnifiedOrderWx getProjectInfo,
addsignInInfo,
addUnifiedOrder,
addUnifiedOrderWx
} from "@/api/activity.js"; } from "@/api/activity.js";
export default { export default {
data() { data() {
...@@ -116,8 +119,7 @@ import { ...@@ -116,8 +119,7 @@ import {
} }
return true return true
} }
} } ]
]
}, },
projectIndex: { projectIndex: {
rules: [{ rules: [{
...@@ -183,7 +185,7 @@ import { ...@@ -183,7 +185,7 @@ import {
projectList: [], projectList: [],
projectCode: '', projectCode: '',
sexDisable: false, sexDisable: false,
orderVo :{ orderVo: {
signupId: null, signupId: null,
wechatId: null wechatId: null
}, },
...@@ -200,66 +202,66 @@ import { ...@@ -200,66 +202,66 @@ import {
onReady() { onReady() {
this.$refs.form.setRules(this.rules) this.$refs.form.setRules(this.rules)
}, },
computed:{ computed: {
...mapState('m_user', ['userInfo']), ...mapState('m_user', ['userInfo']),
...mapState('m_user', ['token']), ...mapState('m_user', ['token']),
realProjectFee: function(){ realProjectFee: function() {
if(this.projectIndex===this.projectList.length) if (this.projectIndex === this.projectList.length)
return '' return ''
else else
return '¥'+this.projectFee return '¥' + this.projectFee
}, },
people: function(){ people: function() {
if(this.projectIndex===this.projectList.length) if (this.projectIndex === this.projectList.length)
return '' return ''
else else
return this.projectSignupNum + '/' + this.limitPeople return this.projectSignupNum + '/' + this.limitPeople
} }
}, },
methods: { methods: {
getProjectInfo(activityId){ getProjectInfo(activityId) {
console.log(this.userInfo.wechatId) console.log(this.userInfo.wechatId)
getProjectInfo(activityId).then(response=>{ getProjectInfo(activityId).then(response => {
console.log(response) console.log(response)
this.projectList= [...this.projectList,...response.rows] this.projectList = [...this.projectList, ...response.rows]
this.projectIndex = response.rows.length this.projectIndex = response.rows.length
console.log('projectIndex'+this.projectIndex) console.log('projectIndex' + this.projectIndex)
}) })
}, },
submitForm(form) { submitForm(form) {
this.info.projectId =+ this.projectCode this.info.projectId = +this.projectCode
this.info.activityId = this.activityId this.info.activityId = this.activityId
this.info.wechatId = this.userInfo.wechatId this.info.wechatId = this.userInfo.wechatId
this.info.sex = this.sexCode this.info.sex = this.sexCode
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
if(this.sexIndex === 2){ if (this.sexIndex === 2) {
return uni.$showMsg('请选择性别!') return uni.$showMsg('请选择性别!')
} }
if(this.projectIndex === this.projectList.length){ if (this.projectIndex === this.projectList.length) {
return uni.$showMsg('请选择项目!') return uni.$showMsg('请选择项目!')
} }
if(this.projectSignupNum>=this.limitPeople){ if (this.projectSignupNum >= this.limitPeople) {
return uni.$showMsg('报名人数已满!') return uni.$showMsg('报名人数已满!')
} }
if(this.projectFee !== 0){ if (this.projectFee !== 0) {
this.info.status = '0' this.info.status = '0'
addsignInInfo(this.info).then(response=>{ addsignInInfo(this.info).then(response => {
console.log(response) //存在的话就返回报错 console.log(response) //存在的话就返回报错
if(response.code === 500) if (response.code === 500)
return uni.$showMsg(response.msg) return uni.$showMsg(response.msg)
this.orderVo.signupId = response.data.signupId this.orderVo.signupId = response.data.signupId
this.orderVo.wechatId = this.info.wechatId this.orderVo.wechatId = this.info.wechatId
addUnifiedOrder(this.orderVo).then(response =>{ addUnifiedOrder(this.orderVo).then(response => {
console.log(response) console.log(response)
uni.requestPayment({ uni.requestPayment({
provider:'wxpay', provider: 'wxpay',
timeStamp: response.data.timeStamp, timeStamp: response.data.timeStamp,
nonceStr: response.data.nonceStr, nonceStr: response.data.nonceStr,
package: response.data.package, package: response.data.package,
signType: response.data.signType, signType: response.data.signType,
paySign: response.data.paySign, paySign: response.data.paySign,
success:function(res){ success: function(res) {
console.log('success'+ JSON.stringify(res)) console.log('success' + JSON.stringify(res))
uni.showLoading({ uni.showLoading({
title: '报名成功!', title: '报名成功!',
}) })
...@@ -269,18 +271,18 @@ import { ...@@ -269,18 +271,18 @@ import {
}); });
}, 1000); }, 1000);
}, },
fail: function (err) { fail: function(err) {
console.log('fail:' + JSON.stringify(err)); console.log('fail:' + JSON.stringify(err));
} }
}) })
}) })
}) })
}else{ } else {
this.info.status = '1' this.info.status = '1'
addsignInInfo(this.info).then(response=>{ addsignInInfo(this.info).then(response => {
console.log(response) console.log(response)
if(response.code === 500) if (response.code === 500)
return uni.$showMsg(response.msg) return uni.$showMsg(response.msg)
uni.showLoading({ uni.showLoading({
title: '报名成功!', title: '报名成功!',
...@@ -298,12 +300,12 @@ import { ...@@ -298,12 +300,12 @@ import {
}, },
sexPickerChange(e) { sexPickerChange(e) {
console.log('picker发送选择改变,携带值为', e.detail) console.log('picker发送选择改变,携带值为', e.detail)
this.sexIndex =+e.detail.value this.sexIndex = +e.detail.value
this.sexCode = this.sexList[this.sexIndex].code this.sexCode = this.sexList[this.sexIndex].code
}, },
projectPickerChange(e){ projectPickerChange(e) {
console.log('picker发送选择改变,携带值为', e.detail) console.log('picker发送选择改变,携带值为', e.detail)
this.projectIndex =+e.detail.value this.projectIndex = +e.detail.value
this.projectCode = this.projectList[this.projectIndex].projectId this.projectCode = this.projectList[this.projectIndex].projectId
console.log(this.projectCode) console.log(this.projectCode)
this.projectFee = this.projectList[this.projectIndex].projectFee this.projectFee = this.projectList[this.projectIndex].projectFee
...@@ -316,7 +318,7 @@ import { ...@@ -316,7 +318,7 @@ import {
this.sexIndex = 0 this.sexIndex = 0
this.sexCode = '' this.sexCode = ''
}, },
projectCancel(e){ projectCancel(e) {
console.log(e); console.log(e);
} }
......
...@@ -81,7 +81,8 @@ ...@@ -81,7 +81,8 @@
<image style="width: 51px; height: 16px; float: right; margin-right: 11px;" <image style="width: 51px; height: 16px; float: right; margin-right: 11px;"
src="../../static/home-imgs/home_pic_gengduo@2x.png" @click="toExeMore()"></image> src="../../static/home-imgs/home_pic_gengduo@2x.png" @click="toExeMore()"></image>
</view> </view>
<view class="home_exercise_item" v-for="(item,index) in exerciseList" :key="index" @click="toAppoint(item)"> <view class="home_exercise_item" v-for="(item,index) in exerciseList" :key="index"
@click="toAppoint(item)">
<view class="ima"> <view class="ima">
<image style="width: 116px;height:116px;border-radius:16px " <image style="width: 116px;height:116px;border-radius:16px "
:src="'https://www.aiwanyundong.com/stage-api' + item.image"></image> :src="'https://www.aiwanyundong.com/stage-api' + item.image"></image>
...@@ -202,7 +203,7 @@ ...@@ -202,7 +203,7 @@
success: res => { success: res => {
console.log("uni.login res", res.code) console.log("uni.login res", res.code)
let code = res.code let code = res.code
getToken(code, this.token).then(res => { getToken(code, this.userInfo, this.token).then(res => {
// console.log(res); // console.log(res);
this.updateToken(res.data.token) this.updateToken(res.data.token)
this.updateUserInfo(res.data.user) this.updateUserInfo(res.data.user)
...@@ -237,6 +238,7 @@ ...@@ -237,6 +238,7 @@
if (!this.token) { if (!this.token) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login?url=' + this.url url: '/pages/login/login?url=' + this.url
// url: '/pages/home/home?url=' + this.url
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
...@@ -259,6 +261,7 @@ ...@@ -259,6 +261,7 @@
console.log("没有token") console.log("没有token")
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login?url=' + this.url url: '/pages/login/login?url=' + this.url
// url: '/pages/home/home?url=' + this.url
}) })
} else { } else {
if (item.type == '1') { if (item.type == '1') {
......
...@@ -157,6 +157,7 @@ ...@@ -157,6 +157,7 @@
console.log("没有token") console.log("没有token")
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login?url=' + this.url url: '/pages/login/login?url=' + this.url
// url: '/pages/home/home?url=' + this.url
}) })
} else { } else {
this.getWXUserCode() this.getWXUserCode()
...@@ -193,7 +194,7 @@ ...@@ -193,7 +194,7 @@
// console.log("uni.login res", res) // console.log("uni.login res", res)
let code = res.code let code = res.code
// getToken(code,this.token,this.userInfo).then(res => { // getToken(code,this.token,this.userInfo).then(res => {
getToken(code, this.token).then(res => { getToken(code, this.userInfo ,this.token).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.updateToken(res.data.token) this.updateToken(res.data.token)
this.updateUserInfo(res.data.user) this.updateUserInfo(res.data.user)
......
...@@ -74,7 +74,7 @@ import { userInfo } from 'os'; ...@@ -74,7 +74,7 @@ import { userInfo } from 'os';
...mapState('m_user', ['userInfo']), ...mapState('m_user', ['userInfo']),
}, },
onLoad() { onLoad() {
this.wechatId=userInfo.wechatId this.wechatId=this.userInfo.wechatId
this.getList(this.wechatId) this.getList(this.wechatId)
}, },
methods:{ methods:{
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
console.log("token", this.token); console.log("token", this.token);
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login?url=' + this.url url: '/pages/login/login?url=' + this.url
// url: '/pages/home/home?url=' + this.url
}) })
} else { } else {
this.getWXUserCode() this.getWXUserCode()
......
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