skillsTraining.vue 6.3 KB

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