jys.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <view class="hd">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="top" v-for="(item,index) in actItemList" :key="index">
  5. <view class="card">
  6. <image class="image" :src="item.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">{{ item.acName }}</view>
  11. </view>
  12. <view class="col sZw-font">
  13. 负责人:{{ item.username }}
  14. </view>
  15. <view class="col sZw-font">
  16. 教研室标签:{{ typetext }}
  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="nickname" />
  31. </view>
  32. <view class="name sZw-font">
  33. 联系方式:
  34. <input type="text" style=" text-align: right;" maxlength="11" placeholder="请输入联系方式"
  35. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="telephone" />
  36. </view>
  37. <view class="name sZw-font">
  38. 单位:
  39. <input type="text" style=" text-align: right;" maxlength="15" placeholder="请输入单位"
  40. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="units" />
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- </uni-card> -->
  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 :disabled="isButtonDisabled" :style="isButtonDisabled ? 'background-color:#87CEFA;' : 'background-colo:#0056a8;'" @click="gotoSign" class="btn2 sZw-font">申请加入</button>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. navBarData: {
  62. title: '教研室报名',
  63. btn: 1
  64. },
  65. nickname: '',
  66. telephone: '',
  67. units: '',
  68. actItemList: [],
  69. typetext: '',
  70. isButtonDisabled: false,
  71. };
  72. },
  73. methods: {
  74. button1Action() {
  75. this.nickname = ''
  76. this.telephone = ''
  77. this.units = ''
  78. },
  79. gotoSign() {
  80. // 这里添加按钮2点击后触发的动作
  81. if (this.nickname.trim() === '' || this.telephone.trim() === '') {
  82. uni.showToast({
  83. title: '请填写完整的表单内容',
  84. icon: 'none'
  85. });
  86. return;
  87. }
  88. let data = {
  89. acId: this.actItemList[0].acId,
  90. openid: uni.getStorageSync('oId'),
  91. acName: this.actItemList[0].acName,
  92. brief: this.actItemList[0].brief,
  93. pic: this.actItemList[0].pic,
  94. pers: this.actItemList[0].pers,
  95. acshape: this.actItemList[0].acshape,
  96. // create_at:this.actItemList[0].create_at,
  97. address: this.actItemList[0].address,
  98. type: this.actItemList[0].type,
  99. begin_at: this.actItemList[0].begin_at,
  100. endTime: this.actItemList[0].endTime,
  101. cost: this.actItemList[0].cost
  102. }
  103. console.log(data);
  104. console.log('1111');
  105. console.log(this.actItemList[0].acId);
  106. this.$request('/insertActivityEnroll', "POST", data).then(res => {
  107. console.log(res);
  108. uni.navigateTo({
  109. url: '/pages/Sign/Sign'
  110. })
  111. })
  112. },
  113. mapTypeToText(type) {
  114. if (type === 0) {
  115. return "直播活动";
  116. } else if (type === 1) {
  117. return "常规教研活动";
  118. } else {
  119. return "专题教研活动";
  120. }
  121. },
  122. enrollPublisher(clickedAcId) {
  123. this.$request('/selectPublisher', "POST", {
  124. openid: uni.getStorageSync('oId'),
  125. acId: clickedAcId,
  126. }).then(res => {
  127. const openid = uni.getStorageSync('oId')
  128. console.log(res[0][0].openid);
  129. if (openid === res[0][0].openid) {
  130. uni.showToast({
  131. title: '您是该活动的发布者,不能报名',
  132. icon: 'none'
  133. });
  134. this.isButtonDisabled = true
  135. return;
  136. }
  137. })
  138. },
  139. getActivity() {
  140. // 获取当前页面的URL
  141. const routes = getCurrentPages();
  142. console.log(routes);
  143. const acId = routes[2].options.acId
  144. let data = {
  145. acId: acId,
  146. ty: 2
  147. }
  148. this.$request('/selectActivityID', "POST", data).then(res => {
  149. console.log(res[0]);
  150. // this.activeList=[...this.activeList,...res[0]]
  151. this.actItemList = res[0]
  152. this.typetext = this.mapTypeToText(this.actItemList.type);
  153. const clickedAcId = this.actItemList[0].acId;
  154. this.enrollPublisher(clickedAcId)
  155. })
  156. },
  157. },
  158. onShow() {
  159. this.getActivity()
  160. }
  161. };
  162. </script>
  163. <style lang="scss" scoped>
  164. .hd {
  165. .top {
  166. width: 690rpx;
  167. height: 192rpx;
  168. background-color: #ffffff;
  169. margin: auto;
  170. margin-top: 30rpx;
  171. // padding: 24rpx;
  172. padding: 16rpx 24rpx;
  173. border-radius: 10rpx;
  174. .col {
  175. color: #999999;
  176. }
  177. }
  178. .card {
  179. // margin-top: 40rpx;
  180. display: flex;
  181. .image {
  182. flex-shrink: 0;
  183. width: 160rpx;
  184. height: 160rpx;
  185. border-radius: 4px;
  186. }
  187. .text {
  188. margin-left: 10px; // 增加一点空间
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: space-between;
  192. .text_title {
  193. display: flex;
  194. align-items: center;
  195. .manage {
  196. // padding:4rpx 12rpx 4rpx 12rpx;
  197. display: flex;
  198. justify-content: center;
  199. align-items: center;
  200. width: 68rpx;
  201. height: 36rpx;
  202. border-radius: 5rpx;
  203. color: #00b2b6;
  204. border: 1px solid #00b2b6;
  205. // border-radius: 10rpx;
  206. margin-right: 10rpx;
  207. }
  208. .t1 {
  209. color: black;
  210. width: 350rpx;
  211. font-weight: 550;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. white-space: nowrap;
  215. }
  216. }
  217. }
  218. }
  219. .xinxi {
  220. background-color: #ffffff;
  221. width: 690rpx;
  222. // height: 272rpx;
  223. margin: auto;
  224. margin-top: 20rpx;
  225. padding: 20rpx 24rpx;
  226. border-radius: 12rpx;
  227. }
  228. .hdxx {
  229. .xxTit {
  230. color: black;
  231. // font-size: 18px;
  232. // font-weight: 400px;
  233. line-height: 42px;
  234. }
  235. .textcolor {
  236. color: #999999;
  237. line-height: 42px;
  238. .name {
  239. display: flex;
  240. justify-content: space-between;
  241. margin-bottom: 20rpx;
  242. .nickname {
  243. width: 350rpx;
  244. text-align: end;
  245. // padding-right: 10rpx;
  246. // margin-right: 10rpx;
  247. font-size: 28rpx;
  248. color: rgb(153, 153, 153);
  249. }
  250. }
  251. }
  252. }
  253. .buttons {
  254. background-color: white;
  255. position: fixed;
  256. bottom: 0;
  257. left: 0;
  258. width: 100%;
  259. display: flex;
  260. justify-content: space-around;
  261. align-items: center;
  262. height: 137rpx;
  263. // padding-bottom: 50rpx;
  264. // font-size: 30rpx;
  265. .button-container {
  266. width: 100%;
  267. display: flex;
  268. justify-content: space-around;
  269. .btn1 {
  270. width: 326rpx;
  271. height: 71rpx;
  272. border: 1px solid #666666;
  273. border-radius: 50px;
  274. height: 70rpx;
  275. line-height: 70rpx;
  276. // font-size: 35rpx;
  277. color: #666666;
  278. }
  279. .btn2 {
  280. width: 326rpx;
  281. height: 71rpx;
  282. background-color: #0056a8;
  283. border-radius: 50px;
  284. height: 70rpx;
  285. line-height: 70rpx;
  286. color: #ffffff;
  287. }
  288. }
  289. }
  290. }
  291. </style>