index-nav.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. this.form.name = "";
  155. this.form.identifyNumber = "";
  156. this.form.identifyValidDate = "";
  157. this.form.address = "";
  158. this.form.name4 = "";
  159. this.form.name5 = "";
  160. this.form.xueli = "";
  161. if (this.userInfo.sysUser.usertype == 'A') {
  162. return uni.showToast({
  163. icon: "none",
  164. title: '没有权限',
  165. duration: 1500
  166. })
  167. }
  168. if (this.userInfo.sysUser.status == '2') {
  169. uni.showToast({
  170. icon: "none",
  171. title: '请先通过实名认证',
  172. duration: 1500
  173. })
  174. } else if (this.userInfo.sysUser.status == '1') {
  175. if (!e.src || e.src == '#' || e.src == '') {
  176. uni.showToast({
  177. icon: "none",
  178. title: '正在开发中...',
  179. duration: 1500
  180. })
  181. } else {
  182. this.navigate({
  183. url: e.src
  184. }, "navigateTo", true)
  185. }
  186. }
  187. // if (this.userInfo.sysUser.status == '2') {
  188. // let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
  189. // if (res.code == 200) {
  190. // this.getApplicationStatus = res.data;
  191. // if (this.getApplicationStatus == '0') {
  192. // if (!e.src || e.src == '#' || e.src == '') {
  193. // uni.showToast({
  194. // icon: "none",
  195. // title: '正在开发中...',
  196. // duration: 1500
  197. // })
  198. // } else {
  199. // uni.showToast({
  200. // icon: "none",
  201. // title: '该账户已删除',
  202. // duration: 1500
  203. // })
  204. // }
  205. // } else if (this.getApplicationStatus == '3') {
  206. // if (!e.src || e.src == '#' || e.src == '') {
  207. // uni.showToast({
  208. // icon: "none",
  209. // title: '正在开发中...',
  210. // duration: 1500
  211. // })
  212. // } else {
  213. // uni.showToast({
  214. // icon: "none",
  215. // title: '实名认证不通过,请修改后提交',
  216. // duration: 1500
  217. // })
  218. // setTimeout(() => {
  219. // uni.navigateTo({
  220. // url: '/pages/user/certification'
  221. // })
  222. // }, 1000)
  223. // }
  224. // }
  225. // else if (this.getApplicationStatus == '2') {
  226. // uni.showToast({
  227. // icon: "none",
  228. // title: '请先通过实名认证',
  229. // duration: 1500
  230. // })
  231. // }
  232. // } else {
  233. // if (!e.src || e.src == '#' || e.src == '') {
  234. // uni.showToast({
  235. // icon: "none",
  236. // title: '正在开发中...',
  237. // duration: 1500
  238. // })
  239. // } else {
  240. // this.show();
  241. // setTimeout(() => {
  242. // uni.navigateTo({
  243. // url: '/pages/user/infoInput'
  244. // })
  245. // }, 1000)
  246. // }
  247. // }
  248. // } else if (this.userInfo.sysUser.status == '1') {
  249. // if (!e.src || e.src == '#' || e.src == '') {
  250. // uni.showToast({
  251. // icon: "none",
  252. // title: '正在开发中...',
  253. // duration: 1500
  254. // })
  255. // } else {
  256. // this.navigate({
  257. // url: e.src
  258. // }, "navigateTo", true)
  259. // }
  260. // } else {
  261. // this.show1 = false;
  262. // }
  263. },
  264. xueliConfirm(e) {
  265. this.form.xueli = e[0].value;
  266. },
  267. //更新分类指示器
  268. categoryChange(event) {
  269. this.currentPageindex = event.detail.current;
  270. }
  271. }
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. .dots {
  276. display: flex;
  277. justify-content: center;
  278. height: 15upx;
  279. width: 100%;
  280. }
  281. .dots>view {
  282. width: 30upx;
  283. height: 5upx;
  284. background-color: rgba(0, 0, 0, 0.2);
  285. }
  286. .dots>view.active {
  287. background-color: #0A98D5;
  288. }
  289. .swiper {
  290. padding: 10upx 0upx;
  291. }
  292. .category-list {
  293. width: 100%;
  294. height: auto;
  295. display: flex;
  296. justify-content: flex-start;
  297. flex-flow: wrap;
  298. }
  299. .category-title {
  300. font-size: 25upx;
  301. }
  302. .icon {
  303. margin-top: 5upx;
  304. margin-bottom: 5upx;
  305. width: 20%;
  306. height: 150upx;
  307. display: flex;
  308. flex-flow: wrap;
  309. justify-content: center;
  310. font-size: 25upx;
  311. color: #666;
  312. }
  313. .icon image {
  314. margin: 5upx;
  315. width: 65%;
  316. }
  317. .icon>view {
  318. width: 100%;
  319. display: flex;
  320. justify-content: center;
  321. }
  322. </style>