|
@@ -2,7 +2,8 @@
|
|
<view class="base-container">
|
|
<view class="base-container">
|
|
<image class="tabbar" src="https://birdseye-img.sysuimars.com/dinggou-mini/tabbar-new.png" mode="" />
|
|
<image class="tabbar" src="https://birdseye-img.sysuimars.com/dinggou-mini/tabbar-new.png" mode="" />
|
|
</view>
|
|
</view>
|
|
- <up-popup :show="showPopup" mode="center" round="10" :overlay="false" :safeAreaInsetBottom="false" bgColor="transparent">
|
|
|
|
|
|
+ <up-popup :show="showPopup" mode="center" round="10" :overlay="false" :safeAreaInsetBottom="false"
|
|
|
|
+ bgColor="transparent">
|
|
<view class="popup">
|
|
<view class="popup">
|
|
<button class="avatar-none" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
|
<button class="avatar-none" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
|
<view class="avatar-wrapper">
|
|
<view class="avatar-wrapper">
|
|
@@ -13,7 +14,7 @@
|
|
</view>
|
|
</view>
|
|
</button>
|
|
</button>
|
|
<view class="tips">设置头像,可以在地图上显示自己守护树的点位哦~</view>
|
|
<view class="tips">设置头像,可以在地图上显示自己守护树的点位哦~</view>
|
|
- <button class="arrow-icon" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber">
|
|
|
|
|
|
+ <button class="arrow-icon" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">
|
|
<view class="button">微信授权</view>
|
|
<view class="button">微信授权</view>
|
|
</button>
|
|
</button>
|
|
</view>
|
|
</view>
|
|
@@ -23,93 +24,94 @@
|
|
<script setup>
|
|
<script setup>
|
|
import {
|
|
import {
|
|
ref
|
|
ref
|
|
- } from 'vue';
|
|
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
+ } from 'vue';
|
|
|
|
+ import {
|
|
|
|
+ onLoad
|
|
|
|
+ } from '@dcloudio/uni-app'
|
|
import USER from '@/api/user.js'
|
|
import USER from '@/api/user.js'
|
|
|
|
|
|
- const showPopup = ref(true);
|
|
|
|
- const userData = ref({})
|
|
|
|
- const pageUrl = ref('')
|
|
|
|
- const pageParams = ref(null)
|
|
|
|
-
|
|
|
|
- onLoad(({route_path,params = "{}"}) =>{
|
|
|
|
- pageUrl.value = route_path
|
|
|
|
- pageParams.value = params
|
|
|
|
- getUserData()
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- const getUserData = () =>{
|
|
|
|
- USER.userInfo().then(res =>{
|
|
|
|
- const timestamp = res.data.birthDate && Date.parse(res.data.birthDate); // 返回毫秒级时间戳
|
|
|
|
- userData.value = res.data
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const onChooseAvatar = (e) =>{
|
|
|
|
- const { avatarUrl } = e.detail
|
|
|
|
- // wx.showLoading({title: '上传中'})
|
|
|
|
- // upload(this.data.userInfo.id + "/" + new Date().getTime() + ".png", avatarUrl, (res) => {
|
|
|
|
- // that.setData({
|
|
|
|
- // 'userInfo.icon':BASE_IMG_DIR+res.key,
|
|
|
|
- // })
|
|
|
|
- // wx.hideLoading()
|
|
|
|
- // })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const onGetPhoneNumber = (e) =>{
|
|
|
|
- if (e.detail.code) {
|
|
|
|
- // getPhone({code:e.detail.code}).then(res =>{
|
|
|
|
- // if(res.success){
|
|
|
|
- // this.setData({'userInfo.tel':res.data})
|
|
|
|
- // that.saveUserInfo(that.data.userInfo)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url: `/pages/tabBar/home/subPages/allGardenMap?enterSelectTree=true`
|
|
|
|
- });
|
|
|
|
- }else{
|
|
|
|
- console.log("用户拒绝了授权");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const saveUserInfo = (params) =>{
|
|
|
|
- // saveUser(params).then(response =>{
|
|
|
|
- // wx.hideLoading()
|
|
|
|
- // if(response.success){
|
|
|
|
- // wx.showToast({
|
|
|
|
- // title: '保存成功',
|
|
|
|
- // icon: 'none',
|
|
|
|
- // duration: 2000,
|
|
|
|
- // mask:true
|
|
|
|
- // })
|
|
|
|
- // const params = {
|
|
|
|
- // showPopup:true
|
|
|
|
- // }
|
|
|
|
- // wx.reLaunch({
|
|
|
|
- // url: `/pages/tabBar/home/index?route_path=lj_home¶ms=${JSON.stringify(params)}`
|
|
|
|
- // })
|
|
|
|
- // }else{
|
|
|
|
- // wx.showToast({
|
|
|
|
- // title: '保存失败',
|
|
|
|
- // icon: 'none',
|
|
|
|
- // duration: 2000,
|
|
|
|
- // mask:true
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ const showPopup = ref(true);
|
|
|
|
+ const userData = ref({})
|
|
|
|
+ const pageUrl = ref('')
|
|
|
|
+ const pageParams = ref(null)
|
|
|
|
+
|
|
|
|
+ onLoad(({
|
|
|
|
+ route_path,
|
|
|
|
+ params = "{}"
|
|
|
|
+ }) => {
|
|
|
|
+ pageUrl.value = route_path
|
|
|
|
+ pageParams.value = params
|
|
|
|
+ getUserData()
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const getUserData = () => {
|
|
|
|
+ USER.userInfo().then(res => {
|
|
|
|
+ const timestamp = res.data.birthDate && Date.parse(res.data.birthDate); // 返回毫秒级时间戳
|
|
|
|
+ userData.value = res.data
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const onChooseAvatar = (e) => {
|
|
|
|
+ const {
|
|
|
|
+ avatarUrl
|
|
|
|
+ } = e.detail
|
|
|
|
+ // wx.showLoading({title: '上传中'})
|
|
|
|
+ // upload(this.data.userInfo.id + "/" + new Date().getTime() + ".png", avatarUrl, (res) => {
|
|
|
|
+ // that.setData({
|
|
|
|
+ // 'userInfo.icon':BASE_IMG_DIR+res.key,
|
|
|
|
+ // })
|
|
|
|
+ // wx.hideLoading()
|
|
|
|
+ // })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const onGetPhoneNumber = (e) => {
|
|
|
|
+ if (e.detail.code) {
|
|
|
|
+ USER.getPhone({
|
|
|
|
+ code: e.detail.code
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.success) {
|
|
|
|
+ userData.value.tel = res.data
|
|
|
|
+ saveUserInfo(userData.value)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ console.log("用户拒绝了授权");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const saveUserInfo = (params) => {
|
|
|
|
+ USER.updateUser(params).then(response => {
|
|
|
|
+ uni.hideLoading()
|
|
|
|
+ if (response.success) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '保存成功',
|
|
|
|
+ icon: 'none',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: `/pages/tabBar/home/subPages/gardenMap?enterSelectTree=true`
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '保存失败',
|
|
|
|
+ icon: 'none',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@import "@/static/style/mixin.scss";
|
|
@import "@/static/style/mixin.scss";
|
|
-
|
|
|
|
.base-container {
|
|
.base-container {
|
|
background-image: url('https://birdseye-img.sysuimars.com/dinggou-mini/login-new.png');
|
|
background-image: url('https://birdseye-img.sysuimars.com/dinggou-mini/login-new.png');
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
background-position: center center;
|
|
background-position: center center;
|
|
-
|
|
|
|
.tabbar {
|
|
.tabbar {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 112rpx;
|
|
height: 112rpx;
|
|
@@ -121,11 +123,11 @@
|
|
|
|
|
|
.popup {
|
|
.popup {
|
|
width: 86vw;
|
|
width: 86vw;
|
|
- padding: 40rpx;
|
|
|
|
|
|
+ padding: 40rpx;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
- background-image: url('https://birdseye-img.sysuimars.com/dinggou-mini/popup-bg.png');
|
|
|
|
- background-size: 100% 100%;
|
|
|
|
- background-repeat: no-repeat;
|
|
|
|
|
|
+ background-image: url('https://birdseye-img.sysuimars.com/dinggou-mini/popup-bg.png');
|
|
|
|
+ background-size: 100% 100%;
|
|
|
|
+ background-repeat: no-repeat;
|
|
background-position: center center;
|
|
background-position: center center;
|
|
|
|
|
|
.avatar-none {
|
|
.avatar-none {
|