浏览代码

强制关注可切换

JXDS18FUJT 1 年之前
父节点
当前提交
dc99b633df

+ 1 - 0
src/api/request.js

@@ -12,6 +12,7 @@ const service = axios.create({
 	// axios中请求配置有baseURL选项,表示请求URL公共部分
 	//#ifdef MP-WEIXIN
 	//baseURL: process.env.NODE_ENV === 'development' ? 'https://jpcj-admin1.zzxcx.net/stage-api' : 'https://jpcj-admin.zzxcx.net/prod-api',
+	//https://107j18o08.vicp.fun/
 	baseURL: process.env.NODE_ENV === 'development' ? 'https://nbjk1.zzxcx.net/nbjk-admin/' : 'https://nbjk.zzxcx.net/nbjk-admin/',
 	
 	//#endif

+ 65 - 0
src/otherPages/donation/index.vue

@@ -0,0 +1,65 @@
+<template>
+    <div>
+        <div style="width: 50vw;margin: 15rpx auto;">
+            <button @click="friendlyDonation()" type="primary">友情捐赠</button>
+        </div>
+
+    </div>
+</template>
+
+<script>
+import api from '@/api'
+export default {
+    data() {
+        return {
+
+        }
+    },
+    methods: {
+        friendlyDonation() {
+            let systemInfo = wx.getSystemInfoSync();
+            api.buy
+                .studentWxXcxPrepareOrder({
+                    goodsId: this.examId,
+                    foreType: 2,
+                    goodsType: 2,
+                    phoneType: systemInfo.platform == "ios" ? 1 : 2,
+                }).then(res => {
+                    wx.requestPayment({
+                        ...res.data,
+                        complete: (res) => {
+
+                            if (res.errMsg.includes("ok")) {
+                                uni.showLoading({
+                                    title: "支付中",
+                                });
+                                setTimeout(() => {
+                                    uni.showToast({
+                                    title: "支付成功",
+                                });
+                                    uni.hideLoading();
+                                }, 3000);
+                            } else if (res.errMsg.includes("fail")) {
+                                uni.showToast({
+                                    title: "支付失败",
+                                    icon:'error'
+                                });
+                            
+                            } else {
+                                setTimeout(() => {
+
+                                    uni.hideLoading();
+                                }, 3000);
+                            }
+                        },
+                    });
+                })
+
+        }
+    },
+
+
+}
+</script>
+
+<style lang="less" scoped></style>

+ 4 - 0
src/pages.json

@@ -223,6 +223,10 @@
     {
       "root": "otherPages",
       "pages": [
+        {
+          "path": "donation/index",
+          "style": {}
+        },
         {
           "path": "joinBusiness/index",
           "style": {}

+ 1 - 0
src/pages/carVideo/index.vue

@@ -234,6 +234,7 @@ import utils from "@/utils/index";
 import api from "@/api";
 import subjectVideoSelect from "./components/subjectVideoSelect.vue";
 import userInfoAuth from "./components/userInfoAuth.vue";
+import { mapGetters, mapState } from "vuex";
 export default {
   components: {
     userInfoAuth,

+ 24 - 7
src/pages/teacherVideo/index.vue

@@ -45,10 +45,12 @@
         <view class="title">请先关注公众号</view>
         <official-account></official-account>
         <view @click="() => {
-            careVisible = false;
-          }
+          careVisible = false;
+        }
           " class="confirm">
           关闭</view>
+
+
       </view>
     </view>
 
@@ -62,6 +64,7 @@
 <script>
 import bottom_arrrow from "@/assets/img/bottom_arrrow.png";
 import api from "@/api";
+import { mapState } from 'vuex'
 export default {
   data() {
     return {
@@ -76,12 +79,15 @@ export default {
       let that = this;
       let userInfo = uni.getStorageSync("userInfo");
       let gzhOpenid = userInfo.gzhOpenid;
-      console.log(userInfo);
-      if (gzhOpenid) {
+
+      if (gzhOpenid || that.gzhGuanZhu == '0') {
+        console.log('有关注或者无需强制',that.gzhGuanZhu)
         uni.navigateTo({
           url,
         });
+        return
       } else {
+        console.log('无关注',that.gzhGuanZhu)
         let hotStartupOption = uni.getStorageSync("hot_startup_option");
         let coldStartupOption = uni.getStorageSync("cold_startup_option");
         console.log(hotStartupOption.scene);
@@ -107,6 +113,7 @@ export default {
             });
             break;
         }
+        return
         // switch (){
         //   case :
         //   break;
@@ -117,6 +124,15 @@ export default {
     onLoad(query) {
       this.query = query;
     },
+  },
+  computed: {
+  
+      gzhGuanZhu() {
+        //二者暂时同时使用一个
+        return this.$store.state.user.baZiIsPay
+      }
+  
+
   },
   onShow() {
     if (typeof this.$mp.page.getTabBar === 'function' &&
@@ -133,10 +149,11 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.teacherVideo{
- // padding-bottom: constant(safe-area-inset-bottom);//兼容 IOS<11.2
-//padding-bottom: env(safe-area-inset-bottom);//兼容 IOS>11.2
+.teacherVideo {
+  // padding-bottom: constant(safe-area-inset-bottom);//兼容 IOS<11.2
+  //padding-bottom: env(safe-area-inset-bottom);//兼容 IOS>11.2
 }
+
 .care {
   width: 100vw;
   height: 100vh;

+ 9 - 6
src/pages/user/index.vue

@@ -4,9 +4,9 @@
       <div class="user">
         <van-cell custom-class="head-cell" is-link label-class="" center>
           <view @click="() => {
-              userFormShow = true;
-              nickName = userInfo.nickName || '新用户';
-            }
+            userFormShow = true;
+            nickName = userInfo.nickName || '新用户';
+          }
             " class="userButton" slot="title">
             <image class="user-headImg" v-if="userInfo.headImage" :src="userInfo.headImage"></image>
             <image class="user-headImg" v-else :src="unLoginHead"></image>
@@ -34,11 +34,15 @@
         <van-cell title-class="uni-app-fontsize-paragraph" title="每日驾考资讯" is-link center
           url="/otherPages/careEveryDay/index">
         </van-cell>
+
         <van-cell title-class="uni-app-fontsize-paragraph" title="生成分享二维码" is-link center
           url="/otherPages/createReferCode/index">
         </van-cell>
         <van-cell title-class="uni-app-fontsize-paragraph" title="用户反馈" is-link center url="/otherPages/userAdvise/index">
         </van-cell>
+        <van-cell title-class="uni-app-fontsize-paragraph" title="捐赠" is-link center
+          url="/otherPages/donation/index">
+        </van-cell>
         <!-- <van-cell title="我要提现" value="" is-link center @click="goCashOut">
         </van-cell> -->
         <!-- <van-cell title="我的下级" value="" is-link center @click="goMyBranch">
@@ -95,8 +99,8 @@
         <view class="userform">
           <view class="userform-close">
             <van-icon @click="() => {
-                userFormShow = false;
-              }
+              userFormShow = false;
+            }
               " color="#a8a8a8" size="18" name="cross" />
           </view>
           <view>
@@ -228,7 +232,6 @@ export default {
 .user .head-cell {
   background: transparent;
 }
-
 </style>
 <style lang="scss" scoped>
 .userform {

+ 9 - 0
src/store/modules/user.js

@@ -12,6 +12,7 @@ const user = {
 		},
 		isVideoFree:"0",
 		baZiIsPay:'0',
+		gzhGuanZhu:'0',
 		roadExamList:[],
 		openExamRoom: [],
 		userInfo: '',
@@ -32,6 +33,10 @@ const user = {
 		}
 	},
 	mutations: {
+		SET_GZH_GUANZHU:(state,gzhGuanZhu)=>{
+			state.gzhGuanZhu = gzhGuanZhu
+
+		},
 		SET_BAZIISPAY:(state,baZiIsPay)=>{
 			state.baZiIsPay = baZiIsPay
 		},
@@ -150,9 +155,13 @@ const user = {
 			let BAZI_IS_PAY = res.data.filter(item=>{
 				return item.dictLabel=='BAZI_IS_PAY'
 			})
+			// let GZH_GUANZHU = res.data.filter(item=>{
+			// 	return item.dictLabel=='GZH_GUANZHU'
+			// })
 			console.log(IS_VIDEO_FREE,"IS_VIDEO_FREE")
 			store.commit("SET_ISVIDEOFREE",IS_VIDEO_FREE[0].dictValue)
 			store.commit('SET_BAZIISPAY',BAZI_IS_PAY[0].dictValue)
+			// store.commit('SET_GZH_GUANZHU',GZH_GUANZHU[0].dictValue)
 		},
 		/**
 		 * 获取用户信息