李万涛 преди 2 години
родител
ревизия
ae73d3c88f
променени са 5 файла, в които са добавени 59 реда и са изтрити 12 реда
  1. 1 0
      common/wechat/wechat.js
  2. 1 1
      pages.json
  3. 15 5
      pages/chat/chat.vue
  4. 29 6
      pages/index/index.vue
  5. 13 0
      pages/index/scoreDetail/index.vue

+ 1 - 0
common/wechat/wechat.js

xqd
@@ -79,6 +79,7 @@ export default {
 			throw false;
 		}
 		let host = $platform.host();
+
 		// let host = window.Location.href;
 		// let host = 'http://www.liwantao.top';
 		// let host = 'http://t20.9026.com/h5';

+ 1 - 1
pages.json

xqd
@@ -36,7 +36,7 @@
 				// #ifdef H5
 				"navigationStyle": "custom",
 				// #endif
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": true
 			},
 			"meta": {
 				"auth": false,

+ 15 - 5
pages/chat/chat.vue

xqd xqd xqd xqd xqd
@@ -2,10 +2,10 @@
 	<!-- <view style="padding-bottom: 248rpx;"> -->
 	<view style="">
 		<!-- #ifdef H5 -->
-		<!-- 	<view style="color: #000;">
+		<view style="color: #000;">
 			<tn-nav-bar backgroundColor="#fff">GPT</tn-nav-bar>
 			<view :style="{ height: tobheight + 'px' }"></view>
-		</view> -->
+		</view>
 		<!-- #endif -->
 
 		<view class="content" @touchmove="">
@@ -125,7 +125,8 @@
 	} from '@/api/public/index.js';
 
 	import {
-		userInfo
+		userInfo,
+		sysParms
 	} from '@/api/my/index.js'
 
 	export default {
@@ -144,7 +145,8 @@
 				codeBgColor: '#26B3A0',
 				userInfo: {},
 
-				freeCount: 5
+				freeCount: 5,
+				freeCountSum: 0
 			};
 		},
 		computed: {
@@ -152,6 +154,14 @@
 		},
 
 		async onLoad() {
+			let ress = await sysParms()
+			console.log('gpt页系统设置信息返回值', ress.data[6].value);
+			if (ress.code == 0) {
+				this.freeCount = ress.data[6].value
+				this.freeCountSum = ress.data[6].value
+			}
+
+
 			if (uni.getStorageSync('token')) {
 				this.freeCount = 99999
 
@@ -194,7 +204,7 @@
 			async send(e) {
 				if (this.freeCount <= 0) {
 					uni.showToast({
-						title: '抱歉,您的免费次数(5次)已用完!',
+						title: `抱歉,您的免费次数(${this.freeCountSum}次)已用完!`,
 						icon: 'none'
 					});
 					return;

+ 29 - 6
pages/index/index.vue

xqd xqd
@@ -110,16 +110,35 @@
 		watch: {
 
 		},
-		async onLoad() {
-			// console.log('111111111111111111111111111111111111111');
-			// http("wechat.test", {
+		async onPullDownRefresh() {
+			// uni.reLaunch({
+			// 	url: '/pages/index/index'
+			// })
+			let ress = await taskList({
+				is_new: 1,
+				page: this.page,
+				per_page: this.pagesize
+			})
+			if (ress.code == 0) {
+				this.totalElements = ress.data.total
+				this.tuskList = ress.data.data
+			}
+			// console.log('课程学习页任务列表返回值', ress);
 
-			// }).then(res => {
 
-			// 	console.log('利用原请求封装轮播图返回值', res);
-			// })
 
+			let ress1 = await courseList()
+			if (ress1.code == 0) {
+				this.courseList = ress1.data.data
+			}
+			// console.log('课程学习页课程列表返回值', ress1);
 
+			if (ress.code == 0 && ress1.code == 0) {
+				uni.stopPullDownRefresh()
+			}
+		},
+
+		async onLoad() {
 			if (!uni.getStorageSync('token')) {
 				uni.redirectTo({
 					url: '/pages/user/signin'
@@ -143,6 +162,10 @@
 				this.courseList = ress1.data.data
 			}
 			console.log('课程学习页课程列表返回值', ress1);
+
+			if (ress.code == 0 && ress1.code == 0) {
+				uni.stopPullDownRefresh()
+			}
 		},
 		async onReachBottom() {
 			let allTotal = this.page * this.pagesize

+ 13 - 0
pages/index/scoreDetail/index.vue

xqd xqd
@@ -65,6 +65,11 @@
 	import ShoproPay from '@/common/pay';
 	import wxsdk from '@/common/wechat/sdk'
 
+
+	// 判断是否为微信环境
+	const isWechat = () => {
+		return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
+	}
 	export default {
 		components: {},
 		data() {
@@ -107,6 +112,14 @@
 				})
 			},
 			async goStudy(course_id) {
+				// console.log(isWechat());
+				if (!isWechat()) {
+					uni.showToast({
+						title: '请用微信内置浏览器打开本网站,进行课程购买!',
+						icon: 'none'
+					})
+					return
+				}
 				let res1 = await shopCourse({
 					course_id
 				})