skillsTraining.vue 6.7 KB

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