123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <div class="HeaderOne">
- <div>
- <span :class="[language_type == 'AR' ? 'albbefor' : 'befor']" @click="backHome">
- <img src="../../assets/teacherdev/Frame3.png" alt="" />
- </span>
- <template v-if="allList">
- <span>
- <img src="../../assets/teacherdev/Frame2759.png" alt="" />
- </span>
- <span class="text" @click="back"> <!-- 全部列表 -->{{ this.$t("Key572") }} </span>
- </template>
- <span>
- <img src="../../assets/teacherdev/Frame2759.png" alt="" />
- </span>
- <span class="text">{{ text }}</span>
- </div>
- <div>
- <div class="seek" @keyup="keyDownSeekData">
- <el-input
- type="text"
- name=""
- id=""
- :placeholder="$t('Key43')"
- v-model="SeekName"
- @change="SeekName = SeekName.trim()"
- maxlength="50"
- />
- <img @click="gotoSeekResult" src="../../assets/teacherdev/Group2149.png" alt="" />
- </div>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import { mapGetters } from "vuex";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {},
- props: ["type", "text", "changeKeycode", "keycode", "allList"],
- data() {
- //这里存放数据
- return {
- SeekName: "",
- AllList: false,
- };
- },
- //计算属性 类似于data概念
- computed: {
- ...mapGetters(["language_type"]),
- },
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- backHome() {
- this.$router.push("/");
- },
- back() {
- this.$router.back();
- },
- // 前往搜索结果
- gotoSeekResult() {
- if (this.SeekName != "") {
- // 是不是在搜索结果页面不是则跳转
- this.SeekName = this.SeekName.trim();
- if (this.$route.name == "Viewmore") {
- this.changeKeycode(this.SeekName);
- } else {
- this.$router.push({
- path: "/Viewmore",
- query: { keyWord: this.SeekName, id: this.$route.query.id },
- });
- }
- } else {
- this.$message.warning(this.$t("Key46")); //请输入内容
- }
- },
- // 回车搜索
- keyDownSeekData(e) {
- if (e.keyCode == 13) {
- if (this.SeekName != "") {
- this.SeekName = this.SeekName.trim();
- if (this.$route.name == "Viewmore") {
- this.changeKeycode(this.SeekName);
- this.$router.replace({
- path: "/Viewmore",
- query: {
- keycode: this.SeekName,
- },
- });
- } else {
- this.$router.push({
- path: "/Viewmore",
- query: { keyWord: this.SeekName, id: this.$route.query.id },
- });
- }
- } else {
- this.$message.warning(this.$t("Key46")); //请输入内容
- }
- }
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- if (this.keycode) {
- this.SeekName = this.keycode;
- }
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .HeaderOne {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 120px 0 24px;
- height: 64px;
- background: #fff;
- >:first-child {
- display: flex;
- align-items: center;
- > span {
- margin-left: 15px;
- cursor: pointer;
- img {
- width: 24px;
- }
- }
- .befor,
- .albbefor {
- img {
- width: 24px;
- }
- }
- .befor::before {
- content: "|";
- width: 6px;
- height: 24px;
- color: #ff9900;
- background: #ff9900;
- position: relative;
- right: 10px;
- }
- .albbefor::before {
- content: "|";
- width: 6px;
- height: 24px;
- color: #ff9900;
- background: #ff9900;
- position: relative;
- left: 10px;
- }
- .text {
- font-weight: bold;
- font-size: 16px;
- color: #2c2c2c;
- }
- }
- .seek {
- width: 300px;
- height: 40px;
- background: #ffffff;
- border: 1px solid #d9d9d9;
- box-sizing: border-box;
- border-radius: 8px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 16px;
- input {
- width: 90%;
- border: none;
- outline: none;
- margin-left: 5px;
- }
- img {
- width: 18px;
- height: 18px;
- }
- }
- }
- </style>
- <style lang="scss">
- .seek {
- .el-input__inner {
- border: none;
- height: 38px;
- padding: 0;
- }
- }
- </style>
|