Kaynağa Gözat

登录注册绑定

he2802 4 yıl önce
ebeveyn
işleme
5b4192fa38
6 değiştirilmiş dosya ile 569 ekleme ve 16 silme
  1. 4 4
      common/request.js
  2. 27 9
      pages.json
  3. 453 0
      pages2/plan/create.vue
  4. 28 1
      pages2/plan/index.vue
  5. 53 0
      pages2/verify/input.vue
  6. 4 2
      pages2/wd/class.vue

+ 4 - 4
common/request.js

@@ -4,7 +4,7 @@
 import store from '@/store/index.js'
 import api from './api.js'
 var num = 1
-export const BASE_URL = 'http://192.168.1.24:5055'//接口api
+export const BASE_URL = 'http://192.168.1.222:5055'//接口api
 export const BASE_IMG_URL = 'https://file.xyyxt.net/'//图片上传api
 export const tenantId = '867735392558919680'
 export const myRequest = (options) => {
@@ -29,7 +29,7 @@ export const myRequest = (options) => {
 			success: async (res) => {
 				if (res.data.code == 401) {
 					if (num <= 3) {
-						if (!uni.getStorageSync('union_id')) {
+						if (!uni.getStorageSync('user_account')) {
 							uni.navigateTo({
 								url: '/pages/login/login'
 							});
@@ -57,7 +57,7 @@ export const myRequest = (options) => {
 	})
 	async function doRequest(response) {
 		var datas = {
-			url: '/refreshToken/' + uni.getStorageSync('union_id'),
+			url: '/refreshToken/' + uni.getStorageSync('user_account'),
 			method: 'get',
 			noToken: true
 		}
@@ -66,7 +66,7 @@ export const myRequest = (options) => {
 			uni.setStorageSync('token', res.data.data.token)
 
 			var userInfo = {
-				url: '/getInfo',
+				url: '/app/user/getInfo',
 				method: 'get',
 			}
 			const resUser = await myRequest(userInfo)

+ 27 - 9
pages.json

@@ -248,17 +248,35 @@
 				}
 			},
 			{
-					"path": "plan/index",
-					"style": {
-						"navigationBarTitleText": "学习计划",
-						"navigationBarTextStyle": "white",
-						"navigationStyle": "custom", // 隐藏系统导航栏
-						"app-plus": {
-							"titleNView": false, //禁用原生导航栏 
-							"bounce": "none"
-						}
+				"path": "plan/index",
+				"style": {
+					"navigationBarTitleText": "学习计划",
+					"app-plus": {
+						"titleNView": false, //禁用原生导航栏 
+						"bounce": "none"
 					}
 				}
+			},
+			{
+				"path": "plan/create",
+				"style": {
+					"navigationBarTitleText": "创建计划",
+					"app-plus": {
+						"titleNView": false, //禁用原生导航栏 
+						"bounce": "none"
+					}
+				}
+			},
+			{
+				"path": "verify/input",
+				"style": {
+					"navigationBarTitleText": "填写审核资料",
+					"app-plus": {
+						"titleNView": false, //禁用原生导航栏 
+						"bounce": "none"
+					}
+				}
+			}
 		],
 		"plugins": {
 			"polyv-player": {

+ 453 - 0
pages2/plan/create.vue

@@ -0,0 +1,453 @@
+<template>
+	<view style="padding: 30rpx;">
+		<view class="list_box">
+			<view class="item" v-for="(item, index) in list" :key="index">
+				<image :src="item.coverUrl"></image>
+				<text>{{ item.courseName }}</text>
+				<view class="del_icon"><u-icon name="minus-circle-fill" color="#EB4D3D" size="40" @click="delItem(index)"></u-icon></view>
+			</view>
+			<view class="item" style="vertical-align: top;">
+				<view class="item_add" @click="openSel"><u-icon name="plus-circle-fill" color="#32467B" size="32"></u-icon></view>
+			</view>
+		</view>
+		<view class="list_box form">
+			<u-form :model="form" ref="uForm">
+				<u-form-item label="课程类型" :label-width="auto"><u-input v-model="form.category" :disabled="true" /></u-form-item>
+				<u-form-item label="考试日期" prop="birth" :label-width="auto">
+					<picker mode="date" :value="form.date" @change="bindDateChange">
+						<view class="picker">{{ form.date }}</view>
+					</picker>
+				</u-form-item>
+				<u-form-item label="学习提醒" prop="birth" :label-width="auto">
+					<picker mode="time" :value="form.time" @change="bindTimeChange">
+						<view class="picker">{{ form.time }}</view>
+					</picker>
+				</u-form-item>
+				<u-form-item label="学习频率" :label-width="auto">
+					<view class="picker" @click="openWeek">{{ form.week }}</view>
+				</u-form-item>
+				<u-form-item label="复习天数" :label-width="auto">
+					<picker @change="bindPickerChangeReview" :value="index_review" :range="array_review">
+						<view class="picker">{{ array_review[index_review] }}</view>
+					</picker>
+				</u-form-item>
+				<u-form-item label="起止日期" :label-width="auto">
+					<view class="picker" @click="openCalendar">{{ form.startDate }}~{{ form.endDate }}</view>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="list_box form">
+			<view style="height: 80rpx;line-height: 80rpx;color: #007AFF;">
+				根据当前计划每个学习日需完成 <text style="color: #FF9500;">3</text> 个学时
+				</view>
+		</view>
+		<u-calendar v-model="calendar_show" :min-date="minDate" :mode="calendar" @change="change" :max-date="maxDate"></u-calendar>
+		<!-- 弹框-->
+		<u-popup v-model="week_show" mode="bottom">
+			<view style="height: 400rpx;text-align: center">
+				<view style="padding-top: 100rpx;padding-left: 40rpx;text-align: center;">
+					<u-checkbox-group @change="checkboxGroupChange">
+						<u-checkbox v-model="item.checked" v-for="(item, index) in list3" :key="index" :name="item.name">{{ item.name }}</u-checkbox>
+					</u-checkbox-group>
+					<view class="title_l" @click="week_submit" style="margin: 50rpx auto;">确认</view>
+				</view>
+			</view>
+		</u-popup>
+		<u-popup v-model="show" mode="bottom">
+			<view class="popup_box">
+				<view class="popup_title">
+					<u-row>
+						<u-col span="6"><view class="title_r">我的课程</view></u-col>
+						<u-col span="3" offset="3"><view class="title_l" @click="submit">确认</view></u-col>
+					</u-row>
+				</view>
+				<view class="popup_list" v-if="list2.length !== 0">
+					<view class="popup_item" v-for="(item, index) in list2" :key="index">
+						<view style="display: flex;align-items: center;">
+							<u-checkbox
+								:disabled="item.disabled"
+								@change="checkboxChange"
+								shape="circle"
+								active-color="#32467B"
+								v-model="item.checked"
+								:key="index"
+								:name="item.courseId"
+							></u-checkbox>
+						</view>
+						<view style="display: flex;align-items: center;"><image :src="item.coverUrl" style="width: 278rpx;height: 134rpx;"></image></view>
+						<view style="margin: 30rpx;">{{ item.courseName }}</view>
+					</view>
+				</view>
+				<view v-else><u-empty text="请前往购买课程" mode="list"></u-empty></view>
+			</view>
+		</u-popup>
+		<view @click="resultForm" class="submit_btn">确认计划</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			week_show: false,
+			form: {
+				category: '',
+				date: '2021-01-01',
+				time: '20:30',
+				startDate: '2021-05-07',
+				endDate: '2021-05-31',
+				week: '一、三、五'
+			},
+			calendar: 'range',
+			list: [],
+			list2: [],
+			show: false,
+			calendar_show: false,
+			maxDate: '2023-01-01',
+			minDate:'',
+			list3: [
+				{
+					name: '一',
+					checked: false,
+					disabled: false,
+					id: 1
+				},
+				{
+					name: '二',
+					checked: false,
+					disabled: false,
+					id: 2
+				},
+				{
+					name: '三',
+					checked: false,
+					disabled: false,
+					id: 3
+				},
+				{
+					name: '四',
+					checked: false,
+					disabled: false,
+					id: 4
+				},
+				{
+					name: '五',
+					checked: false,
+					disabled: false,
+					id: 5
+				},
+				{
+					name: '六',
+					checked: false,
+					disabled: false,
+					id: 6
+				},
+				{
+					name: '日',
+					checked: false,
+					disabled: false,
+					id: 0
+				}
+			],
+			selWeek: '',
+			index_review: 4,
+			array_review: [1, 2, 3, 4, 5, 6, 7]
+		};
+	},
+	onLoad(option) {
+		this.minDate = this.$method.timestampToTime(new Date().getTime() / 1000);
+		this.form.startDate = this.minDate;
+		this.form.endDate = this.$method.timestampToTime(new Date().getTime() / 1000 + 24 * 3600 * 30);
+		this.getMyCourse();
+	},
+	onShow() {},
+	methods: {
+		resultForm() {
+			if (this.list.length == 0) {
+				uni.showModal({
+					title: '提示',
+					content: '请选择课程',
+					showCancel: false
+				});
+				return;
+			}
+			// if (this.form.week == '请选择') {
+			// 	uni.showModal({
+			// 		title: '提示',
+			// 		content: '请选择学习频率',
+			// 		showCancel: false
+			// 	});
+			// 	return;
+			// }
+			let courseId = [];
+			for (let i = 0; i < this.list.length; i++) {
+				courseId.push(this.list[i].courseId);
+			}
+			let ss = this.form.week.split('、');
+			let weekArray = [];
+			for (let i = 0; i < ss.length; i++) {
+				if (ss[i] == '日') {
+					weekArray.push(0);
+				}
+				if (ss[i] == '一') {
+					weekArray.push(1);
+				}
+				if (ss[i] == '二') {
+					weekArray.push(2);
+				}
+				if (ss[i] == '三') {
+					weekArray.push(3);
+				}
+				if (ss[i] == '四') {
+					weekArray.push(4);
+				}
+				if (ss[i] == '五') {
+					weekArray.push(5);
+				}
+				if (ss[i] == '六') {
+					weekArray.push(6);
+				}
+			}
+			let data = {
+				courseId: courseId.join(','),
+				reminderTime: this.form.time,
+				examDate: this.$method.TimeTotimestamp(this.form.date),
+				startTime: this.$method.TimeTotimestamp(this.form.startDate),
+				endTime: this.$method.TimeTotimestamp(this.form.endDate),
+				studyCount: weekArray.join(','),
+				studyDay: this.array_review[this.index_review],
+				status: 1
+			};
+			console.log(this.form);
+			console.log(data);
+			this.$api.planGenerate(data).then(result => {
+				if (result.data.code == 200) {
+					uni.showModal({
+						title: '提示',
+						content: '提交成功',
+						success: function(resst) {
+							uni.navigateBack()
+						}
+					});
+				}else{
+					uni.showToast({
+						title: result.data.msg,
+						icon: 'none',
+						duration: 2000
+					});
+				}
+				console.log(result);
+			});
+		},
+		selItem(item) {
+			console.log(34);
+			item.checked = !item.checked;
+		},
+		getMyCourse() {
+			let data = {
+				typeId: 1
+			};
+			let self = this;
+			this.$api.getUserBuy(data).then(result => {
+				if (result.data.data.courseVoList !== null) {
+					if (result.data.data.courseVoList.length > 0) {
+						for (let i = 0; i < result.data.data.courseVoList.length; i++) {
+							let item = result.data.data.courseVoList[i];
+							item.checked = false;
+							item.disabled = false;
+							item.coverUrl = self.$method.splitImgHost(item.coverUrl);
+						}
+						self.list2 = result.data.data.courseVoList;
+					}
+				}
+			});
+		},
+		bindPickerChangeReview(e) {
+			this.index_review = e.detail.value;
+		},
+		week_submit() {
+			if (this.selWeek == '') {
+				uni.showModal({
+					title: '提示',
+					content: '至少选择一个'
+				});
+				return;
+			}
+			this.form.week = this.selWeek;
+			this.week_show = false;
+		},
+		openWeek() {
+			this.week_show = true;
+			this.selWeek = this.form.week;
+			let that = this;
+			this.list3.map(val => {
+				val.checked = false;
+				if (that.form.week.indexOf(val.name) != -1) {
+					val.checked = true;
+				}
+			});
+		},
+		checkboxGroupChange(e) {
+			this.selWeek = e.join('、');
+		},
+		openCalendar() {
+			this.calendar_show = true;
+		},
+		change(e) {
+			console.log(e);
+			this.form.startDate = e.startDate;
+			this.form.endDate = e.endDate;
+		},
+		bindTimeChange(e) {
+			this.form.time = e.detail.value;
+		},
+		bindDateChange(e) {
+			this.form.date = e.detail.value;
+		},
+		submit() {
+			let that = this;
+			this.list2.map(val => {
+				if (val.checked) {
+					that.list.push(val);
+				}
+			});
+			this.checkSameItem();
+			this.show = false;
+			this.form.category = this.list[0].categoryName;
+		},
+		checkboxChange(e) {},
+		checkSameItem() {
+			this.list2.map(val => {
+				val.disabled = false;
+				this.list.map(val1 => {
+					if (val.courseId == val1.courseId) {
+						val.disabled = true;
+					}
+					val.checked = false;
+				});
+			});
+		},
+		delItem(index) {
+			this.list.splice(index, 1);
+			if (this.list.length === 0) {
+				this.form.category = '';
+			} else {
+				this.form.category = this.list[0].categoryName;
+			}
+		},
+		openSel() {
+			this.show = true;
+			this.checkSameItem();
+		}
+	}
+};
+</script>
+<style>
+::-webkit-scrollbar {
+	width: 0;
+	height: 0;
+	color: transparent;
+}
+.u-drawer-content-visible {
+	border-radius: 32rpx 32rpx 0rpx 0rpx;
+	overflow: hidden;
+}
+</style>
+<style scope>
+.submit_btn {
+	width: 526rpx;
+	height: 80rpx;
+	background: #007AFF;
+	border-radius: 40rpx;
+	text-align: center;
+	line-height: 80rpx;
+	color: #FFFFFF;
+	margin: 30rpx auto;
+}
+.picker {
+	text-align: right;
+}
+.form {
+	padding: 0 16rpx !important;
+	margin-top: 30rpx;
+}
+input {
+	text-align: right;
+}
+.popup_item {
+	width: 100%;
+	height: 182rpx;
+	background: #ffffff;
+	box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
+	border-radius: 32rpx;
+	margin: 20rpx 0;
+	padding: 10rpx;
+	display: flex;
+}
+.popup_list {
+	height: 500rpx;
+	padding: 0 20rpx;
+}
+.title_l {
+	width: 88rpx;
+	height: 48rpx;
+	background: #32467b;
+	border-radius: 16rpx;
+	font-size: 28rpx;
+	color: #ffffff;
+	text-align: center;
+	line-height: 48rpx;
+}
+.title_r {
+	font-size: 30rpx;
+	font-family: PingFang SC;
+	font-weight: bold;
+	color: #2f4379;
+}
+.popup_title {
+	width: 100%;
+	margin: 40rpx;
+}
+.popup_box {
+	height: 600rpx;
+}
+.del_icon {
+	position: absolute;
+	right: -15rpx;
+	top: -15rpx;
+}
+.item_add {
+	background: #f9f9f9;
+	border-radius: 32rpx;
+	width: 100%;
+	height: 150rpx;
+	text-align: center;
+	line-height: 150rpx;
+}
+.item text {
+	font-size: 24rpx;
+	color: #0c141f;
+}
+.item image {
+	border-radius: 32rpx;
+	width: 100%;
+	height: 150rpx;
+}
+.item {
+	width: 46%;
+	display: inline-block;
+	margin: 1% 2%;
+	position: relative;
+}
+.list_box {
+	width: 100%;
+	background: #ffffff;
+	box-shadow: 0rpx 0rpx 1rpx 4rpx rgba(145, 156, 178, 0.1);
+	border-radius: 32rpx;
+	padding: 20rpx 0;
+}
+
+page {
+	background: #ffffff;
+}
+</style>

+ 28 - 1
pages2/plan/index.vue

@@ -1,5 +1,6 @@
 <template>
 	<view style="padding: 30rpx;">
+	<view v-if="havePlan">
 		<view class="card" v-if="havePlan">
 			<view class="date_t1">
 				<u-icon name="arrow-left" size="28" v-if="havePreviousMonth" @click="swipeMonth(-1)"></u-icon>
@@ -79,9 +80,14 @@
 				</uni-swipe-action-item>
 			</uni-swipe-action>
 		</view>
-
+		
 		<view class="newPlan" @click="newPlan()">新建计划</view>
 	</view>
+		<view v-else class="tipBox">
+			<view class="tip">您暂无相关计划哦~</view>
+			<view class="tipBtn" @click="newPlan()">马上制定~</view>
+		</view>
+	</view>
 </template>
 
 <script>
@@ -356,6 +362,27 @@ export default {
 </script>
 
 <style scope>
+	.tipBtn{
+		width: 160rpx;
+		height: 56rpx;
+		background: #007AFF;
+		border-radius: 16rpx;
+		color: #FFFFFF;
+		text-align: center;
+		line-height: 56rpx;
+		margin-top: 30rpx;
+	}
+	.tipBox{
+		display:flex;
+		align-items:center;/*垂直居中*/
+		justify-content: center;/*水平居中*/
+		flex-direction: column;
+		margin-top: 40%;
+	}
+	.tip{
+		color: #999999;
+		font-size: 32rpx;
+	}
 .newPlan {
 	width: 200rpx;
 	height: 64rpx;

+ 53 - 0
pages2/verify/input.vue

@@ -0,0 +1,53 @@
+<template>
+	<view style="padding: 30rpx;">
+		<view class="topBox">
+			<view >
+				<u-icon name="error-circle-fill" color="#FF3B30" size="28"></u-icon>
+				<text style="color: #FF3B30;margin-left: 10rpx;">学习前请提交完整审核资料</text></view>
+
+			<view style="color: #007AFF;">稍后再填</view>
+		</view>
+		<view class="bodyBox">
+			
+		</view>
+	
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			
+		};
+	},
+
+	methods: {
+		
+	}
+};
+</script>
+<style >
+	page {
+			background: #EAEEF1;
+		}
+</style>
+<style scope>
+	.bodyBox{
+		background: #FFFFFF;
+		border-radius: 24rpx;
+		width: 100%;
+	}
+	.topBox{
+		height: 80rpx;
+		background: #FFFFFF;
+		border-radius: 24rpx;
+		width: 100%;
+		display: flex;
+		justify-content: space-between;
+		line-height: 80rpx;
+		padding: 0 20rpx;
+		font-size: 24rpx;
+	}
+
+</style>

+ 4 - 2
pages2/wd/class.vue

@@ -27,7 +27,7 @@
 						<u-line-progress active-color="#ff9900" :percent="70"></u-line-progress>
 					</view>
 					<view>
-						<u-button type="warning" size="mini">进入学习</u-button>
+						<u-button type="warning" size="mini" @click.stop="studyIn">进入学习</u-button>
 					</view>
 				</view>
 				<view class="box_progress">
@@ -61,7 +61,9 @@
 			
 		},
 		methods: {
-			
+			studyIn(){
+				this.$navTo.togo('/pages2/verify/input');
+			}
 		},
 		
 	}