jubao.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view>
  3. <view v-if="XCXIsSelect == '是'" class="page" style="background-color: #ffffff;">
  4. <view class="feedback-title">
  5. <text>问题和意见</text>
  6. <text @tap="chooseMsg">快速键入</text>
  7. </view>
  8. <view class="feedback-body"><textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content"
  9. class="feedback-textare" /></view>
  10. <view class="feedback-title"><text>电话/微信</text></view>
  11. <view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact"
  12. placeholder="方便我们联系你 " />
  13. </view>
  14. <view class="feedback-title"><text>上传图片</text></view>
  15. <view class="imgs flex align-center justify-between flex-wrap">
  16. <!-- imgs -->
  17. <view class="imgs-item" v-for="(item, index) in imgs" :key="index">
  18. <image :src="item" mode="aspectFill"></image>
  19. <view class="imgs-item-close" @click="close(index)">
  20. <u-icon name="close-circle" color="red" size="38"></u-icon>
  21. </view>
  22. </view>
  23. <view class="imgs-item" @click="uploadImg">
  24. <u-icon name="photo" color="#016BF6" size="58"></u-icon>
  25. <view class="imgs-item-txt">
  26. 上传图片
  27. </view>
  28. </view>
  29. <view class="imgs-item" style="height: 0;">
  30. </view>
  31. </view>
  32. <button style="" class="feedback-submit" @tap="send">提交</button>
  33. </view>
  34. <view class="" v-else>
  35. 帮助中心,联系我们,为你提供帮助
  36. </view>
  37. <!-- 权限说明弹窗 -->
  38. <u-popup mode="top" ref="permission">
  39. <view class="popup-content">
  40. <view class="popup-text-permission">选择/拍摄照片需要相机/相册权限,用于上传用户头像</view>
  41. </view>
  42. </u-popup>
  43. </view>
  44. </template>
  45. <script>
  46. import config from '../../common/config';
  47. export default {
  48. data() {
  49. return {
  50. msgContents: ['岗位不符', '虚假岗位', '内容违规', '虚假招聘'],
  51. stars: [1, 2, 3, 4, 5],
  52. imageList: [],
  53. sendDate: {
  54. score: 5,
  55. content: '',
  56. contact: ''
  57. },
  58. postPushId: '',
  59. XCXIsSelect: '是',
  60. imgs: [],
  61. resumesId: '',
  62. };
  63. },
  64. onLoad(e) {
  65. this.XCXIsSelect = uni.getStorageSync('XCXIsSelect')
  66. if (e.resumesId) {
  67. this.resumesId = e.resumesId
  68. }
  69. if (e.postPushId) {
  70. this.postPushId = e.postPushId
  71. }
  72. // #ifdef APP
  73. let deviceInfo = {
  74. appid: plus.runtime.appid,
  75. imei: plus.device.imei, //设备标识
  76. p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  77. md: plus.device.model, //设备型号
  78. app_version: plus.runtime.version,
  79. plus_version: plus.runtime.innerVersion, //基座版本号
  80. os: plus.os.version,
  81. net: '' + plus.networkinfo.getCurrentType()
  82. };
  83. this.sendDate = Object.assign(deviceInfo, this.sendDate);
  84. // #endif
  85. },
  86. methods: {
  87. //上传图片
  88. async uploadImg() {
  89. let that = this
  90. // // 1. 先判断系统类型,区分Android/iOS权限
  91. // const systemInfo = uni.getSystemInfoSync();
  92. // const isAndroid = systemInfo.system.includes('Android');
  93. // const permissionType = isAndroid ? 'storage' : 'photos'; // Android=存储,iOS=相册
  94. // // 2. 权限检查(复用之前封装的 checkPermission 函数)
  95. // const hasPermission = this.$queue.checkPermission(
  96. // permissionType,
  97. // isAndroid
  98. // ? '选择/拍摄照片需要相机/相册权限,用于上传举报证据' // Android 专属提示
  99. // : '选择/拍摄照片需要相机/相册权限,用于上传举报证据'
  100. // );
  101. // if (!hasPermission) {
  102. // uni.showToast({ title: '未获取权限,无法选择照片', icon: 'none' });
  103. // return;
  104. // }
  105. // 1. 检查权限状态
  106. const hasPermission = await this.$queue.checkPermission(
  107. 'camera',
  108. '选择/拍摄照片需要相机/相册权限,用于上传用户头像',
  109. this
  110. );
  111. // 2. 如果未授权或者用户拒绝,显示提示
  112. if (!hasPermission) {
  113. return;
  114. }
  115. uni.chooseImage({
  116. count: 1, //默认9
  117. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  118. sourceType: ['album'], //从相册选择
  119. success: function (res) {
  120. uni.showLoading({
  121. title: '上传中...'
  122. });
  123. uni.uploadFile({
  124. url: 'https://h5.bosszan.com/sqx_fast/alioss/upload',
  125. // url: config.APIHOST + '/alioss/upload',
  126. filePath: res.tempFilePaths[0],
  127. name: 'file',
  128. success: uploadFileRes => {
  129. uni.hideLoading();
  130. let url = JSON.parse(uploadFileRes.data);
  131. console.log(url)
  132. that.imgs.push(url.data)
  133. },
  134. fail() {
  135. uni.hideLoading()
  136. uni.showToast({
  137. title: '上传失败',
  138. icon: 'none'
  139. })
  140. }
  141. });
  142. }
  143. });
  144. },
  145. close(e) {
  146. this.imgs.splice(e, 1);
  147. },
  148. chooseMsg() {
  149. //快速输入
  150. uni.showActionSheet({
  151. itemList: this.msgContents,
  152. success: res => {
  153. this.sendDate.content = this.msgContents[res.tapIndex];
  154. }
  155. });
  156. },
  157. chooseStar(e) {
  158. //点击评星
  159. this.sendDate.score = e;
  160. },
  161. previewImage() {
  162. //预览图片
  163. uni.previewImage({
  164. urls: this.imageList
  165. });
  166. },
  167. send() {
  168. //发送反馈
  169. console.log(JSON.stringify(this.sendDate));
  170. if (!this.sendDate.content) {
  171. uni.showToast({
  172. icon: 'none',
  173. title: '请输入反馈内容'
  174. });
  175. return;
  176. }
  177. if (!this.sendDate.contact) {
  178. uni.showToast({
  179. icon: 'none',
  180. title: '请填写电话或微信'
  181. });
  182. return;
  183. }
  184. this.$queue.showLoading('加载中...');
  185. if (this.imgs.length > 0) {
  186. this.sendDate.imgs = this.imgs.join(',')
  187. }
  188. this.$Request.postJson('/app/message/insertMessage', {
  189. title: this.sendDate.contact,
  190. content: JSON.stringify(this.sendDate),
  191. state: this.postPushId ? 3 : 6, //3:举报岗位 6:举报简历
  192. byUserId: this.postPushId ? this.postPushId : this.resumesId
  193. }).then(res => {
  194. if (res.code === 0) {
  195. uni.showToast({
  196. title: '提交成功'
  197. });
  198. setTimeout(function () {
  199. uni.navigateBack();
  200. }, 1000);
  201. } else {
  202. uni.hideLoading();
  203. uni.showModal({
  204. showCancel: false,
  205. title: '投诉失败',
  206. content: res.msg
  207. });
  208. }
  209. });
  210. }
  211. }
  212. };
  213. </script>
  214. <style>
  215. @font-face {
  216. font-family: uniicons;
  217. font-weight: normal;
  218. font-style: normal;
  219. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  220. }
  221. page {
  222. background-color: #F5F5F5 !important;
  223. }
  224. view {
  225. font-size: 28upx;
  226. }
  227. /*问题反馈*/
  228. .feedback-title {
  229. display: flex;
  230. flex-direction: row;
  231. justify-content: space-between;
  232. align-items: center;
  233. padding: 20upx;
  234. color: #8f8f94;
  235. font-size: 28upx;
  236. }
  237. .feedback-star-view.feedback-title {
  238. justify-content: flex-start;
  239. margin: 0;
  240. }
  241. .feedback-body {
  242. font-size: 32upx;
  243. padding: 16upx;
  244. margin: 16upx;
  245. border-radius: 16upx;
  246. background: #FFFFFF;
  247. /* color: #FFF; */
  248. }
  249. .feedback-textare {
  250. height: 200upx;
  251. font-size: 34upx;
  252. line-height: 50upx;
  253. width: 100%;
  254. box-sizing: border-box;
  255. padding: 20upx 30upx 0;
  256. }
  257. .feedback-input {
  258. font-size: 32upx;
  259. height: 60upx;
  260. padding: 15upx 20upx;
  261. line-height: 60upx;
  262. }
  263. .imgs {
  264. margin: 20rpx;
  265. }
  266. .imgs-item {
  267. width: 220rpx;
  268. height: 220rpx;
  269. background-color: #f5f5f5;
  270. margin-bottom: 20rpx;
  271. border-radius: 10rpx;
  272. display: flex;
  273. flex-direction: column;
  274. align-items: center;
  275. justify-content: center;
  276. position: relative;
  277. }
  278. .imgs-item-close {
  279. position: absolute;
  280. top: 0;
  281. right: 0;
  282. }
  283. .imgs-item image {
  284. width: 100%;
  285. height: 100%;
  286. border-radius: 10rpx;
  287. }
  288. .feedback-submit {
  289. background: #016BF6;
  290. color: #ffffff;
  291. margin: 20upx;
  292. margin-top: 32upx;
  293. }
  294. </style>