activity.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="content">
  3. <view class="self-inf">
  4. <view class="antu-box">
  5. <view class="img-name-box">
  6. <image :src="userHeadImg" class="heade-img" mode="aspectFill"></image>
  7. <p class="nickname">{{userNickName}}</p>
  8. <p class="nickname">{{userPhone}}</p>
  9. </view>
  10. <view class="org-info-box" v-for="(item,index) in userPosList" :key="index">
  11. <view class="org-info">{{item.name || '-'}}</view>
  12. <!-- <view class="org-line"></view> -->
  13. <view class="org-info">{{item.position || '-'}}</view>
  14. </view>
  15. </view>
  16. <!-- <view class="img-name-box" v-if="!isAuth" style="height: 180rpx;">
  17. <image src="/static/auth-icon.png" class="heade-img" mode="aspectFill" style="margin-left: 80rpx;"></image>
  18. <button @click="goAuthPage()" class="auth-btn">授权登录</button>
  19. </view> -->
  20. </view>
  21. <view>
  22. <view class="active-title-box">
  23. <!-- <uni-datetime-picker
  24. class="time-select-box"
  25. type="date"
  26. :value="single"
  27. @change="change"
  28. :clear-icon="false"
  29. /> -->
  30. <picker mode="date" fields="year" @change="bindDateChange" class="picker-class">
  31. <view class="uni-input display-between items-center">{{dateYear}}年<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  32. </picker>
  33. <picker :range="arrayMonth" :value="dateMonth" @change="bindDateMonthChange" class="picker-class" style="margin-left: 2%;">
  34. <view class="uni-input display-between items-center" style="color: #707070;">{{dateMonth}}月<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
  35. </picker>
  36. <picker @change="bindPickerChange" :value="index" :range="array">
  37. <view class="uni-input">{{array[index]}}</view>
  38. <image src="/static/arrow_down.svg" mode="aspectFit"></image>
  39. </picker>
  40. <button @click="publish()">+发布活动</button>
  41. </view>
  42. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
  43. <view class="active-box" v-for="(item,index) in activiList" :key="index" @click="goList()">
  44. <view class="active-type" :class="{'bg-yellow':item.type == '组织建设' ,'bg-red':item.type == '学习培训','bg-blue':item.type == '参政议政',}" >
  45. {{item.type}}
  46. </view>
  47. <view class="active-content-box">
  48. <view class="active-content">
  49. <view class="active-name">{{item.name}}</view>
  50. <view class="active-date">{{item.start_time}}</view>
  51. </view>
  52. <view class="active-content">
  53. <view style="margin-right:10rpx;">{{item.branch}}</view>
  54. <view class="author-box">{{item.author}}</view>
  55. <view style="margin-left:10rpx;">记录数:({{item.process_count}}/<text style="color:red;">{{item.process_unread_count}}</text>)</view>
  56. </view>
  57. </view>
  58. <view class="edit-icon-box">
  59. <image src="/static/edit-icon.png" mode="aspectFit" v-show="item.edit_auth" @click="goRecord(item.id)"></image>
  60. <image src="/static/del-icon.png" mode="aspectFit" v-show="item.del_auth" @click="delRecord(item.id)"></image>
  61. </view>
  62. </view>
  63. </mescroll-body>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import md5 from "@/common/md5.js";
  69. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  70. export default {
  71. components: {
  72. },
  73. mixins: [MescrollMixin], // 使用mixin
  74. data() {
  75. return {
  76. dateYear:new Date().getFullYear(),
  77. dateMonth:new Date().getMonth() + 1,
  78. arrayMonth:["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"],
  79. userHeadImg: getApp().globalData.user_headUrl,
  80. userNickName:getApp().globalData.user_name,
  81. userPhone:getApp().globalData.user_phone.substr(0, 3) + '****' + getApp().globalData.user_phone.substr(7),
  82. userPosList:[],
  83. array: ['全部', '浐灞一支部', '浐灞二支部'],
  84. index: 0,
  85. page:1,
  86. pageSize:10,
  87. activiList:[]
  88. };
  89. },
  90. onShow() {
  91. },
  92. onLoad() {
  93. this.getUserInfoBranch()
  94. // this.getActivityBranch()
  95. },
  96. methods: {
  97. getUserInfoBranch() {
  98. let md5Sign = md5(
  99. "method=" +
  100. "member" +
  101. "&timestamp=" +
  102. getApp().globalData.globalTimestamp +
  103. "&secret=" +
  104. getApp().globalData.secret
  105. );
  106. let url =
  107. getApp().globalData.shareUrl +
  108. "api/api.php" +
  109. "?method=member&action=my_branch&timestamp=" +
  110. getApp().globalData.globalTimestamp +
  111. "&sign=" +
  112. md5Sign;
  113. uni.request({
  114. url: url,
  115. method: "POST",
  116. header: {
  117. "content-type": "application/x-www-form-urlencoded",
  118. },
  119. data: {
  120. openid:getApp().globalData.open_id,
  121. },
  122. success: (res) => {
  123. if (res.data.code === 200) {
  124. this.userPosList = res.data.data;
  125. }
  126. },
  127. fail: () => {
  128. console.log("连接失败");
  129. },
  130. });
  131. },
  132. bindDateChange(e){
  133. this.dateYear = e.target.value;
  134. },
  135. bindDateMonthChange(e){
  136. this.dateMonth = this.arrayMonth[e.target.value];
  137. },
  138. bindPickerChange: function(e) {
  139. console.log('picker发送选择改变,携带值为', e.target.value)
  140. this.index = e.target.value
  141. },
  142. upCallback(page) {
  143. let pageNum = page.num; // 页码, 默认从1开始
  144. let pageSize = page.size; // 页长, 默认每页10条
  145. let md5Sign = md5(
  146. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  147. "&secret=" + getApp().globalData.secret
  148. );
  149. let url = getApp().globalData.shareUrl +"api/api.php" +
  150. "?method=activity&action=list&timestamp=" +
  151. getApp().globalData.globalTimestamp +
  152. "&sign=" +
  153. md5Sign;
  154. uni.request({
  155. url: url,
  156. method: "POST",
  157. header: {
  158. "content-type": "application/x-www-form-urlencoded",
  159. },
  160. data: {
  161. openid: getApp().globalData.open_id,
  162. year:this.dateYear,
  163. month:this.dateMonth,
  164. s:'',
  165. page:pageNum,
  166. page_size:pageSize
  167. },
  168. success: (res) => {
  169. if (res.data.code === 200) {
  170. // 接口返回的当前页数据列表 (数组)
  171. let curPageData = res.data.data.list;
  172. // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
  173. let curPageLen = curPageData.length;
  174. // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
  175. let totalPage = res.data.data.page_count;
  176. // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
  177. let totalSize = res.data.data.count;
  178. // // 接口返回的是否有下一页 (true/false)
  179. // let hasNext = data.xxx;
  180. if(page.num == 1) this.activiList = []; //如果是第一页需手动制空列表
  181. // let list = res.data.data.list;
  182. // list.forEach((item)=>{
  183. // item.pic_url = this.shareUrl + item.pic_url;
  184. // item.pic_url_resize = this.shareUrl + item.pic_url_resize;
  185. // })
  186. this.activiList=this.activiList.concat(res.data.data.list); //追加新数据
  187. this.mescroll.endByPage(curPageLen || 0, totalPage);
  188. }
  189. },
  190. fail: () => {
  191. console.log("连接失败");
  192. this.mescroll.endErr();
  193. },
  194. });
  195. },
  196. publish(){
  197. uni.navigateTo({
  198. url:'./create1'
  199. })
  200. },
  201. goList(){
  202. uni.navigateTo({
  203. url:'./list'
  204. })
  205. }
  206. },
  207. };
  208. </script>
  209. <style lang="scss" scoped>
  210. .content {
  211. display: flex;
  212. flex-direction: column;
  213. .self-inf {
  214. // border-radius: 0rpx 0rpx 100% 100%;
  215. .img-name-box {
  216. height: 150rpx;
  217. margin-top: 20rpx;
  218. margin-bottom: 20rpx;
  219. display: flex;
  220. align-items: center;
  221. width: 85%;
  222. .auth-btn {
  223. margin-left: 30rpx;
  224. margin-top: 20rpx;
  225. font-size: 28rpx;
  226. background-color: #02a7f0;
  227. color: #fff;
  228. }
  229. .heade-img {
  230. z-index: 1;
  231. width: 100rpx;
  232. height: 100rpx;
  233. border-radius: 50%;
  234. // margin-left: 80rpx;
  235. }
  236. }
  237. .nickname {
  238. font-weight: 600;
  239. font-size: 28rpx;
  240. margin-left: 30rpx;
  241. margin-top: 20rpx;
  242. color: #555;
  243. letter-spacing: 1rpx;
  244. }
  245. }
  246. }
  247. .antu-box {
  248. display: flex;
  249. flex-direction: column;
  250. align-items: center;
  251. background: #fff;
  252. margin-left: 5%;
  253. margin-top: 50rpx;
  254. border-radius: 10rpx;
  255. width: 90%;
  256. color: #555;
  257. box-shadow: 0px 2px 16px rgba(0, 0, 0, 0.2);
  258. }
  259. .org-info-box {
  260. display: flex;
  261. justify-content: space-evenly;
  262. height: 80rpx;
  263. align-items: center;
  264. width: 100%;
  265. border-top: 1px solid #d4d4d4;
  266. color: #555;
  267. font-size: 28rpx;
  268. background: #fff;
  269. }
  270. .org-line {
  271. width: 1px;
  272. height: 82rpx;
  273. background: #d4d4d4;
  274. }
  275. .active-title-box {
  276. display: flex;
  277. align-items: center;
  278. margin-top: 10rpx;
  279. font-size: 26rpx;
  280. height: 100rpx;
  281. border-bottom: 1px solid #d7d7d7;
  282. margin-top: 10rpx;
  283. .time-select-box {
  284. width: 32%;
  285. margin-left: 5%;
  286. }
  287. picker {
  288. width: 25%;
  289. border: 1px solid #d7d7d7;
  290. height: 60rpx;
  291. line-height: 60rpx;
  292. border-radius: 10rpx;
  293. margin-left: 20rpx;
  294. padding: 0 10rpx;
  295. position: relative;
  296. image {
  297. width: 20rpx;
  298. height: 20rpx;
  299. position: absolute;
  300. top: 11px;
  301. right: 5px;
  302. }
  303. }
  304. button {
  305. width: 29%;
  306. font-size: 25rpx;
  307. background: #4988fd;
  308. color: #fff;
  309. margin-left: 20rpx;
  310. margin-right: 20rpx;
  311. }
  312. }
  313. .active-box {
  314. display: flex;
  315. align-items: center;
  316. position: relative;
  317. font-size: 28rpx;
  318. padding: 30rpx;
  319. border-bottom: 1px solid #d7d7d7;
  320. .active-type {
  321. width: 100rpx;
  322. height: 100rpx;
  323. border-radius: 50%;
  324. background-color: yellow;
  325. text-align: center;
  326. display: flex;
  327. align-items: center;
  328. font-size: 26rpx;
  329. color: #fff;
  330. }
  331. .active-content-box {
  332. height: 120rpx;
  333. display: flex;
  334. flex-direction: column;
  335. margin-left: 20rpx;
  336. justify-content: space-around;
  337. }
  338. .active-content {
  339. display: flex;
  340. align-items: center;
  341. height: 45rpx;
  342. font-size: 26rpx;
  343. .author-box {
  344. border-left: 1px solid #d7d7d7;
  345. border-right: 1px solid #d7d7d7;
  346. padding: 0 30rpx 0 30rpx;
  347. margin: 0 20rpx 0 20rpx;
  348. }
  349. .active-name {
  350. font-size: 30rpx;
  351. margin-right: 10rpx;
  352. }
  353. .active-date {
  354. font-size: 24rpx;
  355. color: #ccc;
  356. }
  357. }
  358. .edit-icon-box {
  359. position: absolute;
  360. right: 10px;
  361. top: 10px;
  362. image {
  363. width: 35rpx;
  364. height: 35rpx;
  365. margin-right: 10rpx;
  366. }
  367. }
  368. .bg-yellow {
  369. background-color: #ffdd40;
  370. }
  371. .bg-red {
  372. background-color: #ec808d;
  373. }
  374. .bg-blue {
  375. background-color: #81d3f8;
  376. }
  377. }
  378. </style>