소스 검색

no message

zpj 2 년 전
부모
커밋
da995b17d3
7개의 변경된 파일과 77개의 추가작업 그리고 32개의 파일을 삭제
  1. 4 0
      api/member.js
  2. 7 1
      manifest.json
  3. 0 7
      pages-buy/save-order.vue
  4. 1 3
      pages-my/set-user-sex.vue
  5. 28 14
      pages-my/user-info.vue
  6. 19 0
      pages/index/index.vue
  7. 18 7
      pages/me/index.vue

+ 4 - 0
api/member.js

@@ -6,6 +6,10 @@ export const appletLogin = (data) => request(newsUrl + 'appletLogin', 'post', {
 
 
 // 用户详情
 // 用户详情
 export const userInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
 export const userInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
+// 更新用户信息
+export const userUpdate = (data) => request(newsUrl + 'update', 'post', { ...data },false)
+// 更新用户手机号
+export const userPhone = (data) => request(newsUrl + 'phone', 'post', { ...data },false)
 
 
 // 获取用户地址列表
 // 获取用户地址列表
 export const getAddressList = (data) => request(newsUrl + 'address', 'post', { ...data },false)
 export const getAddressList = (data) => request(newsUrl + 'address', 'post', { ...data },false)

+ 7 - 1
manifest.json

@@ -55,7 +55,13 @@
             "urlCheck" : false,
             "urlCheck" : false,
             "minified" : true
             "minified" : true
         },
         },
-        "usingComponents" : true
+        "usingComponents" : true,
+        "permission" : {
+            "scope.userLocation" : {
+                "desc" : "获取您的位置授权,用于更准确的,更快捷的为您服务"
+            }
+        },
+		"requiredPrivateInfos":["getLocation"]
     },
     },
     "mp-alipay" : {
     "mp-alipay" : {
         "usingComponents" : true
         "usingComponents" : true

+ 0 - 7
pages-buy/save-order.vue

@@ -33,16 +33,9 @@
 					</view>
 					</view>
 					<view class="box-right">
 					<view class="box-right">
 						<view class="fs-32 fw-600 text-align-right mb-12">¥19.5</view>
 						<view class="fs-32 fw-600 text-align-right mb-12">¥19.5</view>
-						<!-- <view class="fs-26  text-align-right fc-9">x1</view> -->
-						<!-- <view class="display-flex align-items-center">
-							<view class="right-only-right-red fw-500 text-align-center fs-36 fc-f">-</view>
-							<view class="right-only-right-2 text-align-center fs-28 fw-400">1</view>
-							<view class="right-only-right-add fw-500 text-align-center fs-36 fc-f">+</view>
-						</view> -->
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="box-buttom text-align-right">
 				<view class="box-buttom text-align-right">
-					<!-- <span class="fs-28 fc-9 fw-400">共5件,</span> -->
 					<span class="fs-28 fc-0 fw-400">合计¥</span>
 					<span class="fs-28 fc-0 fw-400">合计¥</span>
 					<span class="fs-44 fc-0 fw-b">{{goodsData.deposit||''}}</span>
 					<span class="fs-44 fc-0 fw-b">{{goodsData.deposit||''}}</span>
 				</view>
 				</view>

+ 1 - 3
pages-my/set-user-sex.vue

@@ -23,15 +23,13 @@
 
 
 <script>
 <script>
 	export default {
 	export default {
-		components: {},
 		data() {
 		data() {
 			return {
 			return {
 				sexList:['保密','男','女'],
 				sexList:['保密','男','女'],
 				sexId: 0
 				sexId: 0
 			};
 			};
 		},
 		},
-		onLoad(data) {},
-		mounted() {},
+		
 		methods: {
 		methods: {
 			setSex(index) {
 			setSex(index) {
 				this.sexId = index
 				this.sexId = index

+ 28 - 14
pages-my/user-info.vue

@@ -1,9 +1,9 @@
 <template>
 <template>
 	<view class="flex-common-css bgc-f">
 	<view class="flex-common-css bgc-f">
 		<Nav title="个人资料" titleColor="#333" bgckgroundBox='#fff'></Nav>
 		<Nav title="个人资料" titleColor="#333" bgckgroundBox='#fff'></Nav>
-		<scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
+		<scroll-view :scroll-y="true" class="scroll-view-css">
 			<view class="user-img-box">
 			<view class="user-img-box">
-				<image class="user-img" src="@/static/img/my/user-img.png" mode=""></image>
+				<image class="user-img" :src="userInfoData.head_img" mode=""></image>
 				<image @click="goToUrl(0)" class="set-iimg" src="@/static/img/my/pen.png" mode=""></image>
 				<image @click="goToUrl(0)" class="set-iimg" src="@/static/img/my/pen.png" mode=""></image>
 			</view>
 			</view>
 			<view class="item-info-box box-border-box">
 			<view class="item-info-box box-border-box">
@@ -13,7 +13,7 @@
 					</view>
 					</view>
 					<view class="item-right align-items-center" @click="goToUrl(1)">
 					<view class="item-right align-items-center" @click="goToUrl(1)">
 						<view class="fc-9198A2 fs-28 mr-6">
 						<view class="fc-9198A2 fs-28 mr-6">
-							仰看-1883354266
+							{{userInfoData.nickname||''}}
 						</view>
 						</view>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 					</view>
 					</view>
@@ -23,9 +23,9 @@
 						性别
 						性别
 					</view>
 					</view>
 					<view class="item-right align-items-center" @click="goToUrl(2)">
 					<view class="item-right align-items-center" @click="goToUrl(2)">
-						<view class="fc-9198A2 fs-28 mr-6">
-							保密
-						</view>
+						<view v-if="userInfoData.sex == 0" class="fc-9198A2 fs-28 mr-6">保密</view>
+						<view v-else-if="userInfoData.sex == 1" class="fc-9198A2 fs-28 mr-6">男</view>
+						<view v-else class="fc-9198A2 fs-28 mr-6">女</view>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -35,7 +35,7 @@
 					</view>
 					</view>
 					<view class="item-right align-items-center" @click="goToUrl(3)">
 					<view class="item-right align-items-center" @click="goToUrl(3)">
 						<view class="fc-9198A2 fs-28 mr-6">
 						<view class="fc-9198A2 fs-28 mr-6">
-							188******88
+							{{userInfoData.phone}}
 						</view>
 						</view>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 						<uni-icons color="#9198A2" type="right" size="20"></uni-icons>
 					</view>
 					</view>
@@ -46,15 +46,32 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import {userInfo} from '@/api/member.js'
 	import tools from '@/service/tools';
 	import tools from '@/service/tools';
 	export default {
 	export default {
-		components: {},
 		data() {
 		data() {
-			return {};
+			return {
+				userInfoData:{
+					nickname:'',
+					head_img:'',
+					phone:'',
+					sex:'',
+					msg_count:'',
+				},
+			};
+		},
+		onShow() {
+			this.getUserInfo();
 		},
 		},
-		onLoad(data) {},
-		mounted() {},
 		methods: {
 		methods: {
+			getUserInfo(){
+				userInfo().then((res)=>{
+					if(res.code === 1){
+						this.userInfoData = res.data;
+					}
+				})
+			},
+			
 			goToUrl(type) {
 			goToUrl(type) {
 				if (type === 1) {
 				if (type === 1) {
 					// 昵称
 					// 昵称
@@ -73,9 +90,6 @@
 					})
 					})
 				}
 				}
 			},
 			},
-			scrolltolower() {
-				console.log('触底');
-			},
 		},
 		},
 	}
 	}
 </script>
 </script>

+ 19 - 0
pages/index/index.vue

@@ -169,6 +169,25 @@
 		},
 		},
 		
 		
 		onShow() {
 		onShow() {
+			let lon = uni.getStorageSync('lon');
+			let lat = uni.getStorageSync('lat');
+			if(!lon||!lat){
+				uni.getLocation({
+					type:"gcj02",
+					success:(res)=>{
+						if(res.errMsg === 'getLocation:ok'){
+							uni.setStorageSync('lon',res.longitude);
+							uni.setStorageSync('lat',res.latitude);
+						}else{
+							tools.error('位置授权失败,请检查是否开始授权')
+						}
+					},
+					fail:(res)=>{
+						tools.error('位置授权失败,请检查是否开始授权')
+					},
+				})
+			}
+			
 			let school_id = uni.getStorageSync('school_id');
 			let school_id = uni.getStorageSync('school_id');
 			let operate_id = uni.getStorageSync('operate_id');
 			let operate_id = uni.getStorageSync('operate_id');
 			let school_name = uni.getStorageSync('school_name');
 			let school_name = uni.getStorageSync('school_name');

+ 18 - 7
pages/me/index.vue

@@ -4,11 +4,12 @@
 		<image class="bg-box" src="@/static/img/my/bg.png" mode=""></image>
 		<image class="bg-box" src="@/static/img/my/bg.png" mode=""></image>
 		<view class="user-box align-items-center" @click="goToUrl(0)">
 		<view class="user-box align-items-center" @click="goToUrl(0)">
 			<view class="user-img-box mr-24">
 			<view class="user-img-box mr-24">
-				<image class="user-img" src="@/static/img/my/user-img.png" mode=""></image>
+				<image v-if="userInfoData.head_img" class="user-img" :src="userInfoData.head_img" mode=""></image>
+				<image v-else class="user-img" src="@/static/img/my/user-img.png" mode=""></image>
 				<image  class="set-iimg" src="@/static/img/my/pen.png" mode=""></image>
 				<image  class="set-iimg" src="@/static/img/my/pen.png" mode=""></image>
 			</view>
 			</view>
 			<view class="user-name text-overflow-ellipsis-one fs-34">
 			<view class="user-name text-overflow-ellipsis-one fs-34">
-				{{ name }}
+				{{ userInfoData.nickname }}
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="function-one-box box-border-box">
 		<view class="function-one-box box-border-box">
@@ -62,8 +63,8 @@
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="item-right align-items-center">
 						<view class="item-right align-items-center">
-							<view class="fs-24 fc-9">
-								{{newsNum}}条未读消息
+							<view class="fs-24 fc-9" v-if="userInfoData.msg_count > 0">
+								{{userInfoData.msg_count}}条未读消息
 							</view>
 							</view>
 							<image class="to-right" src="@/static/img/toRight.png" mode=""></image>
 							<image class="to-right" src="@/static/img/toRight.png" mode=""></image>
 						</view>
 						</view>
@@ -150,19 +151,29 @@
 		components: {},
 		components: {},
 		data() {
 		data() {
 			return {
 			return {
-				name: '请先登录',
-				newsNum: 24
+				userInfoData:{
+					nickname:'',
+					head_img:'',
+					phone:'',
+					sex:'',
+					msg_count:'',
+				},
 			};
 			};
 		},
 		},
 		onShow() {
 		onShow() {
 			let token = uni.getStorageSync('token');
 			let token = uni.getStorageSync('token');
+			if(!token){
+				this.userInfoData.nickname = '请先登录'
+			}else{
+				this.getUserInfo();
+			}
 		},
 		},
 		
 		
 		methods: {
 		methods: {
 			getUserInfo(){
 			getUserInfo(){
 				userInfo().then((res)=>{
 				userInfo().then((res)=>{
 					if(res.code === 1){
 					if(res.code === 1){
-						
+						this.userInfoData = res.data;
 					}
 					}
 				})
 				})
 			},
 			},