index-nav.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view>
  3. <swiper style="resistanceRatio : 0" class="swiper" :style="'height: '+currentPageHeight+'upx;'"
  4. :duration="duration" :interval="interval" :autoplay="autoplay" @change="categoryChange">
  5. <swiper-item v-for="(page, pageindex) in categoryList" :key="pageindex">
  6. <view class="category-list">
  7. <view class="icon" v-for="category in page" :key="category.cat_id" @tap="tapEvent(category)">
  8. <image :src="category.img" style="width: 50px;height: 50px;"></image>
  9. <view class="category-title">{{ category.title }}</view>
  10. </view>
  11. </view>
  12. </swiper-item>
  13. </swiper>
  14. <view class="dots">
  15. <view v-for="(page, pageindex) in categoryList" :key="pageindex"
  16. :class="{ active: pageindex == currentPageindex }"></view>
  17. </view>
  18. <u-toast :type="type" ref="uToast"></u-toast>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. mapState,
  24. mapMutations
  25. } from "vuex";
  26. import {
  27. pathToBase64,
  28. base64ToPath
  29. } from '@/common/image-tools-base64.js';
  30. import bankBin from "@/common/bankcardinfo.js"
  31. export default {
  32. props: {
  33. resdata: Array,
  34. row: {
  35. type: Number,
  36. default: 2
  37. },
  38. autoplay: { //自动轮播
  39. type: Boolean,
  40. default: true,
  41. },
  42. duration: { //切换时长
  43. type: Number,
  44. default: 500
  45. },
  46. interval: { //间隔时长
  47. type: Number,
  48. default: 5000
  49. }
  50. },
  51. data() {
  52. return {
  53. xuelishow: false,
  54. border: false,
  55. form: {
  56. name: "",
  57. identifyNumber: "",
  58. identifyValidDate: "",
  59. address: "",
  60. name4: "",
  61. name5: "",
  62. xueli: "",
  63. },
  64. labelPosition: 'left',
  65. errorType: ['message'],
  66. type: 'warning',
  67. title: '请先实名认证',
  68. icon: true,
  69. position: 'center',
  70. url: '',
  71. show1: false,
  72. content: '慈母手中线,游子身上衣',
  73. contentSlot: true,
  74. showTitle: false,
  75. asyncClose: false,
  76. currentPageindex: 0,
  77. currentPageHeight: "310upx",
  78. getApplicationStatus: "",
  79. }
  80. },
  81. computed: {
  82. categoryList() {
  83. this.currentPageHeight = 150 * this.row + 10;
  84. let totalPages = Math.floor(this.resdata.length / (this.row * 5));
  85. if (this.resdata.length % (this.row * 5) != 0) {
  86. totalPages += 1;
  87. }
  88. let list = [];
  89. for (let i = 0; i < totalPages; i++) {
  90. let item = [];
  91. item = this.resdata.slice(this.row * 5 * i, this.row * 5 * (i + 1));
  92. list.push(item)
  93. }
  94. return list;
  95. },
  96. ...mapState(['userInfo'])
  97. },
  98. onReady() {
  99. this.$refs.uForm.setRules(this.rules);
  100. },
  101. methods: {
  102. // 验证银行卡
  103. async validateBankCard() {
  104. var that = this;
  105. that.bankname = "";
  106. await bankBin.getBankBin(this.form.name4)
  107. .then((data) => {
  108. that.form.name5 = data.bankName;
  109. return true;
  110. })
  111. .catch((err) => {
  112. return uni.showToast({
  113. title: err.split(":")[1],
  114. icon: "none"
  115. });
  116. })
  117. },
  118. async chooseImage() {
  119. var _this = this;
  120. uni.chooseImage({
  121. count: 1,
  122. sizeType: "compressed",
  123. success(res) {
  124. pathToBase64(res.tempFilePaths[0])
  125. .then(async base64 => {
  126. var paramImg = {
  127. "image": base64, //图片base64
  128. "imgType": "1" //1身份证 2行驶证
  129. }
  130. let res2 = await _this.$http.post('/api/huanong/imgAI', paramImg);
  131. var data = res2.data.customerInfo;
  132. data.identifyValidDate = data.identifyValidDate.substr(0, 4) + '-' +
  133. data.identifyValidDate.substr(4, 2) + "-" + data.identifyValidDate
  134. .substr(6, 2)
  135. _this.form.name = data.name;
  136. _this.form.identifyNumber = data.identifyNumber;
  137. _this.form.identifyValidDate = data.identifyValidDate;
  138. })
  139. }
  140. });
  141. },
  142. show() {
  143. this.$refs.uToast.show({
  144. title: this.title,
  145. position: this.position,
  146. type: this.type,
  147. icon: this.icon,
  148. duration: 1000,
  149. });
  150. },
  151. event(item) {},
  152. //分类跳转
  153. async tapEvent(e) {
  154. console.log(e);
  155. this.form.name = "";
  156. this.form.identifyNumber = "";
  157. this.form.identifyValidDate = "";
  158. this.form.address = "";
  159. this.form.name4 = "";
  160. this.form.name5 = "";
  161. this.form.xueli = "";
  162. if (this.userInfo.sysUser.usertype == 'A') {
  163. return uni.showToast({
  164. icon: "none",
  165. title: '没有权限',
  166. duration: 1500
  167. })
  168. }
  169. if (this.userInfo.sysUser.status == '2') {
  170. uni.showToast({
  171. icon: "none",
  172. title: '请先通过实名认证',
  173. duration: 1500
  174. })
  175. } else if (this.userInfo.sysUser.status == '1') {
  176. if (!e.src || e.src == '#' || e.src == '') {
  177. uni.showToast({
  178. icon: "none",
  179. title: '正在开发中...',
  180. duration: 1500
  181. })
  182. } else {
  183. this.navigate({
  184. url: e.src
  185. }, "navigateTo", true)
  186. }
  187. }
  188. // if (this.userInfo.sysUser.status == '2') {
  189. // let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
  190. // if (res.code == 200) {
  191. // this.getApplicationStatus = res.data;
  192. // if (this.getApplicationStatus == '0') {
  193. // if (!e.src || e.src == '#' || e.src == '') {
  194. // uni.showToast({
  195. // icon: "none",
  196. // title: '正在开发中...',
  197. // duration: 1500
  198. // })
  199. // } else {
  200. // uni.showToast({
  201. // icon: "none",
  202. // title: '该账户已删除',
  203. // duration: 1500
  204. // })
  205. // }
  206. // } else if (this.getApplicationStatus == '3') {
  207. // if (!e.src || e.src == '#' || e.src == '') {
  208. // uni.showToast({
  209. // icon: "none",
  210. // title: '正在开发中...',
  211. // duration: 1500
  212. // })
  213. // } else {
  214. // uni.showToast({
  215. // icon: "none",
  216. // title: '实名认证不通过,请修改后提交',
  217. // duration: 1500
  218. // })
  219. // setTimeout(() => {
  220. // uni.navigateTo({
  221. // url: '/pages/user/certification'
  222. // })
  223. // }, 1000)
  224. // }
  225. // }
  226. // else if (this.getApplicationStatus == '2') {
  227. // uni.showToast({
  228. // icon: "none",
  229. // title: '请先通过实名认证',
  230. // duration: 1500
  231. // })
  232. // }
  233. // } else {
  234. // if (!e.src || e.src == '#' || e.src == '') {
  235. // uni.showToast({
  236. // icon: "none",
  237. // title: '正在开发中...',
  238. // duration: 1500
  239. // })
  240. // } else {
  241. // this.show();
  242. // setTimeout(() => {
  243. // uni.navigateTo({
  244. // url: '/pages/user/infoInput'
  245. // })
  246. // }, 1000)
  247. // }
  248. // }
  249. // } else if (this.userInfo.sysUser.status == '1') {
  250. // if (!e.src || e.src == '#' || e.src == '') {
  251. // uni.showToast({
  252. // icon: "none",
  253. // title: '正在开发中...',
  254. // duration: 1500
  255. // })
  256. // } else {
  257. // this.navigate({
  258. // url: e.src
  259. // }, "navigateTo", true)
  260. // }
  261. // } else {
  262. // this.show1 = false;
  263. // }
  264. },
  265. xueliConfirm(e) {
  266. this.form.xueli = e[0].value;
  267. },
  268. //更新分类指示器
  269. categoryChange(event) {
  270. this.currentPageindex = event.detail.current;
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .dots {
  277. display: flex;
  278. justify-content: center;
  279. height: 15upx;
  280. width: 100%;
  281. }
  282. .dots>view {
  283. width: 30upx;
  284. height: 5upx;
  285. background-color: rgba(0, 0, 0, 0.2);
  286. }
  287. .dots>view.active {
  288. background-color: #0A98D5;
  289. }
  290. .swiper {
  291. padding: 10upx 0upx;
  292. }
  293. .category-list {
  294. width: 100%;
  295. height: auto;
  296. display: flex;
  297. justify-content: flex-start;
  298. flex-flow: wrap;
  299. }
  300. .category-title {
  301. font-size: 25upx;
  302. }
  303. .icon {
  304. margin-top: 5upx;
  305. margin-bottom: 5upx;
  306. width: 20%;
  307. height: 150upx;
  308. display: flex;
  309. flex-flow: wrap;
  310. justify-content: center;
  311. font-size: 25upx;
  312. color: #666;
  313. }
  314. .icon image {
  315. margin: 5upx;
  316. width: 65%;
  317. }
  318. .icon>view {
  319. width: 100%;
  320. display: flex;
  321. justify-content: center;
  322. }
  323. </style>