123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- <template>
- <view>
-
- <view class="lz-status_bar">
- <view class="lz-top_view"></view>
- </view>
-
- <view class="kaoshi-head">
- <view class="kaoshi-head-top">
- <view class="kaoshi-head-left" @tap="$openrul('/pages/auth/choiceSubject/index')">
- <view class="kaoshi-head-kemu">{{subject.subject_name}}</view>
- <view class="iconfont icon-weibiaoti"></view>
- </view>
- <view class="kaoshi-head-right">
- <text class="iconfont icon-sousuo" @tap="gotoSearch"></text>
- <text class="iconfont icon-lingdang" @tap="$openrul('/pages/article/notice')"
- style="margin-left: 12px;"></text>
- </view>
- </view>
- </view>
- <view class="kaoshi-index-content">
- <view class="kaoshi-head-banner">
- <swiper class="swiper" :indicator-dots="swiper_config.indicatorDots" :autoplay="swiper_config.autoplay"
- indicator-active-color="#3c7bfc" :interval="swiper_config.interval"
- :duration="swiper_config.duration">
- <swiper-item v-for="(item, index) in swiper_list" :key="index">
- <view @tap="windowopen(item.url)"><img :src="item.image" /></view>
- </swiper-item>
- </swiper>
- </view>
- <view class="notice" v-if="noticeList.length > 0">
- <an-notice-bar :message_list="noticeList" style="width: 100%;"></an-notice-bar>
- </view>
- <view class="kaoshi-index-nav" v-if="navList && navList.length > 0">
- <view class="kaoshi-index-nav-flex" @tap="windowopen(item.url)" v-for="(item,index) in navList"
- :key="index">
- <image :src="item.image" class="kaoshi-index-nav-img"></image>
- <view class="kaoshi-index-nav-title">{{item.title}}</view>
- </view>
- </view>
- </view>
- <view class="home-title" v-if="list.length > 0">
- <view class="home-title-l">最新题库</view>
- <navigator open-type="switchTab" url="/pages/questionBank/index" hover-class="none" class="home-title-r">
- <view>更多</view>
- <view class="iconfont icon-arrow"></view>
- </navigator>
- </view>
- <view class="home-box">
- <view v-for="(item, index) in list" :key="index" class="kaoshi-tiku">
- <view class="kaoshi-tiku-content" @tap="goto_detail(item,'1')">
- <view class="kaoshi-tiku-content-flex">
- <view class="kaoshi-tiku-content-top">
- <view>{{item.name}}
- <view v-if="item.is_vip == 1 && !subjectVip" class="vip">
- <image src="../../static/img/vip.png" mode=""></image>
- <view>VIP</view>
- </view>
- </view>
- </view>
- </view>
- <view class="kaoshi-tiku-content-flex">
- <view class="kaoshi-tiku-content-bottom">
- <view class="iconfont icon-dui2"></view>
- <view class="pub-gray">共{{item.total_num}}题</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <template v-if="articleList.length > 0 && auth != 1">
- <view class="home-title">
- <view class="home-title-l">新闻资讯</view>
- <navigator open-type="navigate" url="/pages/article/index" hover-class="none" class="home-title-r">
- <view>更多</view>
- <view class="iconfont icon-arrow"></view>
- </navigator>
- </view>
- <view class="home-box">
- <view class="news-content-box">
- <view class="news-content">
- <view class="news-list" v-for="(item, index) in articleList" :key="index"
- @tap="gotoNoticeDetail(item)">
- <view class="news-flex">
- <image :src="item.image == '' ? '../../static/img/pic.jpg' : item.image"
- class="news-list-img"></image>
- <view class="news-list-r">
- <view class="news-list-title">{{item.title}}</view>
- <view class="news-list-time">
- <view>{{item.noticetime}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <view style="height: 10px;"></view>
- <authVip v-if="showAuthVip" @hideAuthVip="showAuthVip = false"></authVip>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import Error from '@/core/untils/error/index';
- import authVip from '@/components/authVip.vue'
- export default {
- data() {
- return {
-
- auth: 1,
-
-
- auth: 0,
-
- showAuthVip: false,
- swiper_list: [],
- swiper_config: {
- indicatorDots: true,
- autoplay: true,
- interval: 2000,
- duration: 500
- },
- list: [],
- subList: [],
- noticeList: [],
- articleList: [],
- navList: [],
- };
- },
- async onShow() {
- this.get_lunbo_list();
- if (this.subject.id != undefined) {
- this.get_tiku_list();
- this.canReset && this.getNoticeList()
- this.canReset && this.getArticleList()
- this.canReset = true
- }
- if (this.userinfo.user_id !== undefined) {
- await this.$myUserLogin.getSubvip(this.subject.id)
- }
-
- this.getUpdate()
-
-
- if (this.userinfo.user_id !== undefined) {
- this.share.path = 'pages/index/index?scene=' + this.userinfo.user_id
- console.log(this.userinfo, 'this.userinfo')
- wx.showShareMenu({
- withShareTicket: true,
- menus: ["shareAppMessage"]
- })
- } else {
- wx.hideShareMenu()
- }
-
-
- this.loadShare()
-
- },
- onLoad(option) {
-
- this.getSh()
- if (option.scene) {
-
- uni.setStorageSync('spread_code', option.scene);
- console.log(option.scene, 'option.scene')
- }
-
-
- if (option.recommend) {
- uni.setStorageSync('recommend', option.recommend);
- }
-
- if (this.subject.id == undefined) {
- this.getSub();
- } else {
- this.getNoticeList()
- this.getArticleList()
- }
- this.getNavList()
- },
- computed: {
- ...mapState(['subject', 'userinfo', 'subjectVip'])
- },
- components: {
- authVip
- },
- methods: {
- async loadShare() {
- let that = this
- let weixinObj = require('jweixin-module');
- console.log(window.location.href);
- let res = await this.$myHttp.get({
- url: this.$myHttp.urlMap.getConfig + '?url=https://ks.igxys.com/h5/',
- data: {
- url: 'https://ks.igxys.com/h5/'
- },
- params: {
- url: 'https://ks.igxys.com/h5/'
- },
- needLogin: false,
- })
- if (res.code == 1) {
-
- console.log(res, 'res')
- let data = res.data
- weixinObj.config({
- debug: false,
- appId: data.appId,
- timestamp: data.timestamp,
- nonceStr: data.nonceStr,
- signature: data.signature,
- jsApiList: data.jsApiList
- });
- weixinObj.ready((e) => {
- let mess;
- mess = {
- link: 'https://ks.igxys.com/h5/?recommend=' +that.userinfo.user_id,
- imgUrl: 'https://ks.igxys.com/wap/sharelogo.jpg',
- desc: '看完就过医学考试题库',
- title:'隆熹晋升平台',
- success:function(a) {
- console.log(a);
- },
- fail: function(e) {
- console.log(e);
- }
- }
- weixinObj.updateAppMessageShareData(mess);
-
- weixinObj.updateTimelineShareData(mess);
- })
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
-
- async getSh() {
- let res = await this.$myHttp.get({
- url: this.$myHttp.urlMap.sh,
- data: {},
- needLogin: false,
- })
- if (res.code == 1) {
-
- console.log(res)
- this.auth = res.data.auth
-
- this.auth = 0
-
- }
- },
- getUpdate() {
- const updateManager = wx.getUpdateManager()
- updateManager.onCheckForUpdate(function(res) {
-
- console.log(res.hasUpdate)
- })
- updateManager.onUpdateReady(function() {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
-
- updateManager.applyUpdate()
- }
- }
- })
- })
- updateManager.onUpdateFailed(function() {
-
- })
- },
-
- async getNavList() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.navList,
- data: {},
- needLogin: false,
- })
- if (res.code == 1) {
- this.navList = res.data.data
- }
- },
-
- async getNoticeList() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.noticeList,
- data: {
- page: 1,
- limit: 10,
- subject_id: this.subject.id || this.subList[0].id,
- cate_id: 1,
- },
- needLogin: false,
- })
- if (res.code == 1) {
- this.noticeList = res.data.data
- }
- },
-
- async getArticleList() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.noticeList,
- data: {
- page: 1,
- limit: 10,
- subject_id: this.subject.id || this.subList[0].id,
- cate_id: 2,
- },
- needLogin: false,
- })
- if (res.code == 1) {
- this.articleList = res.data.data
- }
- },
-
- async getSub() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.subjectList,
- data: {
- page: 1,
- limit: 0
- }
- })
- if (res.code === 1) {
- this.subList = res.data
- console.log(this.subList, '选择的项目555')
- this.$store.commit('setSubject', {
- subject: {
- id: this.subList[0].childlist[0].id,
- subject_name: this.subList[0].childlist[0].subject_name,
- price: this.subList[0].childlist[0].price
- }
- })
- this.get_tiku_list();
- }
- },
-
- async get_lunbo_list() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.swiper,
- data: {
- searchdb: {
- code: 'shouye'
- }
- }
- });
- if (res.code === 1) {
- let rows = res.data.data || [];
- this.swiper_list = rows;
- }
- },
-
- async get_tiku_list() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.unitList,
- data: {
- subject_id: this.subject.id || this.subList[0].id,
- unit_id: 0,
- page: 1,
- limit: 10
- },
- });
- if (res.code === 1) {
- this.list = res.data.data;
- }
- },
-
- goto_detail(item, type) {
- if (item.total_num == 0) {
- this.$myUtils.$prompt.showToast({
- icon: 'none',
- title: '当前目录下没有题目,请联系老师'
- });
- return
- }
- if (!this.subjectVip && item.is_vip) {
- if (this.$myUserLogin.getToken()) {
- this.showAuthVip = true
- return
- } else {
- Error.errorNotLoggedIn();
- return
- }
- }
- if (type == '1') {
- if (item.is_last == 0) {
-
- this.$openrul('/pages/questionBank/detail/index?id=' + item.id + '&from_type=1' + '&name=' + item
- .name)
- } else if (item.is_last == 1) {
- if (this.$myUserLogin.getToken()) {
-
- this.$openrul('/pages/questionBank/questionBankAnswer/index?id=' + item.id + '&from_type=1' +
- '&name=' + item.name)
- } else {
- Error.errorNotLoggedIn();
- }
- }
- } else if (type == '2') {
- if (this.$myUserLogin.getToken()) {
-
- this.$openrul('/pages/questionBank/questionBankAnswer/index?id=' + item.id + '&from_type=2' +
- '&name=' + item.name)
- } else {
- Error.errorNotLoggedIn();
- }
- }
- },
-
- navTo(url) {
- if (this.$myUserLogin.getToken()) {
- this.$openrul(url)
- } else {
- Error.errorNotLoggedIn();
- }
- },
-
- gotoSearch() {
- uni.navigateTo({
- url: '/pages/questionSearch/searchList'
- })
- },
-
- gotoNoticeDetail(item) {
- if (item.url == '') {
- uni.navigateTo({
- url: '/pages/article/detail?id=' + item.id + '&type=1'
- })
- } else {
- uni.navigateTo({
- url: '/pages/webview/webview?url=' + item.url + '&title=' + item.title
- })
- }
- },
-
- windowopen(url) {
- if (url.startsWith('http')) {
- uni.navigateTo({
- url: '/pages/webview/webview?url=' + url
- })
- } else {
- if (url == '/pages/index/index' || url == '/pages/questionBank/index' || url ==
- '/pages/examination/index' ||
- url == '/pages/article/index' || url == '/pages/my/index') {
- uni.switchTab({
- url
- })
- } else {
- uni.navigateTo({
- url
- })
- }
- }
- }
- }
- };
- </script>
- <style>
- page {
- background-image: linear-gradient(#026aef 0, #fff 180px, #fff 200px, #f9f9f9 230px, #f9f9f9 100%);
- background-repeat: no-repeat;
- background-color: #f9f9f9;
- }
-
- .kaoshi-head {
- background: none;
- position: relative;
- top: 0;
- border-bottom: none;
- }
- .kaoshi-head-top {
- color: #fff;
- line-height: 58px;
- }
- .kaoshi-head-top .kaoshi-head-left {
- flex: 1;
- display: flex;
- align-items: center;
- }
- .kaoshi-head-top .kaoshi-head-left .icon-weibiaoti {
- padding-left: 4px;
- font-size: 18px;
- }
- .kaoshi-head-top .kaoshi-head-kemu {
- font-size: 16px;
- text-align: center;
- }
- .kaoshi-head-top .kaoshi-head-right {
- width: 18%;
- text-align: right;
- }
- .kaoshi-head-top .kaoshi-head-right .icon-datiqia {
- font-size: 22px;
- }
- .kaoshi-index-content {
- overflow: hidden;
- }
-
- .kaoshi-head-banner {
- border-radius: 10px;
- width: 92%;
- margin: 6px auto;
- box-shadow: 0 3px 8px rgb(0 0 0 / 11%);
- margin-bottom: 19px;
- }
- .kaoshi-head-banner img {
- width: 100%;
-
- height: 45vw;
- border-radius: 10px;
- }
- .kaoshi-head-banner .uni-swiper-dot-active::before {
- background: #3c7bfc !important;
- }
- .kaoshi-head-banner .swiper {
- height: 45vw !important;
- }
-
- .notice {
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 92%;
- margin: 15px auto;
- padding: 0 10px;
- border-radius: 5px;
- line-height: 42px;
- background-color: #d1e5fe;
- }
-
- .kaoshi-index-nav {
- box-sizing: border-box;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- flex-wrap: wrap;
- text-align: center;
- font-size: 14px;
- color: #605d70;
- width: 92%;
- margin: 0 auto;
- background-color: #fff;
- border-radius: 8px;
- padding-bottom: 14px;
- }
- .kaoshi-index-nav .kaoshi-index-nav-flex {
- width: 25%;
- height: 70px;
- padding-top: 14px;
- }
- .kaoshi-index-nav .kaoshi-index-nav-title {
- margin: 7px auto 0;
- }
- .kaoshi-index-nav-img {
- width: 38px;
- height: 38px;
- border-radius: 5px;
- }
- .home-title {
- width: 92%;
- margin: 0 auto;
- padding: 12px 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .home-title-l {
- display: flex;
- font-weight: bold;
- font-size: 18px;
- }
- .home-title-r {
- display: flex;
- align-items: center;
- color: #bbb;
- font-size: 14px;
- }
- .home-title-r .iconfont {
- font-size: 11px;
- }
- .home-box {
- width: 92%;
- margin: 0 auto;
- border-radius: 8px;
- overflow: hidden;
- background: #fff;
- }
- .kaoshi-tiku-content {
- width: 92%;
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- font-size: 14px;
- padding: 10px 0;
- border-bottom: solid 1px #f5f5f5;
- }
- .kaoshi-tiku-content-flex {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: inherit;
- }
- .kaoshi-tiku-content .kaoshi-tiku-content-flex:first-child {
- padding-bottom: 6px;
- }
- .kaoshi-tiku-content .kaoshi-tiku-content-flex:last-child {
- font-size: 14px;
- }
- .kaoshi-tiku-content-top {
- display: flex;
- align-items: center;
- flex: 1;
- font-size: 16px;
- }
- .kaoshi-tiku-content-top img {
- width: 20px;
- height: 22px;
- margin-right: 10px;
- }
- .kaoshi-tiku-content-bottom {
- font-size: 13px;
- display: flex;
- align-items: center;
- }
- .kaoshi-tiku-content-flex .icon-dui2 {
- margin: 2px 2px 0 0;
- color: #3c7bfc;
- }
-
- .news-content-box {
- background: #fff;
- padding: 1px 0;
- }
- .news-content {
- width: 94%;
- margin: 0 auto;
- }
- .news-flex {
- display: flex;
- align-items: flex-start;
- margin-bottom: 12px;
- }
- .news-list-img {
- width: 66px;
- height: 66px;
- border-radius: 6px;
- border: solid 1px #f1f1f1;
- }
- .news-list-r {
- margin-left: 10px;
- flex: 1;
- height: 66px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .news-list-title {
- font-size: 16px;
- line-height: 21px;
- padding-top: 4px;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- display: -moz-box;
- -moz-line-clamp: 2;
- -moz-box-orient: vertical;
- overflow-wrap: break-word;
- word-break: break-all;
- white-space: normal;
- overflow: hidden;
- }
- .news-list-time {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- color: #999;
- font-size: 13px;
- line-height: 21px;
- }
- .news-list {
- margin-top: 12px;
- border-bottom: solid 1px #f1f1f1;
- }
- .news-content .news-list:last-child {
- margin-bottom: 0;
- border-bottom: none
- }
- </style>
|