detail.vue 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694
  1. <template>
  2. <view class="page">
  3. <headerline shownav=true isback="true" @tapnav="tapnav" :navstyle="navstyle" :navitem="navitem"
  4. :navselect="navselect" :statusbarheight='statusBarHeight'></headerline>
  5. <view class="loading" v-if="isloading" style="padding-top: 70px;">
  6. <view class="spinner">
  7. <view class="rect1"></view>
  8. <view class="rect2"></view>
  9. <view class="rect3"></view>
  10. <view class="rect4"></view>
  11. <view class="rect5"></view>
  12. </view>
  13. </view>
  14. <block v-else>
  15. <view style="clear: both;" v-if="navselect==0">
  16. <view class="group_detail">
  17. <ul class="avatarline" style="position: relative;">
  18. <li>
  19. <image :src="image_cache(group.avatar)" class="avatar"></image>
  20. </li>
  21. <li>
  22. <div class="title" id="group_title">{{decodeURI(group.name)}}</div>
  23. <div>
  24. ID:{{group.id}}
  25. </div>
  26. </li>
  27. <view class="emoji"
  28. style="position: absolute;right: 10px;top:0px;font-size: 26px;color: #3388ff" @tap="qrcode">
  29. &#xe613;</view>
  30. </ul>
  31. <div class="mark">
  32. <div>
  33. 该群创建于: {{addtime}}
  34. </div>
  35. <div>
  36. <block v-if="group.content">
  37. {{group.content}}
  38. </block>
  39. <block v-else>
  40. <view style="color: #999;">什么都没填写</view>
  41. </block>
  42. </div>
  43. </div>
  44. <ul class="lines">
  45. <li>群标签</li>
  46. <li>
  47. <div class="tagshow" style="width: 100%;">
  48. <block v-for="(m,index) in group.tag" :key="index">
  49. <span>{{m}}</span>
  50. </block>
  51. </div>
  52. </li>
  53. <li>
  54. <uni-icons type='arrowright' v-if="isOwner || is_manager"
  55. @tap="tags_show=true;tapnav(3)"></uni-icons>
  56. </li>
  57. </ul>
  58. <ul class="lines" @click="search()" v-if="isin==1">
  59. <li>聊天记录</li>
  60. <li>
  61. <div class="tagshow" style="width: 100%;">
  62. </div>
  63. </li>
  64. <li>
  65. <uni-icons type='arrowright'></uni-icons>
  66. </li>
  67. </ul>
  68. <ul class="lines" style="height: 30px;line-height: 30px;" @tap="tapnav(1)">
  69. <li>管理员</li>
  70. <li style="text-align: right">共{{managenum}}人</li>
  71. <li> <uni-icons type='arrowright'></uni-icons></li>
  72. </ul>
  73. <div class="users">
  74. <div>
  75. <block v-for="m in members" :key="m.id">
  76. <li v-if="m.type=='owner' || m.type=='manager'" @tap="lookMember(m)">
  77. <image class="avatar" :src="imgshow(m.avatar)" /><br>
  78. <block v-if="m.name!=m.nickname">
  79. {{m.nickname}}
  80. </block>
  81. <block v-else> {{m.name}}</block>
  82. </li>
  83. </block>
  84. </div>
  85. </div>
  86. <ul class="lines" style="height: 30px;line-height: 30px;" @tap="tapnav(1)">
  87. <li>群成员</li>
  88. <li>共{{group.people_count}}人</li>
  89. <li><uni-icons type='arrowright'></uni-icons></li>
  90. </ul>
  91. <div class="users" v-if="group['people_count']!=managenum || isOwner || is_manager || !no_invite">
  92. <div>
  93. <block v-for="(m,index) in members" :key="index">
  94. <li v-if="m.type=='user' && index-managenum<13 " @tap="lookMember(m)">
  95. <image class="avatar" :src="imgshow(m.avatar)" /><br>
  96. <block v-if="m.name!=m.nickname">
  97. {{m.nickname}}
  98. </block>
  99. <block v-else> {{m.name}}</block>
  100. </li>
  101. </block>
  102. <li class="member" v-if="isOwner || is_manager || !no_invite">
  103. <view class="avatar emoji" @tap="invite_user">&#xe8e1;</view>
  104. </li>
  105. <li class="member" v-if=" isOwner==1 || is_manager==1">
  106. <view class="avatar emoji" @tap="tapnav(1)">&#xe8e2;</view>
  107. </li>
  108. </div>
  109. <span class="nodata" @tap="tapnav(1);" v-if="group['people_count']-managenum>=13">
  110. 查看全部群成员
  111. </span>
  112. </div>
  113. <ul class="profile">
  114. <li style='width: 110px;'>设为置顶:</li>
  115. <li style="width:calc(100% - 130px);text-align: right;">
  116. <switch :checked="istop" @change="user_setmenu11('top')" style="vertical-align: middle;" />
  117. </li>
  118. </ul>
  119. <ul class="profile">
  120. <li style='width: 110px;'>消息免打扰:</li>
  121. <li style="width:calc(100% - 130px);text-align: right;">
  122. <switch :checked="no_tip" @change="user_setmenu11('tip')" style="vertical-align: middle;" />
  123. </li>
  124. </ul>
  125. <ul class="lines" v-if="isin==1 && isOwner!=1 && is_manager!=1">
  126. <li>其他:</li>
  127. <li style="text-align: left">
  128. <button class="btn2" @tap="quit_group()">退出该群</button>
  129. </li>
  130. <li>
  131. </li>
  132. </ul>
  133. </view>
  134. <view style="height: 50px;"></view>
  135. <block v-if="userid">
  136. <div class="group_btn" v-if="isin==1" @tap="go_chat();"><uni-icons type='chat'
  137. style="color: #fff;font-size: 16px;"></uni-icons>发消息</div>
  138. <div class="group_btn" v-else @tap="apply_group()"><uni-icons type='personadd'
  139. style="color: #fff;font-size: 16px;"></uni-icons>申请入群</div>
  140. </block>
  141. <div class="group_btn" v-else @tap="login_btn">立即登录</div>
  142. </view>
  143. <view class="userlist" v-if="navselect==1">
  144. <view class="" style="background-color: #fff;width: 100%;padding: 10rpx;">
  145. <uni-search-bar ref="searchBar" placeholder="搜索" bgColor="#F7F7F7" :show="false" @confirm="searchf"
  146. @input="searchf">
  147. </uni-search-bar>
  148. </view>
  149. <block v-for="(m,index) in show_men" :key="index" v-if="isShow">
  150. <ul v-if="isin==1 || m.type=='owner' || m.type=='manager'"
  151. :class="{'admintools':isOwner==1 || is_manager==1}">
  152. <li>
  153. <image :src="imgshow(m.avatar)" @tap="lookMember(m)"></image>
  154. </li>
  155. <li v-if="!m.nameset">
  156. <span class="btn_yellow" v-if="m.type=='owner'">群主</span>
  157. <span class="btn_green" v-if="m.type=='manager'">管理员</span>
  158. <span class="btn_blue" v-if='m.isvip==1'>计划员</span>
  159. <span class="btn_grey" v-if="m.is_deny==1">禁言</span>
  160. <span class="nickname">
  161. <block v-if="m.name!=m.nickname">
  162. {{m.nickname}}
  163. </block>
  164. <block v-else> {{m.name}}</block>
  165. </span>
  166. <input type="text" class="markname" :value="m.nickname">
  167. <view class="menu_tabs" v-if="m.menu">
  168. <block v-for="(m1,index1) in menu_tabs" :key="'tabs'+index1">
  169. <view @tap="user_setmenu(m1.type)">{{m1.text}}</view>
  170. </block>
  171. </view>
  172. </li>
  173. <li v-else>
  174. <input type="text" class="rename" v-if="m.name!=m.nickname" v-model="m.nickname"
  175. focus="true" />
  176. <input type="text" class="rename" v-else v-model="m.name" focus="true" />
  177. <view class="btn" @tap="sub_rename(m.id)">确定</view>
  178. <view class="btn_cancle" @tap="m.nameset=false">取消</view>
  179. </li>
  180. <li v-if="!m.nameset">
  181. <view v-if="m.id==userid && (group.is_mark==1 || isOwner==1 || is_manager==1 )" class="btn"
  182. @tap="user_rename(m.id);">修改名片</view>
  183. <view v-if="(isOwner==1 && m.type!='owner') || (is_manager==1 && m.type=='user')"
  184. class="btn" @tap="show_usermenu(m)">操作</view>
  185. </li>
  186. </ul>
  187. </block>
  188. <view v-if='isin==0' class="nodata" onclick="apply_group({$group['no_invite']});">
  189. 查看更多群成员,请先加入该群
  190. </view>
  191. <view v-else class="nodata">
  192. 共有{{group.people_count}}人
  193. </view>
  194. </view>
  195. <view v-if="navselect==2 && note_add==false" class="group_note">
  196. <div class="menu">
  197. 名称:{{group.name}}
  198. <div class="btn" @tap="note_add=true;noteinfo={id:0,content:'',imgs:''}"
  199. v-if="isOwner==1 || is_manager==1">
  200. <uni-icons type="plus" style="color:#fff;margin-right: 3px;;"></uni-icons>发布公告
  201. </div>
  202. </div>
  203. <div class="content">
  204. <block v-if="notelist.length>0">
  205. <div class="list" v-for="(m,index) in notelist" :key="index">
  206. <div class="title">
  207. <div v-if="m.imgs.split('|').length==1 && m.imgs.length>5" class='img'>
  208. <image :src="imgshow(m.imgs.split('|')[0])"></image>
  209. </div>
  210. <div :class="{'moreword':m.more}">
  211. <span class="istop" v-if="m.istop==1">置顶</span>
  212. {{m.content}}
  213. <a class="more" v-if="m.more" @tap="m.more=false">[更多]</a>
  214. <a class="more" v-if="!m.more && m.content.length>100" @tap="m.more=true">[收起]</a>
  215. </div>
  216. </div>
  217. <div v-if="m.imgs.split('|').length>1" class='imgs'>
  218. <block v-for="(m1,index1) in m.imgs.split('|')" :key="index1">
  219. <image :src="imgshow(m)"></image>
  220. </block>
  221. </div>
  222. <div class="timer">
  223. <span style="float: left" v-if="isOwner==1 || is_manager==1">
  224. <a style="color: #3388ff;margin-right: 3px;font-size: 12px;" @tap="editnote(m);">
  225. <uni-icons type='gear' style="color: #2319dc;"></uni-icons>编辑
  226. </a>
  227. <a style="color: #3388ff;margin-right: 3px;font-size: 12px;"
  228. @tap="delete_note(m.id);">
  229. <uni-icons type='clear' style="color: #2319DC;"></uni-icons>删除
  230. </a>
  231. </span>
  232. {{m.nickname}}发布于{{timestampToTime(m.addtime)}}<span
  233. style="color: #3388ff;margin-right: 3px;">{{m.view}}人已阅读</span>
  234. </div>
  235. </div>
  236. </block>
  237. <view class="nodata">
  238. 暂未发布群公告
  239. </view>
  240. </div>
  241. </view>
  242. <view v-if="navselect==3">
  243. <ul class="profile">
  244. <li>头像:</li>
  245. <li>
  246. <image :src="group.avatar" class="avatar" style="height:50px;width: 50px;"></image>
  247. <image src="../../static/img/icon-plus.png" @tap="uploadImage" class="avatar"
  248. style="height:50px;width: 50px;margin-left: 10px;"></image>
  249. </li>
  250. </ul>
  251. <ul class="profile">
  252. <li>名称:</li>
  253. <li><input type="text" class="input1" id="name" v-model="group.name" placeholder="请输入聊天室名称">
  254. </li>
  255. </ul>
  256. <ul class="profile">
  257. <li>介绍:</li>
  258. <li>
  259. <textarea id="content" placeholder="请输入聊天室介绍" style="height: 50px;"
  260. v-model="group.content"></textarea>
  261. </li>
  262. </ul>
  263. <ul class="profile">
  264. <li>加群验证:</li>
  265. <li>
  266. <radio :checked="group.no_invite==1" @tap="group.no_invite=1">需要验证</radio>
  267. <radio style="margin-left: 30px;" :checked="group.no_invite==0" @tap="group.no_invite=0">无需验证
  268. </radio>
  269. </li>
  270. </ul>
  271. <ul class="profile">
  272. <li>添加群友:</li>
  273. <li>
  274. <radio :checked="group.no_add==1" @tap="group.no_add=1">禁止添加</radio>
  275. <radio style="margin-left: 30px;" :checked="group.no_add==0" @tap="group.no_add=0">允许添加</radio>
  276. </li>
  277. </ul>
  278. <ul class="profile">
  279. <li>发送链接:</li>
  280. <li>
  281. <radio :checked="group.issendurl==1" @tap="group.issendurl=1">允许发送</radio>
  282. <radio style="margin-left: 30px;" :checked="group.issendurl==0" @tap="group.issendurl=0">禁止发送
  283. </radio>
  284. </li>
  285. </ul>
  286. <ul class="profile">
  287. <li>修改备注:</li>
  288. <li>
  289. <radio :checked="group.is_mark==1" @tap="group.is_mark=1">开启</radio>
  290. <radio style="margin-left: 30px;" :checked="group.is_mark==0" @tap="group.is_mark=0">关闭</radio>
  291. &nbsp;
  292. <i class="icon-help-circled" style="cursor: pointer;font-size: 18px;color: #2319dc;"
  293. onclick="layer.tips('是否开启修改群名片功能', '.icon-help-circled', {tips:[3,'rgba(0,0,0,0.8)']});"></i>
  294. </li>
  295. </ul>
  296. <ul class="profile">
  297. <li>全体禁言:</li>
  298. <li>
  299. <radio :checked="group.no_speaking==1" @tap="group.no_speaking=1">开启</radio>
  300. <radio style="margin-left: 30px;" :checked="group.no_speaking==0" @tap="group.no_speaking=0">关闭
  301. </radio>
  302. </li>
  303. </ul>
  304. <ul class="profile">
  305. <li style="vertical-align: middle">标签:</li>
  306. <li style="line-height: 25px;vertical-align: middle">
  307. <div class="tagshow">
  308. <span v-for="(m,index) in tags_select.split(',')" :key="index">{{m}}</span>
  309. </div>
  310. <div class="add_btn" @tap='tags_show=true;'
  311. style="height: 20px;line-height: 20px;margin-top: 3px;"><uni-icons class="icons1"
  312. type='plus'></uni-icons>更改</div>
  313. </li>
  314. </ul>
  315. <ul class="profile">
  316. <li>其他:</li>
  317. <li style="vertical-align: middle;line-height: 45px;">
  318. <button class="btn2" @tap="quit_group()" v-if="isOwner==1">解散该群</button>
  319. <button class="btn2" @tap="quit_group()" v-else>退出该群</button>
  320. </li>
  321. </ul>
  322. <view style="height: 50px;"></view>
  323. <view class="group_btn" @tap="click_sub();"><uni-icons type='checkbox'
  324. style="color: #fff;font-size: 16px;" ></uni-icons>确认</view>
  325. <view class="tags" v-if="tags_show">
  326. <view class="content">
  327. <div class="title">选择标签(最多{{system['tags_sum']}}个)</div>
  328. <block v-for="(item,index) in system.tags.split('|')" :key="index">
  329. <span @tap="click_tags(index)" :class="{'active':tags_select.indexOf(item)>-1}">{{item}}
  330. </span>
  331. </block>
  332. </view>
  333. <image class="close_tags" @tap='tags_show=false;' src="/static/close1.png"></image>
  334. </view>
  335. </view>
  336. </block>
  337. <noteadd v-if="note_add" :group='group' :noteinfo="noteinfo" @back="note_add=false;" @getnoteinfo="getnoteinfo">
  338. </noteadd>
  339. <view class="popup" v-if="isreq">
  340. <view class="box">
  341. <ul class="layer_nav" style="height: 40px;line-height: 40px;">
  342. <li class="active" style="width: 100%;border-radius: 15rpx 15rpx 0 0;">申请加入</li>
  343. </ul>
  344. <view class="group_detail">
  345. <ul class="avatarline" style="position: relative;">
  346. <li>
  347. <image :src="image_cache(group.avatar)" class="avatar"></image>
  348. </li>
  349. <li>
  350. <div class="title" id="group_title">名称:{{decodeURI(group.name)}}</div>
  351. <div>
  352. ID:{{group.id}}
  353. </div>
  354. </li>
  355. </ul>
  356. <textarea class="textarea" placeholder="我是..." v-model="reqcon"></textarea>
  357. </view>
  358. <view style="padding: 10px 10px;height: 30px;text-align: right;">
  359. <button class="layer_btns cancel" @tap="isreq=false;">
  360. <uni-icons type='close'
  361. style="font-size: 14px;margin-right: 5px;color: #333;font-weight: 600;"></uni-icons>
  362. 取消</button>
  363. <button class="layer_btns ok" @tap="apply_join()">
  364. <uni-icons type='checkbox' style="font-size: 14px;color: #fff;margin-right: 5px;"></uni-icons>
  365. 确定</button>
  366. </view>
  367. <uni-icons type='close'
  368. style="display: none;font-size:28px;margin-right: 5px;color: #2319DC;font-weight: 600;position: absolute;right: -15px;top:-13px;"></uni-icons>
  369. </view>
  370. </view>
  371. <logoutwords v-if="showlogout" :item="logoutinfo" @sub="logout_sub" @cancle="showlogout=false;"></logoutwords>
  372. </view>
  373. </template>
  374. <script>
  375. import api from "../../library/index.js"
  376. import http from "../../library/http.js"
  377. import action from "../../library/action.js"
  378. import config from "../../config.js"
  379. import noteadd from '../../components/noteadd.vue';
  380. import helper from "../../library/helper.js"
  381. import headerline from '../../components/header.vue'
  382. import logoutwords from '../../components/logout_words.vue'
  383. import uniIcons from '../../components/uni-icons/uni-icons.vue'
  384. var windowHeight = uni.getSystemInfoSync().windowHeight;
  385. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  386. export default {
  387. components: {
  388. uniIcons,
  389. headerline,
  390. noteadd,
  391. logoutwords
  392. },
  393. data() {
  394. return {
  395. showqr: true,
  396. chat_msg: '',
  397. show_men: [],
  398. isShow: true,
  399. statusBarHeight: statusBarHeight + 'px',
  400. roomId: 0,
  401. isOwner: false,
  402. info: {},
  403. group: {},
  404. members: [],
  405. switchs: false,
  406. no_speaking: false,
  407. forbid_redpack: false,
  408. is_manager: false,
  409. no_add: false,
  410. no_add1: false,
  411. pro_title: '修改群名称',
  412. pro_text: '',
  413. placeholder: '',
  414. pro_type: '',
  415. no_invite: false,
  416. userid: uni.getStorageSync('access_token'),
  417. navitem: ['首页', '成员', '公告'],
  418. navselect: 0,
  419. navstyle: "width:70%;left:15%",
  420. step: 0,
  421. addtime: '--:--:--',
  422. managenum: 0,
  423. isin: 0,
  424. from: '',
  425. group_id: 0,
  426. menu_tabs: [],
  427. menu_id: 0,
  428. tags: '',
  429. tags_sum: 3,
  430. tags_show: false,
  431. tags_select: '',
  432. system: uni.getStorageSync('system'),
  433. isuploading: false,
  434. notelist: [],
  435. note_add: false,
  436. noteinfo: {
  437. id: 0,
  438. content: '',
  439. imgs: ''
  440. },
  441. isreq: false,
  442. fromtype: '',
  443. reqcon: '',
  444. isloading: true,
  445. istop: false,
  446. no_tip: false,
  447. showlogout: false,
  448. logoutinfo: {},
  449. }
  450. },
  451. methods: {
  452. searchf(chat_msg) {
  453. this.chat_msg = chat_msg.trim();
  454. this.isShow = false
  455. console.log('chat_msg', chat_msg);
  456. let arr = []
  457. if (chat_msg == '' || chat_msg === undefined) {
  458. this.show_men = this.members
  459. this.isShow = true
  460. } else {
  461. this.members.forEach(item => {
  462. let name = item.nickname || item.name || ''
  463. console.log(name, 'name');
  464. if (name.indexOf(chat_msg) != -1) {
  465. arr.push(item)
  466. }
  467. })
  468. this.$set(this, 'show_men', arr)
  469. this.isShow = true
  470. }
  471. // this.show_men = arr
  472. // console.log(this.show_men,'this.show_men');
  473. },
  474. // 查找聊天记录
  475. search() {
  476. console.log('查找聊天记录');
  477. uni.navigateTo({
  478. url: '/pages/index/record?group_id=' + this.group_id + '&isgroup=1'
  479. })
  480. },
  481. invite_user() {
  482. var ids = this.group.user_id.split(',');
  483. var userlist = uni.getStorageSync(uni.getStorageSync('access_token') + '_frienddata');
  484. var userid = '';
  485. for (var i = 0; i < userlist.length; i++) {
  486. for (var j = 0; j < ids.length; j++) {
  487. if (userlist[i].id == ids[j]) userid += "@" + ids[j];
  488. }
  489. }
  490. var url = '../friend/userlist?isme=0&disabled_id=' + userid + '&next=invite&subtitle=立即邀请&group_id=' +
  491. this.group_id
  492. uni.navigateTo({
  493. url: url
  494. })
  495. },
  496. user_setmenu11(type) {
  497. if (type == 'top') {
  498. this.istop = !this.istop;
  499. var msgtop = uni.getStorageSync('msgtop') ? uni.getStorageSync('msgtop') : [];
  500. if (this.istop) {
  501. msgtop.push('G' + this.group_id)
  502. } else {
  503. for (var i = 0; i < msgtop.length; i++) {
  504. if (msgtop[i] == 'G' + this.group_id) {
  505. msgtop.splice(i, 1)
  506. }
  507. }
  508. }
  509. uni.setStorageSync('msgtop', msgtop);
  510. this.$store.commit('chat/set_istop');
  511. var data = {
  512. cache_key: 'G' + this.group_id,
  513. userid: this.userid,
  514. istop: this.istop
  515. };
  516. http.setWait(false).get('group.php?act=set_msgtop', data).then(res => {
  517. })
  518. }
  519. if (type == 'tip') {
  520. this.no_tip = !this.no_tip;
  521. var msgtop = uni.getStorageSync('msgnotip') ? uni.getStorageSync('msgnotip') : [];
  522. if (this.no_tip) {
  523. msgtop.push('G' + this.group_id)
  524. } else {
  525. for (var i = 0; i < msgtop.length; i++) {
  526. if (msgtop[i] == 'G' + this.group_id) {
  527. msgtop.splice(i, 1)
  528. }
  529. }
  530. }
  531. uni.setStorageSync('msgnotip', msgtop);
  532. var data = {
  533. cache_key: 'G' + this.group_id,
  534. userid: this.userid,
  535. notip: this.no_tip
  536. };
  537. http.setWait(false).get('group.php?act=set_msgnotip', data).then(res => {
  538. })
  539. }
  540. },
  541. timestampToTime(timestamp) {
  542. var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  543. var Y = date.getFullYear();
  544. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
  545. var D = date.getDate();
  546. var h = date.getHours();
  547. var m = date.getMinutes();
  548. var s = date.getSeconds();
  549. if (D < 10) D = '0' + D;
  550. if (h < 10) h = '0' + h;
  551. if (m < 10) m = '0' + m;
  552. if (s < 10) s = '0' + s;
  553. return M + '-' + D + ' ' + h + ':' + m + ':' + s;
  554. },
  555. imgshow(image_url) {
  556. if (image_url.indexOf('http') <= -1) image_url = config.imgUri + image_url;
  557. return this.image_cache(image_url)
  558. },
  559. editnote(m) {
  560. this.noteinfo = m;
  561. this.note_add = true;
  562. },
  563. delete_note(id) {
  564. var that = this;
  565. uni.showModal({
  566. title: '提示',
  567. content: "是否要删除?",
  568. success: function(res) {
  569. if (res.confirm) {
  570. http.setWait(true).post('group.php?act=deletenote', {
  571. id: id
  572. }).then(res => {
  573. if (res.code == 200) {
  574. that.getnoteinfo();
  575. uni.showToast({
  576. title: '删除成功',
  577. icon: 'none'
  578. })
  579. } else {
  580. uni.showToast({
  581. title: '网络错误,请稍后再试',
  582. icon: 'none'
  583. })
  584. }
  585. })
  586. } else if (res.cancel) {
  587. }
  588. }
  589. });
  590. },
  591. quit_group() {
  592. if (this.isOwner == 1) var tips = "是否要解散该群?";
  593. else var tips = "是否要退出该群?";
  594. var that = this;
  595. uni.showModal({
  596. title: '提示',
  597. content: tips,
  598. success: function(res) {
  599. if (res.confirm) {
  600. var data = {
  601. type: 'deleteGroup',
  602. userid: that.userid,
  603. group_id: that.group_id,
  604. fromid: that.userid
  605. };
  606. // console.log(data)
  607. that.$socket.send(data);
  608. that.delete_msg("G" + that.group_id)
  609. uni.reLaunch({
  610. url: '../index/index'
  611. })
  612. uni.showToast({
  613. title: '您已经退出该群',
  614. icon: 'none'
  615. })
  616. } else if (res.cancel) {
  617. }
  618. }
  619. });
  620. },
  621. uploadImage() {
  622. this.navCroper(400, 400, 'avtor')
  623. // uni.chooseImage({
  624. // count: 1,
  625. // success: (chooseImageRes) => {
  626. // console.log(chooseImageRes,'chooseImageRes');
  627. // for (var i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
  628. // var tempFilePaths = chooseImageRes.tempFilePaths[i];
  629. // this.group.avatar = tempFilePaths;
  630. // this.isuploading = true;
  631. // helper.uploadFiles([tempFilePaths], 'images', {
  632. // type: 'avatar'
  633. // }).then(res => {
  634. // // this.group.avatar=res;
  635. // this.avatar = res.replace(config.imgUri, '');
  636. // this.isuploading = false;
  637. // api.changeSpeak({
  638. // avatar: this.avatar,
  639. // group_id: this.group.id
  640. // }).then(res => {
  641. // this.GroupUpdate();
  642. // this.$toast('头像上传成功').then(() => {
  643. // this.getGroupInfo();
  644. // });
  645. // });
  646. // })
  647. // }
  648. // }
  649. // });
  650. },
  651. click_tags(num) {
  652. var tags = this.system.tags.split('|')
  653. var item = tags[num];
  654. if (this.tags_select.indexOf(item) > -1) {
  655. var arr = this.tags_select.split(',');
  656. var select = '';
  657. for (var i = 0; i < arr.length; i++) {
  658. if (arr[i] != item) {
  659. if (select != '') select += ',';
  660. select += arr[i];
  661. }
  662. }
  663. this.tags_select = select;
  664. } else {
  665. var arr = this.tags_select.split(',');
  666. if (arr.length >= this.tags_sum) {
  667. uni.showToast({
  668. title: '最多可以选择' + this.tags_sum + '个标签',
  669. icon: 'none'
  670. })
  671. } else {
  672. if (this.tags_select != '') this.tags_select += ',';
  673. this.tags_select += item;
  674. }
  675. }
  676. },
  677. click_sub() {
  678. if (this.group.name == '') {
  679. uni.showToast({
  680. title: '请输入群组名称',
  681. icon: 'none'
  682. })
  683. return false;
  684. }
  685. if (this.group.content == '') {
  686. uni.showToast({
  687. title: '请输入群组介绍',
  688. icon: 'none'
  689. })
  690. return false;
  691. }
  692. if (this.tags_select == '') {
  693. uni.showToast({
  694. title: '请设置群标签',
  695. icon: 'none'
  696. })
  697. return false;
  698. }
  699. if (this.isuploading == true) {
  700. uni.showToast({
  701. title: '头像正在上传中,请稍后提交',
  702. icon: 'none'
  703. })
  704. return false;
  705. }
  706. var postdata = {
  707. id: this.group_id,
  708. name: this.group.name,
  709. content: this.group.content,
  710. tags: this.tags_select,
  711. no_invite: this.group.no_invite,
  712. no_speaking: this.group.no_speaking,
  713. is_mark: this.group.is_mark,
  714. no_add: this.group.no_add,
  715. issendurl: this.group.issendurl
  716. };
  717. http.setWait(true).post('group.php?act=updateinfo', postdata).then(res => {
  718. if (res.code == 200) {
  719. this.GroupUpdate();
  720. this.getGroupInfo();
  721. uni.showToast({
  722. title: '更新成功',
  723. icon: 'none'
  724. })
  725. } else {
  726. uni.showToast({
  727. title: '网络错误,请稍后再试',
  728. icon: 'none'
  729. })
  730. }
  731. })
  732. },
  733. show_usermenu(m) {
  734. for (var i = 0; i < this.members.length; i++) {
  735. if (this.members[i].id != m.id) this.members[i].menu = false
  736. }
  737. m.menu = !m.menu;
  738. this.menu_id = m.id;
  739. var menu_tabs = [];
  740. if (this.isOwner == 1) {
  741. if (m.type != 'owner') {
  742. if (m.type == 'manager') menu_tabs.push({
  743. 'type': 'manage',
  744. 'text': '取消管理'
  745. });
  746. else menu_tabs.push({
  747. 'type': 'manage',
  748. 'text': '设为管理'
  749. });
  750. if (m.is_deny == 1) menu_tabs.push({
  751. 'type': 'deny',
  752. 'text': '解除禁言'
  753. });
  754. else menu_tabs.push({
  755. 'type': 'deny',
  756. 'text': '禁言'
  757. });
  758. menu_tabs.push({
  759. 'type': 'delete',
  760. 'text': '踢人'
  761. });
  762. }
  763. menu_tabs.push({
  764. 'type': 'update',
  765. 'text': '修改名片'
  766. });
  767. menu_tabs.push({
  768. 'type': 'view',
  769. 'text': '查看资料'
  770. });
  771. } else if (this.is_manager == 1) {
  772. if (m.type == 'user') {
  773. if (m.is_deny == 1) menu_tabs.push({
  774. 'type': 'deny',
  775. 'text': '解除禁言'
  776. });
  777. else menu_tabs.push({
  778. 'type': 'deny',
  779. 'text': '禁言'
  780. });
  781. menu_tabs.push({
  782. 'type': 'delete',
  783. 'text': '踢人'
  784. });
  785. menu_tabs.push({
  786. 'type': 'update',
  787. 'text': '修改名片'
  788. });
  789. menu_tabs.push({
  790. 'type': 'view',
  791. 'text': '查看资料'
  792. });
  793. } else {
  794. menu_tabs.push({
  795. 'type': 'view',
  796. 'text': '查看资料'
  797. });
  798. }
  799. }
  800. this.menu_tabs = menu_tabs;
  801. },
  802. user_setmenu(type) {
  803. var user = [];
  804. var isin = 0;
  805. var nickname = "";
  806. for (var i = 0; i < this.members.length; i++) {
  807. if (this.members[i].id == this.menu_id) {
  808. isin = 1;
  809. user = this.members[i];
  810. if (user.name == user.nickname) nickname = user.name;
  811. else nickname = user.nickname;
  812. this.members[i].menu = false
  813. this.members[i].nameset = false;
  814. break;
  815. }
  816. }
  817. var that = this;
  818. if (isin == 1) {
  819. //设为管理
  820. if (type == 'manage') {
  821. if (user.type == 'manager') {
  822. var tips = "是否要取消[" + nickname + "]的管理权限?";
  823. var settype = 0;
  824. } else {
  825. var tips = "是否要将[" + nickname + "]设为管理?";
  826. var settype = 1;
  827. }
  828. uni.showModal({
  829. title: '提示',
  830. content: tips,
  831. success: function(res) {
  832. if (res.confirm) {
  833. var data = {
  834. type: 'groupset1',
  835. mode: 'manage',
  836. settype: settype,
  837. group_id: that.group_id,
  838. userid: that.menu_id,
  839. from_uid: that.userid
  840. };
  841. that.$socket.send(data);
  842. } else if (res.cancel) {
  843. }
  844. }
  845. });
  846. }
  847. //禁言
  848. if (type == 'deny') {
  849. if (user.is_deny == 1) {
  850. var settype = 0;
  851. var tips = "是否要解除[" + nickname + "]禁言?";
  852. } else {
  853. var settype = 1;
  854. var tips = "是否要将[" + nickname + "]禁言?";
  855. }
  856. uni.showModal({
  857. title: '禁言提示',
  858. content: tips,
  859. success: function(res) {
  860. if (res.confirm) {
  861. var data = {
  862. type: 'groupset1',
  863. mode: 'deny',
  864. settype: settype,
  865. group_id: that.group_id,
  866. userid: that.menu_id,
  867. from_uid: that.userid
  868. };
  869. console.log(data);
  870. that.$socket.send(data);
  871. }
  872. }
  873. });
  874. }
  875. //踢人
  876. if (type == 'delete') {
  877. // var tips="是否要将["+nickname+"]移除本群?";
  878. // uni.showModal({
  879. // title: '踢人提示',
  880. // content: tips,
  881. // success: function (res) {
  882. // if (res.confirm) {
  883. // var data={type:'deleteGroup',group_id:that.group_id,userid:that.menu_id,fromid:that.userid};
  884. // that.$socket.send(data);
  885. // }
  886. // }
  887. // });
  888. this.showlogout = true;
  889. this.logoutinfo = {
  890. group_id: this.group_id,
  891. userid: this.menu_id,
  892. nickname: nickname
  893. };
  894. }
  895. //设置备注
  896. if (type == 'update') {
  897. this.user_rename(this.menu_id);
  898. }
  899. if (type == 'view') {
  900. this.lookMember(user);
  901. }
  902. } else {
  903. uni.showToast({
  904. title: "该用户已被移除群组",
  905. icon: 'none'
  906. })
  907. this.getGroupUsers();
  908. }
  909. },
  910. logout_sub(e) {
  911. uni.showToast({
  912. icon: 'none',
  913. title: '操作成功'
  914. })
  915. },
  916. user_rename(id) {
  917. for (var i = 0; i < this.members.length; i++) {
  918. if (this.members[i].id == id) {
  919. this.members[i].nameset = true;
  920. } else {
  921. this.members[i].nameset = false;
  922. }
  923. }
  924. },
  925. sub_rename(id) {
  926. var nickname = "";
  927. for (var i = 0; i < this.members.length; i++) {
  928. if (this.members[i].id == id) {
  929. var user = this.members[i];
  930. if (user.name == user.nickname) nickname = user.name;
  931. else nickname = user.nickname;
  932. }
  933. this.members[i].nameset = false;
  934. }
  935. var postdata = {
  936. group_id: this.group_id,
  937. content: nickname,
  938. userid: id
  939. };
  940. var that = this;
  941. http.setWait(false).post('group.php?act=setGroupNickname', postdata).then(res => {
  942. if (res.code == 200) {
  943. uni.showToast({
  944. title: "操作成功",
  945. icon: 'none'
  946. })
  947. this.getGroupUsers();
  948. } else {
  949. uni.showToast({
  950. title: res.message,
  951. icon: 'none'
  952. })
  953. this.getGroupUsers();
  954. }
  955. })
  956. },
  957. tapnav(num) {
  958. this.navselect = num;
  959. if (num == 1) this.show_men = this.members
  960. if (num == 2) this.getnoteinfo();
  961. this.note_add = false;
  962. },
  963. GroupUpdate() {
  964. let data = {
  965. group_id: this.group.id,
  966. type: 'GroupUpdate'
  967. }
  968. this.$socket.send(data);
  969. },
  970. qrcode() {
  971. this.$jump('group.qrcode', {
  972. id: this.group_id
  973. });
  974. },
  975. login_btn() {
  976. uni.setStorageSync('gourl', '/pages/group/detail?id=' + this.group_id);
  977. this.$jump('login.index');
  978. },
  979. go_chat() {
  980. if (this.from == 'chat') {
  981. uni.navigateBack();
  982. } else {
  983. this.$jump('group.chat', {
  984. id: this.group.id,
  985. nickname: this.group.nickname
  986. });
  987. }
  988. },
  989. apply_group() {
  990. if (uni.getStorageSync('access_token') > 0) {
  991. var user = uni.getStorageSync('userInfo');
  992. if (user.issetname == 1) {
  993. if (this.fromtype == 'qrcode' || this.group.no_invite == 0) {
  994. var data = {
  995. type: 'Join_Group',
  996. userid: user.id,
  997. group_id: this.group_id
  998. };
  999. this.$socket.send(data);
  1000. } else {
  1001. this.isreq = true;
  1002. }
  1003. } else {
  1004. action.profileTips('未设置昵称,不能申请加入群组', '/pages/group/detail?id=' + this.group_id);
  1005. }
  1006. } else {
  1007. action.loginTips('您还没有登录,不能申请加入群组', '/pages/group/detail?id=' + this.group_id);
  1008. }
  1009. },
  1010. apply_join() {
  1011. var data = {
  1012. type: 'Apply_Group',
  1013. userid: this.userid,
  1014. group_id: this.group_id,
  1015. content: this.reqcon
  1016. };
  1017. this.$socket.send(data);
  1018. uni.showLoading({
  1019. title: '申请中'
  1020. })
  1021. this.isreq = false;
  1022. },
  1023. users_set(data) {
  1024. var num = 0;
  1025. for (var i = 0; i < data.length; i++) {
  1026. var item = data[i];
  1027. if (item.type == 'owner' || item.type == 'manager') num++;
  1028. item.menu = false;
  1029. item.nameset = false;
  1030. data[i] = item
  1031. }
  1032. this.managenum = num;
  1033. uni.setStorageSync(this.group_id + '_group_members', data);
  1034. this.members = data;
  1035. },
  1036. getGroupUsers() {
  1037. this.users_set(uni.getStorageSync(this.group_id + '_group_members'))
  1038. api.getGroupUsers({
  1039. group_id: this.group_id,
  1040. userid: this.userid,
  1041. }).then(res => {
  1042. this.users_set(res.data);
  1043. })
  1044. },
  1045. group_set(result) {
  1046. this.isloading = false;
  1047. var that = this;
  1048. this.group = result;
  1049. result.tag = result.tags.split(',');
  1050. uni.setStorageSync('group_' + result.id, result);;
  1051. this.addtime = action.timestampToTime(result.addtime)
  1052. // console.log(result);
  1053. that.isOwner = result.owner;
  1054. that.is_manager = result.is_manager;
  1055. that.isin = result.isin;
  1056. that.group = that.info = result;
  1057. that.no_speaking = parseInt(result.no_speaking) ? true : false;
  1058. //that.forbid_redpack = parseInt(result.forbid_redpack) ? true : false;
  1059. that.no_invite = parseInt(result.no_invite) ? true : false;
  1060. that.no_add = parseInt(result.no_add) ? true : false
  1061. that.no_add1 = this.no_add;
  1062. //that.no_tip = parseInt(result.no_tip) ? true : false;
  1063. if (this.group.avatar.indexOf('http') > -1) {
  1064. } else {
  1065. that.group.avatar = config.imgUri + that.group.avatar;
  1066. }
  1067. this.tags_select = this.group.tags;
  1068. if ((parseInt(this.group.no_add) == 1) && !this.group.owner && !this.is_manager)
  1069. this.no_add1 = true;
  1070. else this.no_add1 = false;
  1071. if ((this.isOwner == 1 || this.is_manager == 1) && this.navitem.length == 3) this.navitem.push('设置')
  1072. },
  1073. getGroupInfo() {
  1074. let that = this;
  1075. api.getGroupInfo({
  1076. group_id: this.group_id,
  1077. from_id: this.userid
  1078. }).then(res => {
  1079. let result = res.data;
  1080. this.group_set(result);
  1081. })
  1082. },
  1083. getnoteinfo() {
  1084. // this.chat_msg = ''
  1085. var postdata = {
  1086. userid: this.userid,
  1087. id: this.group_id
  1088. };
  1089. http.setWait(false).post('group.php?act=groupnote', postdata).then(res => {
  1090. if (res.code == 200) {
  1091. for (var i = 0; i < res.data.length; i++) {
  1092. if (res.data[i].content.length > 100) res.data[i].more = true;
  1093. else res.data[i].more = false;
  1094. }
  1095. this.notelist = res.data;
  1096. } else {
  1097. uni.showToast({
  1098. title: '网络错误,请稍后再试',
  1099. icon: 'none'
  1100. })
  1101. }
  1102. })
  1103. },
  1104. lookMember(e) {
  1105. return this.$jump('friend.detail', {
  1106. id: e.id,
  1107. from: 'group',
  1108. 'group_id': this.group_id
  1109. });
  1110. },
  1111. // 图片上传
  1112. upLoad(path) {
  1113. let that = this
  1114. uni.showLoading({
  1115. title: '图片上传中',
  1116. mask: true
  1117. });
  1118. console.log('图片上传中')
  1119. return new Promise((resolve, error) => {
  1120. // let arr = [];
  1121. // arr.push(path)
  1122. // const tempFilePaths = arr;
  1123. that.group.avatar = path;
  1124. that.isuploading = true;
  1125. helper.uploadFiles([path], 'images', {
  1126. type: 'avatar'
  1127. }).then(res => {
  1128. // this.group.avatar=res;
  1129. that.avatar = res.replace(config.imgUri, '');
  1130. that.isuploading = false;
  1131. api.changeSpeak({
  1132. avatar: that.avatar,
  1133. group_id: that.group.id
  1134. }).then(res => {
  1135. uni.hideLoading()
  1136. that.GroupUpdate();
  1137. that.$toast('头像上传成功').then(() => {
  1138. that.getGroupInfo();
  1139. });
  1140. });
  1141. })
  1142. })
  1143. },
  1144. chooseImage: function(index) {
  1145. const _this = this
  1146. return new Promise((ok, error) => {
  1147. // 从相册/相机选择
  1148. // 如需直接开相机或直接选相册,请只使用一个选项
  1149. const sourceType = index === 0 ? ['camera'] : ['album']
  1150. uni.chooseImage({
  1151. count: 1, //默认9
  1152. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  1153. sourceType: sourceType,
  1154. success: function(res) {
  1155. ok(res.tempFilePaths[0])
  1156. },
  1157. fail(e) {
  1158. uni.showModal({
  1159. title: '文件打开错误',
  1160. content: '请设置授权文件存储权限',
  1161. showCancel: false,
  1162. });
  1163. error(e)
  1164. }
  1165. });
  1166. })
  1167. },
  1168. onImg(type) {
  1169. const _this = this
  1170. return new Promise((ok, erro) => {
  1171. // 判断是否需要选择
  1172. if (type == 1) {
  1173. _this.showqr = false
  1174. uni.showActionSheet({
  1175. itemList: ['拍照', '选择一张照片'],
  1176. success: function(res) {
  1177. _this.showqr = true
  1178. console.log(res, '上传')
  1179. _this.chooseImage(res.tapIndex).then((url) => {
  1180. console.log(url, 'url');
  1181. ok(url)
  1182. }).catch((res) => {
  1183. erro(res)
  1184. })
  1185. },
  1186. fail: function(res) {
  1187. erro(res)
  1188. _this.showqr = true
  1189. console.log(res.errMsg);
  1190. }
  1191. });
  1192. }
  1193. // 判断是否只需要拍照
  1194. if (type == 2) {
  1195. _this.chooseImage(0).then((url) => {
  1196. ok(url)
  1197. }).catch((res) => {
  1198. erro(res)
  1199. })
  1200. }
  1201. })
  1202. },
  1203. //图像裁剪
  1204. navCroper(w, h, type) {
  1205. let that = this;
  1206. let tt = (type == 'upimg' ? 2 : 1)
  1207. this.onImg(tt).then((url) => {
  1208. uni.navigateTo({
  1209. url: `/pages/index/cropper?width=${w}&height=${h}`,
  1210. events: {
  1211. uploadSuccess(res) {
  1212. console.log(res, '这里')
  1213. that.upLoad(res).then((urldata) => {
  1214. console.log(urldata, '这里')
  1215. // that[type] = urldata.url;
  1216. })
  1217. }
  1218. },
  1219. success: function(res) {
  1220. console.log(res, 'success');
  1221. // 通过eventChannel向被打开页面传送数据
  1222. res.eventChannel.emit('urlNext', {
  1223. url
  1224. })
  1225. }
  1226. })
  1227. })
  1228. },
  1229. },
  1230. onShow() {
  1231. this.getGroupUsers();
  1232. var that = this;
  1233. this.getnoteinfo()
  1234. },
  1235. onLoad(opts) {
  1236. this.from = opts.from ? opts.from : '';
  1237. let that = this;
  1238. this.group_id = opts.id;
  1239. if (opts.id > 0) {
  1240. try {
  1241. this.group = uni.getStorageSync('group_' + this.group_id);;
  1242. if (this.group.id == opts.id) {
  1243. this.isloading = false;
  1244. this.group_set(this.group);
  1245. } else {
  1246. this.group.id = this.group_id;
  1247. }
  1248. } catch (e) {
  1249. //TODO handle the exception
  1250. }
  1251. var msgtop = uni.getStorageSync('msgtop');
  1252. var istop = 0;
  1253. for (var i = 0; i < msgtop.length; i++) {
  1254. if (msgtop[i] == 'G' + this.group_id) {
  1255. this.istop = true;
  1256. break;
  1257. }
  1258. }
  1259. var msgnotip = uni.getStorageSync('msgnotip');
  1260. for (var i = 0; i < msgnotip.length; i++) {
  1261. if (msgnotip[i] == 'G' + this.group_id) {
  1262. this.no_tip = true;
  1263. break;
  1264. }
  1265. }
  1266. this.getGroupInfo();
  1267. this.getGroupUsers()
  1268. this.$socket.on('group_update', (res) => {
  1269. that.getGroupUsers();
  1270. that.getGroupInfo();
  1271. })
  1272. this.$socket.on('apply_response', (res) => {
  1273. if (res.data.code == 1) {
  1274. var group = res.data.group;
  1275. uni.redirectTo({
  1276. url: "/pages/group/chat?id=" + group.id + '&nickname=' + group.name
  1277. })
  1278. } else {
  1279. uni.hideLoading();
  1280. uni.showToast({
  1281. icon: 'none',
  1282. title: res.data.message
  1283. })
  1284. }
  1285. })
  1286. var msgtop = uni.getStorageSync('msgtop') ? uni.getStorageSync('msgtop') : [];
  1287. msgtop.map(item => {
  1288. if (item.storekey == 'G' + this.group.id) this.istop = true;
  1289. })
  1290. var msgnotip = uni.getStorageSync('msgnotip') ? uni.getStorageSync('msgnotip') : [];
  1291. msgnotip.map(item => {
  1292. if (item.storekey == 'G' + this.group.id) this.no_tip = true;
  1293. })
  1294. } else {
  1295. uni.navigateBack()
  1296. }
  1297. }
  1298. }
  1299. </script>
  1300. <style lang="scss" scoped>
  1301. @import "@/static/css/group.css";
  1302. $avatarWidth: 50px;
  1303. @font-face {
  1304. font-family: uniicons;
  1305. font-weight: normal;
  1306. font-style: normal;
  1307. src: url('../../static/fonts/uni.ttf') format('truetype');
  1308. }
  1309. .uni-navigate-right:after {
  1310. font-family: uniicons;
  1311. content: '\e583';
  1312. position: absolute;
  1313. right: 24upx;
  1314. top: 50%;
  1315. color: #bbb;
  1316. -webkit-transform: translateY(-50%);
  1317. transform: translateY(-50%);
  1318. }
  1319. .uni-navigate-bottom:after {
  1320. font-family: uniicons;
  1321. content: '\e581';
  1322. position: absolute;
  1323. right: 24upx;
  1324. top: 50%;
  1325. color: #bbb;
  1326. -webkit-transform: translateY(-50%);
  1327. transform: translateY(-50%);
  1328. }
  1329. .uni-navigate-bottom.uni-active::after {
  1330. font-family: uniicons;
  1331. content: '\e580';
  1332. position: absolute;
  1333. right: 24upx;
  1334. top: 50%;
  1335. color: #bbb;
  1336. -webkit-transform: translateY(-50%);
  1337. transform: translateY(-50%);
  1338. }
  1339. .members {
  1340. padding: $uni-spacing-col-base $uni-spacing-row-base;
  1341. display: flex;
  1342. flex-direction: row;
  1343. flex-flow: wrap;
  1344. justify-content: flex-start;
  1345. background-color: #fff;
  1346. }
  1347. .member {
  1348. display: inline-block;
  1349. flex-direction: column;
  1350. align-items: center;
  1351. text-align: center;
  1352. justify-content: flex-start;
  1353. text-align: center;
  1354. .avatar {
  1355. display: block;
  1356. margin: 0 auto;
  1357. width: $avatarWidth;
  1358. height: $avatarWidth;
  1359. border-radius: $uni-border-radius-base;
  1360. background: rgba(0, 0, 0, 0.05);
  1361. &.emoji {
  1362. text-align: center;
  1363. background-color: #eee;
  1364. font-size: 68upx;
  1365. line-height: $avatarWidth;
  1366. color: #999;
  1367. }
  1368. }
  1369. text {
  1370. width: $avatarWidth;
  1371. text-overflow: ellipsis;
  1372. white-space: nowrap;
  1373. overflow: hidden;
  1374. font-size: 28upx;
  1375. color: #999;
  1376. }
  1377. }
  1378. .notice {
  1379. width: 500upx;
  1380. text-overflow: ellipsis;
  1381. white-space: nowrap;
  1382. overflow: hidden;
  1383. }
  1384. .btn-wrapper {
  1385. margin-top: $uni-spacing-col-base;
  1386. padding: $uni-spacing-col-lg $uni-spacing-row-lg;
  1387. }
  1388. .fromInput {
  1389. text-align: right;
  1390. font-size: 32upx;
  1391. color: #777;
  1392. }
  1393. .page {
  1394. font-size: 14px;
  1395. ;
  1396. }
  1397. .loading {
  1398. //loading动画
  1399. display: flex;
  1400. justify-content: center;
  1401. @keyframes stretchdelay {
  1402. 0%,
  1403. 40%,
  1404. 100% {
  1405. transform: scaleY(0.6);
  1406. }
  1407. 20% {
  1408. transform: scaleY(1.0);
  1409. }
  1410. }
  1411. .spinner {
  1412. margin: 20upx 0;
  1413. width: 60upx;
  1414. height: 25px;
  1415. display: flex;
  1416. align-items: center;
  1417. justify-content: space-between;
  1418. view {
  1419. background-color: #ff9800;
  1420. height: 25px;
  1421. width: 3px;
  1422. border-radius: 3px;
  1423. animation: stretchdelay 1.2s infinite ease-in-out;
  1424. }
  1425. .rect2 {
  1426. animation-delay: -1.1s;
  1427. }
  1428. .rect3 {
  1429. animation-delay: -1.0s;
  1430. }
  1431. .rect4 {
  1432. animation-delay: -0.9s;
  1433. }
  1434. .rect5 {
  1435. animation-delay: -0.8s;
  1436. }
  1437. }
  1438. }
  1439. </style>