jys.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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 @input="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 {value} = e.target
  117. const newValue = value.replace(/[^\d]/g, '') // 只允许输入数字
  118. if (newValue.length <= 11) {
  119. this.phone = newValue
  120. }
  121. },
  122. // 确定按钮显示弹窗
  123. showPop() {
  124. if (this.applyname == '') return uni.showToast({
  125. title: '请输入姓名',
  126. icon: 'none'
  127. })
  128. if (this.phone == '') return uni.showToast({
  129. title: '请输入联系方式',
  130. icon: 'none'
  131. })
  132. if (this.stations == '') return uni.showToast({
  133. title: '请输入单位',
  134. icon: 'none'
  135. })
  136. if (this.phone.length != 11) return uni.showToast({
  137. title: '号码不足11位,请检查',
  138. icon: 'none'
  139. })
  140. this.showPopup = true
  141. },
  142. // 确定报名
  143. gotoSign() {
  144. // 做最后判断防止同一时间进入报名页面都报名成功
  145. this.$request('/selectIntercept', "POST", {
  146. oid: this.$store.state.user.openid,
  147. acid: this.acId
  148. }).then(res => {
  149. let c = res[0][0]
  150. console.log(res[0][0]);
  151. console.log(c.bnum >= c.pers * 1);
  152. if (c.bnum >= c.pers * 1) {
  153. return uni.showToast({
  154. title: '已有人先您一步报名,名额已满',
  155. icon: "none"
  156. })
  157. } else {
  158. let data = {
  159. oid: this.$store.state.user.openid, //用户id
  160. acid: this.acId,
  161. ty: 2,
  162. ume: this.applyname,
  163. pho: this.phone,
  164. sta: this.stations
  165. }
  166. this.$request('/insertSignup', "POST", data).then(res => {
  167. // console.log(res);
  168. // 添加消息页面系统通知提示报名成功
  169. this.addMessage()
  170. // 弹窗关闭
  171. this.showPopup = false
  172. uni.navigateTo({
  173. url: '/pages/Sign/Sign'
  174. })
  175. })
  176. }
  177. })
  178. },
  179. // 添加消息页面系统通知提示报名成功
  180. addMessage() {
  181. let data = {
  182. oid: this.$store.state.user.openid,
  183. acid: this.acId,
  184. type: 0,
  185. }
  186. this.$request('/insertMessage', "POST", data).then(res => {
  187. console.log(res);
  188. })
  189. },
  190. // 获取页面数据
  191. getActivity() {
  192. let data = {
  193. oid: this.$store.state.user.openid, //用户id
  194. acId: this.acId,
  195. }
  196. this.$request('/selectActivityID', "POST", data).then(res => {
  197. console.log(res[0]);
  198. this.actItemList = res[0][0]
  199. })
  200. },
  201. },
  202. onLoad(e) {
  203. console.log('进来了', e);
  204. // 接受参数
  205. this.acId = e.acId
  206. // 导航栏显示教研室报名还是活动报名
  207. this.navBarData.title = e.tit
  208. this.getActivity()
  209. }
  210. };
  211. </script>
  212. <style lang="scss" scoped>
  213. .jys {
  214. .top {
  215. width: 690rpx;
  216. height: 192rpx;
  217. background-color: #ffffff;
  218. margin: auto;
  219. margin-top: 30rpx;
  220. // padding: 24rpx;
  221. padding: 16rpx 24rpx;
  222. border-radius: 10rpx;
  223. .col {
  224. color: #999999;
  225. }
  226. }
  227. .card {
  228. // margin-top: 40rpx;
  229. display: flex;
  230. .image {
  231. flex-shrink: 0;
  232. width: 160rpx;
  233. height: 160rpx;
  234. border-radius: 4px;
  235. }
  236. .text {
  237. margin-left: 10px; // 增加一点空间
  238. display: flex;
  239. flex-direction: column;
  240. justify-content: space-between;
  241. .text_title {
  242. display: flex;
  243. align-items: center;
  244. .manage {
  245. // padding:4rpx 12rpx 4rpx 12rpx;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. width: 68rpx;
  250. height: 36rpx;
  251. border-radius: 5rpx;
  252. color: #00b2b6;
  253. border: 1px solid #00b2b6;
  254. // border-radius: 10rpx;
  255. margin-right: 10rpx;
  256. }
  257. .t1 {
  258. color: black;
  259. width: 350rpx;
  260. font-weight: 550;
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. white-space: nowrap;
  264. }
  265. }
  266. }
  267. }
  268. .xinxi {
  269. background-color: #ffffff;
  270. width: 690rpx;
  271. // height: 272rpx;
  272. margin: auto;
  273. margin-top: 20rpx;
  274. padding: 20rpx 24rpx;
  275. border-radius: 12rpx;
  276. }
  277. .hdxx {
  278. .xxTit {
  279. color: black;
  280. // font-size: 18px;
  281. // font-weight: 400px;
  282. line-height: 42px;
  283. }
  284. .textcolor {
  285. color: #999999;
  286. line-height: 42px;
  287. .name {
  288. display: flex;
  289. justify-content: space-between;
  290. margin-bottom: 20rpx;
  291. .nickname {
  292. width: 350rpx;
  293. text-align: end;
  294. // padding-right: 10rpx;
  295. // margin-right: 10rpx;
  296. font-size: 28rpx;
  297. color: rgb(153, 153, 153);
  298. }
  299. }
  300. }
  301. }
  302. .buttons {
  303. background-color: white;
  304. position: fixed;
  305. bottom: 0;
  306. left: 0;
  307. width: 100%;
  308. display: flex;
  309. justify-content: space-around;
  310. align-items: center;
  311. height: 137rpx;
  312. // padding-bottom: 50rpx;
  313. // font-size: 30rpx;
  314. .button-container {
  315. width: 100%;
  316. display: flex;
  317. justify-content: space-around;
  318. .btn1 {
  319. width: 326rpx;
  320. height: 71rpx;
  321. border: 1px solid #666666;
  322. border-radius: 50px;
  323. height: 70rpx;
  324. line-height: 70rpx;
  325. // font-size: 35rpx;
  326. color: #666666;
  327. }
  328. .btn2 {
  329. width: 326rpx;
  330. height: 71rpx;
  331. background-color: #0056a8;
  332. border-radius: 50px;
  333. height: 70rpx;
  334. line-height: 70rpx;
  335. color: #ffffff;
  336. }
  337. }
  338. }
  339. .mask {
  340. position: fixed;
  341. top: 0;
  342. left: 0;
  343. width: 100%;
  344. height: 100%;
  345. background-color: rgba(0, 0, 0, 0.3);
  346. z-index: 999;
  347. overflow: hidden;
  348. // display: none;
  349. }
  350. .popup-container {
  351. position: fixed;
  352. top: 50%;
  353. left: 50%;
  354. transform: translate(-50%, -50%);
  355. width: 520rpx;
  356. height: 260rpx;
  357. z-index: 1000;
  358. // display: none;
  359. .popup {
  360. width: 100%;
  361. height: 100%;
  362. display: flex;
  363. flex-direction: column;
  364. background-color: #fff;
  365. border-radius: 16rpx;
  366. overflow: hidden;
  367. .header {
  368. flex: 1;
  369. display: flex;
  370. justify-content: center;
  371. align-items: center;
  372. flex-direction: column;
  373. margin-top: 24px;
  374. font-size: 34rpx;
  375. font-weight: 600;
  376. image {
  377. width: 150rpx;
  378. height: 150rpx;
  379. margin-top: 15px;
  380. margin-bottom: 15px;
  381. }
  382. }
  383. .footer {
  384. width: 100%;
  385. display: flex;
  386. overflow: hidden;
  387. .cancel-btn {
  388. width: 50%;
  389. height: 100rpx;
  390. background-color: #F7F7F7;
  391. color: #000;
  392. font-size: 34rpx;
  393. text-align: center;
  394. border-bottom-left-radius: 16rpx;
  395. line-height: 50px;
  396. }
  397. .confirm-btn {
  398. width: 50%;
  399. height: 100rpx;
  400. background-color: #0081FE;
  401. color: #fff;
  402. font-size: 34rpx;
  403. text-align: center;
  404. line-height: 50px;
  405. }
  406. }
  407. }
  408. }
  409. }
  410. </style>