Forráskód Böngészése

抖音首页修改

zhangyujun 3 éve
szülő
commit
724bdcb40e

+ 22 - 4
src/api/modules/user.js

@@ -8,18 +8,28 @@ const user = {
 	async login() {
 		//#ifdef MP-TOUTIAO
 		let res = await wx.login()
-		res  = res[1]
+		res = res[1]
 		//#endif
 		//#ifdef MP-WEIXIN
 		let res = await wx.login()
 		//#endif
-		
+
 		console.log(res)
 		return request({
+			//#ifdef MP-WEIXIN
 			url: `/login/jscode`,
+			//#endif
+			//#ifdef MP-TOUTIAO
+			url: `/login/ttcode`,
+			//#endif
 			method: 'post',
 			params: {
-				jscode: res.code
+				//#ifdef MP-WEIXIN
+				jscode: res.code,
+				//#endif
+				//#ifdef MP-TOUTIAO
+				authorizationCode: res.code
+				//#endif
 			},
 			headers: {
 				isLogin: true
@@ -67,12 +77,20 @@ const user = {
 		})
 	},
 	//更新用户真实姓名
-	studentUserRealname(params){
+	studentUserRealname(params) {
 		return request({
 			url: '/student/user/realname',
 			method: 'put',
 			params
 		})
+	},
+	//是否是vip的数据(抖音小程序)
+	userInfoVipInfo(){
+		return request({
+			url:'/user/info/vipInfo',
+			method:'GET'
+		})
+
 	}
 }
 

+ 25 - 21
src/api/request.js

@@ -11,30 +11,34 @@ const baseUrl = 'https://zzjs.zzxcx.net/prod-api';
 // 创建axios实例
 const service = axios.create({
 	// axios中请求配置有baseURL选项,表示请求URL公共部分
-	baseURL: process.env.NODE_ENV==='development'?'https://jpcj-admin1.zzxcx.net/stage-api':'https://jpcj-admin.zzxcx.net/prod-api',
-	// baseURL: baseUrl,
+	//#ifdef MP-WEIXIN
+	baseURL: process.env.NODE_ENV === 'development' ? 'https://jpcj-admin1.zzxcx.net/stage-api' : 'https://jpcj-admin.zzxcx.net/prod-api',
+	//#endif
+	//#ifdef MP-TOUTIAO
+	baseURL: process.env.NODE_ENV === 'development' ? 'https://sdjk-admin1.zzxcx.net/stage-api' : 'https://sdjk-admin1.zzxcx.net/prod-api',
+	//#endif
 })
 mock.init(service)
 
 // request拦截器
 service.interceptors.request.use(
 	async config => {
-			// 是否需要设置 token
-			if (config.headers.isLogin) {
-				return config
-			}
-			if(await store.dispatch("getToken")){
-				config.headers['Authorization'] = 'Bearer ' + await store.dispatch("getToken") // 让每个请求携带自定义token 请根据实际情况自行修改
-			}
-			else{
-				
-			}
-			
+		// 是否需要设置 token
+		if (config.headers.isLogin) {
 			return config
-		},
-		error => {
-			Promise.reject(error)
 		}
+		if (await store.dispatch("getToken")) {
+			config.headers['Authorization'] = 'Bearer ' + await store.dispatch("getToken") // 让每个请求携带自定义token 请根据实际情况自行修改
+		}
+		else {
+
+		}
+
+		return config
+	},
+	error => {
+		Promise.reject(error)
+	}
 )
 
 // 响应拦截器
@@ -51,10 +55,10 @@ service.interceptors.response.use(
 			if (code == 500) {
 				console.log('code' + code + ':' + msg)
 				wx.showToast({
-					title: 'code' + code + ':系统错误' ,
+					title: 'code' + code + ':系统错误',
 					icon: 'none'
 				})
-			}else{
+			} else {
 				console.log('code' + code + ':' + msg)
 				wx.showToast({
 					title: 'code' + code + ':' + msg,
@@ -62,15 +66,15 @@ service.interceptors.response.use(
 				})
 			}
 		}
-		
+
 		return res.data
 	},
 	error => {
 		let {
 			message
 		} = error;
-		console.log(error,'error')
-		if(!message){
+		console.log(error, 'error')
+		if (!message) {
 			message = "未知错误"
 			wx.showToast({
 				title: message,

+ 2 - 2
src/components/m-video-topbottom-short/m-video-topbottom-short.vue

@@ -44,7 +44,7 @@
 
 <style lang="scss">
 	.video-item {
-		margin-right: 30rpx;
+
 		margin-top: 30rpx;
 		position: relative;
 		display: flex;
@@ -97,4 +97,4 @@
 			overflow: hidden;
 		}
 	}
-</style>
+</style>

+ 0 - 1
src/components/m-video-topbottom/m-video-topbottom.vue

@@ -65,7 +65,6 @@ export default {
 
 <style lang="scss">
 .video-item {
-  margin-right: 30rpx;
   margin-top: 30rpx;
   position: relative;
   display: flex;

+ 4 - 3
src/pages/carVideo/components/videoListBox.vue

@@ -13,14 +13,14 @@
 					<m-icon class="icon" type="bofangshipin"></m-icon>
 				</view>
 			</view>
-			<view class="tabs-bfc">
+			<scroll-view class="tabs-bfc">
 				<view class="tabs">
 					<view class="tab" :class="{'tab-active':active===index}" @click="active=index" v-for="(item,index) in carVideoList.children"
 					 :key='index'>
 						{{item.chapterName}}
 					</view>
 				</view>
-			</view>
+			</scroll-view>
 			
 		</view>
 	</view>
@@ -87,7 +87,7 @@ import vip from "@/assets/img/vip.png";
 				justify-content: center;
 				align-items: center;
 				text-align: center;
-				width: 75px;
+				width: auto;
 				height: 37px;
 				background: #5C6066;
 				border-radius: 3px;
@@ -97,6 +97,7 @@ import vip from "@/assets/img/vip.png";
 				font-weight: 500;
 				color: #FFFFFF;
 				letter-spacing: 0.2800000011920929px;
+				padding: 0 30rpx;
 			}
 
 			.tab-active {

+ 127 - 27
src/pages/carVideo/index.vue

@@ -85,6 +85,7 @@
         ></image>
       </view>
     </view>
+    <!-- #ifdef MP-WEIXIN -->
     <view class="tab">
       <van-tabs
         animated
@@ -123,7 +124,11 @@
         </van-tab>
         <van-tab title="科目三">
           <van-grid column-num="4">
-            <van-grid-item @click="goLightMock" icon="https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/lightmock.png" text="灯光模拟">
+            <van-grid-item
+              @click="goLightMock"
+              icon="https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/lightmock.png"
+              text="灯光模拟"
+            >
             </van-grid-item>
           </van-grid>
           <view v-for="(item, index) in typeList" :key="index">
@@ -135,13 +140,108 @@
         </van-tab>
         <van-tab title="科目四">
           <view class="tab-container">
-            <tab-left :query="tabQuery" :subject="4" :leftList="leftList4"></tab-left>
-            <tab-center :query="tabQuery" :subject="4" :centerList="centerList4"></tab-center>
-            <tab-right :query="tabQuery" :subject="4" :rightList="rightList4"></tab-right>
+            <tab-left
+              :query="tabQuery"
+              :subject="4"
+              :leftList="leftList4"
+            ></tab-left>
+            <tab-center
+              :query="tabQuery"
+              :subject="4"
+              :centerList="centerList4"
+            ></tab-center>
+            <tab-right
+              :query="tabQuery"
+              :subject="4"
+              :rightList="rightList4"
+            ></tab-right>
           </view>
         </van-tab>
       </van-tabs>
     </view>
+    <!-- #endif -->
+    <!-- #ifdef MP-TOUTIAO -->
+    <view class="tabTitle">
+      
+
+    </view>
+    <view class="tab">
+      <swiper
+        :current="active"
+        @change="
+          (e) => {
+            active = e.detail.current;
+          }
+        "
+        style="height: 800rpx"
+      >
+        <swiper-item id="tab1" style="display: inline-block">
+          <view class="tab-container">
+            <tab-left
+              :subject="1"
+              :query="tabQuery"
+              :leftList="leftList1"
+            ></tab-left>
+            <tab-center
+              :subject="1"
+              :query="tabQuery"
+              :centerList="centerList1"
+            ></tab-center>
+            <tab-right
+              :subject="1"
+              :query="tabQuery"
+              :rightList="rightList1"
+            ></tab-right>
+          </view>
+        </swiper-item>
+
+        <swiper-item id="tab2" style="display: inline-block">
+          <view v-for="(item, index) in typeList" :key="index">
+            <branch-two
+              v-if="index == 1"
+              :carVideoList="item.children"
+            ></branch-two>
+          </view>
+        </swiper-item>
+
+        <swiper-item id="tab3" style="display: inline-block">
+          <van-grid column-num="4">
+            <van-grid-item
+              @click="goLightMock"
+              icon="https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/lightmock.png"
+              text="灯光模拟"
+            >
+            </van-grid-item>
+          </van-grid>
+          <view v-for="(item, index) in typeList" :key="index">
+            <branch-two
+              v-if="index == 2"
+              :carVideoList="item.children"
+            ></branch-two>
+          </view>
+        </swiper-item>
+        <swiper-item id="tab4" style="display: inline-block">
+          <view class="tab-container">
+            <tab-left
+              :query="tabQuery"
+              :subject="4"
+              :leftList="leftList4"
+            ></tab-left>
+            <tab-center
+              :query="tabQuery"
+              :subject="4"
+              :centerList="centerList4"
+            ></tab-center>
+            <tab-right
+              :query="tabQuery"
+              :subject="4"
+              :rightList="rightList4"
+            ></tab-right>
+          </view>
+        </swiper-item>
+      </swiper>
+    </view>
+    <!-- #endif -->
   </view>
 </template>
 
@@ -170,9 +270,9 @@ export default {
   data: () => ({
     tabQuery: {
       liceCar: 1,
-      liceTruck: '',
-      liceBus: '',
-      liceMoto: '',
+      liceTruck: "",
+      liceBus: "",
+      liceMoto: "",
       name: "科目一",
       cert: "C1/C2/C3",
       vehicle: "轿车",
@@ -207,12 +307,12 @@ export default {
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SelectedTestQuestions@2x.png",
         text: "精选考题",
-        path:"/otherPages/classifyChoose/index"
+        path: "/otherPages/classifyChoose/index",
       },
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SimulationTestTopics@2x.png",
         text: "模拟考试\n仿真题目",
-        path:"/otherPages/beforeMockExam/index"
+        path: "/otherPages/beforeMockExam/index",
       },
     ],
     leftList1: [
@@ -248,7 +348,7 @@ export default {
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/WrongTopicCollection@2x.png",
         text: "错题·收藏",
-         path: "/otherPages/marked/index?markdown=考前须知",
+        path: "/otherPages/marked/index?markdown=考前须知",
       },
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/NotesBeforeExamination@2x.png",
@@ -265,24 +365,24 @@ export default {
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SelectedTestQuestions@2x.png",
         text: "精选考题",
-        path:"/otherPages/classifyChoose/index"
+        path: "/otherPages/classifyChoose/index",
       },
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SimulationTestTopics@2x.png",
         text: "模拟考试\n仿真题目",
-        path:"/otherPages/beforeMockExam/index"
+        path: "/otherPages/beforeMockExam/index",
       },
     ],
     leftList4: [
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SequentialPractice@2x.png",
         text: "顺序练习",
-       path: "/otherPages/classifyOrder/index",
+        path: "/otherPages/classifyOrder/index",
       },
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/ClassificationExercise@2x.png",
         text: "分类练习",
-       path: "/otherPages/classifyKind/index",
+        path: "/otherPages/classifyKind/index",
       },
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/RealExaminationRoomSimulation@2x.png",
@@ -293,7 +393,7 @@ export default {
       {
         img: "https://t1-1305573081.file.myqcloud.com/wxapp/static/imgs/home/SimulationResults@2x.png",
         text: "模拟成绩",
-         path: "/otherPages/testScores/index",
+        path: "/otherPages/testScores/index",
       },
     ],
     active: 0,
@@ -396,26 +496,26 @@ export default {
       switch (item.typeName) {
         case "轿车":
           this.tabQuery.liceCar = 1;
-          this.tabQuery.liceTruck = '';
-          this.tabQuery.liceBus = '';
-          this.tabQuery.liceMoto = '';
+          this.tabQuery.liceTruck = "";
+          this.tabQuery.liceBus = "";
+          this.tabQuery.liceMoto = "";
           break;
         case "货车":
-          this.tabQuery.liceCar = '';
-          this.tabQuery.liceTruck = '';
+          this.tabQuery.liceCar = "";
+          this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = 1;
-          this.tabQuery.liceMoto = '';
+          this.tabQuery.liceMoto = "";
           break;
         case "客车":
-          this.tabQuery.liceCar = '';
-          this.tabQuery.liceTruck = '';
+          this.tabQuery.liceCar = "";
+          this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = 1;
-          this.tabQuery.liceMoto = '';
+          this.tabQuery.liceMoto = "";
           break;
         case "摩托车":
-          this.tabQuery.liceCar = '';
-          this.tabQuery.liceTruck = '';
-          this.tabQuery.liceBus = '';
+          this.tabQuery.liceCar = "";
+          this.tabQuery.liceTruck = "";
+          this.tabQuery.liceBus = "";
           this.tabQuery.liceMoto = 1;
           break;
         default:

+ 11 - 10
src/pages/user/index.vue

@@ -1,7 +1,7 @@
 <template>
   <scroll-view scroll-y class="content">
     <div class="user">
-      <van-cell  center :value="userInfo.nickName" @click="showVConsole">
+      <van-cell   center :value="userInfo.nickName" @tap="getUserProfile">
         <view slot="title">
          <image class="user-headImg" :src="userInfo.headImage"></image>
         </view>
@@ -67,18 +67,19 @@ export default {
   },
   methods: {
     async getUserProfile(e) {
-      let userInfo = await wx.getUserProfile({
+      let userInfo = await uni.getUserProfile({
         desc: "业务需要",
       });
-      let updateRes = await this.$api.user.updateUserInfo({
-        headImage: userInfo.userInfo.avatarUrl,
-        nickName: userInfo.userInfo.nickName,
-      });
-      if (updateRes.code == 200) {
+      console.log(userInfo)
+      // let updateRes = await this.$api.user.updateUserInfo({
+      //   headImage: userInfo.userInfo.avatarUrl,
+      //   nickName: userInfo.userInfo.nickName,
+      // });
+      // if (updateRes.code == 200) {
         
-        this.$store.state.user.userInfo.headImage = userInfo.userInfo.avatarUrl;
-        this.$store.state.user.userInfo.nickName = userInfo.userInfo.nickName;
-      }
+      //   this.$store.state.user.userInfo.headImage = userInfo.userInfo.avatarUrl;
+      //   this.$store.state.user.userInfo.nickName = userInfo.userInfo.nickName;
+      // }
     },
   },
 };

+ 10 - 2
src/store/modules/user.js

@@ -91,7 +91,7 @@ const user = {
 					})
 				}
 
-				return res.data&&res.data.token
+				return res.data && res.data.token
 			}
 		},
 		/**
@@ -99,7 +99,15 @@ const user = {
 		 * @param {Object} store
 		 */
 		async GetInfo(store) {
-			let res = await userApi.getInfo()
+			let res
+			//#ifdef MP-WEIXIN
+			res = await userApi.getInfo()
+			//#endif
+
+			//#ifdef MP-TOUTIAO
+			res = await userApi.userInfoVipInfo()
+			//#endif
+
 			uni.setStorageSync("userInfo", res.data);
 			store.commit('SET_USERINFO', res.data)
 			return res

BIN
zzjs-xcx.7z