skillsTraining.vue 7.7 KB

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