Преглед изворни кода

Merge branch 'master' of http://47.92.161.104:10080/zkx/JP-ChargeTeam51

# Conflicts:
#	pages.json
zxz пре 3 година
родитељ
комит
71bb75a904
5 измењених фајлова са 391 додато и 185 уклоњено
  1. 172 142
      pages.json
  2. 43 9
      pages/article/newsNotice.vue
  3. 76 4
      pages/index/index.vue
  4. 99 29
      pages/login/login.vue
  5. 1 1
      pages/user/message.vue

+ 172 - 142
pages.json

@@ -1,166 +1,181 @@
-{
-	"easycom": {
-			"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
-		},
-	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages	
-		{
-			"name":"充电中",
-			"path": "pages/index/index",
-			"style": {
-			
-			}
-		},
-		{
-			"name":"h5导航到某地",
-			"path": "pages/navigation/index",
-			"style": {
-			
-			}
-		}
-		
-        ,{
-            "path" : "pages/login/login",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/login/login",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/chargingPileDetails/chargingPileDetails",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/fastRecharge/fastRecharge",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        },
-		{
-			"name":"欢迎页",
+{
+	"easycom": {
+		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
+	},
+	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages	
+		{
+			"name": "充电中",
+			"path": "pages/index/index",
+			"style": {
+
+			}
+		},
+		{
+			"name": "h5导航到某地",
+			"path": "pages/navigation/index",
+			"style": {
+
+			}
+		}, 
+		{
+			"path": "pages/login/login",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}, 
+		{
+			"path": "pages/chargingPileDetails/chargingPileDetails",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}, 
+		{
+			"path": "pages/fastRecharge/fastRecharge",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"name": "欢迎页",
 			"path": "pages/login/welcome",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"我的",
+			"name": "主页",
+			"path": "pages/index/index",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
+		{
+			"name": "我的",
 			"path": "pages/user/index",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"我的余额",
+			"name": "车量管理",
+			"path": "pages/user/car/index",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
+		{
+			"name": "车量信息",
+			"path": "pages/user/car/carAdd",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
+		{
+			"name": "添加车牌",
+			"path": "pages/user/car/carDet",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
+		{
+			"name": "我的余额",
 			"path": "pages/user/finance/balance",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"充值",
+			"name": "充值",
 			"path": "pages/user/finance/recharge",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"充值详情",
+			"name": "充值详情",
 			"path": "pages/user/finance/rechargeDet",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"充值记录",
+			"name": "充值记录",
 			"path": "pages/user/finance/rechargeList",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"充值结果",
+			"name": "充值结果",
 			"path": "pages/user/finance/rechargeRes",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"退款记录",
+			"name": "退款记录",
 			"path": "pages/user/finance/refundList",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"退款详情",
+			"name": "退款详情",
 			"path": "pages/user/finance/refundDet",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"退款申请",
+			"name": "退款申请",
 			"path": "pages/user/finance/refundApp",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"关于我们",
+			"name": "关于我们",
 			"path": "pages/user/about",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"操作指南",
+			"name": "操作指南",
 			"path": "pages/user/help",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"注销账号",
+			"name": "注销账号",
 			"path": "pages/user/logout",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"设置",
+			"name": "设置",
 			"path": "pages/user/setting",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"修改手机号",
+			"name": "修改手机号",
 			"path": "pages/user/phone",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name":"意见反馈",
+			"name": "意见反馈",
 			"path": "pages/user/message",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
@@ -172,76 +187,91 @@
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
+		}, {
+			"path": "pages/article/article",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"path": "pages/article/newsNotice",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"path": "pages/article/articleDetails",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/search/search",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/searchPile/searchPile",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"path": "pages/searchPile/stationAndPile/stationDetails",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		},
+		{
+			"path": "pages/searchPile/searchPileList",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
 		}
-        ,{
-            "path" : "pages/article/article",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        },
-		{
-		    "path" : "pages/article/newsNotice",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "",
-		        "enablePullDownRefresh": false
-		    }
-		    
-		},
-		{
-		    "path" : "pages/article/articleDetails",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "",
-		        "enablePullDownRefresh": false
-		    }
-		    
-		}
-        ,{
-            "path" : "pages/search/search",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/searchPile/searchPile",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        },
-		{
-		    "path" : "pages/searchPile/stationAndPile/stationDetails",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "",
-		        "enablePullDownRefresh": false
-		    }
-		    
-		},
-		{
-		    "path" : "pages/searchPile/searchPileList",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "",
-		        "enablePullDownRefresh": false
-		    }
-		    
-		}
-    ],
+	],
 	"globalStyle": {
-			"navigationStyle": "custom", // 隐藏系统导航栏
-			"navigationBarTitleText": "智能充电系统",
-			"enablePullDownRefresh": false
-			
+		"navigationStyle": "custom", // 隐藏系统导航栏
+		"navigationBarTitleText": "智能充电系统",
+		"enablePullDownRefresh": false
+
 	}
-  
+	// "tabBar": {
+	// 	"color": "#b3a8a8",
+	// 	"selectedColor": "#ff5e5e",
+	// 	"backgroundColor": "#FFFFFF",
+	// 	"borderStyle": "white",
+	// 	"list": [{
+	// 			"pagePath": "pages/index/index",
+	// 			"iconPath": "home-3-line",
+	// 			"selectedIconPath": "home-3-fill",
+	// 			"text": "主页"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/searchPile/searchPile",
+	// 			"iconPath": "road-map-line",
+	// 			"selectedIconPath": "road-map-line",
+	// 			"text": "找桩"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/user/index",
+	// 			"iconPath": "user-5-line",
+	// 			"selectedIconPath": "user-5-line",
+	// 			"text": "我的"
+	// 		}
+	// 	]
+	// },
+
 }

+ 43 - 9
pages/article/newsNotice.vue

@@ -4,13 +4,7 @@
 		
 		<view class="options">
 			<view class="options-item">
-				通知公告
-			</view>
-			<view class="options-item">
-				行业新闻
-			</view>
-			<view class="options-item">
-				优惠活动
+				<u-tabs :list="tabList" :current="current" @change="change" :show-bar="false" active-color="#333" inactive-color="#c4c0c0"></u-tabs>
 			</view>
 		</view>
 		
@@ -81,7 +75,7 @@
 				</view>
 			</view>
 		</view>
-		<u-divider>已经到底了</u-divider>
+		<u-divider v-if="newsList.length ==recordsTotal">已经到底了</u-divider>
 	</view>
 </template>
 
@@ -89,6 +83,16 @@
 	export default {
 		data() {
 			return {
+				tabList: [
+					{name: '通知公告'},
+					{name: '行业新闻'},
+					{name: '优惠活动'},
+				],
+				current: 0,
+				newstype: '',
+				newsList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
 				list: [{
 						image: '/static/img/快乐周末游1x (1).png',
 					}
@@ -96,8 +100,38 @@
 				],
 			}
 		},
+		onReachBottom() {
+			if (this.newsList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
+		onReady() {
+			this.getNewsList();
+		},
 		methods: {
-
+			change(index) {
+				this.current = index;
+				if(this.tabList.length){
+					this.newstype=this.tabList[index]
+				}
+				this.getNewsList(true)
+			},
+			getNewsList(bl) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				if (bl) {
+					this.newsList = [];
+					this.pageIndex = 1;
+				}
+				
+				uni.hideLoading();
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getNewsList()
+			},
 		}
 	}
 		

+ 76 - 4
pages/index/index.vue

@@ -10,7 +10,7 @@
 		<!-- 选项列表 -->
 		<view class="option-list">
 
-			<view class="list-item">
+			<view class="list-item" @click="scanCode">
 				<view class="icon iconfont" style="background-color:#59d96e;">
 					&#xe61a;
 				</view>
@@ -93,7 +93,7 @@
 					</view>
 				</view>
 				<view class="img-box">
-					<img src="/static/img/暂无网络信号-缺省页 1.png"">
+					<img src="/static/img/暂无网络信号-缺省页 1.png">
 		  </view>
 		</view>
 		
@@ -124,7 +124,7 @@
 						<view class="line" style="margin-top:4px;"></view>新闻公告
 					</view>
 
-					<view class="more">更多<view class="more-icon iconfont"> &#xe600;</view>
+					<view class="more" @click="toNewsNotice">更多<view class="more-icon iconfont"> &#xe600;</view>
 					</view>
 
 
@@ -160,7 +160,7 @@
 						</view>
 					</view>
 				</view>
-				<view class="bottom">
+				<view class="bottom" v-if="newsList.length ==recordsTotal">
 					<view class="bot">
 						<view class="bot-line"></view>
 						<view class="bot-text">已经到底了</view>
@@ -189,9 +189,18 @@
 </template>
 
 <script>
+	import * as WxJsApi from '@/utils/wxJsApi.js'
+	import MapLoader from '@/utils/AMap'
+	
 	export default {
 		data() {
 			return {
+				newsList: [],
+				pageIndex: 1,
+				recordsTotal: 0,
+				longitude: '',
+				latitude: '',
+				message: '',
 				tabbarList: [{
 						iconPath: "home-3-line",
 						selectedIconPath: "home-3-fill",
@@ -219,6 +228,69 @@
 				],
 				current: 0
 			}
+		},
+		onReachBottom() {
+			if (this.newsList.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
+		onReady() {
+			WxJsApi.getWxConfig(['getLocation','addEventListener','scanQRCode']).then((res)=>{
+				// console.log(res)
+			}).catch(error => {
+					console.log(res)
+			})
+			
+			this.getPoint();
+			this.getNewsList();
+		},
+		methods: {
+			toNewsNotice() {
+				uni.navigateTo({
+					url: '/pages/article/newsNotice'
+				})
+			},
+			//微信扫二维码
+			scanCode() {
+				WxJsApi.scanQRCode(1).then(res => {
+					
+				}).catch(error => {
+					
+				})
+			},
+			getPoint() {
+				WxJsApi.getLocation().then((res) => {
+					this.latitude = parseFloat(res.latitude);
+					this.longitude = parseFloat(res.longitude);
+					this.message = res.errMsg;
+					
+					if(res.errMsg != 'getLocation:ok') {
+						uni.showToast({
+							title:JSON.stringify(res)
+						})
+					}				
+				}).catch(error => {
+					uni.showToast({
+						title:JSON.stringify(error)
+					})					
+				})
+			},
+			getNewsList(bl) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				if (bl) {
+					this.newsList = [];
+					this.pageIndex = 1;
+				}
+				
+				uni.hideLoading();
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getNewsList()
+			},
 		}
 	}
 </script>

+ 99 - 29
pages/login/login.vue

@@ -10,55 +10,125 @@
 				<view class="login-form-item">
 					<view class="title">手机号</view>
 					<view class="input">
-						<u-input v-model="tel" type="number" placeholder="请输入手机号" placeholder-style="font-size:16px;color:#ccc;"/>
+						<u-input v-model="form.telephone" type="number" placeholder="请输入手机号" placeholder-style="font-size:16px;color:#ccc;"/>
 					</view>
 					<view class="tips">未注册的手机号验证后将自动注册</view>
 				</view>
 				<view class="login-form-item">
 					<view class="title">验证码</view>
 					<view class="input">
-						<view class="code">获取验证码</view>
-						<u-input v-model="tel" type="number" placeholder="请输入验证码" placeholder-style="font-size:16px;color:#ccc;"/>
+						<u-input v-model="form.verifyCode" type="number" placeholder="请输入验证码" placeholder-style="font-size:16px;color:#ccc;"/>
+						<view class="code" @click="getCode">{{codeTips}}</view>
 					</view>
 					<u-checkbox-group>
 						<u-checkbox class="tips" v-model="value" shape="circle" @change="checkboxChange()">
-							<view v-if="!value">我已阅读并同意<span>《会员协议》</span>和<span>《隐私协议》</span></view>
+							<view v-if="!form.telephone && !value">我已阅读并同意<span>《会员协议》</span>和<span>《隐私协议》</span></view>
 							<view v-else>我已阅读并同意<span style="color: #000000;">《会员协议》</span>和<span style="color: #000000;">《隐私协议》</span></view>
 						</u-checkbox>
 					</u-checkbox-group>
 				</view>
-			</view>
-			
-			<u-button :style="[inputStyle]" class="login-btn" type="success" shape="circle">登录</u-button>
-		</view>
-		
+			</view>		
+			<u-button :style="[inputStyle]" class="login-btn" type="success" shape="circle" @click="login">登录</u-button>
+			<u-verification-code :seconds="sendMsgSecond" ref="uCode" @change="codeChange" @end="end" @start="start" change-text="已发送(XS)">
+			</u-verification-code>
+		</view>	
 	</view>
 </template>
 
 <script>
-export default {
-	data() {
-		return {
-			tel: '',
-			value: false,
-		}
-	},
-	computed: {
-		inputStyle() {
-			let style = {};
-			if(this.tel) {
-				style.color = "#fff";
-				style.backgroundColor = this.$u.color['success'];
+	import * as loginApi from '@/apis/login.js'
+	import {
+		checkPhone
+	} from '@/utils'
+	
+	export default {
+		data() {
+			return {
+				form: {
+					telephone: '',
+					verifyCode: '',
+				},
+				isSendMsgIng: false,
+				sendMsgSecond: 60,
+				codeTips: '',
+				value: false,
+			}
+		},
+		computed: {
+			inputStyle() {
+				let style = {};
+				if(this.form.telephone) {
+					style.color = "#fff";
+					style.backgroundColor = this.$u.color['success'];
+				}
+				return style;
 			}
-			return style;
-		}
-	},
-	methods: {
-		checkboxChange() {
-			this.value = !this.value;
 		},
+		methods: {
+			codeChange(text) {
+				this.codeTips = text;
+			},
+			start() {
+				if (!this.isSendMsgIng) {
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					loginApi.getVerifyCode(this.form.telephone).then((response) => {
+						uni.hideLoading();
+						this.carhelp.set("getvcodetime", new Date().getTime());
+			
+						if (!"") {
+							//倒计时
+							uni.showToast({
+								title: "发送成功"
+							})
+						} else {
+							uni.showToast({
+								title: "您的验证码已经发送[5分钟有效],请勿重复点击"
+							})
+						}
+					}).catch(error => {
+						uni.showToast({
+							title: error,
+							icon: "none"
+						})
+					})
+				}
+			},
+			//倒计时
+			end() {
+				this.sendMsgSecond = 60;
+				this.isSendMsgIng = false;
+			},
+			// 获取验证码
+			getCode() {
+				if (this.$refs.uCode.canGetCode) {} else {
+					uni.showToast({
+						title: '倒计时结束后再发送',
+						icon: "none"
+					})
+					return
+				}
+			
+				var checkPhoneResult = checkPhone(this.form.telephone);
+			
+				if (false && checkPhoneResult !== true) {
+					uni.showToast({
+						title: checkPhoneResult,
+					})
+					return;
+				}
+				this.$refs.uCode.start();
+			},
+			checkboxChange() {
+				this.value = !this.value;
+			},
+			login() {
+				
+			}
+		}
 	}
-};
 </script>
 
 <style>

+ 1 - 1
pages/user/message.vue

@@ -39,7 +39,7 @@
 		},
 		methods: {
 			submit() {
-				uni.redirectTo({
+				uni.switchTab({
 					url: '/pages/user/index'
 				})
 			}