achao 1 ano atrás
pai
commit
266b7ff905

+ 44 - 11
yinyuan/components/yunmiao-jobSelect/yunmiao-jobSelect.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="">
+	<view class="container">
 		<!-- <u-popup  mode="right" width="100%" height="100%"> -->
 		<view class="u-wrap">
 			<view class="u-search-box">
@@ -32,8 +32,13 @@
 								<view class="item-container">
 									<view class="thumb-box" v-for="(item1, index1) in item.children" :key="index1"
 										@click="selval(item1)">
-										<view :class="[value==item1[valueName] ? 'item-active' : '']">
-											<text>{{item1[labelName]}}</text>
+										<view :class="[value==item1[valueName] ? 'item-active' : '']"
+											class="img-content">
+											<image :src="item2" mode="" v-for="item2 in item1.urlPath.split(',')"
+												class="img">
+											</image>
+											<text class="right-text"
+												style="margin-left: 20rpx;">{{item1[labelName]}}</text>
 										</view>
 										<!-- <u-icon v-if="value==item1[valueName]" name="checkbox-mark" :color="iconColor"
 											size="28">
@@ -58,7 +63,7 @@
 			//label展示字段
 			labelName: {
 				type: String,
-				default: 'name'
+				default: 'typeName'
 			},
 			//value选中字段
 			valueName: {
@@ -206,6 +211,9 @@
 		align-items: center;
 		height: 100rpx;
 		width: 100%;
+		position: fixed;
+		top: 85px;
+		z-index: 99;
 	}
 
 	.search-warp {
@@ -228,7 +236,8 @@
 
 	.u-tab-view {
 		width: 300rpx;
-		height: 100%;
+		height: 100vh;
+		overflow: hidden;
 	}
 
 	.u-tab-item {
@@ -245,7 +254,7 @@
 
 	.u-tab-item-active {
 		position: relative;
-		color: #333333;
+		color: red;
 		font-size: 28rpx;
 		font-weight: 600;
 		background: #fff;
@@ -254,18 +263,20 @@
 	.u-tab-item-active::before {
 		content: "";
 		position: absolute;
-		border-left: 4px solid #ccc;
+		border-left: 4px solid red;
 		height: 32rpx;
 		left: 0;
 		top: 39rpx;
 	}
 
 	.u-tab-view {
-		height: 100%;
+		// height: 100%;
 	}
 
 	.right-box {
 		background-color: white;
+		height: 93vh;
+		overflow: hidden;
 	}
 
 	.page-view {
@@ -297,10 +308,32 @@
 		display: flex;
 		flex-direction: row;
 		justify-content: space-between;
-		height: 100rpx;
-		width: 100%;
-		padding: 0 20rpx;
+		padding: 20rpx;
 		align-items: center;
 		font-size: 32rpx;
+
+	}
+
+	.img {
+		width: 300rpx;
+		height: 150rpx;
+	}
+
+	.img-content {
+		width: 100%;
+
+		display: flex;
+		align-items: center;
+
+		// justify-content: space-between;
+		// width: 90%;
+		.right-text {
+			width: calc(100% - 320rpx);
+		}
+	}
+
+	.container {
+		position: relative;
+		top: 100px;
 	}
 </style>

+ 11 - 0
yinyuan/config/index.js

@@ -0,0 +1,11 @@
+const dev = {
+	baseUrlNew: 'http://121.5.163.150:8181',
+	// baseUrlNew: 'http://192.168.110.67:8081',
+	// baseUrlNew: 'https://api.thesunbelt.shop',
+	h5Appid: 'wxb66b599f7f61b46f',
+	debug: false
+}
+
+export function def() {
+	return dev
+}

+ 4 - 0
yinyuan/main.js

@@ -4,6 +4,10 @@ import App from './App'
 import Vue from 'vue'
 Vue.config.productionTip = false
 import uView from '@/uni_modules/uview-ui'
+import request from '@/util/request.js'
+Vue.prototype.$request = request
+import store from './store'
+Vue.prototype.$store = store
 App.mpType = 'app'
 const app = new Vue({
 	...App

+ 3 - 8
yinyuan/pages.json

@@ -3,8 +3,7 @@
 		{
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "银元价格查询",
-				"navigationStyle": "custom"
+				"navigationBarTitleText": "银元价格查询"
 			}
 		},
 		{
@@ -47,7 +46,8 @@
 				"enablePullDownRefresh": false
 			}
 
-		}, {
+		},
+		{
 			"path": "pages/statistical/statistical",
 			"style": {
 				"navigationBarTitleText": "交易量统计",
@@ -69,11 +69,6 @@
 				"text": "银元"
 			},
 			{
-				"pagePath": "pages/statistical/statistical",
-				"iconPath": "static/4.png",
-				"selectedIconPath": "static/44.png",
-				"text": "统计"
-			}, {
 				"pagePath": "pages/mine/index",
 				"iconPath": "static/4.png",
 				"selectedIconPath": "static/44.png",

+ 120 - 6
yinyuan/pages/index/index.vue

@@ -2,29 +2,53 @@
 	<view class="content">
 		<view class="top">
 			<view class="left">
-				<image src="../../static/logo.png" mode="widthFix" class="head-img"></image>
+				用户名:
+				<!-- <image src="../../static/logo.png" mode="widthFix" class="head-img"></image> -->
 			</view>
 			<view class="right">
 				<view class="">
-					achao
+					{{userInfo.username}}
 				</view>
-				<view class="">
+				<!-- <view class="">
 					2022-12-2到期
-				</view>
+				</view> -->
 			</view>
 		</view>
-		<jobSelect ref="jobSelect" :listData="listData" @confirem="confiremJob"></jobSelect>
+		<jobSelect ref="jobSelect" :listData="listData" @confirem="confiremJob" :typeOneData='typeOneData'
+			:typeTwoData='typeTwoData'></jobSelect>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
+	import {
+		mapState
+	} from 'vuex';
 	import jobSelect from '@/components/yunmiao-jobSelect/yunmiao-jobSelect.vue'
 	export default {
 		components: {
 			jobSelect
 		},
+		computed: {
+			...mapState(['hasLogin'])
+		},
+		onShow() {
+			if (this.hasLogin || uni.getStorageSync("userInfo").username) {
+				this.userInfo = uni.getStorageSync("userInfo")
+			} else {
+				uni.navigateTo({
+					url: "/pages/login/login"
+				})
+				// uni.({
+				// 	url: '/pages/index/index'
+				// })
+			}
+		},
 		data() {
 			return {
+				typeOneData: [],
+				typeTwoData: [],
+				userInfo: {},
 				listData: [{
 					"id": 1,
 					"name": "餐饮",
@@ -68,14 +92,99 @@
 			}
 		},
 		onLoad() {
+			uni.showLoading({
+				title: '数据加载中'
+			})
+			this.$request.baseRequest('admin.gubi.gubiTypeInfo', 'list', {
+					page: 1,
+					limit: 1000
+				},
+				failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+				// if (res.errno == 200) {
+				uni.hideLoading()
+				console.log(11)
+				console.log(res.data.items)
+				this.typeOneData = res.data.items
+				this.$request.baseRequest('admin.gubi.gubiTypeSecond', 'list', {
+						page: 1,
+						limit: 1000,
+						typeId: this.typeOneData[0].id
+					},
+					failres => {
+						console.log('res+++++', failres.errmsg)
+						this.$refs.uToast.show({
+							type: 'error',
+							message: failres.errmsg,
+						})
+						uni.hideLoading()
+					}).then(res => {
+					// if (res.errno == 200) {
+					uni.hideLoading()
+					console.log(11)
+					console.log(res.data.items)
+					this.typeTwoData = res.data.items
+					// this.makeData(res.data)
+					// }
+
+				})
+				// this.makeData(res.data)
+				// }
+
+			})
+			// this.$request.baseRequest('admin.gubi.gubiTypeInfo', 'listInfo', failres => {
+			// 	console.log('res+++++', failres.errmsg)
+			// 	this.$refs.uToast.show({
+			// 		type: 'error',
+			// 		message: failres.errmsg,
+			// 	})
+			// 	uni.hideLoading()
+			// }).then(res => {
+			// 	// if (res.errno == 200) {
+			// 	uni.hideLoading()
+			// 	console.log(11)
+			// 	console.log(res.data)
+
+			// 	this.makeData(res.data)
+			// 	// }
+
+			// })
 			// this.$refs.jobSelect.show()
 		},
 		methods: {
+			makeData(val) {
+				console.log(val)
+				for (let i = 0; i < val.length; i++) {
+					if (val[i].children) {
+						for (let j = 0; j < val[i].children.length; j++) {
+							let _obj = val[i].children[j]
+							_obj.typeName = val[i].children[j].secondName
+							val[i].children[j] = _obj
+							if (val[i].children[j].children) {
+								for (let k = 0; k < val[i].children[j].children.length; k++) {
+									let _obj1 = val[i].children[j].children[k]
+									_obj1.typeName = val[i].children[j].children[k].typeId
+									val[i].children[j].children[k] = _obj1
+								}
+							}
+						}
+					}
+				}
+				this.listData = val
+				// console.log(this.data)
+			},
 			// show() {
 			// 	this.$refs.jobSelect.show()
 			// },
 			confiremJob(e) {
-				console.log(e)
+				console.log("e", e)
+				uni.setStorageSync('selectInfo', e)
 				uni.navigateTo({
 					url: "/pages/index/price"
 				})
@@ -89,6 +198,11 @@
 
 	.top {
 		display: flex;
+		background: #ececec;
+		padding: 20rpx;
+		position: fixed;
+		z-index: 999;
+		width: 100%;
 
 	}
 

+ 310 - 83
yinyuan/pages/index/price.vue

@@ -6,10 +6,10 @@
 				</u-subsection>
 			</view>
 			<view class="row2" v-if="curNow!=2">
-				<text>123</text><text>/</text><text>123</text><text>/</text><text>123</text>
+				<text>{{type1}}</text><text>/</text><text>{{type2}}</text><text>/</text><text>{{type3}}</text>
 			</view>
 			<view class="row3" v-if="curNow==0">
-				<u-tabs :list="list1" @click="click"></u-tabs>
+				<u-tabs :list="list1" @click="click" keyName="typeName" current='1'></u-tabs>
 			</view>
 		</view>
 		<view class="content2" v-if="curNow==0">
@@ -22,53 +22,59 @@
 			<view class="title">
 				价格历史记录
 			</view>
-			<view class="price-list">
-				<view class="" style="display: flex;justify-content: space-between;">
-					<view class="">
-						最新价格
+			<mescroll-body v-if="curNow==0" ref="mescrollRef" @init="mescrollInit" @up="upCallback1" :down="downOption"
+				:up="upOption">
+				<view class="price-list">
+					<view class="row-style" style="display: flex;justify-content: space-between;">
+						<view class="">
+							最新价格
+						</view>
+						<view class="">
+							单位(万元)
+						</view>
 					</view>
-					<view class="">
-						单位(万元)
+					<view class="row-style" style="display: flex;justify-content: space-between;"
+						v-for="item in priceList">
+						<view class="">
+							{{new Date(item.collection).toLocaleDateString() }}
+						</view>
+						<view class="">
+							{{item.price}}
+						</view>
 					</view>
 				</view>
-				<view class="" style="display: flex;justify-content: space-between;" v-for="item in priceList">
-					<view class="">
-						{{item.date}}
-					</view>
-					<view class="">
-						{{item.price}}
-					</view>
-				</view>
-			</view>
-
+			</mescroll-body>
 		</view>
-		<mescroll-body v-if="curNow==1" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
-			:down="downOption" :up="upOption">
-
+		<mescroll-body v-if="curNow==1" ref="mescrollRef" @init="mescrollInit" @up="upCallback" :down="downOption"
+			:up="upOption">
+			<view class="jyjl">
+				以下为近期成交数据
+			</view>
 			<view v-for="data in dataList" class="row">
 				<view class="left">
-					<view class="">
-						图片1
-					</view>
-					<view class="">
-						图片2
-					</view>
+					<image :src="data.urlPath" mode="widthFix" class="price-img" @click="fdImg(data.urlPath)"></image>
+					<u-popup :show="show" @close="close" @open="open" mode="center">
+						<image :src="selectSrc" mode="widthFix"></image>
+					</u-popup>
 				</view>
 				<view class="right">
-					<view class="">
-						0.19万
+					<view class="right-row" style="color:#fca87d;font-size:20px;font-weight:700">
+						¥{{data.price}}万元
 					</view>
-					<view class="">
-						编号
+					<view class="right-row">
+						名称:{{data.grade}}
 					</view>
-					<view class="">
-						分值
+					<view class="right-row">
+						编号:{{data.number}}
 					</view>
-					<view class="">
-						状态
+					<view class="right-row">
+						状态:{{data.status}}
 					</view>
-					<view class="">
-						交易日期
+					<view class="right-row">
+						交易日期:
+						<text
+							style="color:#fca87d;font-size:12px">{{new Date(data.collection).toLocaleDateString() }}</text>
+
 					</view>
 				</view>
 			</view>
@@ -82,26 +88,104 @@
 					系列
 				</view>
 				<view class="right">
-					原乡
+					{{nowItem.series}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					品名
+				</view>
+				<view class="right">
+					{{nowItem.product}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					官网编号
+				</view>
+				<view class="right">
+					{{nowItem.number}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					年份
+				</view>
+				<view class="right">
+					{{nowItem.year}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					面值
+				</view>
+				<view class="right">
+					{{nowItem.face}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					版别
+				</view>
+				<view class="right">
+					{{nowItem.edition}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					地区
+				</view>
+				<view class="right">
+					{{nowItem.region}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					分值/等级
+				</view>
+				<view class="right">
+					{{nowItem.grade}}
 				</view>
 			</view>
+			<view class="row">
+				<view class="left">
+					同分数量/增量
+				</view>
+				<view class="right">
+					{{nowItem.tongFen}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					高分数量
+				</view>
+				<view class="right">
+					{{nowItem.highScores}}
+				</view>
+			</view>
+			<view class="row">
+				<view class="left">
+					收集时间
+				</view>
+				<view class="right">
+					{{nowItem.collection}}
+				</view>
+			</view>
+
 			<view class="detail-view">
 				<view class="title">
 					详细介绍
 				</view>
 				<view class="">
-					1212332231123司法鉴定副书记奥克斯的风景两地分居上课了撒娇分类法就是浪费加速度计发介绍来的
+					{{nowItem.introduction}}
 				</view>
 				<view class="imgList">
-					<view class="">
-						图片1
-					</view>
-					<view class="">
-						图片2
-					</view>
+					<!-- <image :src="item" mode="widthFix" v-for="item in nowItem.urlPath.split(',')" style="width: 50%;">
+					</image> -->
 				</view>
 			</view>
 		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
@@ -109,8 +193,33 @@
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	export default {
 		mixins: [MescrollMixin], // 使用mixin
+		onLoad() {
+			this.info = uni.getStorageSync("selectInfo")
+			this.list1 = this.info.children
+			if (this.info.children.length != 0) {
+				this.nowItem = this.info
+				this.orderId = this.info.children[1].id
+				this.type1 = this.info.series
+				this.type2 = this.info.secondName
+				this.type3 = this.info.children[1].typeId
+				// for (let i = 0; i < this.info.children.length; i++) {
+
+				// }
+			}
+
+
+		},
 		data() {
 			return {
+				selectSrc: '',
+				show: false,
+				x: [],
+				y: [],
+				type1: '',
+				type2: '',
+				type3: '',
+				orderId: '',
+				info: {},
 				downOption: {},
 				upOption: {
 					page: {
@@ -121,6 +230,16 @@
 						tip: '暂无相关数据'
 					}
 				},
+				downOption1: {},
+				upOption1: {
+					page: {
+						size: 10 // 每页数据的数量,默认10
+					},
+					noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
+					empty: {
+						tip: '暂无相关数据'
+					}
+				},
 				dataList: [{
 					img1: "",
 					img2: '',
@@ -163,36 +282,120 @@
 					}
 				},
 				btnList: ['价格概况', '交易记录', '币种介绍'],
-				curNow: 1,
-				list1: [{
-					name: '关注',
-				}, {
-					name: '推荐',
-				}, {
-					name: '电影'
-				}, {
-					name: '科技'
-				}, {
-					name: '音乐'
-				}, {
-					name: '美食'
-				}, {
-					name: '文化'
-				}, {
-					name: '财经'
-				}, {
-					name: '手工'
-				}]
+				curNow: 0,
+				list1: []
 			}
 		},
 		methods: {
+			close() {
+				this.show = false
+				// console.log('close');
+			},
+			fdImg(src) {
+				this.selectSrc = src
+				this.show = true
+			},
 			sectionChange(index) {
 				this.curNow = index;
 			},
 			click(item) {
-				console.log('item', item);
+				this.orderId = item.id
+				this.type3 = item.typeId
+				this.mescroll.resetUpScroll()
+			},
+			makeData(val) {
+				for (let i = 0; i < val.length; i++) {
+					if (val[i].children) {
+						for (let j = 0; j < val[i].children.length; j++) {
+							let _obj = val[i].children[j]
+							_obj.typeName = val[i].children[j].secondName
+							val[i].children[j] = _obj
+							if (val[i].children[j].children) {
+								for (let k = 0; k < val[i].children[j].children.length; k++) {
+									let _obj1 = val[i].children[j].children[k]
+									_obj1.typeName = val[i].children[j].children[k].typeId
+									val[i].children[j].children[k] = _obj1
+								}
+							}
+						}
+					}
+				}
+				this.listData = val
+				// console.log(this.data)
+			},
+			upCallback1(page) {
+				this.x = []
+				this.y = []
+				this.$request.baseRequest('admin.gubi.gubiPriceHis', 'list', {
+					pageNum: page.num,
+					pageSize: page.size,
+					orderId: this.orderId
+				}, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					// if (res.errno == 200) {
+					uni.hideLoading()
+					let curPageData = res.data.items;
+					let totalPage = res.data.total;
+					let curPageLen = curPageData.length;
+					this.mescroll.endByPage(curPageLen, totalPage);
+					// this.makeData(res.data)
+					if (page.num == 1) this.priceList = []; //如果是第一页需手动置空列表
+					this.priceList = this.priceList.concat(curPageData); //追加新数据
+					for (let i = 0; i < this.priceList.length; i++) {
+						console.log(new Date(this.priceList[i].collection).toLocaleDateString())
+						this.x.push(new Date(this.priceList[i].collection).toLocaleDateString());
+						this.y.push(this.priceList[i].price)
+					}
+					let _data = {
+						categories: this.x,
+						series: [{
+							name: "价格",
+							data: this.y
+						}]
+					};
+					console.log("x", this.x)
+					console.log("y", this.y)
+					this.chartData = JSON.parse(JSON.stringify(_data));
+					// }
+
+				})
 			},
 			upCallback(page) {
+				this.$request.baseRequest('admin.gubi.gubiTransaction', 'list', {
+					pageNum: page.num,
+					pageSize: page.size,
+					orderId: this.orderId
+				}, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					// if (res.errno == 200) {
+					uni.hideLoading()
+					console.log(11)
+					let curPageData = res.data.items;
+					let totalPage = res.data.total;
+					let curPageLen = curPageData.length;
+					this.mescroll.endByPage(curPageLen, totalPage);
+					console.log(res.data)
+					// this.makeData(res.data)
+					if (page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
+					this.dataList = this.dataList.concat(curPageData); //追加新数据
+					for (let i = 0; i < this.dataList.length; i++) {
+						// this.dataList[i].urlPath = this.dataList[i].urlPath.split(",")
+					}
+					// }
+
+				})
 				// // 此处可以继续请求其他接口
 				// // if(page.num == 1){
 				// // 	// 请求其他接口...
@@ -235,7 +438,7 @@
 				// 		this.mescroll.endByPage(0, 0);
 				// 		setTimeout(() => {
 				// 			// this.mescroll.endSuccess(curPageLen)
-				this.mescroll.endSuccess(0)
+				// this.mescroll.endSuccess(0)
 				// 		}, 20)
 				// 	},
 				// 	fail: () => {
@@ -245,22 +448,8 @@
 				// })
 
 			},
-			getServerData() {
-				setTimeout(() => {
-					let res = {
-						categories: ["2016", "2017", "2018", "2019", "2020", "2021"],
-						series: [{
-							name: "目标值",
-							data: [35, 36, 31, 33, 13, 34]
-						}]
-					};
-					this.chartData = JSON.parse(JSON.stringify(res));
-				}, 500);
-			}
-		},
-		onReady() {
-			this.getServerData();
-		},
+
+		}
 	}
 </script>
 
@@ -268,4 +457,42 @@
 	.content {
 		padding: 20rpx;
 	}
+
+	.row2 {
+		margin: 20rpx 0;
+	}
+
+	.title {
+		margin: 20rpx 0;
+		font-weight: 700;
+	}
+
+	.row-style,
+	.row {
+		display: flex;
+		justify-content: space-between;
+		border-bottom: 1px solid #ebebeb;
+		padding: 20rpx;
+	}
+
+	// .imgList {
+	// 	display: flex;
+	// }
+	.jyjl {
+		color: rgb(60, 156, 255);
+		border: 1px solid rgb(60, 156, 255);
+		width: 300rpx;
+		padding: 10rpx;
+		border-radius: 10rpx;
+	}
+
+	.price-img {
+		width: 200rpx;
+	}
+
+	.right-row {
+		display: flex;
+		justify-content: flex-end;
+		align-items: center;
+	}
 </style>

+ 179 - 164
yinyuan/pages/login/login.vue

@@ -1,172 +1,187 @@
 <template>
-  <view class="content">
-    <view class="header">
-      <image src="../../static/shilu-login/logo.png"></image>
-    </view>
-
-    <view class="list">
-      <view class="list-call">
-        <image class="img" src="/static/shilu-login/1.png"></image>
-        <input class="sl-input" v-model="phone" type="number" maxlength="11" placeholder="输入手机号" />
-      </view>
-      <view class="list-call">
-        <image class="img" src="/static/shilu-login/2.png"></image>
-        <input class="sl-input" v-model="password" type="text" maxlength="32" placeholder="输入密码" password="true" />
-      </view>
-
-    </view>
-
-    <view class="button-login" hover-class="button-hover" @tap="bindLogin()">
-      <text>登录</text>
-    </view>
-
-    <view class="agreenment">
-      <navigator url="forget" open-type="navigate">忘记密码</navigator>
-      <text>|</text>
-      <navigator url="reg" open-type="navigate">注册账户</navigator>
-    </view>
-  </view>
+	<view class="content">
+		<view class="header">
+			<image src="../../static/shilu-login/logo.png"></image>
+		</view>
+
+		<view class="list">
+			<view class="list-call">
+				<image class="img" src="/static/shilu-login/1.png"></image>
+				<input class="sl-input" v-model="userInfo.username" maxlength="11" placeholder="输入用户名" />
+			</view>
+			<view class="list-call">
+				<image class="img" src="/static/shilu-login/2.png"></image>
+				<input class="sl-input" v-model="userInfo.password" type="text" maxlength="32" placeholder="输入密码"
+					password="true" />
+			</view>
+
+		</view>
+
+		<view class="button-login" hover-class="button-hover" @tap="bindLogin()">
+			<text>登录</text>
+		</view>
+
+		<!-- <view class="agreenment">
+			<navigator url="forget" open-type="navigate">忘记密码</navigator>
+			<text>|</text>
+			<navigator url="reg" open-type="navigate">注册账户</navigator>
+		</view> -->
+	</view>
 </template>
 
 <script>
-  export default {
-    data() {
-      return {
-        phone: '',
-        password: ''
-      };
-    },
-    methods: {
-      bindLogin() {
-        if (this.phone.length != 11) {
-          uni.showToast({
-            icon: 'none',
-            title: '手机号不正确'
-          });
-          return;
-        }
-        if (this.password.length < 6) {
-          uni.showToast({
-            icon: 'none',
-            title: '密码不正确'
-          });
-          return;
-        }
-        uni.request({
-          url: 'http://***/login.html',
-          data: {
-            phone: this.phone,
-            password: this.password
-          },
-          method: 'POST',
-          dataType: 'json',
-          success: (res) => {
-            if (res.data.code != 200) {
-              uni.showToast({
-                title: res.data.msg,
-                icon: 'none'
-              });
-            } else {
-              //成功后的逻辑
-              uni.navigateBack();
-            }
-          }
-        });
-
-      }
-    }
-  }
+	export default {
+		data() {
+			return {
+				userInfo: {
+					username: '',
+					password: '',
+					verifyCode: 666666
+				}
+
+			};
+		},
+		methods: {
+			bindLogin() {
+				// if (this.phone.length) {
+				// 	uni.showToast({
+				// 		icon: 'none',
+				// 		title: '用户名不正确'
+				// 	});
+				// 	return;
+				// }
+				// if (this.password.length < 6) {
+				// 	uni.showToast({
+				// 		icon: 'none',
+				// 		title: '密码不正确'
+				// 	});
+				// 	return;
+				// }
+				// {
+				// sunMemberInfo: JSON.stringify({
+				// 	name: that.userInfo.nickname,
+				// 	phone: val.phoneNumber,
+				// 	sex: '1'
+				// })
+				// }
+				uni.showLoading({
+					mask: true,
+					title: "加载中"
+				})
+				this.$request.baseRequest('admin', 'login', this.userInfo, failres => {
+					console.log('res+++++', failres.errmsg)
+					this.$refs.uToast.show({
+						type: 'error',
+						message: failres.errmsg,
+					})
+					uni.hideLoading()
+				}).then(res => {
+					console.log(res)
+					if (res.errno == 200) {
+						uni.hideLoading()
+						uni.setStorageSync('userInfo', this.userInfo)
+						this.$store.commit('login', this.userInfo)
+						// that.$api.setUserInfo(that.userInfo)
+						uni.switchTab({
+							url: '/pages/index/index'
+						})
+					}
+
+				})
+			}
+		}
+	}
 </script>
 
 <style>
-  .content {
-    display: flex;
-    flex-direction: column;
-    justify-content: center;
-  }
-
-  .header {
-    width: 161rpx;
-    height: 161rpx;
-    background: rgba(63, 205, 235, 1);
-    box-shadow: 0rpx 12rpx 13rpx 0rpx rgba(63, 205, 235, 0.47);
-    border-radius: 50%;
-    margin-top: 30rpx;
-    margin-left: auto;
-    margin-right: auto;
-  }
-
-  .header image {
-    width: 161rpx;
-    height: 161rpx;
-    border-radius: 50%;
-  }
-
-  .list {
-    display: flex;
-    flex-direction: column;
-    padding-top: 50rpx;
-    padding-left: 70rpx;
-    padding-right: 70rpx;
-  }
-
-  .list-call {
-    display: flex;
-    flex-direction: row;
-    justify-content: space-between;
-    align-items: center;
-    height: 100rpx;
-    color: #333333;
-    border-bottom: 0.5px solid #e2e2e2;
-  }
-
-  .list-call .img {
-    width: 40rpx;
-    height: 40rpx;
-  }
-
-  .list-call .sl-input {
-    flex: 1;
-    text-align: left;
-    font-size: 32rpx;
-    margin-left: 16rpx;
-  }
-
-  .button-login {
-    color: #FFFFFF;
-    font-size: 34rpx;
-    width: 470rpx;
-    height: 100rpx;
-    background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
-    box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
-    border-radius: 50rpx;
-    line-height: 100rpx;
-    text-align: center;
-    margin-left: auto;
-    margin-right: auto;
-    margin-top: 100rpx;
-  }
-
-  .button-hover {
-    background: linear-gradient(-90deg, rgba(63, 205, 235, 0.8), rgba(188, 226, 158, 0.8));
-  }
-
-  .agreenment {
-    display: flex;
-    flex-direction: row;
-    justify-content: center;
-    align-items: center;
-    font-size: 30rpx;
-    margin-top: 80rpx;
-    color: #FFA800;
-    text-align: center;
-    height: 40rpx;
-    line-height: 40rpx;
-  }
-
-  .agreenment text {
-    font-size: 24rpx;
-    margin-left: 15rpx;
-    margin-right: 15rpx;
-  }
+	.content {
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+	}
+
+	.header {
+		width: 161rpx;
+		height: 161rpx;
+		background: rgba(63, 205, 235, 1);
+		box-shadow: 0rpx 12rpx 13rpx 0rpx rgba(63, 205, 235, 0.47);
+		border-radius: 50%;
+		margin-top: 30rpx;
+		margin-left: auto;
+		margin-right: auto;
+	}
+
+	.header image {
+		width: 161rpx;
+		height: 161rpx;
+		border-radius: 50%;
+	}
+
+	.list {
+		display: flex;
+		flex-direction: column;
+		padding-top: 50rpx;
+		padding-left: 70rpx;
+		padding-right: 70rpx;
+	}
+
+	.list-call {
+		display: flex;
+		flex-direction: row;
+		justify-content: space-between;
+		align-items: center;
+		height: 100rpx;
+		color: #333333;
+		border-bottom: 0.5px solid #e2e2e2;
+	}
+
+	.list-call .img {
+		width: 40rpx;
+		height: 40rpx;
+	}
+
+	.list-call .sl-input {
+		flex: 1;
+		text-align: left;
+		font-size: 32rpx;
+		margin-left: 16rpx;
+	}
+
+	.button-login {
+		color: #FFFFFF;
+		font-size: 34rpx;
+		width: 470rpx;
+		height: 100rpx;
+		background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
+		box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
+		border-radius: 50rpx;
+		line-height: 100rpx;
+		text-align: center;
+		margin-left: auto;
+		margin-right: auto;
+		margin-top: 100rpx;
+	}
+
+	.button-hover {
+		background: linear-gradient(-90deg, rgba(63, 205, 235, 0.8), rgba(188, 226, 158, 0.8));
+	}
+
+	.agreenment {
+		display: flex;
+		flex-direction: row;
+		justify-content: center;
+		align-items: center;
+		font-size: 30rpx;
+		margin-top: 80rpx;
+		color: #FFA800;
+		text-align: center;
+		height: 40rpx;
+		line-height: 40rpx;
+	}
+
+	.agreenment text {
+		font-size: 24rpx;
+		margin-left: 15rpx;
+		margin-right: 15rpx;
+	}
 </style>

+ 48 - 6
yinyuan/pages/mine/index.vue

@@ -4,12 +4,12 @@
 			<view class="personal-main">
 				<u-avatar :src="avatar" mode="square" size="60" class="u-avatar"></u-avatar>
 				<view class="personal-info">
-					<view class="">name</view>
-					<view class="">id:12333333333</view>
+					<view class="">用户名</view>
+					<view class="">{{userInfo.username}}</view>
 				</view>
 			</view>
 		</view>
-		<view class="n-p" v-for="(item,index) in list" :key="index" hover-class="hover-class" @click="onClick(item)">
+		<!-- <view class="n-p" v-for="(item,index) in list" :key="index" hover-class="hover-class" @click="onClick(item)">
 			<view style="position: relative">
 				<view class="p-left">
 					<u-icon :name="item.icon" size="30" color="#757575"></u-icon>
@@ -26,15 +26,34 @@
 					<u-icon name="arrow-right" size="20" class="p-right-icon"></u-icon>
 				</view>
 			</view>
-		</view>
-		<button type="default">退出登录</button>
+		</view> -->
+		<view class="button-login" @click="layout">退出登录</view>
 	</view>
 </template>
 
 <script>
+	import {
+		mapState
+	} from 'vuex';
 	export default {
+		computed: {
+			...mapState(['hasLogin'])
+		},
+		onShow() {
+			if (this.hasLogin || uni.getStorageSync("userInfo").username) {
+				this.userInfo = uni.getStorageSync("userInfo")
+			} else {
+				uni.navigateTo({
+					url: "/pages/login/login"
+				})
+				// uni.({
+				// 	url: '/pages/index/index'
+				// })
+			}
+		},
 		data() {
 			return {
+				userInfo: {},
 				avatar: 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1730713693,2130926401&fm=26&gp=0.jpg',
 				list: [
 					// 	{
@@ -69,6 +88,14 @@
 			}
 		},
 		methods: {
+			layout() {
+				this.$store.commit('logout', {})
+				uni.clearStorageSync();
+				uni.navigateTo({
+					url: "/pages/login/login"
+				})
+
+			},
 			onClick(item) {
 				uni.navigateTo({
 					url: "/pages/login/forget"
@@ -97,7 +124,7 @@
 
 	.personal-info {
 		display: flex;
-		flex-direction: column;
+		/* flex-direction: column; */
 	}
 
 	.u-avatar {
@@ -164,4 +191,19 @@
 		font-size: 24rpx;
 		color: #9d9d9d;
 	}
+
+	.button-login {
+		color: #FFFFFF;
+		font-size: 34rpx;
+		width: 470rpx;
+		height: 100rpx;
+		background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
+		box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
+		border-radius: 50rpx;
+		line-height: 100rpx;
+		text-align: center;
+		margin-left: auto;
+		margin-right: auto;
+		margin-top: 100rpx;
+	}
 </style>

+ 109 - 0
yinyuan/store/index.js

@@ -0,0 +1,109 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+Vue.use(Vuex)
+let lifeData = {};
+
+try {
+	// 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
+	lifeData = uni.getStorageSync('lifeData');
+} catch (e) {}
+
+// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
+let saveStateKeys = ['userInfo', 'goods',
+	'isHaveService'
+];
+
+// 保存变量到本地存储中
+const saveLifeData = function(key, value) {
+	// 判断变量名是否在需要存储的数组中
+	if (saveStateKeys.indexOf(key) != -1) {
+		// 获取本地存储的lifeData对象,将变量添加到对象中
+		let tmp = uni.getStorageSync('lifeData');
+		// 第一次打开APP,不存在lifeData变量,故放一个{}空对象
+		tmp = tmp ? tmp : {};
+		// if(key == 'contractTip' && tmp[key] < value){
+		// 	uni.vibrateLong({
+		// 	    success: function () {
+		// 	        console.log('震动成功');
+		// 	    }
+		// 	});
+		// }
+		// if(key == 'taskTip' && tmp[key] < value){
+		// 	uni.vibrateLong({
+		// 	    success: function () {
+		// 	        console.log('震动成功');
+		// 	    }
+		// 	});
+		// }
+		tmp[key] = value;
+		// 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中
+		uni.setStorageSync('lifeData', tmp);
+	}
+}
+
+
+const store = new Vuex.Store({
+	modules: {},
+	state: {
+		sysinfo: uni.getSystemInfoSync(), //系统信息
+		hasLogin: false,
+		isHaveService: false,
+		goods: []
+	},
+	mutations: {
+		$uStore(state, payload) {
+			// 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1
+			let nameArr = payload.name.split('.');
+			let saveKey = '';
+			let len = nameArr.length;
+			if (nameArr.length >= 2) {
+				let obj = state[nameArr[0]];
+				for (let i = 1; i < len - 1; i++) {
+					obj = obj[nameArr[i]];
+				}
+				obj[nameArr[len - 1]] = payload.value;
+				saveKey = nameArr[0];
+			} else {
+				// 单层级变量,在state就是一个普通变量的情况
+				state[payload.name] = payload.value;
+				saveKey = payload.name;
+			}
+			// 保存变量到本地,见顶部函数定义
+			saveLifeData(saveKey, state[saveKey])
+		},
+		login(state, provider) {
+			state.hasLogin = true;
+			state.userInfo = provider;
+			uni.setStorageSync('userInfo', provider)
+		},
+
+		logout(state) {
+			state.hasLogin = false;
+			state.userInfo = {};
+			uni.removeStorageSync('userInfo')
+		},
+
+		goodCar(state, provider) {
+			
+			state.goods = provider;
+			uni.setStorageSync('goods', provider)
+		},
+		goodService(state, provider) {
+			state.isHaveService = provider;
+			uni.setStorageSync('isHaveService', provider)
+		},
+
+
+
+	},
+	actions: {
+
+	},
+	getters: {
+		getUserInfo(state) {
+			return state.userInfo
+		}
+	}
+})
+
+export default store