123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- // pages/report/report.js
- const request = require("../../utils/request.js");
- const login = require("../../utils/login.js");
- const uploadImage = require('../../utils/uploadFile.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- uploadURL: request._debug ? 'test/toktok/report/report_image/' : 'toktok/report/report_image/',
- TypeList: [
- {name: '违法违规', value:'Illegal'},
- {name: '色情低俗', value:'Porn'},
- {name: '虚假不实', value:'Fake'},
- {name: '谩骂攻击', value:'Obloquy'},
- {name: '其他', value:'Other'}
- ],
- imgList: [],
- parmas: {
- targetType: '',
- reason: '',
- targetId: '',
- reportType: '',
- imgUrls: ''
- }
- },
- submitFun() {
- let that = this;
- that.data.parmas.imgUrls = that.data.imgList.join(';'),
- request.postData(
- 'app/op/report',
- that.data.parmas,
- res => {
- wx.showToast({
- title: '举报成功',
- icon: 'none',
- duration: 2000
- })
- setTimeout(function () {
- wx.navigateBack({
- delta: 1
- })
- }, 3000)
- }
- )
- },
- delFun(event) {
- let index = event.currentTarget.dataset.idx;
- this.data.imgList.splice(index,1)
- this.setData({
- imgList: this.data.imgList
- })
- },
- uploadImg() {
- let that = this;
- let count = Number(3 - that.data.imgList.length);
- wx.chooseMedia({
- count: count,
- mediaType: ['image'],
- sourceType: ['album', 'camera'],
- success(res) {
- console.log(res)
- const tempFiles = res.tempFiles;
- tempFiles.forEach(function(value, index) {
- uploadImage(value.tempFilePath, that.data.uploadURL,
- function(res) {
- that.data.imgList.push(res)
- that.setData({
- imgList: that.data.imgList
- })
- },
- function(res) {
- console.log(res)
- })
- })
- }
- })
- },
- getbindinput(event) {
- this.data.parmas.reason = event.detail.value;
- this.setData({
- parmas: this.data.parmas
- })
- },
- checkTypeFun(event) {
- this.data.parmas.reportType = event.currentTarget.dataset.value;
- this.setData({
- parmas: this.data.parmas
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- login.getAssumeRole()
- this.data.parmas.targetType = options.targetType;
- this.data.parmas.targetId = options.targetId;
- this.setData({
- parmas: this.data.parmas
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|