skillsTraining.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <!-- 技能培训 -->
  2. <template>
  3. <view class="training">
  4. <!-- banner -->
  5. <view class="training-banner">
  6. <u-swiper v-if="bannerList.length" :list="bannerList" name="bannerUrl" border-radius="0" mode="round" height="440"
  7. img-mode="scaleToFill"></u-swiper>
  8. <image v-else src="../../static/img/banner-skillsTraining.png" mode="aspectFill"></image>
  9. </view>
  10. <view class="training-total" @click="jumpPage('/pages/mine/skillsTraining/skillsTraining')" v-if="isAddClass">
  11. <view class="training-total-left">
  12. <view>我的技能培训</view>
  13. <view>学习时长:{{ skillTotal.learnTime }}小时</view>
  14. </view>
  15. <view class="training-total-right">
  16. <u-icon name="arrow-right" size="44" color="#fff"></u-icon>
  17. </view>
  18. </view>
  19. <view class="training-total" v-else>
  20. <view class="training-total-left">
  21. <view>您还未报班</view>
  22. </view>
  23. </view>
  24. <!-- 报班通知 -->
  25. <view class="training-notice">
  26. <view class="training-notice-title">
  27. <view>报班通知</view>
  28. <view @click="jumpPage('pages/skillsTraining/registrationNotice/registrationNotice')">
  29. <text>更多</text>
  30. <u-icon name="arrow-right"></u-icon>
  31. </view>
  32. </view>
  33. <view class="training-notice-content">
  34. <swiper class="swiper" :indicator-dots="true" :autoplay="false" :interval="1000" :duration="500"
  35. indicator-color="#D8D8D8" indicator-active-color="#D8D8D8">
  36. <swiper-item v-for="(item, index) in enrollList" :key="index">
  37. <view class="swiper-item">
  38. <view class="left">
  39. <u-image :src="item.img" mode="aspectFill" border-radius="10" height="220" />
  40. </view>
  41. <view class="right">
  42. <view>{{ item.name }}</view>
  43. <view>{{ item.schoolName }}</view>
  44. <view>{{ item.description }}</view>
  45. <view class="btn"
  46. @click="signUp(item)">报名</view>
  47. </view>
  48. </view>
  49. </swiper-item>
  50. </swiper>
  51. </view>
  52. </view>
  53. <!-- 技能包 -->
  54. <view class="training-package">
  55. <view class="training-package-title">
  56. <view>技能包</view>
  57. <!-- <view>
  58. <text>更多</text>
  59. <u-icon name="arrow-right"></u-icon>
  60. </view> -->
  61. </view>
  62. <view class="training-package-list">
  63. <view class="training-package-list-item" v-for="(item, index) in packageList" :key="index"
  64. @click="recordBrowseTotal(item)">
  65. <view>
  66. <u-image :src="item.img" height="190" mode="aspectFill" border-radius="10" />
  67. </view>
  68. <view>{{ item.name }}</view>
  69. <view>{{ item.schoolName }}</view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 问题咨询 -->
  74. <view class="training-bottom" @click="questionAsk">问题咨询</view>
  75. <u-toast ref="uToast" />
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. enrollList: [],
  83. packageList: [],
  84. skillTotal: {},
  85. isAddClass: false,
  86. bannerList: []
  87. }
  88. },
  89. onShow() {
  90. this.getPackageList();
  91. this.getClassNoticeList();
  92. this.getTrainingTotal();
  93. this.queryIsAttendedClass();
  94. this.getBannerList();
  95. },
  96. methods: {
  97. getBannerList() {
  98. this.$u.api.indexApi.indexBannerListApi({ type: 4 }).then(res => {
  99. if (res?.code === 200) {
  100. this.bannerList = res.data;
  101. }
  102. })
  103. },
  104. /**
  105. * 查询是否报过班
  106. */
  107. queryIsAttendedClass() {
  108. this.$u.api.skillTraining.queryIsAttendedClassApi().then(res => {
  109. if (res.code === 200) {
  110. console.log(res)
  111. if (res.data > 0) {
  112. this.isAddClass = true
  113. }
  114. }
  115. })
  116. },
  117. /**
  118. * 获取技能包列表
  119. */
  120. getPackageList() {
  121. this.$u.api.skillTraining.getSkillPackageListApi().then(res => {
  122. if (res.code === 200) {
  123. this.packageList = res.rows
  124. }
  125. })
  126. },
  127. /**
  128. * 获取报班通知列表
  129. */
  130. getClassNoticeList() {
  131. this.$u.api.skillTraining.getClassNoticeApi({
  132. pageNum: 1,
  133. pageSize: 5
  134. }).then(res => {
  135. if (res.code === 200) {
  136. this.enrollList = res.rows;
  137. }
  138. })
  139. },
  140. /**
  141. * 获取个人技能培训统计
  142. */
  143. getTrainingTotal() {
  144. this.$u.api.skillTraining.getTrainingTotalApi().then(res => {
  145. if (res.code === 200) {
  146. this.skillTotal = res.data
  147. }
  148. })
  149. },
  150. /**
  151. * 适应性培训关注度统计
  152. * @param {Object} item
  153. */
  154. recordBrowseTotal(item) {
  155. const query = {
  156. platform: '1', // 平台:1-H5 2-APP 3-小程序 4-PC端
  157. pages: location.href, // 页面路径
  158. btnName: '查看技能包详情', // 按钮名称
  159. btnEvent: '1', //按钮事件: 1-点击 2-长按 3-滑动
  160. ipAddress: '', //IP地址
  161. typeName: '技能培训关注度', //类型名称 例:学校关注度 、适应性考试等
  162. typeCode: 'JNPXGZD', // 类型编码 例:类型名称首字母缩写(XXGZD)
  163. categoryName: item.name, //类别名称 例:XX学校,SS考试
  164. }
  165. this.$u.api.postAnalysis(query).then(res => {
  166. this.jumpPage('/pages/skillsTraining/skillsPackage/skillsPackage', {
  167. id: item.id,
  168. schoolName: item.schoolName
  169. })
  170. })
  171. },
  172. /**
  173. * 跳转到指定页面
  174. * @param { String } url
  175. * @param {Object} parmas
  176. */
  177. jumpPage(url, params) {
  178. this.$u.route({
  179. url,
  180. params
  181. })
  182. },
  183. /**
  184. * 报名
  185. * @param {Object} item
  186. */
  187. signUp(item) {
  188. this.$u.api.skillTraining.signUpClassApi({ packageId: item.id }).then(res => {
  189. if (res.code === 200) {
  190. this.jumpPage('/pages/skillsTraining/submitSuccess/submitSuccess');
  191. } else {
  192. this.$refs.uToast.show({
  193. title: res.msg,
  194. type: 'error'
  195. })
  196. }
  197. })
  198. },
  199. /**
  200. * 问题咨询
  201. */
  202. questionAsk() {
  203. let url =
  204. `${this.config.timChatUrl}?userID=${this.vuex_user.userId}&title=问题咨询&permission=2&type=retire`
  205. this.$u.route({
  206. url: '/pages/webView/webView',
  207. params: {
  208. url: encodeURIComponent(url)
  209. }
  210. })
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. @import './skillsTraining.scss';
  217. </style>