jubao.vue 7.1 KB

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