jys.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <view class="jys">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="top">
  5. <view class="card">
  6. <image class="image" :src="actItemList.pic" mode="aspectFill"></image>
  7. <view class="text">
  8. <view class="text_title">
  9. <view class="manage bqZ-font">类型</view>
  10. <view class="t1 bmTit-font">{{ actItemList.acName }}</view>
  11. </view>
  12. <view class="col sZw-font">
  13. 负责人:{{ actItemList.username }}
  14. </view>
  15. <view class="col sZw-font">
  16. 教研室标签:暂无
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- <uni-card :is-shadow="false"> -->
  22. <!-- <view class="xinxi">
  23. <view class="card2">
  24. <view class="hdxx">
  25. <view class="xxTit btn-font">活动信息</view>
  26. <view class="textcolor">
  27. <view class="name sZw-font">
  28. 姓名:
  29. <input type="text" style=" text-align: right;" maxlength="10" placeholder="请输入姓名"
  30. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="applyname" />
  31. </view>
  32. <view class="name sZw-font">
  33. 联系方式:
  34. <input @blur="handleInput" type="number" style=" text-align: right;" maxlength="11"
  35. placeholder="请输入联系方式" placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);"
  36. v-model="phone" />
  37. </view>
  38. <view class="name sZw-font">
  39. 单位:
  40. <input type="text" style=" text-align: right;" maxlength="15" placeholder="请输入单位"
  41. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="stations" />
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view> -->
  47. <view class="buttons">
  48. <view class="button-container">
  49. <!-- <button @click="button1Action" class="btn1 sZw-font">清空填写信息</button> -->
  50. <!-- <text class="button-spacing"></text> -->
  51. <!-- 添加间距 -->
  52. <button style="background-colo:#0056a8;" @click="showPop" class="btn2 sZw-font">申请加入</button>
  53. </view>
  54. </view>
  55. <!-- 弹窗 -->
  56. <view>
  57. <view class="mask" v-show="showPopup" @click="closePopup"></view>
  58. <view class="popup-container" v-show="showPopup">
  59. <view class="popup">
  60. <view class="header">
  61. <text>确认报名</text>
  62. </view>
  63. <view class="footer">
  64. <view class="cancel-btn" @click="showPopup=false">取消</view>
  65. <view class="confirm-btn" @click="gotoSign">确认</view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view>
  71. <view class="mask" v-show="showPopupConfirm" @click="closePopup"></view>
  72. <view class="popup-container" style="height: 175px;" v-show="showPopupConfirm">
  73. <view class="popup">
  74. <view class="header" style="margin-top: 15px;">
  75. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//gou1.png" mode="aspectFill">
  76. </image>
  77. <text style="margin-bottom: 24px;">报名成功</text>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. navBarData: {
  89. title: '活动报名',
  90. btn: 1
  91. },
  92. //控制弹窗
  93. showPopup: false,
  94. // 成功弹窗
  95. showPopupConfirm: false,
  96. // 用户名
  97. applyname: '',
  98. // 联系方式
  99. phone: '',
  100. // 单位
  101. stations: '',
  102. // 决定你能不能报名
  103. isApply: false,
  104. // 获取的渲染数据
  105. actItemList: {},
  106. };
  107. },
  108. methods: {
  109. // 清空填写信息
  110. button1Action() {
  111. this.applyname = ''
  112. this.phone = ''
  113. this.stations = ''
  114. },
  115. handleInput(e) {
  116. const {
  117. value
  118. } = e.target
  119. // console.log('value',value);
  120. const newValue = value.replace(/[^\d]/g, '') // 只允许输入数字
  121. // console.log('newValue',newValue);
  122. // if (newValue.length <= 11) {
  123. this.phone = newValue;
  124. // }
  125. },
  126. // 确定按钮显示弹窗
  127. showPop() {
  128. // if (this.applyname == '') return uni.showToast({
  129. // title: '请输入姓名',
  130. // icon: 'none'
  131. // })
  132. // if (this.phone == '') return uni.showToast({
  133. // title: '请输入联系方式',
  134. // icon: 'none'
  135. // })
  136. // if (this.stations == '') return uni.showToast({
  137. // title: '请输入单位',
  138. // icon: 'none'
  139. // })
  140. // if (this.phone.length != 11) return uni.showToast({
  141. // title: '号码不足11位,请检查',
  142. // icon: 'none'
  143. // })
  144. this.showPopup = true
  145. },
  146. // 确定报名
  147. gotoSign() {
  148. // 做最后判断防止同一时间进入报名页面都报名成功
  149. this.$request('/selectIntercept', "POST", {
  150. oid: this.$store.state.user.openid,
  151. acid: this.acId
  152. }).then(res => {
  153. let c = res[0][0]
  154. console.log(res[0][0]);
  155. console.log(c.bnum >= c.pers * 1);
  156. if (c.bnum >= c.pers * 1) {
  157. return uni.showToast({
  158. title: '已有人先您一步报名,名额已满',
  159. icon: "none"
  160. })
  161. } else {
  162. let data = {
  163. oid: this.$store.state.user.openid, //用户id
  164. acid: this.acId,
  165. ty: 2,
  166. ume: this.applyname,
  167. pho: this.phone,
  168. sta: this.stations
  169. }
  170. this.$request('/insertSignup', "POST", data).then(res => {
  171. // console.log(res);
  172. // 添加消息页面系统通知提示报名成功
  173. this.addMessage()
  174. // 弹窗关闭
  175. this.showPopup = false
  176. uni.reLaunch({
  177. url: '/pages/Sign/Sign',
  178. })
  179. // uni.navigateTo({
  180. // url: '/pages/Sign/Sign',
  181. // success() {
  182. // //跳转成功后,禁止返回
  183. // uni.navigateBack({
  184. // delta:0
  185. // })
  186. // }
  187. // })
  188. })
  189. }
  190. })
  191. },
  192. // 添加消息页面系统通知提示报名成功
  193. addMessage() {
  194. let data = {
  195. oid: this.$store.state.user.openid,
  196. acid: this.acId,
  197. type: 0,
  198. }
  199. this.$request('/insertMessage', "POST", data).then(res => {
  200. console.log(res);
  201. })
  202. },
  203. // 获取页面数据
  204. getActivity() {
  205. let data = {
  206. oid: this.$store.state.user.openid, //用户id
  207. acId: this.acId,
  208. }
  209. this.$request('/selectActivityID', "POST", data).then(res => {
  210. console.log(res[0]);
  211. this.actItemList = res[0][0]
  212. })
  213. },
  214. },
  215. onLoad(e) {
  216. console.log('进来了', e);
  217. // 接受参数
  218. this.acId = e.acId
  219. // 导航栏显示教研室报名还是活动报名
  220. this.navBarData.title = e.tit
  221. this.getActivity()
  222. }
  223. };
  224. </script>
  225. <style lang="scss" scoped>
  226. .jys {
  227. .top {
  228. width: 690rpx;
  229. height: 192rpx;
  230. background-color: #ffffff;
  231. margin: auto;
  232. margin-top: 30rpx;
  233. // padding: 24rpx;
  234. padding: 16rpx 24rpx;
  235. border-radius: 10rpx;
  236. .col {
  237. color: #999999;
  238. }
  239. }
  240. .card {
  241. // margin-top: 40rpx;
  242. display: flex;
  243. .image {
  244. flex-shrink: 0;
  245. width: 160rpx;
  246. height: 160rpx;
  247. border-radius: 4px;
  248. }
  249. .text {
  250. margin-left: 10px; // 增加一点空间
  251. display: flex;
  252. flex-direction: column;
  253. justify-content: space-between;
  254. .text_title {
  255. display: flex;
  256. align-items: center;
  257. .manage {
  258. // padding:4rpx 12rpx 4rpx 12rpx;
  259. display: flex;
  260. justify-content: center;
  261. align-items: center;
  262. width: 68rpx;
  263. height: 36rpx;
  264. border-radius: 5rpx;
  265. color: #00b2b6;
  266. border: 1px solid #00b2b6;
  267. // border-radius: 10rpx;
  268. margin-right: 10rpx;
  269. }
  270. .t1 {
  271. color: black;
  272. width: 350rpx;
  273. font-weight: 550;
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. white-space: nowrap;
  277. }
  278. }
  279. }
  280. }
  281. .xinxi {
  282. background-color: #ffffff;
  283. width: 690rpx;
  284. // height: 272rpx;
  285. margin: auto;
  286. margin-top: 20rpx;
  287. padding: 20rpx 24rpx;
  288. border-radius: 12rpx;
  289. }
  290. .hdxx {
  291. .xxTit {
  292. color: black;
  293. // font-size: 18px;
  294. // font-weight: 400px;
  295. line-height: 42px;
  296. }
  297. .textcolor {
  298. color: #999999;
  299. line-height: 42px;
  300. .name {
  301. display: flex;
  302. justify-content: space-between;
  303. margin-bottom: 20rpx;
  304. .nickname {
  305. width: 350rpx;
  306. text-align: end;
  307. // padding-right: 10rpx;
  308. // margin-right: 10rpx;
  309. font-size: 28rpx;
  310. color: rgb(153, 153, 153);
  311. }
  312. }
  313. }
  314. }
  315. .buttons {
  316. background-color: white;
  317. position: fixed;
  318. bottom: 0;
  319. left: 0;
  320. width: 100%;
  321. display: flex;
  322. justify-content: space-around;
  323. align-items: center;
  324. height: 137rpx;
  325. // padding-bottom: 50rpx;
  326. // font-size: 30rpx;
  327. .button-container {
  328. width: 100%;
  329. display: flex;
  330. justify-content: space-around;
  331. .btn1 {
  332. width: 326rpx;
  333. height: 71rpx;
  334. border: 1px solid #666666;
  335. border-radius: 50px;
  336. height: 70rpx;
  337. line-height: 70rpx;
  338. // font-size: 35rpx;
  339. color: #666666;
  340. }
  341. .btn2 {
  342. width: 600rpx;
  343. height: 71rpx;
  344. background-color: #0056a8;
  345. border-radius: 50px;
  346. height: 70rpx;
  347. line-height: 70rpx;
  348. color: #ffffff;
  349. }
  350. }
  351. }
  352. .mask {
  353. position: fixed;
  354. top: 0;
  355. left: 0;
  356. width: 100%;
  357. height: 100%;
  358. background-color: rgba(0, 0, 0, 0.3);
  359. z-index: 999;
  360. overflow: hidden;
  361. // display: none;
  362. }
  363. .popup-container {
  364. position: fixed;
  365. top: 50%;
  366. left: 50%;
  367. transform: translate(-50%, -50%);
  368. width: 520rpx;
  369. height: 260rpx;
  370. z-index: 1000;
  371. // display: none;
  372. .popup {
  373. width: 100%;
  374. height: 100%;
  375. display: flex;
  376. flex-direction: column;
  377. background-color: #fff;
  378. border-radius: 16rpx;
  379. overflow: hidden;
  380. .header {
  381. flex: 1;
  382. display: flex;
  383. justify-content: center;
  384. align-items: center;
  385. flex-direction: column;
  386. margin-top: 24px;
  387. font-size: 34rpx;
  388. font-weight: 600;
  389. image {
  390. width: 150rpx;
  391. height: 150rpx;
  392. margin-top: 15px;
  393. margin-bottom: 15px;
  394. }
  395. }
  396. .footer {
  397. width: 100%;
  398. display: flex;
  399. overflow: hidden;
  400. .cancel-btn {
  401. width: 50%;
  402. height: 100rpx;
  403. background-color: #F7F7F7;
  404. color: #000;
  405. font-size: 34rpx;
  406. text-align: center;
  407. border-bottom-left-radius: 16rpx;
  408. line-height: 50px;
  409. }
  410. .confirm-btn {
  411. width: 50%;
  412. height: 100rpx;
  413. background-color: #0081FE;
  414. color: #fff;
  415. font-size: 34rpx;
  416. text-align: center;
  417. line-height: 50px;
  418. }
  419. }
  420. }
  421. }
  422. }
  423. </style>