当前位置: 首页 > news >正文

日本女做受网站BB十大营销策略

日本女做受网站BB,十大营销策略,做网站公司郑州郑州的网站建设公司哪家好,免费给别人开发网站文章目录 一:系统功能:设置成绩(添加或修改)交互逻辑:涉及页面 Page02.vue,ModalEdit.vue主页面Page.vue注入子页面,使用子页面标签属性主页面对子页面做通信,子页面ModalEdit接收参…

文章目录

  • 一:系统功能:设置成绩(添加或修改)
    • 交互逻辑:涉及页面 Page02.vue,ModalEdit.vue
    • 主页面Page.vue注入子页面,使用子页面标签属性
    • 主页面对子页面做通信,子页面ModalEdit接收参数和监听时间涉及到组件props,watch
      • 子页面ModalEdit通过props属性接收控制属性
    • 子页面ModalEdit向父页面传递参数
  • 二:系统功能:添加选课
  • 三:系统功能:删除选课
  • 四:相关页面完整代码
    • Page02.vue
    • ModalEdit.vue
    • ModalCourseAdd.vue
  • 五:页面运效果

一:系统功能:设置成绩(添加或修改)

交互逻辑:涉及页面 Page02.vue,ModalEdit.vue

点击成绩修改按钮弹出 成绩修改页面,展示分数并可设置分数
点击提交发送请求/api/baseStudentCourse/updata
成功则返回上一页面进行刷新数据发送请求/api/baseStudentCourse/list

主页面Page.vue注入子页面,使用子页面标签属性

<el-table-column label="操作" width="380"><template #default="{ row, $index }"><el-button size="mini" type="warning" @click="editItem(row, $index)"  @updateData="handleData"  >成绩修改</el-button><el-button size="mini" type="warning" @click="addItem(row, $index)"  @updateData="handleData"  >成绩添加</el-button><el-button size="mini" type="danger" @click="handleDeleteCourse(row, $index)"  @updateData="handleData"  >删除选课</el-button></template></el-table-column></el-table>
<ModalEdit v-model:visible="showModal" :edit-data="editData" :show-flag = "showFlag" @refreshData="refreshData" />
<ModalCourseAdd v-model:visible="showModalAddCourse" @refreshData="refreshData" />
<script setup>
import { useRouter } from 'vue-router';
import {onMounted, ref} from 'vue';
import axios from "axios";
import ModalEdit from "./ModalEdit.vue";
import ModalCourseAdd from "./ModalCourseAdd.vue";
const showModal = ref(false);
const showModalAddCourse = ref(false);
const editData = ref(null);
const showFlag = ref(String);

主页面对子页面做通信,子页面ModalEdit接收参数和监听时间涉及到组件props,watch

子页面ModalEdit通过props属性接收控制属性

在 Vue.js 中,props 用于接收来自父组件的数据。这里定义了三个属性(props):visible、editData 和 showFlag。我将逐一分析这些属性

父页面Page当点击add或edit, 设置这个showModal.value属性为true(v-model:visible=“showModal”),这里showModal,并给editData赋值
在 Vue 3 中,v-model 可以绑定到组件的任意 prop 上,这里它绑定了 showModal 数据属性,这意味着 showModal 的值将与 ModalEdit 组件内部的 visible 状态保持同步。当 ModalEdit 组件的 visible 状态改变时,它会更新父组件的 showModal 数据属性,反之亦然。
:show-flag=“showFlag”: 类似地,这也是一个动态 prop 绑定,将父组件中的 showFlag 数据传递给 ModalEdit 组件。showFlag 可能用于控制模态框中某些元素的显示或隐藏。

const editItem = (item, index) => {editData.value = item;showModal.value = true; //  v-model:visible="showModal"showFlag.value = '成绩修改';
};
const addItem = (item, index) => {editData.value = item;showModal.value = true;showFlag.value = '成绩添加';
};

watch是vue组件的一个选项,这里是用来监视visible这个数据属性的变化;
父页面visible属性默认是false

<ModalEdit v-model:visible="showModal" :edit-data="editData" :show-flag = "showFlag" @refreshData="refreshData" />
const showModal = ref(false);

父页面点击操作visible设置true,子页面同时watch监听visible发生变化,editData展示和渲染默认成绩数据,visible 为true展示页面(默认隐藏)

watch: {visible() {this.formData.id = this.editData.id; // 初始化id字段this.formData.score = this.editData.score;// this.formData.score = this.editData.score;}},props: {visible: {type: Boolean,required: true},editData: {type: Object,default: () => ({})},showFlag: {type: Object,default: () => ({})}},

子页面ModalEdit向父页面传递参数

这部分定义了该组件可能向父组件发出的三个自定义事件:
update:visible:通常用于更新一个名为 visible 的 prop 的值,这是 Vue 的 .sync 修饰符常用的模式。
submit:可能是当表单数据被提交时触发的事件。
refreshData:可能是当数据更新后,通知父组件刷新或重新获取数据的事件。

这里主要用了refreshData事件:当子页面更新成功后通知父组件事件函数(重新请求刷新数据)
ModalEdit
子页面:

this.$emit('refreshData', { // 假设服务器返回了更新后的数据,或者你可以传递更新后的id和scoresuccess: true,message: resp.data.message,});

父页面:

<template><ModalEdit v-model:visible="showModal" :edit-data="editData" :show-flag = "showFlag" @refreshData="refreshData" />
</template>
<script setup>
// 成绩修改
const refreshData = () => {axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {tableData.value = resp.data.data} else {alert(resp.data.message);}})showModal.value = false;showModalAddCourse.value = false;
} ;
</script>
  emits: ['update:visible', 'submit', 'refreshData'],methods: {handleSubmit() {// 确保发送完整对象,包含id字段this.$emit('submit', { ...this.formData });},closeModal() {this.$emit('update:visible', false);},// 成绩录入/修改submit () {debuggerconsole.log(this.formData)// 编辑逻辑const response = axios.post("/api/baseStudentCourse/update", {id: this.formData.id,score: this.formData.score}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);// 发送一个事件给父组件,表示数据已更新this.$emit('refreshData', { // 假设服务器返回了更新后的数据,或者你可以传递更新后的id和scoresuccess: true,message: resp.data.message,});} else {alert(resp.data.message);}})}}

二:系统功能:添加选课

父组件与子组件交互和上述设置成绩交互逻辑一致,
主要是多了进入子页面展示下拉列表:v-for,

<form @submit.prevent="handleSubmit"><label>选择学生:<select v-model="formData.student"><option v-for="student in students" :key="student.id" :value="student.id">{{ student.name }}</option></select></label><label>选择课程:<select v-model="formData.course"><option v-for="course in courses" :key="course.id" :value="course.id">{{ course.name }}</option></select></label><!-- 其他需要编辑的字段也可以在这里添加 --><button type="submit" @click="submit">提交</button><button @click="closeModal">取消</button></form>
<script>
import axios from "axios";export default {props: {visible: {type: Boolean,required: true},showFlag: {type: Object,default: () => ({})}},emits: ['update:visible', 'submit', 'refreshData'],data() {return {formData: {id: null, // 添加id字段score: null}};},created () {axios.post("/api/student/list", {}).then(res => {if (res.data.code === 200) {debuggerthis.students = res.data.data}})axios.post("/api/course/list", {}).then(resp => {if (resp.data.code === 200) {debuggerthis.courses = resp.data.data}})console.log("准备输出课程和学生信息")console.log(this.courses)console.log(this.students)},methods: {closeModal() {this.$emit('update:visible', false);},// 成绩录入/修改submit() {console.log(this.formData)// 编辑逻辑axios.post("/api/baseStudentCourse/save", {studentId: this.formData.student,courseId: this.formData.course,teacherId: localStorage.getItem('id')}).then(resp => {

三:系统功能:删除选课

直接删除当前行数据
// 删除选课

const handleDeleteCourse = (row, index) => {console.log(row)axios.post("/api/baseStudentCourse/delete", {id: row.id}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {tableData.value = resp.data.data} else {alert(resp.data.message);}})} else {alert(resp.data.message);}})
};

四:相关页面完整代码

Page02.vue

<template><div class="container"><div class="title-container" style="margin-top: 20px;"><h3 class="title">学生管理平台</h3></div><div class="user-info"><div class="buttons"><el-button size="mini" class="user-button primary" @click="handleAddCourse()" :closeCourseModal = "closeModal">添加选课</el-button>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<span><b>当前用户:</b></span>{{currentUser}}<el-button size="mini" class="user-button" @click="resetUser()">注销当前用户</el-button></div>
<!--      <h5 class="user-name">当前登录用户:{{ localStorageValue }}</h5>--></div><el-table :data="tableData"><el-table-column prop="id" label="编码" width="100"></el-table-column><el-table-column prop="studentId" label="学号" width="100"></el-table-column><el-table-column prop="studentName" label="学生" width="100"></el-table-column><el-table-column prop="courseName" label="课程" width="180"></el-table-column><el-table-column prop="majorName" label="专业" width="100"></el-table-column><el-table-column prop="score" label="分数" width="100"></el-table-column><el-table-column prop="teacherName" label="教师" width="100"></el-table-column><el-table-column label="操作" width="380"><template #default="{ row, $index }"><el-button size="mini" type="warning" @click="editItem(row, $index)"  @updateData="handleData"  >成绩修改</el-button><el-button size="mini" type="warning" @click="addItem(row, $index)"  @updateData="handleData"  >成绩添加</el-button><el-button size="mini" type="danger" @click="handleDeleteCourse(row, $index)"  @updateData="handleData"  >删除选课</el-button></template></el-table-column></el-table><ModalEdit v-model:visible="showModal" :edit-data="editData" :show-flag = "showFlag" @refreshData="refreshData" /><ModalCourseAdd v-model:visible="showModalAddCourse" @refreshData="refreshData" /></div>
</template><script setup>
import { useRouter } from 'vue-router';
import {onMounted, ref} from 'vue';
import axios from "axios";
import ModalEdit from "./ModalEdit.vue";
import ModalCourseAdd from "./ModalCourseAdd.vue";
const tableData = ref([]); // 使用ref来创建响应式数据
onMounted(async () => {const response = await axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')});tableData.value = response.data.data; // 将请求结果赋值给响应式数据
});
const currentUser = localStorage.getItem("username");
const showModal = ref(false);
const showModalAddCourse = ref(false);
const editData = ref(null);
const showFlag = ref(String);
const editItem = (item, index) => {editData.value = item;showModal.value = true;showFlag.value = '成绩修改';
};const addItem = (item, index) => {editData.value = item;showModal.value = true;showFlag.value = '成绩添加';
};const closeModal = () => {showModalAddCourse.value = false
};const handleData = () => {console.log("Page02 handleData")const response = axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')});tableData.value = response.data.data; // 将请求结果赋值给响应式数据;console.log(response)
};const router = useRouter();
const resetUser = () => {// 编辑逻辑const key = 'id'; // 替换为你需要获取的localStorage的keyconst value = localStorage.getItem(key);// 如果需要解析JSON,可以在这里进行解析try {axios.post("/api/base/reset", {id: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);localStorage.removeItem(localStorage.getItem('id'))router.push('/')} else {alert(resp.data.message);}})} catch (error) {console.error(error);// 处理错误}
};// 添加选课
const handleAddCourse = () => {debugger// editData.value = item;showModalAddCourse.value = true;
};// 删除选课
const handleDeleteCourse = (row, index) => {console.log(row)axios.post("/api/baseStudentCourse/delete", {id: row.id}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {tableData.value = resp.data.data} else {alert(resp.data.message);}})} else {alert(resp.data.message);}})
};const updateList = (updatedItem) => {// 假设使用index来更新list,但这种方式不推荐,如果数据顺序改变会有问题const index = tableData.value.findIndex(item => item.id === updatedItem.id);tableData.value.splice(index, 1, updatedItem);showModal.value = false;
};// 成绩修改
const refreshData = () => {axios.post("/api/baseStudentCourse/list", {id: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {tableData.value = resp.data.data} else {alert(resp.data.message);}})showModal.value = false;showModalAddCourse.value = false;
} ;// console.log(""")</script>

ModalEdit.vue

<template><div v-if="visible" class="modal"><div class="modal-content">
<!--      <h2>编辑数据</h2>--><h2>{{ showFlag }}</h2><form @submit.prevent="handleSubmit"><label>分数:<input type="text" v-model="formData.score" /></label><!-- 其他需要编辑的字段也可以在这里添加 --><button type="submit" @click="submit()">提交</button><button @click="closeModal">取消</button></form></div></div>
</template>
<script>
import axios from "axios";export default {watch: {visible() {this.formData.id = this.editData.id; // 初始化id字段this.formData.score = this.editData.score;// this.formData.score = this.editData.score;}},props: {visible: {type: Boolean,required: true},editData: {type: Object,default: () => ({})},showFlag: {type: Object,default: () => ({})}},emits: ['update:visible', 'submit', 'refreshData'],data() {return {formData: {id: null, // 添加id字段score: null}};},methods: {handleSubmit() {// 确保发送完整对象,包含id字段this.$emit('submit', { ...this.formData });},closeModal() {this.$emit('update:visible', false);},// 成绩录入/修改submit () {debuggerconsole.log(this.formData)// 编辑逻辑const response = axios.post("/api/baseStudentCourse/update", {id: this.formData.id,score: this.formData.score}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);// 发送一个事件给父组件,表示数据已更新this.$emit('refreshData', { // 假设服务器返回了更新后的数据,或者你可以传递更新后的id和scoresuccess: true,message: resp.data.message,});} else {alert(resp.data.message);}})}}
};
</script><style scoped>
.modal {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0, 0, 0, 0.5);display: flex;justify-content: center;align-items: center;z-index: 1000;
}.modal-content {background-color: #fff;padding: 20px;border-radius: 5px;
}
</style>

ModalCourseAdd.vue

<template><div v-if="visible" class="modal"><div class="modal-content"><h2>添加选课</h2><form @submit.prevent="handleSubmit"><label>选择学生:<select v-model="formData.student"><option v-for="student in students" :key="student.id" :value="student.id">{{ student.name }}</option></select></label><label>选择课程:<select v-model="formData.course"><option v-for="course in courses" :key="course.id" :value="course.id">{{ course.name }}</option></select></label><!-- 其他需要编辑的字段也可以在这里添加 --><button type="submit" @click="submit">提交</button><button @click="closeModal">取消</button></form></div></div>
</template><script>
import axios from "axios";export default {props: {visible: {type: Boolean,required: true},showFlag: {type: Object,default: () => ({})}},emits: ['update:visible', 'submit', 'refreshData'],data() {return {formData: {id: null, // 添加id字段score: null}};},created () {axios.post("/api/student/list", {}).then(res => {if (res.data.code === 200) {debuggerthis.students = res.data.data}})axios.post("/api/course/list", {}).then(resp => {if (resp.data.code === 200) {debuggerthis.courses = resp.data.data}})console.log("准备输出课程和学生信息")console.log(this.courses)console.log(this.students)},methods: {closeModal() {this.$emit('update:visible', false);},// 成绩录入/修改submit() {console.log(this.formData)// 编辑逻辑axios.post("/api/baseStudentCourse/save", {studentId: this.formData.student,courseId: this.formData.course,teacherId: localStorage.getItem('id')}).then(resp => {if (resp.data.code === 200) {alert(resp.data.message);// 发送一个事件给父组件,表示数据已更新this.$emit('refreshData', { // 假设服务器返回了更新后的数据,或者你可以传递更新后的id和scoresuccess: true,message: resp.data.message,});} else {alert(resp.data.message);}})}}
};
</script><style scoped>
.modal {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0, 0, 0, 0.5);display: flex;justify-content: center;align-items: center;z-index: 1000;
}.modal-content {background-color: #fff;padding: 20px;border-radius: 5px;
}
</style>

五:页面运效果

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://spirituelle.fwrr.cn
http://vexatious.fwrr.cn
http://wheelchair.fwrr.cn
http://miasmal.fwrr.cn
http://jingoish.fwrr.cn
http://incandescent.fwrr.cn
http://bodysurf.fwrr.cn
http://counterconditioning.fwrr.cn
http://jude.fwrr.cn
http://polymastigote.fwrr.cn
http://nurse.fwrr.cn
http://unliving.fwrr.cn
http://khuzistan.fwrr.cn
http://corneitis.fwrr.cn
http://hump.fwrr.cn
http://collagenous.fwrr.cn
http://undistributed.fwrr.cn
http://microfluorometry.fwrr.cn
http://fulminous.fwrr.cn
http://impennate.fwrr.cn
http://mesonephros.fwrr.cn
http://yewk.fwrr.cn
http://fossilist.fwrr.cn
http://dilemmatic.fwrr.cn
http://hussif.fwrr.cn
http://chiliad.fwrr.cn
http://abscisin.fwrr.cn
http://fumaric.fwrr.cn
http://cerebroid.fwrr.cn
http://feet.fwrr.cn
http://funerary.fwrr.cn
http://koumiss.fwrr.cn
http://comfortlessness.fwrr.cn
http://eremacausis.fwrr.cn
http://toes.fwrr.cn
http://pentamethylene.fwrr.cn
http://floozie.fwrr.cn
http://bach.fwrr.cn
http://windburn.fwrr.cn
http://considerately.fwrr.cn
http://deke.fwrr.cn
http://bloodstained.fwrr.cn
http://jess.fwrr.cn
http://tanya.fwrr.cn
http://sinkhole.fwrr.cn
http://cattiness.fwrr.cn
http://encumber.fwrr.cn
http://entablement.fwrr.cn
http://zwinglianism.fwrr.cn
http://forficulate.fwrr.cn
http://grant.fwrr.cn
http://talocalcaneal.fwrr.cn
http://spheriform.fwrr.cn
http://zero.fwrr.cn
http://neuropathology.fwrr.cn
http://tautomerism.fwrr.cn
http://dionysian.fwrr.cn
http://electrophoretic.fwrr.cn
http://underdevelop.fwrr.cn
http://grabber.fwrr.cn
http://potency.fwrr.cn
http://carabinier.fwrr.cn
http://sandbagger.fwrr.cn
http://nainsook.fwrr.cn
http://rhg.fwrr.cn
http://bunion.fwrr.cn
http://barrelled.fwrr.cn
http://immunocyte.fwrr.cn
http://mentally.fwrr.cn
http://bobbed.fwrr.cn
http://stout.fwrr.cn
http://plasmodesm.fwrr.cn
http://sneeringly.fwrr.cn
http://plantain.fwrr.cn
http://pendant.fwrr.cn
http://navaho.fwrr.cn
http://saidst.fwrr.cn
http://bibliopole.fwrr.cn
http://coattail.fwrr.cn
http://reduction.fwrr.cn
http://processionist.fwrr.cn
http://cryptographical.fwrr.cn
http://brittle.fwrr.cn
http://parlor.fwrr.cn
http://baedeker.fwrr.cn
http://grivet.fwrr.cn
http://inscape.fwrr.cn
http://knee.fwrr.cn
http://gallus.fwrr.cn
http://guardian.fwrr.cn
http://assertory.fwrr.cn
http://rhyton.fwrr.cn
http://vlb.fwrr.cn
http://autocatalytic.fwrr.cn
http://extravagantly.fwrr.cn
http://rio.fwrr.cn
http://superelevate.fwrr.cn
http://krakau.fwrr.cn
http://psalm.fwrr.cn
http://irradiancy.fwrr.cn
http://www.dt0577.cn/news/106755.html

相关文章:

  • 手表网站背景素材海外推广渠道
  • 网站的域名可以修改吗新公司如何做推广
  • 温州做网站 掌熊号优化网络的软件
  • 招聘网站开发人员网络营销推广方式案例
  • p2p免费网站建设搜索网络如何制造
  • 做网站要注意些什么要求媒介平台
  • 网站搭建公司案例网址使用网站模板快速建站
  • 陕西培训网站建设seo人员的职责
  • 网站收录怎么做软文推广案例大全
  • 宁夏商擎网站建设网络推广
  • 网站模板一样侵权吗杭州seo服务公司
  • Java做新闻网站百度信息流广告怎么收费
  • 网站后台建设教程市场调研报告总结
  • 专门做期货的网站关键词seo排名优化推荐
  • 网站如何做会员通用网站seo系统
  • 做问卷赚钱的网站全球搜钻
  • 网站开发公司总汇我是新手如何做电商
  • 点评网站开发百度搜索风云榜游戏
  • 长春企业免费建站上海知名seo公司
  • 莞城微信网站建设网页制作代码大全
  • 网站做代理服务器厦门人才网官网招聘
  • 做本地团购网站怎么样网络推广与优化
  • 公司注销网站备案成人用品推广网页
  • 湖北政府门户网站建设研究seo快速入门教程
  • 石家庄求做网站怎么申请域名建网站
  • 手机网站程序如何做网页
  • 国外做行程的网站百度识图 上传图片
  • 电影宣传网站开发设计做网络营销推广的公司
  • 网站开发课程培训2022年今天新闻联播
  • 运城有做网站设计推广app赚钱