interfaceDetail.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="Address">
  3. <view class="Address_haeder">
  4. <view class="Address_haeder_title">
  5. {{api_name}}接口申请
  6. </view>
  7. 你正在提交接口申请,所有信息请如实填写,所填信息只用于审核。
  8. </view>
  9. <form @submit="save">
  10. <view class="Address_main">
  11. <view class="Address_item">
  12. <view class="Address_item_title">
  13. 申请原因
  14. </view>
  15. <view class="">
  16. <textarea name="content" maxlength="300" placeholder-class="Address_item_placeholder" :value="my_value"
  17. placeholder="详细描述接口能力的具体使用场景如:因当前业务涉及外卖送餐服务,需获取用户地理位置信息。" />
  18. </view>
  19. </view>
  20. <view class="Address_item">
  21. <view class="Address_item_title">
  22. 辅助网页
  23. (选填)
  24. </view>
  25. <view>
  26. <input name="url" type="text" placeholder-class="Address_item_placeholder" placeholder="可上传官网链接协助审核" />
  27. </view>
  28. </view>
  29. <view class="Address_item">
  30. <view class="Address_item_title">
  31. 辅助图片
  32. (选填)
  33. </view>
  34. <view>
  35. <view class="tip">
  36. 可上传小程序截图,最多上传10张图片。图片支持jpg、jpeg、bmp、gif或png格式,图片大小不超过5M。
  37. </view>
  38. <image class="add_icon" @click="uploadFile" src="../static/images/icon_6.png">
  39. </image>
  40. <block v-if="img_arr.length>0">
  41. <view class="add_icon" v-for="(item,index) of img_arr">
  42. <image class="img" :src="URL+item" :key='index'></image>
  43. <image @click="bindDel(index)" src="../static/images/shanchu.png" class="del"></image>
  44. </view>
  45. </block>
  46. </view>
  47. <view>
  48. <view class="tip">
  49. 可上传小程序使用录屏,最多上传1个视频。视频支持mp4格式,视频大小不超过20M。
  50. </view>
  51. <image class="add_icon" @click="chooseVideo" src="../static/images/icon_6.png">
  52. </image>
  53. <view v-if="video_url">
  54. <video style="width: 100%;" :src="URLVideo+video_url" controls></video>
  55. </view>
  56. </view>
  57. </view>
  58. <button type="primary" formType="submit">提交申请</button>
  59. </view>
  60. </form>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. img_arr: [],
  68. URL: getApp().globalData.URL,
  69. URLVideo: getApp().globalData.URL + '/uploads/video/',
  70. video_url: '',
  71. api_name:'',
  72. my_value:'',
  73. }
  74. },
  75. onLoad(e) {
  76. this.api_name= e.api_name ||'wx.getLocation';
  77. let my_value;
  78. if(e.api_name == 'wx.getLocation'){
  79. my_value="需要获取用户定位,用于计算客户与我司的位置距离,方便客户导航到我司。"
  80. }else if(e.api_name == 'wx.chooseLocation'){
  81. my_value="打开地图选择位置:因涉及消费者填写收货地址,需要申请打开地图选择位置方便用户选择位置;商家把线下把货送给消费者。"
  82. }else if(e.api_name == 'wx.chooseAddress'){
  83. my_value="因涉及商家把货送给用户,需要申请获取用户收货地址。"
  84. }
  85. this.my_value =my_value
  86. },
  87. methods: {
  88. save(e){
  89. let params = e.detail.value;
  90. let data = Object.assign({
  91. admin_id:uni.getStorageSync("admin_id"),
  92. images:this.img_arr.join(","),
  93. video:this.video_url,
  94. api_name:this.api_name
  95. }, params);
  96. this.request({
  97. url: "Smdcshop/apply_privacy_interface",
  98. data,
  99. hide:true
  100. }).then(res => {
  101. console.log(res, "res")
  102. if (res.code === '200') {
  103. console.log(res)
  104. uni.showToast({
  105. title: "提交成功",
  106. icon: 'none',
  107. duration: 1000
  108. })
  109. setTimeout(() => {
  110. uni.navigateBack({
  111. delta: 1
  112. })
  113. }, 1500)
  114. }
  115. }).catch((err) => {
  116. console.log(err)
  117. uni.showModal({
  118. title:"提示",
  119. content: err.message,
  120. showCancel:true,
  121. confirmText:"复制错误",
  122. success:(res)=>{
  123. res.confirm && uni.setClipboardData({
  124. data: err.message,
  125. success: function(r) {
  126. console.log('赋能成功', r);
  127. }
  128. });
  129. }
  130. })
  131. // uni.showToast({
  132. // title: err.message,
  133. // icon: 'none',
  134. // duration: 2000
  135. // })
  136. })
  137. },
  138. uploadFile(e) {
  139. uni.chooseImage({
  140. success: (res) => {
  141. res.tempFilePaths.forEach((v, i) => {
  142. console.log(v)
  143. this.Upload({
  144. url: "setting/upload",
  145. data: {
  146. url: v,
  147. admin_id: uni.getStorageSync("admin_id"),
  148. }
  149. }).then(res => {
  150. console.log(res, "res")
  151. this.img_arr.push(res.src);
  152. }).catch({});
  153. })
  154. }
  155. });
  156. },
  157. chooseVideo(e) {
  158. // 上传视频
  159. uni.chooseVideo({
  160. maxDuration: 60,
  161. sourceType: ['album', 'camera'],
  162. success: (responent) => {
  163. let videoFile = responent.tempFilePath;
  164. this.Upload({
  165. url: "videofuneng/video_upload",
  166. data: {
  167. url: videoFile,
  168. type: 0,
  169. // token: uni.getStorageSync("token"),
  170. }
  171. }).then(res => {
  172. console.log(res, "res")
  173. this.video_url = res.file_name;
  174. }).catch({
  175. });
  176. }
  177. })
  178. },
  179. bindDel(index) {
  180. this.img_arr.splice(index, 1)
  181. },
  182. }
  183. }
  184. </script>
  185. <style>
  186. page {
  187. background: #F1F1F1;
  188. }
  189. .Address {
  190. padding: 20rpx;
  191. }
  192. .Address_haeder {
  193. font-size: 24rpx;
  194. color: #999
  195. }
  196. .Address_haeder_title {
  197. font-size: 34rpx;
  198. color: #000;
  199. }
  200. .Address_main {
  201. background: #FFFFFF;
  202. border-radius: 6rpx;
  203. margin-top: 20rpx;
  204. }
  205. .Address_item {
  206. padding: 20rpx;
  207. margin-bottom: 10rpx;
  208. border-bottom: 1rpx solid #F1F1F1;
  209. }
  210. .Address_item_title {
  211. padding-bottom: 20rpx;
  212. }
  213. .Address_item_placeholder {
  214. font-size: 24rpx;
  215. }
  216. .add_icon {
  217. display: inline-block;
  218. width: 200rpx;
  219. height: 200rpx;
  220. border: 1rpx solid #F1F1F1;
  221. margin: 20rpx 10rpx 20rpx 0;
  222. position: relative;
  223. }
  224. .add_icon .img {
  225. width: 100%;
  226. height: 100%;
  227. }
  228. .tip {
  229. font-size: 24rpx;
  230. color: #999
  231. }
  232. .add_icon .del {
  233. position: absolute;
  234. right: 0;
  235. top: 0;
  236. width: 40rpx;
  237. height: 40rpx;
  238. }
  239. </style>