Tang 4 سال پیش
والد
کامیت
62e69175d3
11فایلهای تغییر یافته به همراه227 افزوده شده و 60 حذف شده
  1. 10 0
      common/api.js
  2. 20 0
      common/httpList/bank.js
  3. 4 3
      common/httpList/course.js
  4. 20 0
      common/httpList/note.js
  5. 15 20
      common/methodTool.js
  6. 4 4
      common/request.js
  7. 110 24
      components/home.vue
  8. 29 1
      package-lock.json
  9. 1 1
      pages/index/index.vue
  10. 9 7
      pages/login/login.vue
  11. 5 0
      pages2/wd/info.vue

+ 10 - 0
common/api.js

@@ -32,10 +32,20 @@
 import login from './httpList/login.js'
 import polyvVideo from './httpList/polyvVideo.js'
 import course from './httpList/course.js'
+<<<<<<< HEAD
 import oss from './httpList/oss.js'
+=======
+import bank from './httpList/bank.js'
+import note from './httpList/note.js'
+>>>>>>> 19adad0d3b563f01c63edb1267920e3c4ea473bf
 export default {
 	...login,
 	...polyvVideo,
 	...course,
+<<<<<<< HEAD
 	...oss
+=======
+	...bank,
+	...note
+>>>>>>> 19adad0d3b563f01c63edb1267920e3c4ea473bf
 }

+ 20 - 0
common/httpList/bank.js

@@ -0,0 +1,20 @@
+import {
+	myRequest
+} from '../request.js'
+export default {
+	banklist(data) {
+		return myRequest({
+			url: '/app/common/bank/list',
+			method: 'get',
+			data: data,
+			noToken:true
+		})
+	},
+	bankInfo(data) {
+		return myRequest({
+			url: '/app/common/bank/' + data,
+			method: 'get',
+			noToken: true
+		})
+	},
+}

+ 4 - 3
common/httpList/course.js

@@ -5,15 +5,16 @@ export default {
 	//查询课程列表
 	courselist(data) {
 		return myRequest({
-			url: '/course/list',
+			url: '/app/common/course/list',
 			method: 'get',
-			data: data
+			data: data,
+			noToken:true
 		})
 	},
 	//获取课程详细信息
 	courseInfo(data) {
 		return myRequest({
-			url: '/course/' + data,
+			url: '/app/common/course/' + data,
 			method: 'get',
 			noToken: true
 		})

+ 20 - 0
common/httpList/note.js

@@ -0,0 +1,20 @@
+import {
+	myRequest
+} from '../request.js'
+export default {
+	notelist(data) {
+		return myRequest({
+			url: '/app/common/exam/note/list',
+			method: 'get',
+			data: data,
+			noToken:true
+		})
+	},
+	noteInfo(data) {
+		return myRequest({
+			url: '/app/common/exam/note/' + data,
+			method: 'get',
+			noToken: true
+		})
+	},
+}

+ 15 - 20
common/methodTool.js

@@ -1,24 +1,19 @@
-import store from '@/store/index.js'
-import api from './api.js'
+const BASE_IMG_URL = 'https://file-dev.xyyxt.net'
 export default {
 	isLogin() {
-		return new Promise((resolve, reject) => {
-			if (store.state.token === "") {
-				uni.getStorage({
-					key: 'union_id',
-					success: function(res) {
-						api.refreshToken(res.data).then(result => {
-							store.state.token = result.data.token
-							resolve(true)
-						})
-					},
-					fail: function(err) {
-						resolve(false)
-					}
-				});
-			} else {
-				resolve(true)
-			}
-		})
+		if(uni.getStorageSync('union_id')){
+			return true;
+		}else{
+			return false
+		}
+	},
+	splitImgHost(url) {
+		if(!url){
+			return ''
+		}
+		if(url.indexOf("http") != -1||url.indexOf("https") != -1){
+			return url;
+		}
+		return BASE_IMG_URL+url
 	},
 }

+ 4 - 4
common/request.js

@@ -1,4 +1,4 @@
-const BASE_URL = 'http://192.168.0.222:8088'
+const BASE_URL = 'http://127.0.0.1:8088'
 import store from '@/store/index.js'
 import api from './api.js'
 var num = 1
@@ -12,7 +12,7 @@ export const myRequest = (options) => {
 			method: options.method || 'GET',
 			data: options.data,
 			header: options.noToken ? {} : {
-				AuthorizationToken: 'WX ' + store.state.token
+				AuthorizationToken: 'WX ' + uni.getStorageSync('token')
 			},
 			success: async (res) => {
 				if (res.data.code == 401) {
@@ -42,9 +42,9 @@ export const myRequest = (options) => {
 		}
 		const res = await myRequest(datas)
 		if (res.data.code === 200) {
-			store.state.token = res.data.data.token
+			uni.setStorageSync('token', res.data.data.token)
 			let onset = await myRequest(response)
-			console.log(onset)
+			console.log(datas)
 			return onset
 		} else {
 			uni.removeStorageSync('union_id')

+ 110 - 24
components/home.vue

@@ -67,10 +67,10 @@
 						</u-col>
 					</u-row>
 				</view>
-				<!-- 列表-->
-				<view>
+				<!-- 课程列表-->
+				<view v-if="current==0">
 					<view @click="jumpDetail" class="list_box" v-for="(item, index) in list1" :key="index">
-						<image src="http://192.168.0.222:8080/img/banner1.png" class="list_img"></image>
+						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
 						<view class="list_content">
 							<view style="margin-left: 280rpx;margin-top: 10rpx;">
 								<view class="list_title">{{item.courseName}}</view>
@@ -80,7 +80,33 @@
 						</view>
 					</view>
 				</view>
-				<view v-if="showStatus" style="text-align: center;margin-top: 24rpx;">
+				<!-- 题库列表-->
+				<view v-if="current==1">
+					<view @click="jumpDetail" class="list_box" v-for="(item, index) in list2" :key="index">
+						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
+						<view class="list_content">
+							<view style="margin-left: 280rpx;margin-top: 10rpx;">
+								<view class="list_title">{{item.bankName}}</view>
+								<view class="old_price">原价:¥{{item.price}}</view>
+								<view class="price">现价:¥{{item.price}}</view>
+							</view>
+						</view>
+					</view>
+				</view>
+				<!-- 重点列表-->
+				<view v-if="current==2">
+					<view @click="jumpDetail" class="list_box" v-for="(item, index) in list3" :key="index">
+						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
+						<view class="list_content">
+							<view style="margin-left: 280rpx;margin-top: 10rpx;">
+								<view class="list_title">{{item.name}}</view>
+								<view class="old_price">原价:¥{{item.price}}</view>
+								<view class="price">现价:¥{{item.price}}</view>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view v-if="paramList[current].showStatus" style="text-align: center;margin-top: 24rpx;">
 					到底啦~
 				</view>
 				<u-popup v-model="show">
@@ -92,6 +118,7 @@
 </template>
 
 <script>
+
 export default {
 	name: 'home',
 	data() {
@@ -120,13 +147,32 @@ export default {
 					image: 'https://cdn.uviewui.com/uview/swiper/3.jpg'
 				}
 			],
-			pageNum:1,
-			pageSize: 10,
+			paramList:[
+				{
+					pageNum:1,
+					pageSize: 10,
+					total:0,
+					showStatus:0
+				},
+				{
+					pageNum:1,
+					pageSize: 10,
+					total:0,
+					showStatus:0
+				},
+				{
+					pageNum:1,
+					pageSize: 10,
+					total:0,
+					showStatus:0
+				}
+			],
 			date: ['日', '一', '二', '三', '四', '五', '六'],
 			date_num: [23, 24, 25, 26, 27, 28, 29],
 			list1: [],
+			list2: [],
+			list3: [],
 			windowHeight: 0,
-			showStatus: false,
 		};
 	},
 	onLoad(){},
@@ -136,30 +182,70 @@ export default {
 	},
 	methods: {
 		initList(){
-			var self = this
-			var data = {
-				status: '1',
-				pageNum : this.pageNum,
-				pageSize: this.pageSize
-			}
-			this.$api.courselist(data).then(res => {
-				if(self.list1.length === res.data.total){
-					this.showStatus = true
-				}else{
-					res.data.rows.forEach((item,index) => {
-						self.list1.push(item)
-					})
-				}
-			})
+			this.courseList()
+			this.bankList()
+			this.noteList()
 		},
 		scroll(e) {},
 		scrollTolower(){
-			this.pageNum++
-			this.initList()
+			if(this.current==0){
+				if(this.list1.length<this.paramList[0].total){
+					this.paramList[0].pageNum++
+					this.courseList()
+				}
+			}
+			if(this.current==1){
+				if(this.list1.length<this.paramList[1].total){
+					this.paramList[1].pageNum++
+					this.bankList()
+				}
+			}
+			if(this.current==2){
+				if(this.list1.length<this.paramList[2].total){
+					this.paramList[2].pageNum++
+					this.noteList()
+				}
+			}
 		},
 		sectionChange(index) {
 			this.current = index;
 		},
+		//课程
+		courseList(){
+			var self = this
+			var param = this.paramList[0]
+			this.$api.courselist(param).then(res => {
+				self.paramList[0].total = res.data.total
+				self.list1.push.apply(self.list1,res.data.rows)
+				if(self.list1.length === res.data.total){
+					self.paramList[0].showStatus = true
+				}
+			})
+		},
+		//题库
+		bankList(){
+			var self = this
+			var param = this.paramList[1]
+			this.$api.banklist(param).then(res => {
+				self.paramList[1].total = res.data.total
+				self.list2.push.apply(self.list2,res.data.rows)
+				if(self.list2.length === res.data.total){
+					self.paramList[1].showStatus = true
+				}
+			})
+		},
+		//考试重点
+		noteList(){
+			var self = this
+			var param = this.paramList[2]
+			this.$api.notelist(param).then(res => {
+				self.paramList[2].total = res.data.total
+				self.list3.push.apply(self.list3,res.data.rows)
+				if(self.list3.length === res.data.total){
+					self.paramList[2].showStatus = true
+				}
+			})
+		},
 		jumpDetail() {
 			if (this.current == 0) {
 				this.$navTo.togo('/pages2/course/detail', {});

+ 29 - 1
package-lock.json

@@ -1,8 +1,36 @@
 {
   "name": "zz-applet",
   "version": "1.0.0",
-  "lockfileVersion": 1,
+  "lockfileVersion": 2,
   "requires": true,
+  "packages": {
+    "": {
+      "name": "zz-applet",
+      "version": "1.0.0",
+      "license": "ISC",
+      "dependencies": {
+        "jweixin-module": "^1.6.0",
+        "tki-qrcode": "^0.1.6",
+        "uview-ui": "^1.8.3"
+      },
+      "devDependencies": {}
+    },
+    "node_modules/jweixin-module": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
+      "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
+    },
+    "node_modules/tki-qrcode": {
+      "version": "0.1.6",
+      "resolved": "https://registry.npmjs.org/tki-qrcode/-/tki-qrcode-0.1.6.tgz",
+      "integrity": "sha512-EnnlS8psowC7PsW3MDYcxvJYkuklX3WAZ/BYanR4TdBHTu74GfjTBX8Y16REP+AeDENiVtBPh4jtTRL2P736hQ=="
+    },
+    "node_modules/uview-ui": {
+      "version": "1.8.3",
+      "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.3.tgz",
+      "integrity": "sha512-DqKc+qRrOZLPcyfWv4b0HspSS9n1Cd6BbgKiYEv9rjTAnWoqJV7rXsvWqZdr5iKGP5EMNbNS741GLNw4sIHbpw=="
+    }
+  },
   "dependencies": {
     "jweixin-module": {
       "version": "1.6.0",

+ 1 - 1
pages/index/index.vue

@@ -47,7 +47,7 @@
 				if(index==this.current){
 					return false
 				}
-				if(!this.login){
+				if(!this.$method.isLogin()){
 					this.$navTo.togo('/pages/login/login');
 					return false
 				}else{

+ 9 - 7
pages/login/login.vue

@@ -26,15 +26,17 @@ export default {
 				};
 				that.$api.login(datas).then(
 					res => {
-						uni.showModal({
-							title: '提示',
-							content: res.data.msg,
-							showCancel: false
-						}); 
-						if (res.code == 200) {
-							that.$store.state.token = res.data.data.token;
+						console.log(res.data.code,666)
+						if (res.data.code == 200) {
 							uni.setStorageSync('union_id', res.data.data.union_id);
+							uni.setStorageSync('token', res.data.data.token);
 							uni.navigateBack();
+						}else{
+							uni.showModal({
+								title: '提示',
+								content: res.data.msg,
+								showCancel: false
+							}); 
 						}
 					},
 					err => {

+ 5 - 0
pages2/wd/info.vue

@@ -46,6 +46,7 @@
 					</picker>
 				</u-form-item>
 				<u-form-item label="一寸头像" :label-width="auto" label-position="top">
+<<<<<<< HEAD
 					<u-upload
 						:auto-upload="false"
 						custom-btn="true"
@@ -58,6 +59,10 @@
 						@on-list-change="changePhotoListHeader"
 					>
 						<template v-slot:addBtn>
+=======
+					<u-upload :auto-upload="false" custom-btn="true" :action="action"  :file-list="fileList" width="120" height ="169" size-type="['compressed']" max-count="1">
+						<template v-slot:addBtn >
+>>>>>>> 19adad0d3b563f01c63edb1267920e3c4ea473bf
 							<image src="/static/info_1.png" style="width: 120rpx; height: 169rpx;"></image>
 						</template>
 					</u-upload>