stu_bz_edit.vue 6.5 KB
<template>
	<view class="wrap_box">
		<!-- <uParse v-if="datas" :content="datas"></uParse> -->
		<!-- stu_bz_index -->
		<view class="tel_index_bg"></view>
		<view class="bz_box">
			<view class="edit_box">
				<view v-if="options.id" class="edit_tit">
					<text class="edit_type"></text>
					<view class="flex_1">
						<!-- 2022/02/16 16:23:32 -->
						{{time}}
					</view>
				</view>
				<picker v-else @change="bindPickerChange" :value="index" :range="tabs" range-key="title">
					<view class="edit_tit">
						<view class="edit_l">
							选择分类
						</view>
						<view class="edit_r">
							{{tabs[index].title}}<text class="icon icon-xiala"></text>
						</view>
					</view>
				</picker>
				<view class="edit_bz">
					备注内容
				</view>
				<textarea class="edit_content" placeholder="请输入备注的内容" v-model="content"></textarea>
			</view>
			
			<view class="bz_add" >
				<view class="" @click="save_fuc" data-url="/pagesA/stu_bz_edit/stu_bz_edit">
					保存
				</view>
			</view>
		</view>
		<!-- 阻止滑动 -->
		<!-- <view @touchmove.stop.prevent='test'></view> -->
	</view>
</template>

<script>
	import Vue from 'vue'
	import {
		mapState,
		mapMutations
	} from 'vuex'
	var that 
	export default {
		data() {
			return {
				options:'',
				datas:'',
				tabs:[
					{
						title:'成绩变化',
						id:1
					},
					{
						title:'思想动态',
						id:2
					},
					{
						title:'生活',
						id:3
					},
				],
				index:0,
				time:'',
				content:''
			}
		},
		computed: {
		...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo','nowtime']),
		},
		onLoad(e) {
			that=this
			that.options=e||{}
			console.log(e)
			if(e.id){
				that.time=e.time
				that.content=e.content
			}
			
		},
		onShow() {
			
		},
		methods: {
			// ...mapMutations(['wxshouquan','login']),
			test(){},
			save_fuc(){
				var datas={
					type:that.tabs[that.index].id,
					id:that.options.stu_id,
					content: that.content
				}
				var jkurl='/teacher/remark_add'
				if(that.options.id){
					///teacher/remark_edit
					jkurl='/teacher/remark_edit'
					datas={
						id:that.options.id,
						content: that.content
					}
				}
				that.$service.P_post(jkurl, datas).then(res => {
					that.btnkg = 0
					console.log(res)
					if (res.code == 1) {
						that.htmlReset = 0
						var datas = res.data
						console.log(typeof datas)
				
						if (typeof datas == 'string') {
							datas = JSON.parse(datas)
						}
						console.log(res)
						uni.showToast({
							icon:'none',
							title:'保存成功'
						})
						setTimeout(function(){
							uni.navigateBack({
								delta:1
							})
						},1000)
					} else {
					
						if (res.msg) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '获取数据失败'
							})
						}
					}
				}).catch(e => {
					that.htmlReset = 1
					that.btnkg = 0
					// that.$refs.htmlLoading.htmlReset_fuc(1)
					console.log(e)
					uni.showToast({
						icon: 'none',
						title: '获取数据失败,请检查您的网络连接'
					})
				})
				
				
				
				
			},
			bindPickerChange: function(e) {
					console.log('picker发送选择改变,携带值为', e.detail.value)
					this.index = e.detail.value
			},
			del_fuc(item){
				uni.showModal({
					title: '提示',
					content: '是否删除该备注',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.showToast({
								icon:'none',
								title:'删除成功'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			getdata(){
				
				var datas={
					key: that.options.type
				}
				var jkurl='/info'
				
				that.$service.P_post(jkurl, datas).then(res => {
					that.btnkg = 0
					console.log(res)
					if (res.code == 1) {
						that.htmlReset = 0
						var datas = res.data
						console.log(typeof datas)
				
						if (typeof datas == 'string') {
							datas = JSON.parse(datas)
						}
						console.log(res)
						that.datas=datas.info.content
						if(datas.info.title){
							uni.setNavigationBarTitle({
								title:datas.info.title
							})
						}
					} else {
					
						if (res.msg) {
							uni.showToast({
								icon: 'none',
								title: res.msg
							})
						} else {
							uni.showToast({
								icon: 'none',
								title: '获取数据失败'
							})
						}
					}
				}).catch(e => {
					that.htmlReset = 1
					that.btnkg = 0
					// that.$refs.htmlLoading.htmlReset_fuc(1)
					console.log(e)
					uni.showToast({
						icon: 'none',
						title: '获取数据失败,请检查您的网络连接'
					})
				})
			},
			getimg(img){
				return service.getimg(img)
			},
			jump(e) {
				var that = this
				if (that.btnkg == 1) {
					return
				} else {
					that.btnkg = 1
					setTimeout(function() {
						that.btnkg = 0
					}, 2000)
				}
				console.log(e.currentTarget.dataset.type)
				service.jump(e)
			},
			goback(){
			  uni.navigateBack()
			},
			func(){
				// that.$store.commit('setSystem',datas.system)
			}
		}
	}
</script>

<style lang="scss" scoped>
.wrap_box{
	width: 100%;
	// padding: 30rpx;
	min-height: 100vh;
	// #ifdef H5
	min-height: calc(100vh - 44px);
	// #endif
	background: #F8F8F8;
	position: relative;
}
.tel_index_bg{
	position: absolute;
	top: 0;
	z-index: 1;
	width: 100%;
	min-height: 220rpx;
	background: linear-gradient(0deg, #f8f8f8 0%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%);
}
.bz_box{
	width: 100%;
	position: relative;
	z-index: 2;
	padding: 30rpx;
}
.edit_box{
	width: 100%;
	height: 456rpx;
	background: #FFFFFF;
	border-radius: 10rpx;
	margin-bottom: 50rpx;
	padding: 0 30rpx;
	.edit_tit{
		width: 100%;
		height: 100rpx;
		border-bottom: 1px solid #eee;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 28rpx;
		color: #A9B1C0;
		.edit_type{
			width: 14rpx;
			height: 14rpx;
			background: #2D81FF;
			border-radius: 50%;
			margin-right: 10rpx;
		}
		.edit_l{
			font-size: 32rpx;
			color: #545D71;
		}
		.edit_r{
			font-size: 30rpx;
			color: #545D71;
			.icon{
				font-size: 20rpx;
				color: rgba(153, 153, 153, .5);
			}
		}
	}
	.edit_bz{
		margin-top: 25rpx;
		font-size: 32rpx;
		color: #545D71;
	}
	.edit_content{
		width: 100%;
		padding: 10rpx 0;
		height: 230rpx;
		font-size: 32rpx;
	}
}
.bz_add{
	width: 100%;
	view{
		font-size: 32rpx;
		color: #FFFFFF;
		width: 100%;
		height: 90rpx;
		background: #2D81FF;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
}
</style>