hmp 4 роки тому
батько
коміт
ce0f046fd5

+ 16 - 1
assets/http/api.js

@@ -37,6 +37,11 @@ const loginUser={
 }
 
 
+const CMCC={
+	isCMCC:p => http.get('/user/login/isCMCC', {params:p}),
+	queryCmccPoint:p => http.post('app/cmcc/queryCmccPoint'+p),
+}
+
 const points={
 	list:p => http.get('sing_point/pointrecord/list', {params:p}),
 }
@@ -45,6 +50,14 @@ const help={
 	list:p => http.get('sing_active/activehelprecord/list', {params:p}),
 }
 
+/**
+ * 积分商城
+ */
+const pointgoods={
+	list:p => http.get('sing_goods/pointgoods/list', {params:p}),
+} 
+
+
 export const api={
 	uploadFile,
 	dict,
@@ -53,5 +66,7 @@ export const api={
 	activity,
 	platform,
 	points,
-	help
+	help,
+	CMCC,
+	pointgoods
 }

+ 6 - 0
assets/http/config.js

@@ -1,5 +1,11 @@
 let config = {}
 
+
+//是否需要获取手机号
+config.isAuthPhone=false
+
+
+
 config.themeRed = {
 	skin: '--bgColor:#e72226;--color:#fff;--shopBg:#f24050;--shopRule:#FF797F',
 	theme: {

+ 1 - 1
assets/http/service.js

@@ -65,7 +65,7 @@ http.interceptors.response.use(async (response) => {
 			// 重试完了清空这个队列
 			requests = []
 			isRefreshing = false
-			return http.request(config)
+			return await http.request(config)
 		} else {
 			return new Promise((resolve) => {
 				// 将resolve放进队列,用一个函数形式来保存,等token刷新后直接执行

+ 6 - 3
components/alert/pointAuth.vue

@@ -3,9 +3,8 @@
 		<image class="auth-bg" mode="aspectFill" src="../../static/poster/bg_shouyetc.png">
 			<view class="auth-msg">
 			</view>
-			<u-button :custom-style="customStyle" shape="circle" >去授权</u-button>
+			<u-button open-type="getPhoneNumber" @getphonenumber="getphonenumber" :custom-style="customStyle" shape="circle" >去授权</u-button>
 		</image>
-
 	</u-popup>
 </template>
 
@@ -14,7 +13,7 @@
 		name:"pointAuth",
 		data() {
 			return {
-				show: true,
+				show: false,
 				popupStyle: {
 					'u-mode-center-box': 'red'
 				},
@@ -33,6 +32,10 @@
 			},
 			hide(){
 				this.show = false;
+			},
+			getphonenumber(e){
+				console.log(e);
+				this.$emit('getphonenumber',e)
 			}
 		}
 	}

+ 11 - 7
components/login.vue

@@ -29,7 +29,6 @@
 			</view>
 		</view>
 		<toast ref="toast" ></toast>
-		<point-auth @auth="getphonenumber"></point-auth>
 	</view>
 </template>
 <script>
@@ -67,6 +66,14 @@
 			}
 		},
 		methods: {
+			//获取手机号
+			showPhoneModal() {
+				this.phoneShow = true
+			},
+			//隐藏授权弹框
+			hidePhoneModal(){
+				this.phoneShow = false
+			},
 			show() {
 				//获取邀请码
 				this.inviteCode = this.$cache.get('inviteCode')
@@ -162,7 +169,7 @@
 						this.dialogShow = false
 						
 						//获取手机号
-						if (this.$isEmpty(this.vuex_phone)) {
+						if (this.$isEmpty(this.vuex_phone) && this.$config.isAuthPhone) {
 							this.showPhoneModal()
 						}else{
 							this.$refs.toast.info('登录成功')
@@ -187,12 +194,8 @@
 			clear() {
 				return
 			},
-			//获取手机号
-			showPhoneModal() {
-				this.phoneShow = true
-			},
 			async getphonenumber(e) {
-				this.$emit('getphonenumber')
+				this.hidePhoneModal()
 				if (this.$isEmpty(this.sessionKey)) {
 					this.sessionKey =this.$cache.get('userInfo').sessionKey
 				}
@@ -220,6 +223,7 @@
 						userInfo.phone = phone
 						this.$cache.put('userInfo', userInfo)
 						this.$u.vuex('vuex_phone', phone)
+						this.$emit('phoneSuccess')
 					}
 				})
 			}

+ 3 - 0
main.js

@@ -24,6 +24,9 @@ import loading from '@/components/loading/loading.vue'
 Vue.component('loading',loading)
 
 
+//配置文件
+import config from "@/assets/http/config.js"
+Vue.prototype.$config = config
 // util begin
 //缓存
 import simpleCache from "@/utils/cache.js"

+ 28 - 1
pages.json

@@ -71,7 +71,34 @@
 			}
 
 		}
-	],
+	    ,{
+            "path" : "pages/webview/webview",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/auth/auth",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "移动积分授权",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/auth/result",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "授权结果",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"tabBar": {
 		"color": "#555555",
 		"backgroundColor": "#FFFFFF",

+ 43 - 0
pages/auth/auth.vue

@@ -0,0 +1,43 @@
+<template>
+	<view class="">
+		<web-view :src="src"></web-view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: '',
+		data() {
+			return {
+				src: ''
+			};
+		},
+		onLoad(options) {
+			this.queryCmccPoint(options.mobile)
+		},
+		methods: {
+			//查询移动积分
+			async queryCmccPoint(mobile) {
+				let params = {
+					mobile
+				}
+				let res = (await this.$api.CMCC.queryCmccPoint(this.$u.queryParams(params))).data.data
+				if (res.resultCode == '0001') {
+					//跳转到移动授权页
+					this.src = res.data
+					this.$forceUpdate()
+				} else if (res.resultCode == '0000') {
+					//授权成功
+					let data = JSON.parse(res.data)
+					console.log(data);
+				} else {
+					console.log("授权失败");
+				}
+			},
+		}
+	};
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 25 - 0
pages/auth/result.vue

@@ -0,0 +1,25 @@
+<template>
+	<view>
+		<text>授权结果页</text>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		onLoad(options) {
+			console.log(options);
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 3 - 0
pages/index/index.vue

@@ -78,6 +78,9 @@
 				})
 			}
 		},
+		onLoad() {
+			console.log(this.$util.getCurrentRoute());
+		},
 		data() {
 			return {
 				worksList: [],

+ 6 - 3
pages/mine/mine.vue

@@ -62,7 +62,7 @@
 			</view>
 		</view>
 		<view class="container">
-			<block v-for="(item, index) in iconList" :key="index" @click="jump(item.url)">
+			<view v-for="(item, index) in iconList" :key="index" @click="jump(item.url,item.auth)">
 				<block v-if="item.name == '分割线'">
 					<view style="padding: 10rpx 20rpx;">
 						<u-line ></u-line>
@@ -84,9 +84,9 @@
 						</view>
 					</view>
 				</block>
-			</block>
+			</view>
 		</view>
-		<login ref="login" @signIn="signIn"></login>
+		<login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
 	</view>
 </template>
 <script>
@@ -142,6 +142,9 @@
 					},
 				],
 			}
+		},
+		onLoad() {
+			
 		},
 		methods: {
 			init() {

+ 140 - 90
pages/shop/shop.vue

@@ -1,117 +1,109 @@
 <template>
 	<view :style="vuex_skin">
-		<u-navbar title-color="#fff" :border-bottom="false" :is-back="false" title="积分商城"
+		<u-navbar title-color="#fff" z-index="90" :border-bottom="false" :is-back="false" title="积分商城"
 			:background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
 
-		<view class="bg-card">
-			<view class="info" style="display: flex;justify-content: space-between;">
-				<view class="flex">
-					<image style="width: 90rpx;height: 90rpx;border-radius: 50%;" src="../../static/test/avatar.png">
-					</image>
-					<view class="center data">
-						<text style="color: #FFD7D9;">我的积分:</text>
-						<text class="text-bold text-xxl">2356</text>
+		<mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
+			@up="upCallback">
+			<view class="bg-card">
+				<view class="info" style="display: flex;justify-content: space-between;">
+					<view class="flex" v-if="vuex_userId">
+						<image style="width: 90rpx;height: 90rpx;border-radius: 50%;" :src="$cache.get('userInfo').avatar">
+						</image>
+						<view class="center data">
+							<text style="color: #FFD7D9;">我的积分:</text>
+							<text class="text-bold text-xxl">{{$cache.get('userInfo').pufaPoint}}</text>
+						</view>
 					</view>
-				</view>
-
-				<view class="center" style="margin-right: -30rpx;">
-					<view class="cu-btn round sm rule">
-						积分规则
+					<view class="flex" v-else @click="showLogin">
+						<image style="width: 90rpx;height: 90rpx;border-radius: 50%;" src="/static/icon/unlogin.png">
+						</image>
+						<view class="center data">
+							<text style="color: #FFFFFF;font-weight: 800;">点击授权登录</text>
+						</view>
+					</view>
+					<view class="center" style="margin-right: -30rpx;">
+						<view class="cu-btn round sm rule">
+							积分规则
+						</view>
 					</view>
 				</view>
 			</view>
-
-		</view>
-		<view class="swiper">
-			<u-swiper :list="swiperList" border-radius="12" height="250"></u-swiper>
-		</view>
-
-		<view class="recommend-info">
-			<view class="goods-list">
-				<view class="list" v-for="(item,index) in list" :key="index">
-					<view class="pictrue">
-						<image :src="item.image"></image>
-					</view>
-					<view class="title-tag" style="text-align: center;font-weight: 800;">
-						<text>{{item.name}}</text>
-					</view>
-					<view class="price-info">
-						<view class="user-price">
-							<text class="min">¥</text>
-							<text class="max">{{item.points}}积分</text>
+			<view class="swiper">
+				<u-swiper :list="swiperList" border-radius="12" height="250"></u-swiper>
+			</view>
+			<view class="recommend-info">
+				<view class="goods-list">
+					<view class="list" v-for="(item,index) in list" :key="index">
+						<view class="pictrue">
+							<image :src="item.imgUrl"></image>
+						</view>
+						<view class="title-tag" style="text-align: center;font-weight: 800;">
+							<text>{{item.name}}</text>
+						</view>
+						<view class="price-info">
+							<view class="user-price">
+								<text class="min">¥</text>
+								<text class="max">{{item.point}}积分</text>
+							</view>
+						</view>
+						<view class="bottom padding-top-20">
+							<button class="cu-btn round text-white bg-base"
+								style="width: 140upx;height: 50upx;">兑换</button>
 						</view>
-					</view>
-					<view class="bottom padding-top-20">
-						<button class="cu-btn round text-white bg-base" style="width: 140upx;height: 50upx;">兑换</button>
 					</view>
 				</view>
 			</view>
-		</view>
+		</mescroll-body-diy>
+		<login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
 	</view>
 </template>
+
 <script>
+	import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	export default {
+		mixins: [MescrollMixin],
+		components: {
+			MescrollBodyDiy,
+		},
 		data() {
 			return {
 				swiperList: [
 					'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/a20288db71c24a8983801f0c0cd66ea8-bg.jpg'
 				],
-				list: [{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					},
-					{
-						image: '/static/test/goods.png',
-						name: '迪士尼门票',
-						points: 200
-					}
-				]
+
+				downOption: {
+					auto: false
+				},
+				top: 0,
+				list: []
 			}
 		},
 		methods: {
-
+			downCallback() {
+				setTimeout(() => {
+					this.mescroll.resetUpScroll();
+				}, 1000)
+			},
+			upCallback(mescroll) {
+				try {
+					let params = {
+						current: mescroll.num,
+						size: mescroll.size,
+					}
+					this.$api.pointgoods.list(params).then(res => {
+						let data = res.data.data.records
+						let total = res.data.data.total
+						mescroll.endBySize(data.length, total);
+						if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
+						this.list = this.list.concat(data); //追加新数据
+					})
+				} catch (e) {
+					console.error(e);
+					this.mescroll.endErr()
+				}
+			}
 		}
 	}
 </script>
@@ -256,3 +248,61 @@
 		}
 	}
 </style>
+
+
+<!-- <template>
+	<view :style="vuex_skin">
+		<mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
+			@up="upCallback">
+			
+
+			
+			
+
+		</mescroll-body-diy>
+	</view>
+</template>
+<script>
+	import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	export default {
+		mixins: [MescrollMixin],
+		data() {
+			return {
+				
+				downOption: {
+					auto: false
+				},
+				list: [],
+			}
+		},
+		methods: {
+			downCallback() {
+				setTimeout(() => {
+					this.mescroll.resetUpScroll();
+				}, 1000)
+			},
+			upCallback(mescroll) {
+				try {
+					let params = {
+						current: mescroll.num,
+						size: mescroll.size,
+					}
+					this.$api.pointgoods.list(params).then(res => {
+						let data = res.data.data.records
+						let total = res.data.data.total
+						mescroll.endBySize(data.length, total);
+						if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
+						this.list = this.list.concat(data); //追加新数据
+					})
+				} catch (e) {
+					console.error(e);
+					this.mescroll.endErr()
+				}
+			}
+		}
+	}
+</script>
+
+
+ -->

+ 25 - 0
pages/webview/webview.vue

@@ -0,0 +1,25 @@
+<template>
+	<view>
+		<web-view :src="url"></web-view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				url: ''
+			}
+		},
+		onLoad(options) {
+			this.url = options.url
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style>
+
+</style>

BIN
static/test/auth.jpg


+ 3 - 1
store/index.js

@@ -14,7 +14,8 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['vuex_audit','vuex_userId','vuex_phone','vuex_skin','vuex_theme','vuex_active_setting','vuex_page_interface_show'];
+let saveStateKeys = ['vuex_audit','vuex_userId','vuex_phone','vuex_skin',
+			'vuex_theme','vuex_active_setting','vuex_page_interface_show','vuex_isCMCC'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value){
@@ -42,6 +43,7 @@ const store = new Vuex.Store({
 			vuex_theme: lifeData.vuex_theme ? lifeData.vuex_theme : config.themeRed.theme,
 			vuex_page_interface_show: lifeData.vuex_page_interface_show ? lifeData.vuex_page_interface_show :  {},
 			vuex_active_setting: lifeData.vuex_active_setting ? lifeData.vuex_active_setting :  {},
+			vuex_isCMCC: lifeData.vuex_isCMCC ? lifeData.vuex_isCMCC :  false,
 		},
 	
 		mutations: {

+ 4 - 2
store/initParams.js

@@ -1,9 +1,11 @@
 export const initPlatformParams =  async function (app){
+	
 				const {ACTIVE_SETTING,PAGE_INTERFACE_SHOW} = (await app.$api.platform.getPlatformParams({
 					keys: 'ACTIVE_SETTING,PAGE_INTERFACE_SHOW'
 				})).data.data;
-				app.$u.vuex('vuex_active_setting', JSON.parse(ACTIVE_SETTING));
-				app.$u.vuex('vuex_page_interface_show', JSON.parse(PAGE_INTERFACE_SHOW));
+				await app.$u.vuex('vuex_active_setting', JSON.parse(ACTIVE_SETTING));
+				await app.$u.vuex('vuex_page_interface_show', JSON.parse(PAGE_INTERFACE_SHOW));
+				console.log(1);
 			};
 			
 

+ 22 - 1
utils/mixin.js

@@ -32,6 +32,9 @@ let page = {
 		}
 	},
 	methods: {
+		init(){
+			console.log("登录成功,初始化数");
+		},
 		// 登录 begin
 		showLogin() {
 			this.$refs.login.show()
@@ -48,10 +51,28 @@ let page = {
 			//获取数据
 			this.init()
 			//获取手机号
-			if (this.$isEmpty(this.vuex_phone)) {
+			if (this.$isEmpty(this.vuex_phone)&&this.$config.isAuthPhone) {
 				this.$refs.login.showPhoneModal()
 			}
 		},
+		async checkIsCmcc(){
+			if (this.$isEmpty(this.vuex_phone)) {
+				return
+			}
+			let params={
+				phone:this.vuex_phone
+			}
+			let res=await this.$api.CMCC.isCMCC(params)
+			this.$u.vuex('vuex_isCMCC',!res.data.data)
+			if (this.vuex_isCMCC) {
+				uni.navigateTo({
+					url:"/pages/auth/auth?mobile="+this.vuex_phone
+				})
+			}
+		},
+		phoneSuccess(){
+			console.log('手机号获取成功>>>>>>>>');
+		},
 		// 登录 end
 	},