Browse Source

功能实现

lianghanqiang 4 years ago
parent
commit
055b10212c

+ 3 - 1
App.vue

@@ -4,7 +4,9 @@
 			//更新版本
 			this.updateApp()
 		},
-
+		onError(err) {
+			console.log(err,1);
+		},
 		methods:{
 			updateApp(){
 				const updateManager = uni.getUpdateManager();

+ 3 - 1
assets/http/service.js

@@ -15,6 +15,8 @@ const getTokenStorage = () => {
 	return token
 }
 const http = new Request()
+
+
 http.setConfig((config) => {
 	/* 设置全局配置 */
 	config.baseURL = baseURL /* 根域名不同 */
@@ -41,7 +43,7 @@ http.interceptors.response.use(async (response) => {
 	/* 请求之后拦截器。可以使用async await 做异步操作  */
 	//toekn过期处理 
 	//200 返回数据成功 0
-	return response
+	return response;
 }, async (err) => { // 请求错误做点什么
 	console.log(err,1234123);
 	if (err.statusCode == 401) {

+ 17 - 11
components/alert/pointAuth.vue

@@ -1,11 +1,16 @@
 <template>
-	<u-popup :custom-style="popupStyle" class="auth-point" v-model="show" mode="center" width="80%" border-radius="18" >
-		<image class="auth-bg" mode="aspectFill" src="../../static/poster/bg_shouyetc.png">
-			<view class="auth-msg">
-			</view>
-			<u-button open-type="getPhoneNumber" @getphonenumber="getphonenumber" :custom-style="customStyle" shape="circle" >去授权</u-button>
-		</image>
-	</u-popup>
+	<view>
+		<u-popup :custom-style="popupStyle" class="auth-point" v-model="show" mode="center" width="80%" border-radius="18" >
+			<image class="auth-bg" mode="aspectFill" src="../../static/poster/bg_shouyetc.png">
+				<view class="auth-msg">
+					<view v-for="item in vuex_active_setting.helpExplainList" >
+						{{item.helpExplain}}
+					</view>
+				</view>
+				<u-button  @click="toAuth" :custom-style="customStyle" shape="circle" >去授权</u-button>
+			</image>
+		</u-popup>
+	</view>
 </template>
 
 <script>
@@ -17,6 +22,7 @@
 				popupStyle: {
 					'u-mode-center-box': 'red'
 				},
+				authUrl: '',
 				customStyle: {
 					color: 'white',
 					background: "#E72226",
@@ -27,15 +33,15 @@
 		},
 
 		methods: {
-			showAuth(){
+			showAuth(url){
+				this.authUrl = url;
 				this.show = true;
 			},
 			hide(){
 				this.show = false;
 			},
-			getphonenumber(e){
-				console.log(e);
-				this.$emit('getphonenumber',e)
+			toAuth(){
+				this.$jump('/pages/auth/auth?url='+encodeURIComponent(this.authUrl));
 			}
 		}
 	}

+ 40 - 27
components/alert/votePopup.vue

@@ -1,38 +1,43 @@
 <template>
-	<u-popup v-model="show" mode="bottom" width="100%" height="750" border-radius="15" :closeable="true">
-		<view class="padding-30">
-			<view class="padding-top-20 text-bold text-xl">投票助力</view>
-			<view class="padding-top-10 padding-bottom-10" style="color: #888888;font-size: 22rpx;" >
-				中国移动用户可使用移动积分兑换活力道具,兑换后可获得移动为你发起{{gitfs[selected].activeVote}}
-				人助力和{{vuex_active_setting.voteAndPointRate*gitfs[selected].activeVote}}个普法积分(可用于积分商城兑换商品),快为喜爱的作品加油助力吧
-			</view>
-			<scroll-view style="white-space: nowrap;" :scroll-x="true">
-				<view v-for="(item,index) in gitfs" class="gift-item">
-					<view @click.stop="selected = index;count = index" class="padding-20" :class="{'icon-box': true,'selected': index ==  selected}" >
-						<image mode="aspectFit" class="gift-img" :src="item.imgUrl"></image>
-						<view class="gift-name">{{item.name}}</view>
-					</view>
-					<view style="color: #999999;font-size: 20rpx;text-align: center;padding-top: 10rpx;">剩余免费次数</view>
+	<view>
+		<u-popup v-model="show" mode="bottom" width="100%" height="750" border-radius="15" :closeable="true">
+			<view class="padding-30">
+				<view class="padding-top-20 text-bold text-xl">投票助力</view>
+				<view class="padding-top-10 padding-bottom-10" style="color: #888888;font-size: 22rpx;" >
+					中国移动用户可使用移动积分兑换活力道具,兑换后可获得移动为你发起{{gitfs[selected].activeVote}}
+					人助力和{{vuex_active_setting.voteAndPointRate*gitfs[selected].activeVote}}个普法积分(可用于积分商城兑换商品),快为喜爱的作品加油助力吧
 				</view>
-			</scroll-view>
-			
-			<view class="handle-bar">
-				<view class="text-center padding-bottom-20" style="color: #0A9FEF;">您目前的移动积分</view>
-				<view class="button-bar">
-					<view class="button-r">
-						<u-count-to v-if="show" color="#E72226" start-val="0" :end-val="gitfs[selected].point" :duration="500"></u-count-to>
-						 <span class="info">移动积分</span>
-					 </view>
-					<view class="button-f">点击投票</view>
+				<scroll-view style="white-space: nowrap;" :scroll-x="true">
+					<view v-for="(item,index) in gitfs" class="gift-item">
+						<view @click.stop="selected = index;count = index" class="padding-20" :class="{'icon-box': true,'selected': index ==  selected}" >
+							<image mode="aspectFit" class="gift-img" :src="item.imgUrl"></image>
+							<view class="gift-name">{{item.name}}</view>
+						</view>
+						<view style="color: #999999;font-size: 20rpx;text-align: center;padding-top: 10rpx;">剩余免费次数</view>
+					</view>
+				</scroll-view>
+				
+				<view class="handle-bar">
+					<view class="text-center padding-bottom-20" style="color: #0A9FEF;">您目前的移动积分</view>
+					<view class="button-bar">
+						<view class="button-r">
+							<u-count-to v-if="show" color="#E72226" start-val="0" :end-val="gitfs[selected].point" :duration="500"></u-count-to>
+							 <span class="info">移动积分</span>
+						 </view>
+						<view class="button-f">点击投票</view>
+					</view>
 				</view>
 			</view>
-		</view>
-	</u-popup>
+		</u-popup>
+		<point-auth ref="pointAuth"></point-auth>
+	</view>
 </template>
 
 <script>
+	import pointAuth from '../../components/alert/pointAuth.vue'
 	export default {
 		name:"votePopup",
+		components:{ pointAuth },
 		data() {
 			return {
 				show: false,
@@ -44,7 +49,15 @@
 		
 		methods: {
 			async showVote(){
-				const res = await this.$api.activity.getGiftList({current: 1,size: 99});
+				let params = {
+					mobile: '13126058204'
+				}
+				const queryRes = (await this.$api.CMCC.queryCmccPoint(this.$u.queryParams(params)));
+				if(queryRes.data.data.resultCode == '0001' ){
+					this.$refs.pointAuth.showAuth(queryRes.data.data.data);
+					return;
+				}
+				const res = await this.$api.activity.getGiftList({userId: 1,current: 1,size: 99});
 				this.gitfs = res.data.data.records;
 				this.show = true;
 			},

+ 2 - 5
main.js

@@ -23,10 +23,8 @@ Vue.component('toast',toast)
 import loading from '@/components/loading/loading.vue'
 Vue.component('loading',loading)
 
-
-//配置文件
-import config from "@/assets/http/config.js"
-Vue.prototype.$config = config
+import pointAuth from '@/components/alert/pointAuth.vue'
+Vue.component('pointAuth',pointAuth)
 // util begin
 //缓存
 import simpleCache from "@/utils/cache.js"
@@ -66,7 +64,6 @@ Vue.prototype.$global = global
 //util end
 
 
-
 //封装api
 import {
 	api

+ 1 - 1
pages/activity/activityDetail.vue

@@ -64,7 +64,7 @@
 			}
 		},
 		methods: {
-			showVote(){
+			async showVote(){
 				this.$refs.votePopup.showVote();
 			}
 		}

+ 2 - 19
pages/auth/auth.vue

@@ -13,27 +13,10 @@
 			};
 		},
 		onLoad(options) {
-			this.queryCmccPoint(options.mobile)
+			this.src = decodeURIComponent(options.url);
 		},
 		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>