skillsTraining.vue 6.2 KB

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