report.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="container" ref="container">
  3. <view id="topnav" class="topnav flex-between" :style="{'height':`${topbarOffsetHeight-statusBarHeight}px`,'padding-top':`${statusBarHeight}px`,'background-color':`rgba(21, 17, 38,${topNavAlpha})`}" v-if="!cover.isFullScreen">
  4. <view class="nav-item" @click="back">
  5. <image :src="`${assetsUrl}back.png`" mode="widthFix" class="nav-img"></image>
  6. </view>
  7. <view class="nav-text font32 fw600">
  8. {{topbarTitle}}
  9. </view>
  10. <view class="nav-item"></view>
  11. </view>
  12. <view class="tip-bar flex-between">
  13. <view class="tip-text">
  14. 如果你在72小时内向她支付 解锁私聊/查看相册 费用,则核实举报属实后,系统将自动退回相关的费用。
  15. </view>
  16. <image :src="`${assetsUrl}report-close.png`" mode="widthFix" class="tip-close"></image>
  17. </view>
  18. <view class="choose-content">
  19. <view class="choose-title">
  20. 请选择举报原因
  21. </view>
  22. <view class="choose-list">
  23. <view class="choose-item flex-start" v-for="(item,index) in chooses" :key="index" @click="chooseItem(index)">
  24. <view :class="chooseIndex===index?'choosed-icon':'choose-icon'"></view>
  25. <view class="choose-text">
  26. {{item}}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="add-img-tip">
  31. 请提供相关截图,一遍我们跟进核实
  32. </view>
  33. <view class="img-box flex-start">
  34. <image :src="item" v-for="(item,index) in imgs" :key="index" class="img" @click="previewImg(item,index)"></image>
  35. <image :src="`${assetsUrl}report-add.png`" mode="widthFix" class="img" @click="chooseMedia"></image>
  36. </view>
  37. <view class="textarea-box">
  38. <textarea placeholder="补充描述" class="textarea" v-model="textarea" @input="textareaInput"></textarea>
  39. <view class="num-box">
  40. {{inputCount}}/{{maxCount}}
  41. </view>
  42. </view>
  43. </view>
  44. <cover-view class="btn-box" @click="send">
  45. 确认举报
  46. </cover-view>
  47. </view>
  48. </template>
  49. <script>
  50. import {getPolicy,computeSignature,getKey} from '@/util/oss.js';
  51. import {encode} from '@/util/base64.js'
  52. export default {
  53. data() {
  54. return {
  55. topbarTitle:'匿名举报',
  56. scrollHeight:0,
  57. topNavAlpha:0,
  58. assetsUrl:this.$util.assetsUrl,
  59. id:null,
  60. chooses:['发广告','骚扰/谩骂/不文明聊天','虚假照片','发布色情/低俗/不良内容','无法联系','TA是骗子','发布招嫖信息','未成年人'],
  61. chooseIndex:0,
  62. imgs:[],
  63. textarea:'',
  64. inputCount:0,
  65. maxCount:200
  66. };
  67. },
  68. computed: {
  69. statusBarHeight() {
  70. return this.$store.state.statusBarHeight;
  71. },
  72. topbarOffsetHeight() {
  73. return this.$store.state.topbarOffsetHeight;
  74. },
  75. platForm(){
  76. return this.$store.state.platform
  77. },
  78. mineInfo(){
  79. return this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))
  80. }
  81. },
  82. onLoad(options) {
  83. this.id=options.id;
  84. console.log(this.id)
  85. },
  86. mounted() {
  87. },
  88. onPageScroll(e) {
  89. this.topNavAlpha=e.scrollTop/250;
  90. this.scrollTop=e.scrollTop;
  91. },
  92. onShareAppMessage(){
  93. return {
  94. title: '糖果公园',
  95. path: `/pages/login/login?share=${this.userInfo.inviteCode}`,
  96. }
  97. },
  98. methods:{
  99. back(){
  100. uni.navigateBack({
  101. delta:1
  102. })
  103. },
  104. chooseItem(index){
  105. this.chooseIndex=index;
  106. },
  107. chooseMedia(){
  108. const that=this;
  109. uni.chooseMedia({
  110. count: 1,
  111. mediaType: ['image'],
  112. sourceType: ['album', 'camera'],
  113. maxDuration: 30,
  114. camera: 'back',
  115. success:(res)=>{
  116. console.log(res.tempFiles[0]);
  117. uni.showLoading({
  118. title:'正在上传',
  119. mask:true
  120. })
  121. const policyText=getPolicy();
  122. const policy=encode(JSON.stringify(policyText));
  123. const key=getKey(0,res.tempFiles[0].tempFilePath.split('.')[1]);
  124. that.$api.public.aliossToken({}).then(resuslt=>{
  125. let formData={
  126. key:key,
  127. policy:policy,
  128. OSSAccessKeyId:resuslt.data.accessKeyId,
  129. signature:computeSignature(resuslt.data.accessKeySecret,policy),
  130. 'x-oss-security-token':resuslt.data.securityToken,
  131. success_action_status:'200'
  132. }
  133. uni.uploadFile({
  134. url: 'https://zhenyanapp-gen.oss-cn-qingdao.aliyuncs.com',
  135. filePath:res.tempFiles[0].tempFilePath,
  136. name: 'file',
  137. header:{
  138. "Content-Type": "multipart/form-data"
  139. },
  140. formData: formData,
  141. success: (data) => {
  142. if (data.statusCode === 200) {
  143. uni.hideLoading();
  144. let imageUrl=`${that.$store.state.videoCdn}/${key}`;
  145. let user=JSON.parse(uni.getStorageSync('user'));
  146. this.imgs.push(imageUrl);
  147. }
  148. },
  149. fail: err => {
  150. console.log(err);
  151. }
  152. })
  153. })
  154. }
  155. })
  156. },
  157. textareaInput(e){
  158. this.inputCount=e.detail.value.length;
  159. },
  160. previewImg(item,index){
  161. uni.previewImage({
  162. urls:this.imgs,
  163. current:this.imgs[index]
  164. })
  165. },
  166. send(){
  167. if(this.imgs.length===0){uni.showToast({icon:'none',title:'请上传截图'});return;}
  168. // if(this.textarea===''){uni.showToast({icon:'none',title:'请填写描述'});return;}
  169. this.$api.public.accuse({desc:this.textarea,imgs:this.imgs,reason:this.chooses[this.chooseIndex],uponUserId:this.id}).then(res=>{
  170. if(res.data.succ){
  171. uni.showToast({
  172. icon:'success',
  173. title:res.data.msg
  174. })
  175. uni.navigateBack();
  176. }
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .container{
  184. width: 100vw;
  185. height: 100vh;
  186. background-color: $bgcolor1;
  187. position: relative;
  188. padding-top: 216rpx;
  189. padding-bottom: 60rpx;
  190. .topnav {
  191. position: fixed;
  192. top: 0;
  193. left: 0;
  194. width: calc(100% - 20rpx);
  195. z-index: 100;
  196. margin-left: 10rpx;
  197. backdrop-filter: blur(10px);
  198. .nav-item {
  199. width: 40rpx;
  200. height: 40rpx;
  201. margin-left: 16rpx;
  202. .nav-img{
  203. width: 40rpx;
  204. height: 40rpx;
  205. }
  206. }
  207. .nav-text{
  208. flex: 1;
  209. color: $fontcolor5;
  210. height: 40rpx;
  211. text-align: center;
  212. }
  213. }
  214. .tip-bar{
  215. background: linear-gradient(133deg, #7F5CFA 0%, #654AFE 100%);
  216. border-radius: 32rpx;
  217. margin: 0rpx 32rpx 32rpx 32rpx;
  218. padding: 16rpx 32rpx;
  219. .tip-text{
  220. font-size: 22rpx;
  221. font-family: PingFangSC-Regular, PingFang SC;
  222. font-weight: 400;
  223. color: #FFFFFF;
  224. line-height: 32rpx;
  225. width: 550rpx;
  226. height: 64rpx;
  227. }
  228. .tip-close{
  229. width: 32rpx;
  230. height: 32rpx;
  231. margin-left: 40rpx;
  232. }
  233. }
  234. .choose-content{
  235. margin: 0 32rpx;
  236. border-radius: 16rpx;
  237. background-color: #1F1A30;
  238. padding: 32rpx;
  239. .choose-title{
  240. font-size: 32rpx;
  241. font-weight: 600;
  242. color: #FFFFFF;
  243. line-height: 44rpx;
  244. margin-bottom: 40rpx;
  245. text-align: center;
  246. }
  247. .choose-item{
  248. margin-bottom: 32rpx;
  249. .choose-icon{
  250. width: 32rpx;
  251. height: 32rpx;
  252. background: #332D4C;
  253. border-radius: 32rpx;
  254. }
  255. .choosed-icon{
  256. background: #6C52F4;
  257. border: 4rpx solid #FFFFFF;
  258. width: 32rpx;
  259. height: 32rpx;
  260. border-radius: 32rpx;
  261. box-sizing: border-box;
  262. }
  263. .choose-text{
  264. font-size: 28rpx;
  265. font-family: PingFangSC-Regular, PingFang SC;
  266. font-weight: 400;
  267. color: #FFFFFF;
  268. line-height: 40rpx;
  269. margin-left: 16rpx;
  270. }
  271. }
  272. }
  273. .btn-box{
  274. width: 622rpx;
  275. height: 104rpx;
  276. line-height: 104rpx;
  277. background: #6C52F4;
  278. border-radius: 56rpx;
  279. color: #ffffff;
  280. text-align: center;
  281. position: fixed;
  282. left: 50%;
  283. transform: translateX( -311rpx );
  284. bottom: 44rpx;
  285. z-index: 999;
  286. }
  287. .add-img-tip{
  288. font-size: 22rpx;
  289. font-weight: 400;
  290. color: #7D7DA4;
  291. line-height: 32rpx;
  292. margin-top: 56rpx;
  293. margin-bottom: 32rpx;
  294. }
  295. .img-box{
  296. flex-wrap: wrap;
  297. .img{
  298. width: 200rpx;
  299. height: 200rpx;
  300. border-radius: 16rpx;
  301. margin-top: 7rpx;
  302. margin-right: 7rpx;
  303. }
  304. }
  305. .textarea-box{
  306. margin-top: 32rpx;
  307. padding: 32rpx;
  308. background-color: #332D4C;
  309. position: relative;
  310. .textarea{
  311. background-color: #332D4C;
  312. width: 100%;
  313. color: #ffffff;
  314. }
  315. .num-box{
  316. position: absolute;
  317. right: 10rpx;
  318. bottom: 10rpx;
  319. font-size: 22rpx;
  320. font-weight: 400;
  321. color: #7D7DA4;
  322. line-height: 32rpx;
  323. }
  324. }
  325. }
  326. </style>