index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. <template>
  2. <view class="index">
  3. <u-navbar class="navbar" :is-back="false" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png"></image>
  6. </view>
  7. </u-navbar>
  8. <view class="swiper">
  9. <swiper :indicator-dots="false" indicator-color="#fff" indicator-active-color="#007AFF" :style="{'height':swiperHeight+'rpx'}" @change="swiperChange" :interval="interval" :duration="duration" :autoplay="autoplay" :circular="true">
  10. <swiper-item v-for="(swiper,index) in list" :key="index" @click="swiperClick(swiper)">
  11. <image @load="imageLoad" :src="$method.splitImgHost(swiper.adverUrl)" mode="widthFix"></image>
  12. </swiper-item>
  13. </swiper>
  14. <view class="dots">
  15. <view class="dot" :class="{'active':index == current}" v-for="(swiper,index) in list" :key="index"></view>
  16. </view>
  17. </view>
  18. <view class="content">
  19. <!-- <view class="notice" v-if="infoNums">
  20. <view class="notice__content">
  21. <image src="/static/icon/msg_icon1.png" class="icon"></image>
  22. <view class="text">
  23. 您有{{infoNums}}条新的通知
  24. </view>
  25. <view class="btn" @click="jumpPage">立即查看</view>
  26. </view>
  27. </view>
  28. <view class="my-list">
  29. <view class="my-list__item my-list__item--course" @click="go('course')">
  30. <image src="../../static/mycourse.png"></image>
  31. <text>我的网课</text>
  32. </view>
  33. <view class="my-list__item my-list__item--bank" @click="go('bank')">
  34. <image src="../../static/mybank.png"></image>
  35. <text>我的题库</text>
  36. </view>
  37. </view> -->
  38. <!-- 日历-->
  39. <!-- <view>
  40. <view class="calendar_card">
  41. <view class="card_box">
  42. <u-row gutter="16">
  43. <u-col span="10" >
  44. <view style="height:60rpx;">
  45. <text class="t1" v-if="nearByDay !== '' && nearByDay !== null">距离最近一次考试还剩{{nearByDay}}天</text>
  46. </view>
  47. </u-col>
  48. <u-col offset="1" span="1">
  49. <view @click="jumpPlan"><image src="/static/more.png" class="img_more"></image></view>
  50. </u-col>
  51. </u-row>
  52. </view>
  53. <u-line color="#EEEEEE" />
  54. <view style="width: 100%;display: flex;justify-content:center;margin-top: 20rpx;">
  55. <view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
  56. </view>
  57. <view style="width: 100%;display: flex;justify-content:center;margin-top: 40rpx;">
  58. <view v-for="(item, index) in date_num" :key="index" class="date_num">
  59. <view v-if="item.color == 0" class="date_num_color0" v-show="item.date > 0">
  60. {{ item.date }}
  61. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  62. <view v-if="item.dot" class="date_dot"></view>
  63. </view>
  64. <view v-if="item.color == 1" class="date_num_color1">
  65. {{ item.date }}
  66. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  67. <view v-if="item.dot" class="date_dot"></view>
  68. </view>
  69. <view v-if="item.color == 2" class="date_num_color2">
  70. {{ item.date }}
  71. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  72. <view v-if="item.dot" class="date_dot"></view>
  73. </view>
  74. <view v-if="item.color == 3" class="date_num_color3">
  75. {{ item.date }}
  76. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  77. <view v-if="item.dot" class="date_dot"></view>
  78. </view>
  79. </view>
  80. </view>
  81. <view style="width: 100%;margin-top: 20rpx;" v-if="workList.length > 0">
  82. <u-row gutter="16">
  83. <u-col span="2" text-align="center">
  84. <view><image src="/static/left.png" class="arr-icon" @click="preveItem"></image></view>
  85. </u-col>
  86. <u-col span="8" text-align="center">
  87. <view class="course_title" @click="jumpGoodsDetail(goodsItem)">{{ goodsItem.goodsName }}</view>
  88. </u-col>
  89. <u-col span="2" text-align="center">
  90. <view><image src="/static/right.png" class="arr-icon" @click="nextItem"></image></view>
  91. </u-col>
  92. </u-row>
  93. </view>
  94. </view>
  95. </view> -->
  96. <!-- <u-tabs class="tabs" :current="tabCurrent" @change="tab" :list="menu" :activeStyle="{fontSize:'36rpx'}" :inactiveStyle="{color:'#EAEEF1',fontSize:'30rpx'}" sticky></u-tabs> -->
  97. <view class="tabs">
  98. <view v-for="(item, index) in menu" :key="index" class="tab_item" :class="{nactive: tabNum == index}" @click="tab(index)">{{ item.name }}</view>
  99. </view>
  100. <view class="course-list" v-show="tabCurrent==0">
  101. <template v-if="list1.length">
  102. <navigator hover-class="none" class="list_item" v-for="(item,index) in list1" :key="index" :url="'/pages3/course/detail?id='+item.goodsId">
  103. <view class="course_content">
  104. <view class="c_title">{{item.goodsName}}</view>
  105. <view class="c_downs">
  106. <view class="img">
  107. <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
  108. <view class="time" v-if="item.year">{{item.year?item.year:''}}</view>
  109. </view>
  110. <view class="text">
  111. <view class="desc">
  112. <view class="left">
  113. <text v-if="item.standPrice" class="mon_t">¥ {{toFixed(item.standPrice)}}</text>
  114. <text v-else class="mon_t free">免费</text>
  115. <!-- <text class="sale">/限时优惠</text> -->
  116. <text v-if="item.linePrice" class="sale"> ¥ </text>
  117. <text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
  118. </view>
  119. <view class="right">
  120. <view class="regiser_row">立即购买</view>
  121. </view>
  122. </view>
  123. <view v-if="item.buyUserNum" class="joins">
  124. <!-- <image class="people" src="/static/index/people.png"></image> -->
  125. <!-- 为0时,不显示 -->
  126. <view class="people">{{ item.buyUserNum }}人参与</view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </navigator>
  132. </template>
  133. <template v-else>
  134. <u-empty text="暂无推荐课程" mode="list" margin-top="100"></u-empty>
  135. </template>
  136. </view>
  137. <view class="course-list" v-show="tabCurrent==1">
  138. <template v-if="list2.length">
  139. <navigator hover-class="none" class="list_item" v-for="(item,index) in list2" :key="index" :url="'/pages2/bank/detail?id='+item.goodsId">
  140. <view class="course_content">
  141. <view class="c_title">{{item.goodsName}}</view>
  142. <view class="c_downs">
  143. <view class="img">
  144. <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
  145. <view class="time" v-if="item.year">{{item.year?item.year:''}}</view>
  146. </view>
  147. <view class="text">
  148. <view class="desc">
  149. <view class="left">
  150. <text v-if="item.standPrice" class="mon_t">¥ {{toFixed(item.standPrice)}}</text>
  151. <text v-else class="mon_t free">免费</text>
  152. <!-- <text class="sale">/限时优惠</text> -->
  153. <text v-if="item.linePrice" class="sale"> ¥ </text>
  154. <text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
  155. </view>
  156. <view class="right">
  157. <view class="regiser_row">立即购买</view>
  158. </view>
  159. </view>
  160. <view v-if="item.buyUserNum" class="joins">
  161. <!-- 为0时,不显示 -->
  162. <view class="people">{{ item.buyUserNum }}人参与</view>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. </navigator>
  168. </template>
  169. <template v-else>
  170. <u-empty text="暂无推荐题库" mode="list" margin-top="100"></u-empty>
  171. </template>
  172. </view>
  173. </view>
  174. <!-- <tab-bar v-model="current" :list="tabbarlist" :mid-button="true" :mid-button-size="50" class="tab_items"></tab-bar> -->
  175. <!-- <view v-if="isLogin" class="official">
  176. <u-icon name="close"></u-icon>
  177. <official-account @load='bindload'></official-account>
  178. </view> -->
  179. <!-- v-if="isLogin && (isFollow != 1) && curClose" -->
  180. <!-- <view class="officialsss">
  181. <text>asdsufd</text>
  182. <official-account></official-account>
  183. </view> -->
  184. <view :style="{'opacity':opacitys}" class="officials">
  185. <view class="weixin_official_account">
  186. <image class="off_logo" src="/static/index/official.png"></image>
  187. <view>
  188. <view class="one">关注 “祥粤学校” 公众号</view>
  189. <view class="two">学习提醒、 报考通知不会错过</view>
  190. </view>
  191. <button type="default" class="btn btn-official" >
  192. 去关注
  193. <official-account class="official-account" id="official_account"></official-account>
  194. </button>
  195. <view class="close_icon">
  196. <u-icon name="close" class="icon-close" @click="closeOff"></u-icon>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. </template>
  202. <script>
  203. import { mapGetters, mapActions } from 'vuex';
  204. import { socket_url, version} from '@/common/request.js';
  205. // import TabBar from '@/components/u-tabbar/u-tabbar.vue';
  206. export default {
  207. // components: { TabBar },
  208. data() {
  209. return {
  210. tabNum: 0,
  211. infoNums:0,
  212. list:[],
  213. tabCurrent:0,
  214. date:['日','一','二','三','四','五','六'],
  215. date_num: [],
  216. current:0,
  217. indicatorDots: true,
  218. autoplay: true,
  219. interval: 2000,
  220. duration: 500,
  221. swiperHeight:0,
  222. nearByDay:'', //距离最近一天考试
  223. menu: [{
  224. name: '推荐课程',
  225. }, {
  226. name: '推荐题库',
  227. }],
  228. goodsIndex: 0,
  229. goodsItem: 0,
  230. workList: [],
  231. workTextList: [],
  232. planGoodsList: [],
  233. paramList: [
  234. {
  235. pageNum: 1,
  236. pageSize: 10,
  237. // total: 0,
  238. // showStatus: 0,
  239. getUserNum: 1, //是否返回商品购买用户数量 1带 0不带 ,会返回个buyUserNum
  240. goodsType:1
  241. },
  242. {
  243. pageNum: 1,
  244. pageSize: 10,
  245. // total: 0,
  246. // showStatus: 0,
  247. getUserNum: 1,
  248. goodsType:2
  249. }
  250. ],
  251. total1: 0,
  252. showStatus1: 0,
  253. total2: 0,
  254. showStatus2: 0,
  255. list1: [],
  256. list2: [],
  257. isLogin:false,
  258. isOld:false,
  259. current: 0,
  260. // tabbarlist: this.$store.state.tabLists,
  261. showOfficial: false,
  262. // opacity: 1,
  263. isFollow: null, //是否关注过,不是1就是没关注
  264. curClose: true, // 当天时是否关闭过
  265. };
  266. },
  267. onPullDownRefresh() {},
  268. async onLoad(option) {
  269. this.isLogin = this.$method.isLogin()
  270. this.dictObj
  271. this.getAdvertising();
  272. if(this.$method.isLogin()) {
  273. try {
  274. await this.getUserInfo()
  275. // websocket.sokcet(socket_url+this.userInfo.userId+'-'+this.$method.getRandomString(6))
  276. // websocket.sokcet(socket_url+this.userInfo.userAccount)
  277. }catch(err) {
  278. }
  279. } else {
  280. if(uni.getStorageSync('needToLogin')) {
  281. uni.removeStorageSync('needToLogin');
  282. uni.navigateTo({
  283. url:'/pages4/login/login'
  284. })
  285. }
  286. }
  287. this.init()
  288. wx.getSystemInfo({
  289. success: function (res) {
  290. let version = res.SDKVersion
  291. console.log('该版本号为: ', version)
  292. }
  293. })
  294. },
  295. onShow() {
  296. this.getInfo() // 判断有没有关注公众号
  297. this.isClickOff() //关注公众号,每天最多显示1次;当天学员关闭弹窗后,无需再显示
  298. console.log('this.$store.state.scene', this.$store.state.scene)
  299. uni.removeStorageSync('goPath')
  300. this.courseList();
  301. this.bankList();
  302. if (uni.getStorageSync('updateHome')){
  303. this.init()
  304. uni.removeStorageSync('updateHome'); //消费首页刷新事件
  305. }
  306. this.appCommonConfig({
  307. version
  308. });
  309. if(this.$method.isLogin()){
  310. this.$store.state.allowLoading = false;
  311. this.$api.getinfoAttached().then(res => {
  312. if(res.data.code ===200){
  313. this.infoNums = res.data.data.informSum
  314. const nums = res.data.data.informSum + res.data.data.orderSum + res.data.data.periodSum + res.data.data.planSum + res.data.data.subscribeSum;
  315. this.$store.commit('tabNum', nums);
  316. }
  317. })
  318. this.$store.state.allowLoading = true;
  319. }else{
  320. this.$store.commit('tabNum', 0);
  321. }
  322. },
  323. onShareAppMessage(res) {
  324. return {
  325. title: '中正',
  326. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  327. };
  328. },
  329. computed: {
  330. ...mapGetters(['dictObj','userInfo']),
  331. opacitys() {
  332. const value = [1011,1017,1025,1047,1124].includes(this.$store.state.scene) && this.isLogin && (this.isFollow != 1) && this.curClose ? 1 : 0
  333. console.log('this.opacity::', value)
  334. return value
  335. },
  336. },
  337. methods: {
  338. ...mapActions(['getUserInfo','appCommonConfig']),
  339. getInfo() {
  340. // /app/user/getInfo 登录用户信息 // fromPlat来源平台 1小程序 2PC网站
  341. this.$api.getInfo({ fromPlat: 1 }).then(res => {
  342. if(res.data.code == 200){
  343. this.$store.state.userInfo = res.data.data
  344. this.isFollow = res.data.data.userFollowWx // 不是1就是没关注
  345. console.log('有没有关注', this.isFollow, this.isFollow != 1)
  346. }
  347. })
  348. },
  349. // 每天最多显示1次;当天学员关闭弹窗后,无需再显示
  350. isClickOff() {
  351. //当天23:59:59秒 转换成的毫秒数
  352. const end = new Date(new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1).getTime()
  353. const start = new Date().getTime() //当前时间的毫秒数
  354. if(uni.getStorageSync('endTime')){ //首先判断本地有没有存入当天23:59:59秒的毫秒数
  355. if(start > uni.getStorageSync('endTime')){ //当前时间毫秒数大于当天23:59:59秒
  356. this.curClose = true
  357. uni.removeStorageSync('curClose')
  358. uni.removeStorageSync('endTime')
  359. } else {
  360. this.curClose = uni.getStorageSync('curClose') ? false : true
  361. }
  362. }else{
  363. uni.setStorageSync("endTime", end) //存入当天晚上23:59:59秒的毫秒数
  364. }
  365. },
  366. closeOff() {
  367. this.curClose = false
  368. uni.setStorageSync("curClose", '1')
  369. },
  370. toFixed(number) {
  371. if(number > 0) {
  372. return number.toFixed(2)
  373. } else {
  374. return '0.00'
  375. }
  376. },
  377. /**
  378. * @param {Object} swiper
  379. * 点击轮播图
  380. */
  381. swiperClick(swiper) {
  382. if(swiper.jumpType == 1) { //无跳转
  383. return;
  384. } else if(swiper.jumpType == 2) { //url
  385. let url = encodeURIComponent(swiper.jumpUrl)
  386. uni.navigateTo({
  387. url:'/pages/webview/index?url='+swiper.jumpUrl
  388. })
  389. } else if(swiper.jumpType == 3) { //内部接口
  390. uni.navigateTo({
  391. url:swiper.jumpUrl
  392. })
  393. } else if(swiper.jumpType == 4) { //外部接口
  394. uni.navigateToMiniProgram({
  395. appId: swiper.remarks,
  396. path: swiper.jumpUrl,
  397. extraData: {
  398. },
  399. success(res) {
  400. // 打开成功
  401. },
  402. fail(err) {
  403. // console.log(err)
  404. }
  405. })
  406. }
  407. },
  408. /**
  409. * banner图片加载完成
  410. */
  411. imageLoad(e) {
  412. let winW = 750;
  413. let imgW = e.detail.width;
  414. let imgH = e.detail.height;
  415. this.swiperHeight = 750 * imgH / imgW;
  416. },
  417. async getAdvertising() {
  418. await this.advertisingHomeLocation();
  419. await this.advertisingList();
  420. },
  421. getUserSubscribeRecentExam() {
  422. return new Promise(resolve => {
  423. this.$api.getUserSubscribeRecentExam().then(res => {
  424. if(res.data.code == 200) {
  425. if(res.data.data) {
  426. let day = this.$method.timestampToTime(res.data.data.applySiteExamTime,true).replace(/-/g,'/')
  427. let dayTime = day + ' ' + res.data.data.applySiteStartTime
  428. let NowTime = new Date(); //考试时间
  429. let examTime = new Date(dayTime); //考试时间
  430. let t = (examTime.getTime() / 1000) - (NowTime.getTime() / 1000).toFixed(0);
  431. if(t > 0) {
  432. let day = +this.$method.GetRTime(examTime.getTime() / 1000,true)
  433. this.nearByDay = day;
  434. }
  435. }
  436. resolve()
  437. }
  438. })
  439. })
  440. },
  441. advertisingHomeLocation() {
  442. return new Promise(resolve => {
  443. this.$api.advertisingHomeLocation().then(res => {
  444. this.interval = res.data.data.intervalTime * 1000
  445. resolve()
  446. })
  447. })
  448. },
  449. advertisingList() {
  450. return new Promise(resolve => {
  451. this.$api.advertisingList({locationId:1}).then(res => {
  452. this.list = res.data.rows;
  453. resolve()
  454. })
  455. })
  456. },
  457. jumpPage(){
  458. this.$navTo.togo('/pages4/msg/index')
  459. },
  460. go(type) {
  461. if (!this.$method.isLogin()) {
  462. if(type == 'course') {
  463. uni.setStorageSync('goPath','course')
  464. } else if(type == 'bank' ) {
  465. uni.setStorageSync('goPath','bank')
  466. }
  467. this.$navTo.togo('/pages4/login/login');
  468. } else {
  469. if(type == 'course') {
  470. uni.navigateTo({
  471. url:'/pages2/wd/class'
  472. })
  473. } else if(type == 'bank') {
  474. this.$api.lockLockStatus({
  475. action:'bank'
  476. }).then(res => {
  477. if(res.data.code == 200) { //有其他端在操作,不能学习
  478. uni.showToast({
  479. icon:'none',
  480. title:res.data.msg,
  481. duration:3000,
  482. })
  483. } else if(res.data.code == 500) { //可以学习
  484. uni.navigateTo({
  485. url:'/pages2/wd/question_bank'
  486. })
  487. }
  488. })
  489. }
  490. }
  491. },
  492. //课程
  493. courseList() {
  494. var param = this.paramList[0];
  495. // /app/common/goods/list
  496. this.$api.goodsList(param).then(res => {
  497. if (res.data.code == 200) {
  498. this.list1 = res.data.rows || []
  499. this.total1 = res.data.total
  500. if (this.list1.length === res.data.total) {
  501. this.showStatus1 = true
  502. }
  503. }
  504. });
  505. },
  506. //题库
  507. bankList() {
  508. var param = this.paramList[1];
  509. this.$api.goodsList(param).then(res => {
  510. // this.paramList[1].total = res.data.total;
  511. if (res.data.code == 200) {
  512. this.list2 = res.data.rows || []
  513. this.total2 = res.data.total
  514. if (this.list2.length === res.data.total) {
  515. // this.paramList[1].showStatus = true;
  516. this.showStatus2 = true
  517. }
  518. }
  519. });
  520. },
  521. /**
  522. * @param {Object} item
  523. * 跳转课程详情
  524. */
  525. async jumpGoodsDetail(item){
  526. uni.navigateTo({
  527. url:'/pages2/wd/class'
  528. })
  529. },
  530. /**
  531. * @param {Object} goodsId 商品id
  532. * 查询商品重修状态
  533. */
  534. courseGoodsRebuildStatus(goodsId,gradeId) {
  535. return new Promise(resolve => {
  536. this.$api.courseGoodsRebuildStatus({
  537. goodsId:goodsId,
  538. gradeId:gradeId
  539. }).then(res => {
  540. resolve(res.data.data)
  541. })
  542. })
  543. },
  544. preveItem() {
  545. if (this.goodsIndex > 0) {
  546. this.goodsIndex = this.goodsIndex - 1;
  547. this.planGoodsList =this.workList[this.goodsIndex].goodsVos
  548. this.goodsItem = this.planGoodsList[0];
  549. this.dealRL(this.workList[this.goodsIndex].calendarStudyVo)
  550. }
  551. },
  552. nextItem() {
  553. if (this.goodsIndex < this.workList.length - 1) {
  554. this.goodsIndex = this.goodsIndex + 1;
  555. this.planGoodsList =this.workList[this.goodsIndex].goodsVos
  556. this.goodsItem = this.planGoodsList[0];
  557. this.dealRL(this.workList[this.goodsIndex].calendarStudyVo)
  558. }
  559. },
  560. jumpPlan() {
  561. if (!this.$method.isLogin()) {
  562. this.$navTo.togo('/pages4/login/login');
  563. } else {
  564. this.$navTo.togo('/pages2/plan/index', {});
  565. }
  566. },
  567. async init() {
  568. if (!this.$method.isLogin()) {
  569. //未登录
  570. this.date_num = [];
  571. this.workList = [];
  572. this.planGoodsList = [];
  573. this.initDay();
  574. } else {
  575. this.date_num = [];
  576. this.workList = [];
  577. this.planGoodsList = [];
  578. await this.userPlanSeven();
  579. await this.getUserSubscribeRecentExam();
  580. }
  581. },
  582. getMonDate() {
  583. var d = new Date(),
  584. day = d.getDay(),
  585. date = d.getDate();
  586. if (day == 0) return d;
  587. else d.setDate(date - day);
  588. return d;
  589. },
  590. initDay() {
  591. // d是当前星期一的日期对象
  592. var d = this.getMonDate();
  593. var arr = [];
  594. let date = new Date();
  595. let num = date.getDate();
  596. this.date_num = []
  597. for (var i = 0; i < 7; i++) {
  598. let item = { date: d.getDate() };
  599. item.color = 0;
  600. if (d.getDate() == num) {
  601. item.color = 3;
  602. }
  603. this.date_num.push(item);
  604. d.setDate(d.getDate() + 1);
  605. }
  606. },
  607. dealRL(calendarStudyVo){
  608. let self = this
  609. self.date_num = []
  610. let date = new Date();
  611. let num = date.getDate();
  612. let month = date.getMonth() + 1;
  613. let list = [];
  614. for (let j = 0; j < calendarStudyVo.length; j++) {
  615. let item = calendarStudyVo[j];
  616. list = item.dayStudyList;
  617. for (let i = 0; i < list.length; i++) {
  618. let item = list[i];
  619. item.color = 0;
  620. if (item.date == num) {
  621. item.color = 3;
  622. }
  623. if (item.perform == 1) {
  624. item.color = 1;
  625. }
  626. if (item.perform == 2) {
  627. item.color = 2;
  628. }
  629. item.note = item.studyCourseKnob;
  630. if (item.note > 0) {
  631. item.dot = true;
  632. }
  633. self.date_num.push(item);
  634. }
  635. }
  636. },
  637. userPlanSeven() {
  638. return new Promise(resolve => {
  639. let self = this;
  640. this.$api.userPlanSeven().then(result => {
  641. if (result.data.data && result.data.data.length>0) {
  642. self.workList = result.data.data
  643. self.planGoodsList = self.workList[0].goodsVos;
  644. if (self.planGoodsList != null && self.planGoodsList.length > 0) {
  645. self.goodsItem = self.planGoodsList[0];
  646. }
  647. self.dealRL(result.data.data[0].calendarStudyVo)
  648. } else {
  649. self.initDay();
  650. }
  651. resolve()
  652. });
  653. })
  654. },
  655. swiperChange(e) {
  656. this.current = e.detail.current;
  657. },
  658. tab(e) {
  659. this.tabCurrent = e;
  660. this.tabNum = e
  661. },
  662. updateHomePlan() {
  663. this.$refs.home.init();
  664. },
  665. beforeSwitch(index) {
  666. let that = this;
  667. if (index == 1) {
  668. this.isClick1 = true;
  669. }
  670. if (index == this.current) {
  671. return false;
  672. }
  673. if (!this.$method.isLogin()) {
  674. if (index == 0 || index == 1) {
  675. return true;
  676. } else {
  677. this.$navTo.togo('/pages4/login/login');
  678. return false;
  679. }
  680. } else {
  681. if (index == 2) {
  682. this.$refs.refMy.init();
  683. }
  684. return true;
  685. }
  686. }
  687. },
  688. onReachBottom() {},
  689. };
  690. </script>
  691. <style>
  692. page {
  693. background: #eaeef1;
  694. }
  695. </style>
  696. <style lang="scss" scoped>
  697. @mixin threeDot {
  698. overflow: hidden;
  699. text-overflow:ellipsis;
  700. white-space: nowrap;
  701. }
  702. .index {
  703. .navbar {
  704. /deep/ .u-navbar-inner {
  705. margin-right:0!important;
  706. }
  707. .slot-wrap {
  708. width:100%;
  709. display: flex;
  710. align-items: center;
  711. justify-content: center;
  712. image {
  713. width: 178rpx;
  714. height: 31rpx;
  715. }
  716. }
  717. }
  718. .swiper {
  719. width:100%;
  720. position: relative;
  721. .dots {
  722. position:absolute;
  723. left:0;
  724. bottom:8rpx;
  725. width:100%;
  726. display: flex;
  727. justify-content: center;
  728. .dot {
  729. width: 8rpx;
  730. height: 8rpx;
  731. background: #FFFFFF;
  732. border-radius: 50%;
  733. margin:0 4rpx;
  734. transition: all 0.3s;
  735. &.active {
  736. width: 24rpx;
  737. height: 8rpx;
  738. background: #007AFF;
  739. border-radius: 4rpx;
  740. }
  741. }
  742. }
  743. image {
  744. width:100%;
  745. }
  746. }
  747. .content {
  748. overflow: hidden;
  749. padding:0 16rpx;
  750. background: rgba(234, 238, 241, 1);
  751. padding-bottom: 100rpx;
  752. .notice {
  753. background:#fff;
  754. border-radius: 16rpx;
  755. margin-top:32rpx;
  756. overflow: hidden;
  757. &__content {
  758. padding:0 8rpx;
  759. height: 56rpx;
  760. background: linear-gradient(-90deg, rgba(255, 209, 0, 0.3), rgba(255, 255, 255, 0.3));
  761. display: flex;
  762. align-items: center;
  763. }
  764. .icon {
  765. width: 40rpx;
  766. height: 40rpx;
  767. margin-right: 8rpx;
  768. }
  769. .text {
  770. flex:1;
  771. font-size: 24rpx;
  772. color: #333333;
  773. position: relative;
  774. }
  775. .btn {
  776. font-size: 24rpx;
  777. color: #007AFF;
  778. }
  779. }
  780. .date-list {
  781. margin-top:16rpx;
  782. width: 718rpx;
  783. height: 330rpx;
  784. background: #FFFFFF;
  785. border-radius: 16rpx;
  786. padding:18rpx 27rpx;
  787. .title {
  788. font-size: 30rpx;
  789. font-weight: bold;
  790. color: #007AFF;
  791. }
  792. .list {
  793. margin-top:40rpx;
  794. display: flex;
  795. justify-content: space-around;
  796. .item {
  797. .top {
  798. text-align: center;
  799. font-size: 26rpx;
  800. color: rgba(102, 102, 102, 0.6);
  801. }
  802. .bottom {
  803. text-align: center;
  804. line-height: 48rpx;
  805. margin-top:30rpx;
  806. width: 48rpx;
  807. height: 48rpx;
  808. border-radius: 50%;
  809. color:rgba(51, 51, 51, 1);
  810. font-size: 26rpx;
  811. position:relative;
  812. &.red {
  813. color:#FF3B30;
  814. }
  815. &.green {
  816. color:#36C75A;
  817. }
  818. &.blue {
  819. background: #007AFF;
  820. color:#fff;
  821. }
  822. .note {
  823. width: 30rpx;
  824. height: 30rpx;
  825. border: 2rpx solid #FF9500;
  826. border-radius: 50%;
  827. position:absolute;
  828. top:-20rpx;
  829. right:-20rpx;
  830. line-height: 28rpx;
  831. text-align: center;
  832. color:#FF9500;
  833. font-size: 26rpx;
  834. }
  835. .point {
  836. margin:0 auto;
  837. width: 8rpx;
  838. height: 8rpx;
  839. background: #FF9500;
  840. border-radius: 50%;
  841. }
  842. }
  843. }
  844. }
  845. .btns {
  846. margin-top:50rpx;
  847. display: flex;
  848. align-items: center;
  849. justify-content: center;
  850. .left,.right {
  851. width: 40rpx;
  852. height: 40rpx;
  853. }
  854. .center{
  855. width: 440rpx;
  856. height: 56rpx;
  857. background: #FFFFFF;
  858. box-shadow: 0px 0px 9rpx 1rpx rgba(47, 67, 121, 0.1);
  859. border-radius: 28rpx;
  860. color:rgba(255, 149, 0, 1);
  861. line-height: 56rpx;
  862. text-align: center;
  863. font-size: 30rpx;
  864. margin:0 30rpx;
  865. }
  866. }
  867. }
  868. .tabs {
  869. width: 100%;
  870. height: 78rpx;
  871. display: flex;
  872. align-items: center;
  873. justify-content: space-between;
  874. background-color: #F2F7FF;
  875. border-radius: 38rpx;
  876. margin: 34rpx 0rpx 24rpx 0rpx;
  877. padding: 0rpx 5rpx;
  878. .tab_item {
  879. width: 345rpx;
  880. height: 65rpx;
  881. line-height: 65rpx;
  882. font-size: 28rpx;
  883. font-weight: bold;
  884. border-radius: 32rpx;
  885. text-align: center;
  886. color: #333;
  887. &.nactive {
  888. color: #fff;
  889. background-color: #3577E8;
  890. }
  891. }
  892. }
  893. .course-list {
  894. box-shadow: 0px 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  895. .list_item {
  896. padding: 24rpx;
  897. // height: 278rpx;
  898. background: #FFFFFF;
  899. box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1,99,235,0.1000);
  900. border-radius: 24rpx;
  901. background:#fff;
  902. margin-bottom: 32rpx;
  903. display: flex;
  904. align-items: center;
  905. .c_title {
  906. font-size: 32rpx;
  907. font-weight: bold;
  908. margin-bottom: 24rpx;
  909. font-weight: bold;
  910. color: #222222;
  911. }
  912. .c_downs {
  913. display: flex;
  914. }
  915. .img {
  916. position:relative;
  917. margin-right: 24rpx;
  918. border-radius: 16rpx ;
  919. overflow: hidden;
  920. width: 204rpx;
  921. height: 120rpx;
  922. image {
  923. width:100%;
  924. height:100%;
  925. }
  926. .time {
  927. position:absolute;
  928. bottom:0;
  929. right:0;
  930. width: 80rpx;
  931. height: 32rpx;
  932. background: rgba(1, 25, 45, 0.4);
  933. color:#fff;
  934. text-align: center;
  935. line-height: 32rpx;
  936. font-size: 24rpx;
  937. border-radius: 10rpx 0px 10rpx 0px;
  938. }
  939. }
  940. .text {
  941. width: 440rpx;
  942. position: relative;
  943. display: flex;
  944. flex-direction: column;
  945. justify-content: space-between;
  946. height: 120rpx;
  947. .joins {
  948. .people {
  949. width: 160rpx;
  950. font-size: 20rpx;
  951. color: #999999;
  952. padding: 0rpx 8rpx;
  953. text-align: center;
  954. height: 36rpx;
  955. line-height: 36rpx;
  956. background: #F6F7FB;
  957. border-radius: 4px;
  958. }
  959. }
  960. .desc {
  961. margin-top: 10rpx;
  962. display: flex;
  963. align-items: center;
  964. justify-content: space-between;
  965. width: 100%;
  966. .left {
  967. flex:1;
  968. color:#333;
  969. font-size: 26rpx;
  970. .mon_t {
  971. font-weight: bold;
  972. color: #FC3F3F;
  973. font-size: 36rpx;
  974. }
  975. .free {
  976. font-size: 24rpx;
  977. }
  978. .sale {
  979. color: #999999;
  980. font-size: 24rpx;
  981. margin-left: 8rpx;
  982. }
  983. .price_line {
  984. color: #999999;
  985. font-size: 24rpx;
  986. text-decoration:line-through;
  987. font-weight: 400;
  988. }
  989. }
  990. .right {
  991. font-size: 24rpx;
  992. font-weight: bold;
  993. .regiser_row {
  994. width: 144rpx;
  995. height: 52rpx;
  996. line-height: 52rpx;
  997. text-align: center;
  998. border-radius: 16rpx;
  999. background-color: #FC3F3F;
  1000. color: #fff;
  1001. font-weight: 500;
  1002. font-size: 26rpx;
  1003. }
  1004. }
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010. // .botms {
  1011. // padding-bottom: 100rpx;
  1012. // }
  1013. .my-list {
  1014. margin:32rpx 0;
  1015. display:flex;
  1016. justify-content: space-between;
  1017. &__item {
  1018. width:351rpx;
  1019. height:96rpx;
  1020. position:relative;
  1021. padding:25rpx 0 0 25rpx;
  1022. font-size: 32rpx;
  1023. &--bank {
  1024. text {
  1025. position: relative;
  1026. z-index: 2;
  1027. color:#00998A;
  1028. }
  1029. }
  1030. &--course {
  1031. text {
  1032. position: relative;
  1033. z-index: 2;
  1034. color:#0062D9;
  1035. }
  1036. }
  1037. image {
  1038. width:100%;
  1039. height:100%;
  1040. left:0;
  1041. top:0;
  1042. position:absolute;
  1043. z-index: 1;
  1044. }
  1045. }
  1046. }
  1047. }
  1048. .date_dot {
  1049. width: 6rpx;
  1050. height: 6rpx;
  1051. background: #ffcc00;
  1052. border-radius: 50%;
  1053. margin: 0 auto;
  1054. }
  1055. .date_note {
  1056. border-radius: 50%;
  1057. width: 29rpx;
  1058. height: 29rpx;
  1059. border: 1px solid #ffcc00;
  1060. font-size: 18rpx;
  1061. color: #ffcc00;
  1062. text-align: center;
  1063. display: inline-block;
  1064. position: absolute;
  1065. top: -19rpx;
  1066. right: 9rpx;
  1067. }
  1068. .circle_num {
  1069. border-radius: 50%;
  1070. width: 29rpx;
  1071. height: 29rpx;
  1072. border: 1px solid #ffcc00;
  1073. font-size: 18rpx;
  1074. color: #ffcc00;
  1075. text-align: center;
  1076. display: inline-block;
  1077. margin: 5rpx;
  1078. }
  1079. .date_num {
  1080. width: 14%;
  1081. text-align: center;
  1082. position: relative;
  1083. display: inline-block;
  1084. margin-top: 20rpx;
  1085. }
  1086. .course_title {
  1087. color: #2f4379;
  1088. box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(47, 67, 121, 0.1);
  1089. border-radius: 28rpx;
  1090. width: 100%;
  1091. height: 48rpx;
  1092. line-height: 48rpx;
  1093. overflow: hidden;
  1094. text-overflow:ellipsis;
  1095. white-space: nowrap;
  1096. }
  1097. .arr-icon {
  1098. width: 40rpx;
  1099. height: 40rpx;
  1100. }
  1101. .date_num_color0 {
  1102. color: #32467b;
  1103. }
  1104. .date_num_color1 {
  1105. color: #34c759;
  1106. }
  1107. .date_num_color2 {
  1108. color: #ff3b30;
  1109. }
  1110. .date_num_color3 {
  1111. color: #ffffff;
  1112. background-color: #ffcc00;
  1113. border-radius: 50%;
  1114. width: 40rpx;
  1115. height: 40rpx;
  1116. display: inline-block;
  1117. }
  1118. .card_date {
  1119. width: 14%;
  1120. text-align: center;
  1121. color: #7f8caf;
  1122. }
  1123. .calendar_card {
  1124. width: 100%;
  1125. background: #ffffff;
  1126. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.1);
  1127. border-radius: 22rpx;
  1128. margin-top: 16rpx;
  1129. padding-bottom: 15rpx;
  1130. }
  1131. .calendar_card .card_box {
  1132. height: 60rpx;
  1133. line-height: 60rpx;
  1134. margin-left: 20rpx;
  1135. }
  1136. .calendar_card .t1 {
  1137. color: #007AFF;
  1138. font-size: 24rpx;
  1139. }
  1140. .img_more {
  1141. width: 26rpx;
  1142. height: 26rpx;
  1143. }
  1144. .flex-d {
  1145. display: flex;
  1146. flex-direction: column;
  1147. justify-content: space-between;
  1148. height: 100%;
  1149. }
  1150. .contentZ {
  1151. flex: 1;
  1152. overflow-y: auto;
  1153. padding-left: 35rpx;
  1154. display: flex;
  1155. justify-content: space-around;
  1156. }
  1157. .contentZ::-webkit-scrollbar {
  1158. display: none;
  1159. }
  1160. .fots {
  1161. height: 100rpx;
  1162. display: flex;
  1163. align-items: center;
  1164. justify-content: space-around;
  1165. border-top: 1rpx solid #eee;
  1166. }
  1167. .leftBtns {
  1168. font-size: 30rpx;
  1169. color: #32467b;
  1170. font-weight: 500;
  1171. }
  1172. .right_Btns {
  1173. font-size: 30rpx;
  1174. color: #fff;
  1175. background-color: #32467b;
  1176. border-radius: 24rpx;
  1177. height: 60rpx;
  1178. line-height: 60rpx;
  1179. text-align: center;
  1180. padding: 0rpx 23rpx;
  1181. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1182. }
  1183. .lzs {
  1184. width: 31%;
  1185. margin: 0rpx 1%;
  1186. max-width: 31%;
  1187. }
  1188. .tylsz{
  1189. margin-top: 23rpx;
  1190. color: #666;
  1191. font-weight: 400;
  1192. font-size: 24rpx;
  1193. }
  1194. .tylsz:first-child{
  1195. text-align: center;
  1196. }
  1197. .activeStys{
  1198. font-weight: bold;
  1199. color: #32467B;
  1200. }
  1201. .officialsss {
  1202. position: fixed;
  1203. left: 0;
  1204. bottom: 100rpx;
  1205. width: 100%;
  1206. }
  1207. .officials {
  1208. width:100%;
  1209. height: 104rpx;
  1210. position:fixed;
  1211. bottom: 0;
  1212. left: 0;
  1213. z-index: 999;
  1214. display: flex;
  1215. align-items: center;
  1216. justify-content: center;
  1217. }
  1218. .weixin_official_account {
  1219. position: fixed;
  1220. bottom: 0;
  1221. left: 0;
  1222. display: flex;
  1223. align-items: center;
  1224. // justify-content: space-between;
  1225. width: 718rpx;
  1226. height: 104rpx;
  1227. padding: 0 32rpx;
  1228. margin-left: 16rpx;
  1229. background: #3A3F54;
  1230. border-radius: 16rpx;
  1231. .off_logo {
  1232. width: 48rpx;
  1233. height: 48rpx;
  1234. margin-right: 24rpx;
  1235. }
  1236. .one {
  1237. color: #fff;
  1238. font-size: 24rpx;
  1239. font-weight: 500;
  1240. }
  1241. .two {
  1242. color: #BCBEC7;
  1243. font-size: 20rpx;
  1244. }
  1245. .btn {
  1246. position: relative;
  1247. top: 0;
  1248. left: 35rpx;
  1249. width: 128rpx;
  1250. height: 56rpx;
  1251. line-height: 56rpx;
  1252. padding: 0;
  1253. background: linear-gradient(274deg, #408BF6 0%, #40B4F6 100%);
  1254. border-radius: 156rpx;
  1255. overflow: hidden;
  1256. text-align: center;
  1257. font-size: 24rpx;
  1258. color: #fff;
  1259. .official-account {
  1260. position: absolute;
  1261. z-index: 1000;
  1262. right: -9px;
  1263. top: -38px;
  1264. opacity: 0;
  1265. }
  1266. }
  1267. .close_icon {
  1268. width: 40rpx;
  1269. height: 40rpx;
  1270. background: #FFFFFF;
  1271. opacity: 0.2;
  1272. display: flex;
  1273. align-items: center;
  1274. position: absolute;
  1275. top: 0;
  1276. right: 0;
  1277. color: #fff;
  1278. border-radius: 0rpx 16rpx;
  1279. }
  1280. .icon-close {
  1281. display: flex;
  1282. align-items: center;
  1283. justify-content: center;
  1284. width: 50rpx;
  1285. height: 68rpx;
  1286. font-size: 22rpx;
  1287. color: #7B8284;
  1288. }
  1289. }
  1290. </style>