detail.vue 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712
  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. <yk-authpup ref="authpupCAMERA" type="top" @changeAuth="changeAuths"
  373. permissionID="CAMERA"></yk-authpup>
  374. </view>
  375. </template>
  376. <script>
  377. import ykAuthpup from "@/components/yk-authpup/yk-authpup";
  378. import api from "../../library/index.js"
  379. import http from "../../library/http.js"
  380. import action from "../../library/action.js"
  381. import config from "../../config.js"
  382. import noteadd from '../../components/noteadd.vue';
  383. import helper from "../../library/helper.js"
  384. import headerline from '../../components/header.vue'
  385. import logoutwords from '../../components/logout_words.vue'
  386. import uniIcons from '../../components/uni-icons/uni-icons.vue'
  387. var windowHeight = uni.getSystemInfoSync().windowHeight;
  388. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  389. export default {
  390. components: {
  391. uniIcons,
  392. headerline,
  393. noteadd,
  394. logoutwords
  395. },
  396. data() {
  397. return {
  398. showqr: true,
  399. chat_msg: '',
  400. show_men: [],
  401. isShow: true,
  402. statusBarHeight: statusBarHeight + 'px',
  403. roomId: 0,
  404. isOwner: false,
  405. info: {},
  406. group: {},
  407. members: [],
  408. switchs: false,
  409. no_speaking: false,
  410. forbid_redpack: false,
  411. is_manager: false,
  412. no_add: false,
  413. no_add1: false,
  414. pro_title: '修改群名称',
  415. pro_text: '',
  416. placeholder: '',
  417. pro_type: '',
  418. no_invite: false,
  419. userid: uni.getStorageSync('access_token'),
  420. navitem: ['首页', '成员', '公告'],
  421. navselect: 0,
  422. navstyle: "width:70%;left:15%",
  423. step: 0,
  424. addtime: '--:--:--',
  425. managenum: 0,
  426. isin: 0,
  427. from: '',
  428. group_id: 0,
  429. menu_tabs: [],
  430. menu_id: 0,
  431. tags: '',
  432. tags_sum: 3,
  433. tags_show: false,
  434. tags_select: '',
  435. system: uni.getStorageSync('system'),
  436. isuploading: false,
  437. notelist: [],
  438. note_add: false,
  439. noteinfo: {
  440. id: 0,
  441. content: '',
  442. imgs: ''
  443. },
  444. isreq: false,
  445. fromtype: '',
  446. reqcon: '',
  447. isloading: true,
  448. istop: false,
  449. no_tip: false,
  450. showlogout: false,
  451. logoutinfo: {},
  452. }
  453. },
  454. methods: {
  455. searchf(chat_msg) {
  456. this.chat_msg = chat_msg.trim();
  457. this.isShow = false
  458. console.log('chat_msg', chat_msg);
  459. let arr = []
  460. if (chat_msg == '' || chat_msg === undefined) {
  461. this.show_men = this.members
  462. this.isShow = true
  463. } else {
  464. this.members.forEach(item => {
  465. let name = item.nickname || item.name || ''
  466. console.log(name, 'name');
  467. if (name.indexOf(chat_msg) != -1) {
  468. arr.push(item)
  469. }
  470. })
  471. this.$set(this, 'show_men', arr)
  472. this.isShow = true
  473. }
  474. // this.show_men = arr
  475. // console.log(this.show_men,'this.show_men');
  476. },
  477. // 查找聊天记录
  478. search() {
  479. console.log('查找聊天记录');
  480. uni.navigateTo({
  481. url: '/pages/index/record?group_id=' + this.group_id + '&isgroup=1'
  482. })
  483. },
  484. invite_user() {
  485. var ids = this.group.user_id.split(',');
  486. var userlist = uni.getStorageSync(uni.getStorageSync('access_token') + '_frienddata');
  487. var userid = '';
  488. for (var i = 0; i < userlist.length; i++) {
  489. for (var j = 0; j < ids.length; j++) {
  490. if (userlist[i].id == ids[j]) userid += "@" + ids[j];
  491. }
  492. }
  493. var url = '../friend/userlist?isme=0&disabled_id=' + userid + '&next=invite&subtitle=立即邀请&group_id=' +
  494. this.group_id
  495. uni.navigateTo({
  496. url: url
  497. })
  498. },
  499. user_setmenu11(type) {
  500. if (type == 'top') {
  501. this.istop = !this.istop;
  502. var msgtop = uni.getStorageSync('msgtop') ? uni.getStorageSync('msgtop') : [];
  503. if (this.istop) {
  504. msgtop.push('G' + this.group_id)
  505. } else {
  506. for (var i = 0; i < msgtop.length; i++) {
  507. if (msgtop[i] == 'G' + this.group_id) {
  508. msgtop.splice(i, 1)
  509. }
  510. }
  511. }
  512. uni.setStorageSync('msgtop', msgtop);
  513. this.$store.commit('chat/set_istop');
  514. var data = {
  515. cache_key: 'G' + this.group_id,
  516. userid: this.userid,
  517. istop: this.istop
  518. };
  519. http.setWait(false).get('group.php?act=set_msgtop', data).then(res => {
  520. })
  521. }
  522. if (type == 'tip') {
  523. this.no_tip = !this.no_tip;
  524. var msgtop = uni.getStorageSync('msgnotip') ? uni.getStorageSync('msgnotip') : [];
  525. if (this.no_tip) {
  526. msgtop.push('G' + this.group_id)
  527. } else {
  528. for (var i = 0; i < msgtop.length; i++) {
  529. if (msgtop[i] == 'G' + this.group_id) {
  530. msgtop.splice(i, 1)
  531. }
  532. }
  533. }
  534. uni.setStorageSync('msgnotip', msgtop);
  535. var data = {
  536. cache_key: 'G' + this.group_id,
  537. userid: this.userid,
  538. notip: this.no_tip
  539. };
  540. http.setWait(false).get('group.php?act=set_msgnotip', data).then(res => {
  541. })
  542. }
  543. },
  544. timestampToTime(timestamp) {
  545. var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  546. var Y = date.getFullYear();
  547. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
  548. var D = date.getDate();
  549. var h = date.getHours();
  550. var m = date.getMinutes();
  551. var s = date.getSeconds();
  552. if (D < 10) D = '0' + D;
  553. if (h < 10) h = '0' + h;
  554. if (m < 10) m = '0' + m;
  555. if (s < 10) s = '0' + s;
  556. return M + '-' + D + ' ' + h + ':' + m + ':' + s;
  557. },
  558. imgshow(image_url) {
  559. if (image_url.indexOf('http') <= -1) image_url = config.imgUri + image_url;
  560. return this.image_cache(image_url)
  561. },
  562. editnote(m) {
  563. this.noteinfo = m;
  564. this.note_add = true;
  565. },
  566. delete_note(id) {
  567. var that = this;
  568. uni.showModal({
  569. title: '提示',
  570. content: "是否要删除?",
  571. success: function(res) {
  572. if (res.confirm) {
  573. http.setWait(true).post('group.php?act=deletenote', {
  574. id: id
  575. }).then(res => {
  576. if (res.code == 200) {
  577. that.getnoteinfo();
  578. uni.showToast({
  579. title: '删除成功',
  580. icon: 'none'
  581. })
  582. } else {
  583. uni.showToast({
  584. title: '网络错误,请稍后再试',
  585. icon: 'none'
  586. })
  587. }
  588. })
  589. } else if (res.cancel) {
  590. }
  591. }
  592. });
  593. },
  594. quit_group() {
  595. if (this.isOwner == 1) var tips = "是否要解散该群?";
  596. else var tips = "是否要退出该群?";
  597. var that = this;
  598. uni.showModal({
  599. title: '提示',
  600. content: tips,
  601. success: function(res) {
  602. if (res.confirm) {
  603. var data = {
  604. type: 'deleteGroup',
  605. userid: that.userid,
  606. group_id: that.group_id,
  607. fromid: that.userid
  608. };
  609. // console.log(data)
  610. that.$socket.send(data);
  611. that.delete_msg("G" + that.group_id)
  612. uni.reLaunch({
  613. url: '../index/index'
  614. })
  615. uni.showToast({
  616. title: '您已经退出该群',
  617. icon: 'none'
  618. })
  619. } else if (res.cancel) {
  620. }
  621. }
  622. });
  623. },
  624. changeAuths() {
  625. console.log('success')
  626. this.navCroper(400, 400, 'avtor')
  627. },
  628. uploadImage() {
  629. // #ifdef APP-PLUS
  630. if(plus.os.name =='Android') {
  631. this.$refs.authpupCAMERA.open()
  632. }else {
  633. this.navCroper(400,400,'avatarsrc')
  634. }
  635. // #endif
  636. // #ifndef APP-PLUS
  637. this.navCroper(400,400,'avatarsrc')
  638. // #endif
  639. // this.navCroper(400, 400, 'avtor')
  640. // uni.chooseImage({
  641. // count: 1,
  642. // success: (chooseImageRes) => {
  643. // console.log(chooseImageRes,'chooseImageRes');
  644. // for (var i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
  645. // var tempFilePaths = chooseImageRes.tempFilePaths[i];
  646. // this.group.avatar = tempFilePaths;
  647. // this.isuploading = true;
  648. // helper.uploadFiles([tempFilePaths], 'images', {
  649. // type: 'avatar'
  650. // }).then(res => {
  651. // // this.group.avatar=res;
  652. // this.avatar = res.replace(config.imgUri, '');
  653. // this.isuploading = false;
  654. // api.changeSpeak({
  655. // avatar: this.avatar,
  656. // group_id: this.group.id
  657. // }).then(res => {
  658. // this.GroupUpdate();
  659. // this.$toast('头像上传成功').then(() => {
  660. // this.getGroupInfo();
  661. // });
  662. // });
  663. // })
  664. // }
  665. // }
  666. // });
  667. },
  668. click_tags(num) {
  669. var tags = this.system.tags.split('|')
  670. var item = tags[num];
  671. if (this.tags_select.indexOf(item) > -1) {
  672. var arr = this.tags_select.split(',');
  673. var select = '';
  674. for (var i = 0; i < arr.length; i++) {
  675. if (arr[i] != item) {
  676. if (select != '') select += ',';
  677. select += arr[i];
  678. }
  679. }
  680. this.tags_select = select;
  681. } else {
  682. var arr = this.tags_select.split(',');
  683. if (arr.length >= this.tags_sum) {
  684. uni.showToast({
  685. title: '最多可以选择' + this.tags_sum + '个标签',
  686. icon: 'none'
  687. })
  688. } else {
  689. if (this.tags_select != '') this.tags_select += ',';
  690. this.tags_select += item;
  691. }
  692. }
  693. },
  694. click_sub() {
  695. if (this.group.name == '') {
  696. uni.showToast({
  697. title: '请输入群组名称',
  698. icon: 'none'
  699. })
  700. return false;
  701. }
  702. if (this.group.content == '') {
  703. uni.showToast({
  704. title: '请输入群组介绍',
  705. icon: 'none'
  706. })
  707. return false;
  708. }
  709. if (this.tags_select == '') {
  710. uni.showToast({
  711. title: '请设置群标签',
  712. icon: 'none'
  713. })
  714. return false;
  715. }
  716. if (this.isuploading == true) {
  717. uni.showToast({
  718. title: '头像正在上传中,请稍后提交',
  719. icon: 'none'
  720. })
  721. return false;
  722. }
  723. var postdata = {
  724. id: this.group_id,
  725. name: this.group.name,
  726. content: this.group.content,
  727. tags: this.tags_select,
  728. no_invite: this.group.no_invite,
  729. no_speaking: this.group.no_speaking,
  730. is_mark: this.group.is_mark,
  731. no_add: this.group.no_add,
  732. issendurl: this.group.issendurl
  733. };
  734. http.setWait(true).post('group.php?act=updateinfo', postdata).then(res => {
  735. if (res.code == 200) {
  736. this.GroupUpdate();
  737. this.getGroupInfo();
  738. uni.showToast({
  739. title: '更新成功',
  740. icon: 'none'
  741. })
  742. } else {
  743. uni.showToast({
  744. title: '网络错误,请稍后再试',
  745. icon: 'none'
  746. })
  747. }
  748. })
  749. },
  750. show_usermenu(m) {
  751. for (var i = 0; i < this.members.length; i++) {
  752. if (this.members[i].id != m.id) this.members[i].menu = false
  753. }
  754. m.menu = !m.menu;
  755. this.menu_id = m.id;
  756. var menu_tabs = [];
  757. if (this.isOwner == 1) {
  758. if (m.type != 'owner') {
  759. if (m.type == 'manager') menu_tabs.push({
  760. 'type': 'manage',
  761. 'text': '取消管理'
  762. });
  763. else menu_tabs.push({
  764. 'type': 'manage',
  765. 'text': '设为管理'
  766. });
  767. if (m.is_deny == 1) menu_tabs.push({
  768. 'type': 'deny',
  769. 'text': '解除禁言'
  770. });
  771. else menu_tabs.push({
  772. 'type': 'deny',
  773. 'text': '禁言'
  774. });
  775. menu_tabs.push({
  776. 'type': 'delete',
  777. 'text': '踢人'
  778. });
  779. }
  780. menu_tabs.push({
  781. 'type': 'update',
  782. 'text': '修改名片'
  783. });
  784. menu_tabs.push({
  785. 'type': 'view',
  786. 'text': '查看资料'
  787. });
  788. } else if (this.is_manager == 1) {
  789. if (m.type == 'user') {
  790. if (m.is_deny == 1) menu_tabs.push({
  791. 'type': 'deny',
  792. 'text': '解除禁言'
  793. });
  794. else menu_tabs.push({
  795. 'type': 'deny',
  796. 'text': '禁言'
  797. });
  798. menu_tabs.push({
  799. 'type': 'delete',
  800. 'text': '踢人'
  801. });
  802. menu_tabs.push({
  803. 'type': 'update',
  804. 'text': '修改名片'
  805. });
  806. menu_tabs.push({
  807. 'type': 'view',
  808. 'text': '查看资料'
  809. });
  810. } else {
  811. menu_tabs.push({
  812. 'type': 'view',
  813. 'text': '查看资料'
  814. });
  815. }
  816. }
  817. this.menu_tabs = menu_tabs;
  818. },
  819. user_setmenu(type) {
  820. var user = [];
  821. var isin = 0;
  822. var nickname = "";
  823. for (var i = 0; i < this.members.length; i++) {
  824. if (this.members[i].id == this.menu_id) {
  825. isin = 1;
  826. user = this.members[i];
  827. if (user.name == user.nickname) nickname = user.name;
  828. else nickname = user.nickname;
  829. this.members[i].menu = false
  830. this.members[i].nameset = false;
  831. break;
  832. }
  833. }
  834. var that = this;
  835. if (isin == 1) {
  836. //设为管理
  837. if (type == 'manage') {
  838. if (user.type == 'manager') {
  839. var tips = "是否要取消[" + nickname + "]的管理权限?";
  840. var settype = 0;
  841. } else {
  842. var tips = "是否要将[" + nickname + "]设为管理?";
  843. var settype = 1;
  844. }
  845. uni.showModal({
  846. title: '提示',
  847. content: tips,
  848. success: function(res) {
  849. if (res.confirm) {
  850. var data = {
  851. type: 'groupset1',
  852. mode: 'manage',
  853. settype: settype,
  854. group_id: that.group_id,
  855. userid: that.menu_id,
  856. from_uid: that.userid
  857. };
  858. that.$socket.send(data);
  859. } else if (res.cancel) {
  860. }
  861. }
  862. });
  863. }
  864. //禁言
  865. if (type == 'deny') {
  866. if (user.is_deny == 1) {
  867. var settype = 0;
  868. var tips = "是否要解除[" + nickname + "]禁言?";
  869. } else {
  870. var settype = 1;
  871. var tips = "是否要将[" + nickname + "]禁言?";
  872. }
  873. uni.showModal({
  874. title: '禁言提示',
  875. content: tips,
  876. success: function(res) {
  877. if (res.confirm) {
  878. var data = {
  879. type: 'groupset1',
  880. mode: 'deny',
  881. settype: settype,
  882. group_id: that.group_id,
  883. userid: that.menu_id,
  884. from_uid: that.userid
  885. };
  886. console.log(data);
  887. that.$socket.send(data);
  888. }
  889. }
  890. });
  891. }
  892. //踢人
  893. if (type == 'delete') {
  894. // var tips="是否要将["+nickname+"]移除本群?";
  895. // uni.showModal({
  896. // title: '踢人提示',
  897. // content: tips,
  898. // success: function (res) {
  899. // if (res.confirm) {
  900. // var data={type:'deleteGroup',group_id:that.group_id,userid:that.menu_id,fromid:that.userid};
  901. // that.$socket.send(data);
  902. // }
  903. // }
  904. // });
  905. this.showlogout = true;
  906. this.logoutinfo = {
  907. group_id: this.group_id,
  908. userid: this.menu_id,
  909. nickname: nickname
  910. };
  911. }
  912. //设置备注
  913. if (type == 'update') {
  914. this.user_rename(this.menu_id);
  915. }
  916. if (type == 'view') {
  917. this.lookMember(user);
  918. }
  919. } else {
  920. uni.showToast({
  921. title: "该用户已被移除群组",
  922. icon: 'none'
  923. })
  924. this.getGroupUsers();
  925. }
  926. },
  927. logout_sub(e) {
  928. uni.showToast({
  929. icon: 'none',
  930. title: '操作成功'
  931. })
  932. },
  933. user_rename(id) {
  934. for (var i = 0; i < this.members.length; i++) {
  935. if (this.members[i].id == id) {
  936. this.members[i].nameset = true;
  937. } else {
  938. this.members[i].nameset = false;
  939. }
  940. }
  941. },
  942. sub_rename(id) {
  943. var nickname = "";
  944. for (var i = 0; i < this.members.length; i++) {
  945. if (this.members[i].id == id) {
  946. var user = this.members[i];
  947. if (user.name == user.nickname) nickname = user.name;
  948. else nickname = user.nickname;
  949. }
  950. this.members[i].nameset = false;
  951. }
  952. var postdata = {
  953. group_id: this.group_id,
  954. content: nickname,
  955. userid: id
  956. };
  957. var that = this;
  958. http.setWait(false).post('group.php?act=setGroupNickname', postdata).then(res => {
  959. if (res.code == 200) {
  960. uni.showToast({
  961. title: "操作成功",
  962. icon: 'none'
  963. })
  964. this.getGroupUsers();
  965. } else {
  966. uni.showToast({
  967. title: res.message,
  968. icon: 'none'
  969. })
  970. this.getGroupUsers();
  971. }
  972. })
  973. },
  974. tapnav(num) {
  975. this.navselect = num;
  976. if (num == 1) this.show_men = this.members
  977. if (num == 2) this.getnoteinfo();
  978. this.note_add = false;
  979. },
  980. GroupUpdate() {
  981. let data = {
  982. group_id: this.group.id,
  983. type: 'GroupUpdate'
  984. }
  985. this.$socket.send(data);
  986. },
  987. qrcode() {
  988. this.$jump('group.qrcode', {
  989. id: this.group_id
  990. });
  991. },
  992. login_btn() {
  993. uni.setStorageSync('gourl', '/pages/group/detail?id=' + this.group_id);
  994. this.$jump('login.index');
  995. },
  996. go_chat() {
  997. if (this.from == 'chat') {
  998. uni.navigateBack();
  999. } else {
  1000. this.$jump('group.chat', {
  1001. id: this.group.id,
  1002. nickname: this.group.nickname
  1003. });
  1004. }
  1005. },
  1006. apply_group() {
  1007. if (uni.getStorageSync('access_token') > 0) {
  1008. var user = uni.getStorageSync('userInfo');
  1009. if (user.issetname == 1) {
  1010. if (this.fromtype == 'qrcode' || this.group.no_invite == 0) {
  1011. var data = {
  1012. type: 'Join_Group',
  1013. userid: user.id,
  1014. group_id: this.group_id
  1015. };
  1016. this.$socket.send(data);
  1017. } else {
  1018. this.isreq = true;
  1019. }
  1020. } else {
  1021. action.profileTips('未设置昵称,不能申请加入群组', '/pages/group/detail?id=' + this.group_id);
  1022. }
  1023. } else {
  1024. action.loginTips('您还没有登录,不能申请加入群组', '/pages/group/detail?id=' + this.group_id);
  1025. }
  1026. },
  1027. apply_join() {
  1028. var data = {
  1029. type: 'Apply_Group',
  1030. userid: this.userid,
  1031. group_id: this.group_id,
  1032. content: this.reqcon
  1033. };
  1034. this.$socket.send(data);
  1035. uni.showLoading({
  1036. title: '申请中'
  1037. })
  1038. this.isreq = false;
  1039. },
  1040. users_set(data) {
  1041. var num = 0;
  1042. for (var i = 0; i < data.length; i++) {
  1043. var item = data[i];
  1044. if (item.type == 'owner' || item.type == 'manager') num++;
  1045. item.menu = false;
  1046. item.nameset = false;
  1047. data[i] = item
  1048. }
  1049. this.managenum = num;
  1050. uni.setStorageSync(this.group_id + '_group_members', data);
  1051. this.members = data;
  1052. },
  1053. getGroupUsers() {
  1054. this.users_set(uni.getStorageSync(this.group_id + '_group_members'))
  1055. api.getGroupUsers({
  1056. group_id: this.group_id,
  1057. userid: this.userid,
  1058. }).then(res => {
  1059. this.users_set(res.data);
  1060. })
  1061. },
  1062. group_set(result) {
  1063. this.isloading = false;
  1064. var that = this;
  1065. this.group = result;
  1066. result.tag = result.tags.split(',');
  1067. uni.setStorageSync('group_' + result.id, result);;
  1068. this.addtime = action.timestampToTime(result.addtime)
  1069. // console.log(result);
  1070. that.isOwner = result.owner;
  1071. that.is_manager = result.is_manager;
  1072. that.isin = result.isin;
  1073. that.group = that.info = result;
  1074. that.no_speaking = parseInt(result.no_speaking) ? true : false;
  1075. //that.forbid_redpack = parseInt(result.forbid_redpack) ? true : false;
  1076. that.no_invite = parseInt(result.no_invite) ? true : false;
  1077. that.no_add = parseInt(result.no_add) ? true : false
  1078. that.no_add1 = this.no_add;
  1079. //that.no_tip = parseInt(result.no_tip) ? true : false;
  1080. if (this.group.avatar.indexOf('http') > -1) {
  1081. } else {
  1082. that.group.avatar = config.imgUri + that.group.avatar;
  1083. }
  1084. this.tags_select = this.group.tags;
  1085. if ((parseInt(this.group.no_add) == 1) && !this.group.owner && !this.is_manager)
  1086. this.no_add1 = true;
  1087. else this.no_add1 = false;
  1088. if ((this.isOwner == 1 || this.is_manager == 1) && this.navitem.length == 3) this.navitem.push('设置')
  1089. },
  1090. getGroupInfo() {
  1091. let that = this;
  1092. api.getGroupInfo({
  1093. group_id: this.group_id,
  1094. from_id: this.userid
  1095. }).then(res => {
  1096. let result = res.data;
  1097. this.group_set(result);
  1098. })
  1099. },
  1100. getnoteinfo() {
  1101. // this.chat_msg = ''
  1102. var postdata = {
  1103. userid: this.userid,
  1104. id: this.group_id
  1105. };
  1106. http.setWait(false).post('group.php?act=groupnote', postdata).then(res => {
  1107. if (res.code == 200) {
  1108. for (var i = 0; i < res.data.length; i++) {
  1109. if (res.data[i].content.length > 100) res.data[i].more = true;
  1110. else res.data[i].more = false;
  1111. }
  1112. this.notelist = res.data;
  1113. } else {
  1114. uni.showToast({
  1115. title: '网络错误,请稍后再试',
  1116. icon: 'none'
  1117. })
  1118. }
  1119. })
  1120. },
  1121. lookMember(e) {
  1122. return this.$jump('friend.detail', {
  1123. id: e.id,
  1124. from: 'group',
  1125. 'group_id': this.group_id
  1126. });
  1127. },
  1128. // 图片上传
  1129. upLoad(path) {
  1130. let that = this
  1131. uni.showLoading({
  1132. title: '图片上传中',
  1133. mask: true
  1134. });
  1135. console.log('图片上传中')
  1136. return new Promise((resolve, error) => {
  1137. // let arr = [];
  1138. // arr.push(path)
  1139. // const tempFilePaths = arr;
  1140. that.group.avatar = path;
  1141. that.isuploading = true;
  1142. helper.uploadFiles([path], 'images', {
  1143. type: 'avatar'
  1144. }).then(res => {
  1145. // this.group.avatar=res;
  1146. that.avatar = res.replace(config.imgUri, '');
  1147. that.isuploading = false;
  1148. api.changeSpeak({
  1149. avatar: that.avatar,
  1150. group_id: that.group.id
  1151. }).then(res => {
  1152. uni.hideLoading()
  1153. that.GroupUpdate();
  1154. that.$toast('头像上传成功').then(() => {
  1155. that.getGroupInfo();
  1156. });
  1157. });
  1158. })
  1159. })
  1160. },
  1161. chooseImage: function(index) {
  1162. const _this = this
  1163. return new Promise((ok, error) => {
  1164. // 从相册/相机选择
  1165. // 如需直接开相机或直接选相册,请只使用一个选项
  1166. const sourceType = index === 0 ? ['camera'] : ['album']
  1167. uni.chooseImage({
  1168. count: 1, //默认9
  1169. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  1170. sourceType: sourceType,
  1171. success: function(res) {
  1172. ok(res.tempFilePaths[0])
  1173. },
  1174. fail(e) {
  1175. uni.showModal({
  1176. title: '文件打开错误',
  1177. content: '请设置授权文件存储权限',
  1178. showCancel: false,
  1179. });
  1180. error(e)
  1181. }
  1182. });
  1183. })
  1184. },
  1185. onImg(type) {
  1186. const _this = this
  1187. return new Promise((ok, erro) => {
  1188. // 判断是否需要选择
  1189. if (type == 1) {
  1190. _this.showqr = false
  1191. uni.showActionSheet({
  1192. itemList: ['拍照', '选择一张照片'],
  1193. success: function(res) {
  1194. _this.showqr = true
  1195. console.log(res, '上传')
  1196. _this.chooseImage(res.tapIndex).then((url) => {
  1197. console.log(url, 'url');
  1198. ok(url)
  1199. }).catch((res) => {
  1200. erro(res)
  1201. })
  1202. },
  1203. fail: function(res) {
  1204. erro(res)
  1205. _this.showqr = true
  1206. console.log(res.errMsg);
  1207. }
  1208. });
  1209. }
  1210. // 判断是否只需要拍照
  1211. if (type == 2) {
  1212. _this.chooseImage(0).then((url) => {
  1213. ok(url)
  1214. }).catch((res) => {
  1215. erro(res)
  1216. })
  1217. }
  1218. })
  1219. },
  1220. //图像裁剪
  1221. navCroper(w, h, type) {
  1222. let that = this;
  1223. let tt = (type == 'upimg' ? 2 : 1)
  1224. this.onImg(tt).then((url) => {
  1225. uni.navigateTo({
  1226. url: `/pages/index/cropper?width=${w}&height=${h}`,
  1227. events: {
  1228. uploadSuccess(res) {
  1229. console.log(res, '这里')
  1230. that.upLoad(res).then((urldata) => {
  1231. console.log(urldata, '这里')
  1232. // that[type] = urldata.url;
  1233. })
  1234. }
  1235. },
  1236. success: function(res) {
  1237. console.log(res, 'success');
  1238. // 通过eventChannel向被打开页面传送数据
  1239. res.eventChannel.emit('urlNext', {
  1240. url
  1241. })
  1242. }
  1243. })
  1244. })
  1245. },
  1246. },
  1247. onShow() {
  1248. this.getGroupUsers();
  1249. var that = this;
  1250. this.getnoteinfo()
  1251. },
  1252. onLoad(opts) {
  1253. this.from = opts.from ? opts.from : '';
  1254. let that = this;
  1255. this.group_id = opts.id;
  1256. if (opts.id > 0) {
  1257. try {
  1258. this.group = uni.getStorageSync('group_' + this.group_id);;
  1259. if (this.group.id == opts.id) {
  1260. this.isloading = false;
  1261. this.group_set(this.group);
  1262. } else {
  1263. this.group.id = this.group_id;
  1264. }
  1265. } catch (e) {
  1266. //TODO handle the exception
  1267. }
  1268. var msgtop = uni.getStorageSync('msgtop');
  1269. var istop = 0;
  1270. for (var i = 0; i < msgtop.length; i++) {
  1271. if (msgtop[i] == 'G' + this.group_id) {
  1272. this.istop = true;
  1273. break;
  1274. }
  1275. }
  1276. var msgnotip = uni.getStorageSync('msgnotip');
  1277. for (var i = 0; i < msgnotip.length; i++) {
  1278. if (msgnotip[i] == 'G' + this.group_id) {
  1279. this.no_tip = true;
  1280. break;
  1281. }
  1282. }
  1283. this.getGroupInfo();
  1284. this.getGroupUsers()
  1285. this.$socket.on('group_update', (res) => {
  1286. that.getGroupUsers();
  1287. that.getGroupInfo();
  1288. })
  1289. this.$socket.on('apply_response', (res) => {
  1290. if (res.data.code == 1) {
  1291. var group = res.data.group;
  1292. uni.redirectTo({
  1293. url: "/pages/group/chat?id=" + group.id + '&nickname=' + group.name
  1294. })
  1295. } else {
  1296. uni.hideLoading();
  1297. uni.showToast({
  1298. icon: 'none',
  1299. title: res.data.message
  1300. })
  1301. }
  1302. })
  1303. var msgtop = uni.getStorageSync('msgtop') ? uni.getStorageSync('msgtop') : [];
  1304. msgtop.map(item => {
  1305. if (item.storekey == 'G' + this.group.id) this.istop = true;
  1306. })
  1307. var msgnotip = uni.getStorageSync('msgnotip') ? uni.getStorageSync('msgnotip') : [];
  1308. msgnotip.map(item => {
  1309. if (item.storekey == 'G' + this.group.id) this.no_tip = true;
  1310. })
  1311. } else {
  1312. uni.navigateBack()
  1313. }
  1314. }
  1315. }
  1316. </script>
  1317. <style lang="scss" scoped>
  1318. @import "@/static/css/group.css";
  1319. $avatarWidth: 50px;
  1320. @font-face {
  1321. font-family: uniicons;
  1322. font-weight: normal;
  1323. font-style: normal;
  1324. src: url('../../static/fonts/uni.ttf') format('truetype');
  1325. }
  1326. .uni-navigate-right:after {
  1327. font-family: uniicons;
  1328. content: '\e583';
  1329. position: absolute;
  1330. right: 24upx;
  1331. top: 50%;
  1332. color: #bbb;
  1333. -webkit-transform: translateY(-50%);
  1334. transform: translateY(-50%);
  1335. }
  1336. .uni-navigate-bottom:after {
  1337. font-family: uniicons;
  1338. content: '\e581';
  1339. position: absolute;
  1340. right: 24upx;
  1341. top: 50%;
  1342. color: #bbb;
  1343. -webkit-transform: translateY(-50%);
  1344. transform: translateY(-50%);
  1345. }
  1346. .uni-navigate-bottom.uni-active::after {
  1347. font-family: uniicons;
  1348. content: '\e580';
  1349. position: absolute;
  1350. right: 24upx;
  1351. top: 50%;
  1352. color: #bbb;
  1353. -webkit-transform: translateY(-50%);
  1354. transform: translateY(-50%);
  1355. }
  1356. .members {
  1357. padding: $uni-spacing-col-base $uni-spacing-row-base;
  1358. display: flex;
  1359. flex-direction: row;
  1360. flex-flow: wrap;
  1361. justify-content: flex-start;
  1362. background-color: #fff;
  1363. }
  1364. .member {
  1365. display: inline-block;
  1366. flex-direction: column;
  1367. align-items: center;
  1368. text-align: center;
  1369. justify-content: flex-start;
  1370. text-align: center;
  1371. .avatar {
  1372. display: block;
  1373. margin: 0 auto;
  1374. width: $avatarWidth;
  1375. height: $avatarWidth;
  1376. border-radius: $uni-border-radius-base;
  1377. background: rgba(0, 0, 0, 0.05);
  1378. &.emoji {
  1379. text-align: center;
  1380. background-color: #eee;
  1381. font-size: 68upx;
  1382. line-height: $avatarWidth;
  1383. color: #999;
  1384. }
  1385. }
  1386. text {
  1387. width: $avatarWidth;
  1388. text-overflow: ellipsis;
  1389. white-space: nowrap;
  1390. overflow: hidden;
  1391. font-size: 28upx;
  1392. color: #999;
  1393. }
  1394. }
  1395. .notice {
  1396. width: 500upx;
  1397. text-overflow: ellipsis;
  1398. white-space: nowrap;
  1399. overflow: hidden;
  1400. }
  1401. .btn-wrapper {
  1402. margin-top: $uni-spacing-col-base;
  1403. padding: $uni-spacing-col-lg $uni-spacing-row-lg;
  1404. }
  1405. .fromInput {
  1406. text-align: right;
  1407. font-size: 32upx;
  1408. color: #777;
  1409. }
  1410. .page {
  1411. font-size: 14px;
  1412. ;
  1413. }
  1414. .loading {
  1415. //loading动画
  1416. display: flex;
  1417. justify-content: center;
  1418. @keyframes stretchdelay {
  1419. 0%,
  1420. 40%,
  1421. 100% {
  1422. transform: scaleY(0.6);
  1423. }
  1424. 20% {
  1425. transform: scaleY(1.0);
  1426. }
  1427. }
  1428. .spinner {
  1429. margin: 20upx 0;
  1430. width: 60upx;
  1431. height: 25px;
  1432. display: flex;
  1433. align-items: center;
  1434. justify-content: space-between;
  1435. view {
  1436. background-color: #ff9800;
  1437. height: 25px;
  1438. width: 3px;
  1439. border-radius: 3px;
  1440. animation: stretchdelay 1.2s infinite ease-in-out;
  1441. }
  1442. .rect2 {
  1443. animation-delay: -1.1s;
  1444. }
  1445. .rect3 {
  1446. animation-delay: -1.0s;
  1447. }
  1448. .rect4 {
  1449. animation-delay: -0.9s;
  1450. }
  1451. .rect5 {
  1452. animation-delay: -0.8s;
  1453. }
  1454. }
  1455. }
  1456. </style>