list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view class="page page--divider">
  3. <headerline shownav=true isback="true" @tapnav="tapnav" :navstyle="navstyle" :navitem="navitem"
  4. :navselect="navselect" :statusbarheight='statusBarHeight' :menuitem="menuitem" @tapmenu="tapmenu"
  5. :rightmenu=false></headerline>
  6. <view id="grouplist" class="grouplist">
  7. <block v-for="(m,index) in groupData" :key='index'>
  8. <li v-if="(navselect==0 && m.createid==userid) || (navselect==1 && m.createid!=userid) "
  9. @tap="gochat(m)">
  10. <div class="avatar">
  11. <image :src="imgshow(m.avatar)"></image>
  12. </div>
  13. <div class="info">
  14. <div class="title">{{m.name}}</div>
  15. <div>
  16. <uni-icons type='person' style="font-size: 16px;font-weight: 700;"></uni-icons>
  17. {{m.people_count}}/{{m.people_max}}人
  18. </div>
  19. <div class="tag">{{m.tags}}</div>
  20. </div>
  21. </li>
  22. </block>
  23. </view>
  24. <view class="loading" v-if="loading">
  25. <view class="spinner">
  26. <view class="rect1"></view>
  27. <view class="rect2"></view>
  28. <view class="rect3"></view>
  29. <view class="rect4"></view>
  30. <view class="rect5"></view>
  31. </view>
  32. </view>
  33. <yk-authpup ref="authpupCAMERA" type="top" @changeAuth="changeAuth"
  34. permissionID="CAMERA"></yk-authpup>
  35. <tabbar></tabbar>
  36. </view>
  37. </template>
  38. <script>
  39. import ykAuthpup from "@/components/yk-authpup/yk-authpup";
  40. import api from "../../library/index.js"
  41. import headerline from '../../components/header.vue'
  42. import http from "../../library/http.js"
  43. import uniIcons from '../../components/uni-icons/uni-icons.vue'
  44. import tabbar from '../../components/tabbar.vue'
  45. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  46. export default {
  47. components: {
  48. uniIcons,
  49. headerline,
  50. tabbar,
  51. ykAuthpup
  52. },
  53. data() {
  54. return {
  55. statusBarHeight: statusBarHeight + 'px',
  56. newfriendNotify: false,
  57. showMenu: false,
  58. initializing: true,
  59. groupData: uni.getStorageSync(uni.getStorageSync('access_token') + '_groups'),
  60. navitem: ['我创建的群', '我加入的群'],
  61. navselect: 0,
  62. navstyle: "width:50%;left:25%",
  63. userid: uni.getStorageSync('access_token'),
  64. loading: true,
  65. user: uni.getStorageSync('userInfo'),
  66. menuitem: [
  67. ]
  68. }
  69. },
  70. methods: {
  71. tapnav(num) {
  72. this.navselect = num;
  73. },
  74. paramClick(e) {
  75. let page, params;
  76. if (e.type === 'friend') {
  77. const {
  78. id,
  79. nickname,
  80. avatar
  81. } = e;
  82. params = {
  83. id,
  84. nickname,
  85. avatar
  86. };
  87. page = 'friend.detail';
  88. } else if (e.type === 'room') {
  89. page = 'group.chat';
  90. params = e
  91. }
  92. this.$jump(page, params);
  93. },
  94. getMyGroup() {
  95. let data = {
  96. userid: this.userid
  97. }
  98. this.loading = true;
  99. api.getMyGroup(data).then(re => {
  100. uni.setStorageSync(this.userid + '_groups', re.data)
  101. for (let i in re.data) {
  102. re.data[i].type = 'room'
  103. }
  104. this.groupData = re.data
  105. this.loading = false;
  106. });
  107. },
  108. imgshow(image_url) {
  109. if (image_url.indexOf('http') <= -1) image_url = config.imgUri + image_url;
  110. return this.image_cache(image_url)
  111. },
  112. gochat(m) {
  113. this.$jump('group.chat', {
  114. id: m.id,
  115. nickname: m.name
  116. });
  117. },
  118. tapmenu(num) {
  119. if (this.$action.loginTips('未登录用户,无法完成此操作', '/pages/game/index') == false) return false;
  120. if (this.$action.check_userlock() == false) return false;
  121. if (num == 0) {
  122. if (this.user.isvip == 1) {
  123. if (this.isadd == true) {
  124. uni.showModal({
  125. title: '提示',
  126. content: this.addtips,
  127. showCancel: true,
  128. cancelText: '取消',
  129. confirmText: '继续发布',
  130. success: res => {
  131. if (res.confirm) {
  132. this.$jump('plan.add', {
  133. gameid: this.gameid
  134. });
  135. }
  136. }
  137. });
  138. } else {
  139. uni.showToast({
  140. title: this.addtips,
  141. icon: 'none'
  142. })
  143. }
  144. } else {
  145. if (this.user.mobile == '') {
  146. uni.showModal({
  147. title: '提示',
  148. content: "您还没有绑定手机号,不能申请计划员",
  149. showCancel: true,
  150. cancelText: '关闭',
  151. confirmText: '绑定手机号',
  152. success: res => {
  153. if (res.confirm) {
  154. uni.navigateTo({
  155. url: "/pages/mine/mobile"
  156. })
  157. }
  158. }
  159. });
  160. } else {
  161. this.$jump('plan.apply');
  162. }
  163. }
  164. } else if (num == 1) {
  165. if (this.user.nickname == '') {
  166. this.$action.profileTips('未设置昵称,不能创建群', '/pages/group/create');
  167. return false;
  168. } else
  169. this.jump('group.create');
  170. } else if (num == 2) {
  171. this.jump('mine.recharge')
  172. } else if (num == 3) {
  173. this.jump('mine.cash')
  174. } else if (num == 4) {
  175. if(plus.os.name == 'Android') {
  176. return this.$refs['authpupCAMERA'].open()
  177. }else {
  178. return uni.scanCode({
  179. success(res) {
  180. scode.getScode(res)
  181. },
  182. fail(e) {
  183. console.log(JSON.stringify(e));
  184. console.log('扫码失败')
  185. }
  186. });
  187. }
  188. }
  189. },
  190. changeAuth() {
  191. return uni.scanCode({
  192. success(res) {
  193. scode.getScode(res)
  194. },
  195. fail(e) {
  196. console.log(JSON.stringify(e));
  197. console.log('扫码失败')
  198. }
  199. });
  200. },
  201. jump(url) {
  202. this.$jump(url);
  203. },
  204. setrightmenu() {
  205. if (this.user.id > 0) {
  206. this.getaddtips();
  207. }
  208. var menuitem = [];
  209. if (this.user.isvip == 1) {
  210. menuitem.push({
  211. 'title': '发布计划',
  212. 'icon': 'plusempty'
  213. });
  214. } else {
  215. menuitem.push({
  216. 'title': '申请计划员',
  217. 'icon': 'plusempty'
  218. });
  219. }
  220. menuitem.push({
  221. 'title': '创建群组',
  222. 'icon': 'personadd'
  223. });
  224. menuitem.push({
  225. 'title': '我要充值',
  226. 'icon': 'plus'
  227. });
  228. menuitem.push({
  229. 'title': '我要提现',
  230. 'icon': 'minus'
  231. });
  232. // #ifdef APP-PLUS
  233. menuitem.push({
  234. 'title': '扫一扫',
  235. 'icon': 'scan'
  236. });
  237. // #endif
  238. this.menuitem = menuitem;
  239. },
  240. getaddtips() {
  241. http.setWait(false).post('plan.php?act=addplantips', {
  242. from: 'app',
  243. userid: this.user.id
  244. }).then(res => {
  245. if (res.code == 200) {
  246. this.isadd = res.isadd;
  247. this.addtips = res.data;
  248. }
  249. });
  250. },
  251. },
  252. onShow() {
  253. this.getMyGroup();
  254. this.setrightmenu();
  255. },
  256. onLoad(opts) {
  257. if (opts.method > 0) this.navselect = opts.method;
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. @import "@/static/css/group.css";
  263. .item {
  264. height: 100upx;
  265. border-bottom: 1px solid #F0F0F0;
  266. overflow: hidden;
  267. padding: $uni-spacing-col-lg 30upx;
  268. display: flex;
  269. flex-direction: row;
  270. justify-content: flex-start;
  271. align-items: center;
  272. background-color: #ffffff;
  273. border-radius: 20upx;
  274. }
  275. .leftImg {
  276. width: 100upx;
  277. height: 100upx;
  278. margin-right: $uni-spacing-row-base;
  279. border-radius: $uni-border-radius-base;
  280. display: flex;
  281. flex-flow: wrap;
  282. justify-content: center;
  283. background-color: #eee;
  284. align-items: center;
  285. &:not(image) {
  286. padding: 1upx;
  287. }
  288. view,
  289. image {
  290. width: (76upx-2upx*4)/3;
  291. height: (76upx-2upx*4)/3;
  292. margin: 1upx;
  293. }
  294. }
  295. .rightContent {
  296. flex: 1;
  297. }
  298. .rightContent,
  299. .topCont {
  300. overflow: hidden;
  301. line-height: 1.25;
  302. }
  303. .topCont {
  304. display: flex;
  305. flex-direction: row;
  306. justify-content: space-between;
  307. align-items: center;
  308. }
  309. .userName {
  310. color: $uni-text-color;
  311. font-size: 38upx;
  312. }
  313. .time {
  314. color: #999999;
  315. font-size: 30upx;
  316. }
  317. .bottomCont {
  318. width: 100%;
  319. font-size: 24upx;
  320. color: #999999;
  321. display: flex;
  322. align-items: center;
  323. justify-content: space-between;
  324. }
  325. .content {
  326. font-size: 28upx;
  327. overflow: hidden;
  328. text-overflow: ellipsis;
  329. white-space: nowrap;
  330. }
  331. .badge {
  332. background-color: red;
  333. color: #fff;
  334. border-radius: 40upx;
  335. line-height: 40upx;
  336. width: 40upx;
  337. height: 40upx;
  338. font-size: 24upx;
  339. text-align: center;
  340. flex-shrink: 0;
  341. }
  342. .loading {
  343. //loading动画
  344. display: flex;
  345. justify-content: center;
  346. @keyframes stretchdelay {
  347. 0%,
  348. 40%,
  349. 100% {
  350. transform: scaleY(0.6);
  351. }
  352. 20% {
  353. transform: scaleY(1.0);
  354. }
  355. }
  356. .spinner {
  357. margin: 20upx 0;
  358. width: 60upx;
  359. height: 25px;
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. view {
  364. background-color: #ff9800;
  365. height: 25px;
  366. width: 3px;
  367. border-radius: 3px;
  368. animation: stretchdelay 1.2s infinite ease-in-out;
  369. }
  370. .rect2 {
  371. animation-delay: -1.1s;
  372. }
  373. .rect3 {
  374. animation-delay: -1.0s;
  375. }
  376. .rect4 {
  377. animation-delay: -0.9s;
  378. }
  379. .rect5 {
  380. animation-delay: -0.8s;
  381. }
  382. }
  383. }
  384. </style>