createTask.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <template>
  2. <view class="">
  3. <view class="y-start container">
  4. <view class="mt40">
  5. 营期名称
  6. </view>
  7. <view class="box" @click="selectCourseTypeShowFun()">
  8. {{!courseName?'请选择营期名称':courseName}}
  9. </view>
  10. <template v-if="params.periodId">
  11. <view class="mt40">
  12. 课程小节名称
  13. </view>
  14. <view class="box" @click="selectCourseShowFun()">
  15. {{!params.courseName?'请选择课程小节':params.courseName}}
  16. </view>
  17. </template>
  18. <view class="u-f u-f-jsb u-f-ac mt40">
  19. <view class=" mr20">
  20. 自动催课
  21. </view>
  22. <u-radio-group v-model="params.isUrgeCourse" @change="groupChange" placement="row">
  23. <u-radio class="mr20" label="是" :name="true"></u-radio>
  24. <u-radio label="否" :name="false"></u-radio>
  25. </u-radio-group>
  26. </view>
  27. <view class="box" @click="selectTime(2)" v-if="params.isUrgeCourse">
  28. {{!params.urgeTime?'请选择发课时间':params.urgeTime && getDetaFun(params.urgeTime)}}
  29. </view>
  30. <view class="mt40">
  31. 发送标题
  32. </view>
  33. <u--input class="mt20 input" placeholder="请输入标题" border="surround" v-model="params.title"></u--input>
  34. <template v-if="params.isUrgeCourse">
  35. <view class="mt40">
  36. 催课文案
  37. </view>
  38. <u--textarea class="mt20 textarea" placeholder="请输入文案" v-model="params.urgeContent"></u--textarea>
  39. </template>
  40. <view class="u-f u-f-jsb u-f-ac mt40">
  41. <view class=" mr20">
  42. 发送方式
  43. </view>
  44. <u-radio-group v-model="params.sendType" @change="sendChange" placement="row">
  45. <u-radio class="mr20" label="定时发送" :name="1"></u-radio>
  46. <u-radio label="实时发送" :name="2"></u-radio>
  47. </u-radio-group>
  48. </view>
  49. <view class="box" v-if="params.sendType && params.sendType==1" @click="selectTime(1)">
  50. {{!params.sendTime?'请选择发送时间':params.sendTime && getDetaFun(params.sendTime)}}
  51. </view>
  52. <view class="u-f u-f-jsb u-f-ac mt40">
  53. <view class=" mr20">
  54. 接收主体
  55. </view>
  56. <u-radio-group v-model="recipientType" @change="recipientTypeChange" placement="row">
  57. <u-radio class="mr20" label="标签" :name="1"></u-radio>
  58. <u-radio label="会员" :name="2"></u-radio>
  59. </u-radio-group>
  60. </view>
  61. <template v-if="recipientType==1">
  62. <view class="box" @tap="selectTagFun('refresh')" v-if="selectTagList.length<=0">
  63. 请选择标签
  64. </view>
  65. <view class="tagbox mt20 " @tap="selectTagFun('refresh')" v-else>
  66. <view class="" v-for="(item, index) in selectTagList" :key="item.tagId">
  67. <u-tag :text="item.tag" plain plainFill :show="item.checked" closable
  68. @close="deleteTag(index)"></u-tag>
  69. </view>
  70. </view>
  71. </template>
  72. <template v-if="recipientType==2">
  73. <view class="box" @tap="selectUserFun()" v-if="selectUserList.length<=0">
  74. 请选择会员
  75. </view>
  76. <view class="tagbox mt20" @tap="selectUserFun()" v-else>
  77. <view class="es-mr-10" v-for="(item, index) in selectUserList" :key="item.userId">
  78. <u-tag :text="item.nickname" plain plainFill :show="item.checked"></u-tag>
  79. </view>
  80. </view>
  81. </template>
  82. </view>
  83. <view class="mt20 button mt20" @click="submitBatchSendCourse">
  84. <u-button type="primary" text="保存"></u-button>
  85. </view>
  86. <u-popup :show="selectCourseShow" :closeOnClickOverlay="true" :round='10' @close="closePopup"
  87. :safeAreaInsetTop="true" mode="bottom">
  88. <view class="container-right popbox">
  89. <view class="popbox-head">
  90. <u-icon class="close-circle" name="close-circle" color="#ccc" size="24"
  91. @click="closePopup"></u-icon>
  92. 选择课程
  93. </view>
  94. <view class="justify-between align-center mb20 mlr20 ">
  95. <u-search placeholder="请输入课程名称" v-model="keyword" :showAction="false" height="30px"
  96. style="width:100%" @search='gettodaylist' @change="searchKeywordCourseList"></u-search>
  97. </view>
  98. <scroll-view style="height:44vh;margin-top: 20rpx;" :scroll-y="true" :refresher-enabled="isEnableds"
  99. :refresher-triggered="triggered" refresher-background="rgba(0,0,0,0)" :scroll-top='scrollTop'
  100. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  101. @refresherabort="triggered = false">
  102. <view class="list">
  103. <courseItem :from="'course'" :activeTab="1" :sourceType="'createTask'"
  104. v-for="(item,index) in dataList" :key="index" :info="item" @courseClick="courseClick(item)"
  105. @retime='reflashtime' />
  106. <u-loadmore :status="loadStatus" />
  107. <view class="h120"></view>
  108. </view>
  109. </scroll-view>
  110. </view>
  111. </u-popup>
  112. <u-datetime-picker :show="timeShow" v-model="defaultTime" @confirm="confirmTime" mode="datetime"
  113. :minDate="new Date().getTime()" :closeOnClickOverlay="true" @close="timeShow = false"
  114. @cancel="timeShow = false"></u-datetime-picker>
  115. <u-popup :show="showPop" :round="12" @close="closePopup" class="model" :zIndex="10076" style="flex: 0;">
  116. <view class="popbox">
  117. <view class="popbox-head">
  118. <u-icon class="close-circle" name="close-circle" color="#ccc" size="24"
  119. @click="closePopup"></u-icon>
  120. 标签筛选
  121. </view>
  122. <view class="popbox-body">
  123. <view class="mb20">
  124. <u-search placeholder="请输入标签 多个标签用 , 隔开" v-model="keyword" :showAction="false" height="30px"
  125. @search="gettaglist" @change="searchKeywordTag"></u-search>
  126. </view>
  127. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  128. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  129. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="100"
  130. @refresherabort="triggereds = false">
  131. <view class="tagbox-list x-f" style="white-space: nowrap;flex-wrap: wrap;">
  132. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="columnsa.length<=0">暂无标签
  133. </view>
  134. <view class="mlr10 mb10" v-for="(item,index) in columnsa" :key='item.tagId'>
  135. <u-tag :text="item.tag"
  136. :plain="(!params.tagIds || params.tagIds && !params.tagIds.includes(item.tagId))"
  137. :name="index" @click="chooseTag(index)"></u-tag>
  138. </view>
  139. </view>
  140. <view class="center fs24 mt20">
  141. <text class="mr20" @click="getTagpage('last','tag')">上一页</text>
  142. <text class="base-color-red">{{pagetag.pageNum}}/{{pagetag.pages}}</text>
  143. <text class="ml20" @click="getTagpage('next','tag')">下一页</text>
  144. </view>
  145. </scroll-view>
  146. </view>
  147. <view class="popbox-footer x-bc">
  148. <button class="popbox-footer-btn" @click="resetTag">重置</button>
  149. <button class="popbox-footer-btn con-btn" @click="confirmPop">确定</button>
  150. </view>
  151. </view>
  152. </u-popup>
  153. <u-popup :show="showvip" @close="closePopup">
  154. <view class="popbox">
  155. <view class="popbox-head">
  156. <u-icon class="close-circle" name="close-circle" color="#ccc" size="24"
  157. @click="closePopup"></u-icon>
  158. 选择会员
  159. </view>
  160. <view class="popbox-body">
  161. <view class="mb20">
  162. <u-search placeholder="请输入会员昵称" v-model="keyword" :showAction="false" height="30px"
  163. @search="gettagUserlist" @change="searchKeyword"></u-search>
  164. </view>
  165. <view class="u-f u-f-ac" @tap="selectTagFun('refresh')">
  166. <view :class="[selectTagList && selectTagList.length>0 ?'mr20':'']">
  167. 选择标签
  168. </view>
  169. <view class="u-f" v-if="selectTagList && selectTagList.length>0">
  170. <view class="" v-for="(item, index) in selectTagList" :key="item.tagId">
  171. <u-tag :text="item.tag" plain plainFill :show="item.checked" closable
  172. @close="deleteTag(index)"></u-tag>
  173. </view>
  174. </view>
  175. <view v-if="selectTagList.length<=0">
  176. <u-icon name="arrow-right" size="12"></u-icon>
  177. </view>
  178. </view>
  179. <scroll-view scroll-y="true" class="hb mt20" :refresher-enabled="isEnableds"
  180. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  181. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="300"
  182. @refresherabort="triggereds = false" @scrolltolower="reachBottom"
  183. @refresherrefresh="pullDownRefresh">
  184. <view class="tagbox-list x-f" style="white-space: nowrap;flex-wrap: wrap;">
  185. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="tagsuserlist.length<=0">
  186. 暂无会员
  187. </view>
  188. <view class="mlr10 mb10" v-for="(item,index) in tagsuserlist" :key='item.userId'>
  189. <u-tag :text="item.nickname"
  190. :plain="(!params.userIds || params.userIds && !params.userIds.includes(item.userId))"
  191. :name="index" @click="checkboxClick(index)"></u-tag>
  192. </view>
  193. </view>
  194. <view class="center fs24 mt20">
  195. <text class="mr20" @click="getTagpage('last','user')">上一页</text>
  196. <text class="base-color-red">{{pagetag.pageNum}}/{{pagetag.pages}}</text>
  197. <text class="ml20" @click="getTagpage('next','user')">下一页</text>
  198. </view>
  199. </scroll-view>
  200. </view>
  201. <view class="popbox-footer x-bc">
  202. <button class="popbox-footer-btn" @click="resetUser">重置</button>
  203. <button class="popbox-footer-btn con-btn" @click="getuserid">确定</button>
  204. </view>
  205. </view>
  206. </u-popup>
  207. <u-popup :show="courseTypeShow" @close="closePopup">
  208. <view class="popbox">
  209. <view class="popbox-head">
  210. <u-icon class="close-circle" name="close-circle" color="#ccc" size="24"
  211. @click="closePopup"></u-icon>
  212. 选择营期
  213. </view>
  214. <view class="popbox-body">
  215. <view class="mb20">
  216. <u-search placeholder="搜索课程" v-model="keyword" :showAction="false" height="30px"
  217. style="width:100%" @search="getFsCourseList('refresh')"
  218. @change="searchKeywordCourse"></u-search>
  219. </view>
  220. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  221. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  222. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="100"
  223. @refresherabort="triggereds = false">
  224. <view class="tagbox-list x-f" style="white-space: nowrap;flex-wrap: wrap;">
  225. <view class="base-color-red fs24 bor-red p8 radius8 plr12" v-if="courseList.length<=0">
  226. 暂无课程
  227. </view>
  228. <view class="mlr10 mb10" v-for="(item,index) in courseList" :key='item.userId'>
  229. <u-tag :text="item.periodName"
  230. :plain="(searchCourseIdStorage && searchCourseIdStorage.periodId || !searchCourseIdStorage && searchCourseId) != item.periodId"
  231. :name="index" @click="handleCourse(item,index)"></u-tag>
  232. </view>
  233. </view>
  234. <view class="center fs24 mt20">
  235. <text class="mr20" @click="getTagpage('last','courseType')">上一页</text>
  236. <text class="base-color-red">{{pagetag.pageNum}}/{{pagetag.pages}}</text>
  237. <text class="ml20" @click="getTagpage('next','courseType')">下一页</text>
  238. </view>
  239. </scroll-view>
  240. </view>
  241. <view class="popbox-footer x-bc">
  242. <button class="popbox-footer-btn" @click="searchReset">重置</button>
  243. <button class="popbox-footer-btn con-btn" @click="searchConfirm">确定</button>
  244. </view>
  245. </view>
  246. </u-popup>
  247. </view>
  248. </template>
  249. <script>
  250. import {
  251. ca
  252. } from "date-fns/locale"
  253. import {
  254. batchSendCourse
  255. } from "./api/courseManage.js"
  256. import {
  257. getallTags,
  258. getFsCourseList,
  259. getCourseVdieoList,
  260. getfsuserList
  261. } from "./api/manageCompany.js"
  262. import courseItem from "./components/courseItem.vue"
  263. import dropdownPanel from "./components/dropdownPanel.vue"
  264. export default {
  265. components: {
  266. courseItem,
  267. dropdownPanel
  268. },
  269. data() {
  270. return {
  271. courseTypeShow: false,
  272. columnsa: [], //标签
  273. showPop: false,
  274. groupid: 0,
  275. pagetag: [],
  276. usertag: [],
  277. showvip: false, //会员
  278. tagsuserlist: [],
  279. userName: [],
  280. triggereds: false,
  281. defaultTime: Number(new Date()),
  282. timeShow: false,
  283. isUrgeClasses: '',
  284. selectCourseShow: false,
  285. dataList: [],
  286. triggered: false,
  287. loadStatus: 'loadmore',
  288. parameter: {
  289. pageNum: 1,
  290. pageSize: 10
  291. },
  292. scrollTop: 0,
  293. isEnableds: true,
  294. urgeClassesText: '',
  295. searchCourseId: null,
  296. searchCourseIdStorage: null,
  297. courserIndex: null,
  298. courseName: '',
  299. params: {
  300. userIds: [],
  301. companyUserId: 0,
  302. companyId: 0,
  303. periodId: 0,
  304. courseId: 0,
  305. courseName: '',
  306. videoId: 0,
  307. videoName: '',
  308. tagIds: [],
  309. tagNames: [],
  310. sendTime: '',
  311. sendType: 1,
  312. sendMode: 1,
  313. title: '',
  314. effectiveDuration: 0,
  315. id: 0,
  316. url: '',
  317. projectId: 0,
  318. isUrgeCourse: true,
  319. urgeTime: 0,
  320. urgeContent: ''
  321. },
  322. keyword: '',
  323. courseList: [],
  324. courseItme: '',
  325. pagetag: [],
  326. timer: null,
  327. recipientType: 1,
  328. selectUserList: [],
  329. selectTagList: [],
  330. searchTagIds: [],
  331. searchTagName: [],
  332. timeType: 0,
  333. }
  334. },
  335. onLoad(params) {
  336. if (params.title) {
  337. uni.setNavigationBarTitle({
  338. title: params.title
  339. });
  340. }
  341. let courseItemArr = uni.getStorageSync('courseItemArr')
  342. if (courseItemArr) {
  343. this.courseClick(courseItemArr)
  344. uni.removeStorageSync('courseItemArr')
  345. }
  346. },
  347. onShow() {
  348. uni.$on('selectUserData', (res) => {
  349. this.selectUserList = res
  350. })
  351. },
  352. mounted() {
  353. let companyUserInfo = uni.getStorageSync('companyUserInfo')
  354. companyUserInfo = JSON.parse(companyUserInfo)
  355. this.params.companyId = companyUserInfo.companyId
  356. this.params.companyUserId = companyUserInfo.userId
  357. },
  358. methods: {
  359. searchConfirm() {
  360. if (this.searchCourseIdStorage) {
  361. this.courseName = this.searchCourseIdStorage.periodName
  362. this.searchCourseId = this.searchCourseIdStorage.periodId
  363. }
  364. this.gettodaylist()
  365. this.keyword = ''
  366. this.courseTypeShow = false
  367. this.selectCourseShow = true
  368. },
  369. searchReset() {
  370. this.keyword = ''
  371. this.courserIndex = this.searchCourseIdStorage = null
  372. },
  373. handleCourse(item, index) {
  374. this.courserIndex = index
  375. this.searchCourseIdStorage = item
  376. },
  377. selindex(e) {
  378. this.params.pageNum = 1
  379. this.keyword = ''
  380. this.getFsCourseList('refresh')
  381. },
  382. checkboxClick(name) {
  383. this.tagsuserlist[name].checked = !this.tagsuserlist[name].checked
  384. const index = this.selectUserList.findIndex(item => item.userId == this.tagsuserlist[name].userId);
  385. if (index !== -1) {
  386. this.selectUserList.splice(index, 1);
  387. } else {
  388. this.selectUserList.push(this.tagsuserlist[name])
  389. }
  390. this.userName = this.selectUserList.map(v => v.nickname)
  391. this.params.userIds = this.selectUserList.map(v => v.userId)
  392. },
  393. deleteUser(index) {
  394. this.selectUserList.splice(index, 1)
  395. this.userName = this.selectUserList.map(v => v.nickname)
  396. this.params.userIds = this.selectUserList.map(v => v.userId)
  397. },
  398. getuserid() {
  399. //会员确定
  400. this.userName = this.tagsuserlist.filter(item => item.checked)
  401. .map(v => v.nickname)
  402. this.params.userIds = this.tagsuserlist.filter(item => item.checked).map(v => v.userId)
  403. this.showvip = !this.showvip
  404. if (this.recipientType == 2) {
  405. this.selectTagList = this.params.tagIds = this.params.tagNames = []
  406. }
  407. },
  408. close() {
  409. this.showvip = !this.showvip
  410. },
  411. async selectUserFun() {
  412. if (!this.params.projectId) return uni.showToast({
  413. icon: 'none',
  414. title: '请选择课程!'
  415. })
  416. let paramsId = ''
  417. if (this.selectUserList) {
  418. paramsId = this.selectUserList.map(item => item.userId)
  419. }
  420. return uni.navigateTo({
  421. url: `/pages_manage/selectMember?paramsId=${paramsId}&projectId=${this.params.projectId}`
  422. })
  423. await this.gettagUserlist('refresh')
  424. this.showvip = true
  425. },
  426. //会员列表
  427. gettagUserlist(type) {
  428. const param = {
  429. pageNum: this.parameter.pageNum,
  430. pageSize: this.parameter.pageSize,
  431. keyword: this.keyword,
  432. tagIds: this.params.tagIds
  433. }
  434. getfsuserList(param).then(res => {
  435. if (res.code == 200) {
  436. this.viewload = false;
  437. let dataList = res.data.list.map((item) => {
  438. return {
  439. ...item,
  440. checked: false
  441. };
  442. });
  443. if (type == 'refresh') {
  444. this.tagsuserlist = dataList;
  445. } else if (type == 'more') {
  446. this.tagsuserlist = dataList;
  447. } else {
  448. this.tagsuserlist = [...this.tagsuserlist, ...dataList];
  449. }
  450. if (res.data.isLastPage) {
  451. this.status = 'nomore';
  452. } else {
  453. this.status = 'loadmore';
  454. }
  455. this.pagetag = res.data;
  456. } else {
  457. uni.showToast({
  458. icon: 'none',
  459. title: res.msg
  460. });
  461. }
  462. })
  463. },
  464. confirmPop() {
  465. //标签选择确定
  466. this.showPop = false
  467. this.params.tagNames = this.columnsa.filter(item => item.checked).map(v => v.tag)
  468. this.params.tagIds = this.columnsa.filter(item => item.checked).map(v => v.tagId)
  469. this.projectid = []
  470. this.projectuser = ''
  471. this.ids = []
  472. this.tagsuser = ''
  473. if (this.recipientType == 2) {
  474. this.showvip = true
  475. this.gettagUserlist('refresh')
  476. }
  477. },
  478. chooseTag(i) {
  479. this.columnsa[i].checked = !this.columnsa[i].checked
  480. const index = this.selectTagList.findIndex(item => item.tagId == this.columnsa[i].tagId);
  481. if (index !== -1) {
  482. this.selectTagList.splice(index, 1);
  483. } else {
  484. this.selectTagList.push(this.columnsa[i])
  485. }
  486. this.params.tagNames = this.selectTagList.map(v => v.tag)
  487. this.params.tagIds = this.selectTagList.map(v => v.tagId)
  488. },
  489. deleteTag(index) {
  490. this.selectTagList.splice(index, 1)
  491. this.tagNames = this.selectTagList.map(v => v.nickname)
  492. this.params.tagIds = this.selectTagList.map(v => v.userId)
  493. if (this.recipientType == 2) {
  494. this.showvip = true
  495. this.gettagUserlist('refresh')
  496. }
  497. },
  498. searchKeywordCourseList(e) {
  499. if (this.timer) {
  500. clearTimeout(this.timer)
  501. }
  502. this.timer = setTimeout(() => {
  503. this.keyword = e
  504. this.parameter.pageNum = 1
  505. this.gettodaylist()
  506. this.timer = ''
  507. }, 1000)
  508. },
  509. searchKeywordCourse(e) {
  510. if (this.timer) {
  511. clearTimeout(this.timer)
  512. }
  513. this.timer = setTimeout(() => {
  514. this.keyword = e
  515. this.parameter.pageNum = 1
  516. this.getFsCourseList('refresh')
  517. this.timer = ''
  518. }, 1000)
  519. },
  520. searchKeywordTag(e) {
  521. if (this.timer) {
  522. clearTimeout(this.timer)
  523. }
  524. this.timer = setTimeout(() => {
  525. this.keyword = e
  526. this.parameter.pageNum = 1
  527. this.gettaglist('refresh')
  528. this.timer = ''
  529. }, 1000)
  530. },
  531. searchKeyword(e) {
  532. if (this.timer) {
  533. clearTimeout(this.timer)
  534. }
  535. this.timer = setTimeout(() => {
  536. this.keyword = e
  537. this.parameter.pageNum = 1
  538. this.gettagUserlist('refresh')
  539. this.timer = ''
  540. }, 1000)
  541. },
  542. changeFunction(type) {
  543. switch (type) {
  544. case 'tag':
  545. return this.gettaglist('refresh')
  546. case 'user':
  547. return this.gettagUserlist('refresh')
  548. case 'courseType':
  549. return this.getFsCourseList('refresh')
  550. }
  551. },
  552. getTagpage(type, tag) {
  553. //标签页数选择
  554. if (type == 'last') {
  555. if (this.parameter.pageNum >= 2) {
  556. this.parameter.pageNum--
  557. this.changeFunction(tag)
  558. } else {
  559. uni.showToast({
  560. title: '已经是第一页',
  561. icon: 'none',
  562. duration: 1000
  563. });
  564. }
  565. } else {
  566. if (this.parameter.pageNum < this.pagetag.pages) {
  567. this.parameter.pageNum++
  568. this.changeFunction(tag)
  569. } else {
  570. uni.showToast({
  571. title: '已经是最后一页',
  572. icon: 'none',
  573. duration: 1000
  574. });
  575. }
  576. }
  577. },
  578. //重置标签
  579. resetTag() {
  580. this.keyword = ''
  581. this.parameter.pageNum = 1
  582. this.gettaglist('refresh')
  583. },
  584. resetUser() {
  585. this.userName = this.keyword = ''
  586. this.parameter.pageNum = 1
  587. this.params.userIds = this.selectUserList = []
  588. if (this.recipientType == 2) {
  589. this.selectTagList = this.params.tagIds = this.params.tagNames = []
  590. }
  591. this.gettagUserlist('refresh')
  592. },
  593. closePopup() {
  594. this.keyword = ''
  595. this.parameter.pageNum = 1
  596. this.courseTypeShow = this.selectCourseShow = this.showPop = this.showvip = false
  597. this.searchCourseIdStorage = ''
  598. if (this.recipientType == 2) {
  599. this.selectTagList = this.params.tagIds = this.params.tagNames = []
  600. }
  601. },
  602. async selectTagFun() {
  603. this.showvip = false
  604. await this.gettaglist('refresh')
  605. this.showPop = true
  606. },
  607. //获取标签列表
  608. gettaglist(type) {
  609. uni.showLoading({
  610. title: '加载中...'
  611. })
  612. const data = {
  613. pageNum: this.parameter.pageNum,
  614. pageSize: this.parameter.pageSize,
  615. keyword: this.keyword,
  616. }
  617. getallTags(data).then(res => {
  618. if (res.code == 200) {
  619. uni.hideLoading()
  620. const dataList = res.data.list.map(item => {
  621. let check = false
  622. if (this.params.tagIds.length > 0 && this.params.tagIds.includs(item.tagId)) {
  623. check = true
  624. }
  625. return {
  626. ...item,
  627. checked: check,
  628. }
  629. })
  630. if (type == 'refresh') {
  631. this.columnsa = dataList
  632. } else {
  633. this.columnsa = [...this.columnsa, ...dataList]
  634. }
  635. if (res.data.isLastPage) {
  636. this.statusA = 'nomore'
  637. } else {
  638. this.statusA = 'loadmore'
  639. }
  640. this.pagetag = res.data
  641. this.changetag = this.columnsa
  642. } else {
  643. uni.hideLoading()
  644. uni.showToast({
  645. icon: 'none',
  646. title: res.msg
  647. })
  648. }
  649. })
  650. },
  651. async getFsCourseList(type) {
  652. const day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
  653. const param = {
  654. pageNum: this.parameter.pageNum,
  655. pageSize: this.parameter.pageSize,
  656. keyword: this.keyword
  657. }
  658. const res = await getFsCourseList(param)
  659. if (res.code == 200) {
  660. if (type == 'refresh') {
  661. this.courseList = res.data.list
  662. } else {
  663. // 加载更多 当前页和下一页合并
  664. this.courseList = [...this.courseList, ...res.data.list]
  665. }
  666. this.pagetag = res.data;
  667. if (res.data.isLastPage) {
  668. this.status = 'nomore'
  669. } else {
  670. this.status = 'loadmore'
  671. }
  672. } else {
  673. uni.showToast({
  674. icon: 'none',
  675. title: res.msg,
  676. });
  677. }
  678. },
  679. selectTime(e) {
  680. this.timeType = e
  681. this.timeShow = true
  682. },
  683. groupChange(e) {
  684. this.params.isUrgeCourse = e
  685. },
  686. sendChange(e) {
  687. this.params.sendType = e
  688. },
  689. recipientTypeChange(e) {
  690. this.selectTagList = []
  691. this.selectUserList = this.params.tagIds = this.params.userIds = this.userName = this
  692. .params.tagNames = []
  693. this.recipientType = e
  694. },
  695. submitBatchSendCourse() {
  696. if (!this.params.courseId) return uni.showToast({
  697. icon: 'none',
  698. title: '请选择课程!'
  699. })
  700. if (!this.params.title) return uni.showToast({
  701. icon: 'none',
  702. title: '请填写标题!'
  703. })
  704. if (this.params.isUrgeCourse && !this.params.urgeTime) {
  705. return uni.showToast({
  706. icon: 'none',
  707. title: '请选择发课时间!'
  708. })
  709. } else if (this.params.isUrgeCourse && !this.params.urgeContent) {
  710. return uni.showToast({
  711. icon: 'none',
  712. title: '请填写催课文案!'
  713. })
  714. } else if (!this.params.isUrgeCourse) {
  715. this.params.urgeTime = ''
  716. }
  717. if (this.params.sendType == 1 && !this.params.sendTime) {
  718. return uni.showToast({
  719. icon: 'none',
  720. title: '请选择发送时间!'
  721. })
  722. } else if (this.params.sendType != 1) {
  723. this.params.sendTime = ''
  724. }
  725. if (this.recipientType == 1 && this.selectTagList.length <= 0) {
  726. return uni.showToast({
  727. icon: 'none',
  728. title: '请选择标签!'
  729. })
  730. } else if (this.recipientType == 2 && this.selectUserList.length <= 0) {
  731. return uni.showToast({
  732. icon: 'none',
  733. title: '请选择会员!'
  734. })
  735. }
  736. this.params.userIds = [...this.selectUserList.map(item => item.userId)]
  737. uni.showLoading({
  738. title: '加载中...'
  739. })
  740. batchSendCourse(this.params).then(res => {
  741. if (res.code == 200 || res.errCode == 0) {
  742. uni.hideLoading()
  743. uni.showToast({
  744. title: '保存成功!'
  745. })
  746. uni.$emit('updateList', true)
  747. setTimeout(() => {
  748. uni.navigateBack()
  749. }, 1000)
  750. } else {
  751. uni.hideLoading()
  752. uni.showToast({
  753. icon: 'none',
  754. title: res.msg
  755. })
  756. }
  757. })
  758. },
  759. confirmTime(e) {
  760. if (this.timeType == 1) {
  761. this.params.sendTime = e.value
  762. } else {
  763. this.params.urgeTime = e.value
  764. }
  765. this.timeShow = false
  766. },
  767. getDetaFun(time) {
  768. const date = new Date(time)
  769. const year = date.getFullYear()
  770. let month = date.getMonth() + 1
  771. let day = date.getDate()
  772. let hour = date.getHours()
  773. let minute = date.getMinutes()
  774. let second = date.getSeconds()
  775. month = month >= 10 ? month : '0' + month
  776. day = day >= 10 ? day : '0' + day
  777. hour = hour >= 10 ? hour : '0' + hour
  778. minute = minute >= 10 ? minute : '0' + minute
  779. second = second >= 10 ? second : '0' + second
  780. return year + '-' + month + '-' + day + ' ' + hour + ':' + minute
  781. },
  782. reachBottom(options) {
  783. if (this.loadStatus === 'loadmore') {
  784. this.loadStatus = 'loading'
  785. uni.showNavigationBarLoading()
  786. setTimeout(() => {
  787. this.params.pageNum += 1;
  788. this.getListData('more')
  789. uni.hideNavigationBarLoading()
  790. }, 500);
  791. }
  792. },
  793. pullDownRefresh(options) {
  794. this.triggered = true;
  795. setTimeout(() => {
  796. this.triggered = false;
  797. uni.stopPullDownRefresh()
  798. this.params.pageNum = 1;
  799. if (this.seltoday == 0) {
  800. this.gettodaylist()
  801. } else {
  802. this.getListData('refresh')
  803. }
  804. }, 500)
  805. },
  806. reflashtime() {
  807. this.keywordlist = ''
  808. this.params.pageNum = 1
  809. this.dataList = []
  810. this.gettodaylist()
  811. this.getFsCourseList('refresh')
  812. },
  813. courseClick(e) {
  814. this.courseItme = e
  815. this.params.periodId = e.periodId
  816. this.params.courseId = e.courseId
  817. this.params.courseName = e.title
  818. this.params.videoId = e.videoId
  819. this.params.videoName = e.title
  820. this.params.projectId = e.projectId
  821. this.params.id = e.id
  822. this.courseName = e.periodName
  823. this.searchCourseId = e.periodId
  824. this.selectCourseShow = false
  825. },
  826. gettodaylist() {
  827. if (!this.searchCourseId) return
  828. const data = {
  829. keyword: this.keyword,
  830. periodId: this.searchCourseId,
  831. pageNum: this.parameter.pageNum,
  832. pageSize: this.parameter.pageSize,
  833. }
  834. getCourseVdieoList(data).then(res => {
  835. if (res.code == 200) {
  836. this.viewload = false
  837. this.dataList = res.data.list
  838. if (res.data.isLastPage) {
  839. this.loadStatus = 'nomore'
  840. } else {
  841. this.loadStatus = 'loadmore'
  842. }
  843. } else {
  844. uni.showToast({
  845. icon: 'none',
  846. title: res.msg,
  847. });
  848. }
  849. })
  850. },
  851. async selectCourseTypeShowFun() {
  852. await this.getFsCourseList('refresh')
  853. this.courseTypeShow = true
  854. },
  855. async selectCourseShowFun() {
  856. await this.gettodaylist('refresh')
  857. this.selectCourseShow = true
  858. }
  859. }
  860. }
  861. </script>
  862. <style scoped lang="scss">
  863. .container {
  864. width: calc(100vw - 48rpx);
  865. margin: 0 24rpx;
  866. }
  867. .box {
  868. background: #fff;
  869. padding: 10rpx 20rpx;
  870. width: 100%;
  871. margin-top: 20rpx;
  872. }
  873. .textarea {
  874. width: 100%;
  875. }
  876. .input {
  877. width: 100%;
  878. background: #fff;
  879. }
  880. .button {
  881. position: fixed;
  882. bottom: 0;
  883. width: calc(100vw - 48rpx);
  884. margin: 0 24rpx;
  885. }
  886. .mt20 {
  887. margin-top: 20rpx;
  888. }
  889. .mt40 {
  890. margin-top: 40rpx;
  891. }
  892. .mr20 {
  893. margin-right: 20rpx;
  894. }
  895. .container-right {
  896. padding: 10px;
  897. box-sizing: border-box;
  898. width: 100%;
  899. flex: 1;
  900. overflow-y: scroll;
  901. }
  902. .popbox {
  903. background-color: #fff;
  904. border-radius: 12px;
  905. font-family: PingFang SC, PingFang SC;
  906. font-weight: 400;
  907. font-size: 14px;
  908. color: #333;
  909. &-head {
  910. padding: 15px;
  911. font-weight: bold;
  912. font-size: 15px;
  913. text-align: center;
  914. position: relative;
  915. }
  916. .close-circle {
  917. position: absolute;
  918. right: 10px;
  919. top: 50%;
  920. transform: translateY(-50%);
  921. }
  922. &-body {
  923. padding: 10px 10px;
  924. }
  925. .radiobox {
  926. &-item {
  927. padding: 10px 0;
  928. border-bottom: 1px solid #f5f5f5;
  929. &:last-child {
  930. border-bottom: none;
  931. }
  932. }
  933. }
  934. &-footer {
  935. padding: 15px 0;
  936. }
  937. &-footer-btn {
  938. flex: 1;
  939. height: 44px;
  940. line-height: 44px;
  941. margin: 0 10px;
  942. border-radius: 50px;
  943. border: none;
  944. font-family: PingFang SC, PingFang SC;
  945. font-weight: 400;
  946. font-size: 14px;
  947. color: #333;
  948. &::after {
  949. border: none;
  950. }
  951. }
  952. .con-btn {
  953. background-color: #1677ff;
  954. color: #fff;
  955. }
  956. .choosetitle {
  957. font-family: PingFang SC, PingFang SC;
  958. font-weight: 400;
  959. font-size: 15px;
  960. color: #333;
  961. }
  962. .invitetip {
  963. margin-top: 10px;
  964. background-color: #ebf5fb;
  965. color: #1677ff;
  966. padding: 5px 10px;
  967. border-radius: 5px;
  968. }
  969. .sharePop-item {
  970. padding: 0 10px;
  971. box-sizing: border-box;
  972. font-family: PingFang SC, PingFang SC;
  973. font-weight: 400;
  974. font-size: 14px;
  975. display: inline-flex !important;
  976. image {
  977. height: 48px;
  978. width: 48px;
  979. margin-bottom: 10px;
  980. }
  981. }
  982. }
  983. .tagbox {
  984. // padding-top: 10rpx;
  985. font-size: 12px;
  986. color: #1677ff;
  987. background: #fff;
  988. width: 100%;
  989. display: flex;
  990. align-content: center;
  991. flex-wrap: wrap;
  992. padding: 0 20rpx;
  993. .tagbox-item {
  994. height: 26px;
  995. padding: 0 8px;
  996. margin: 0 6px 6px 0;
  997. border-radius: 4px;
  998. background-color: #e7f1fe;
  999. color: #1677ff;
  1000. border: 1px solid #1677ff;
  1001. box-sizing: border-box;
  1002. font-size: 12px;
  1003. }
  1004. }
  1005. ::v-deep .courselist-footer {
  1006. display: none;
  1007. }
  1008. .boxnav {
  1009. flex-wrap: wrap;
  1010. padding: 0 0 0 10px;
  1011. &-item {
  1012. width: 50%;
  1013. overflow: hidden;
  1014. }
  1015. &-item-info {
  1016. border: 1px solid #f5f5f5;
  1017. text-align: center;
  1018. color: #222;
  1019. background-color: #f5f5f5;
  1020. border-radius: 3px;
  1021. padding: 5px;
  1022. margin: 0 10px 10px 0;
  1023. }
  1024. &-active {
  1025. border: 1px solid #1677ff !important;
  1026. color: #1677ff !important;
  1027. background-color: #e7f1fe !important;
  1028. }
  1029. }
  1030. ::v-deep .navs {}
  1031. .courseTitlBox {
  1032. padding: 20rpx;
  1033. }
  1034. </style>