cardHolder.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. <template>
  2. <view class="content">
  3. <u-navbar title="电子名片" placeholder>
  4. <view class="u-nav-slot relative" slot="left">
  5. <u-icon name="bell" size="26" @click="toNotice"></u-icon>
  6. <u-badge :isDot="unread>0?true:false" type="error" class="point"></u-badge>
  7. </view>
  8. </u-navbar>
  9. <view class="content1 flex-row-center">
  10. <view class="col flex">
  11. <uni-icons type="scan" size="30" @click="scan"></uni-icons>
  12. </view>
  13. <view class="search flex flex-between" @click="search">
  14. <view class="left flex">
  15. <uni-icons type="search" size="24"></uni-icons>
  16. <text class="search-val"> {{searchVal?searchVal:'搜索名片'}}</text>
  17. <uni-icons type="closeempty" size="24" @click.native.stop="delSearchVal"
  18. v-if="searchVal"></uni-icons>
  19. </view>
  20. <view class="right">
  21. <uni-icons type="mic" size="24" @click.stop="micOpen"></uni-icons>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="content2">
  26. <view class="all-type flex" @click="selectType">
  27. <text>{{typeName?typeName:'全部分类'}}</text>
  28. <uni-icons type="bottom" size="20"></uni-icons>
  29. </view>
  30. </view>
  31. <!-- <u-skeleton
  32. :animate="true"
  33. rows="3"
  34. title
  35. :loading='loading'
  36. ></u-skeleton> -->
  37. <view v-if='islongPress'>
  38. <view @click="del">删除</view>
  39. <view @click='islongPress=false'>取消</view>
  40. <u-checkbox-group placement="column" @change="checkboxChange($event,'')">
  41. <u-checkbox :checked='checked' name='全部' :customStyle="{marginBottom: '8px'}">
  42. </u-checkbox>
  43. </u-checkbox-group>
  44. </view>
  45. <mescroll-body v-if='cardHolderList' :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback"
  46. @down="downCallback">
  47. <view v-for='(item,index) in cardHolderList' @longpress="longpress" class="content3 flex">
  48. <view class="left">
  49. <view class="top flex-row-center">
  50. <image :src="item.headSculpture" mode="widthFix" class="img"></image>
  51. </view>
  52. <view class="bottom flex flex-evenly">
  53. <uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
  54. <text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
  55. <uni-icons @click='share(item)' type="redo" size="20" color=''></uni-icons>
  56. </view>
  57. </view>
  58. <view class="right">
  59. <view class="row1 flex">
  60. <text>{{item.name}}</text>
  61. <text class="line"></text>
  62. <text>{{item.post}}</text>
  63. <u-checkbox-group v-if='islongPress' placement="column" @change="checkboxChange($event,index)">
  64. <u-checkbox :name='index+1' :checked='item.checked' :customStyle="{marginBottom: '8px'}">
  65. </u-checkbox>
  66. </u-checkbox-group>
  67. </view>
  68. <view class="row2">
  69. {{item.companyName}}
  70. </view>
  71. <view class="row3" @click="toMap(item)">
  72. <uni-icons type="redo" size="20"></uni-icons>
  73. <text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
  74. </view>
  75. <view class="row3">
  76. <uni-icons type="redo" size="20"></uni-icons>
  77. <text>{{item.phone}}</text>
  78. </view>
  79. <view @click='remarkEdit(item)' class="row3">
  80. <uni-icons type="redo" size="20"></uni-icons>
  81. <text>{{item.remark?item.remark:'单击添加备注'}}</text>
  82. </view>
  83. </view>
  84. </view>
  85. </mescroll-body>
  86. <u-picker :show="isShowType" :columns="typeColumns" keyName="circleName" title="选择分类" @close="isShowType=false"
  87. @cancel="isShowType=false" closeOnClickOverlay @confirm="typeConfirm"></u-picker>
  88. <lyuan-tx-asr ref="asr" :uploadMethod="uploadFile" @change="asrChange" @fileChange="fileChange" appId=""
  89. secretId="" secretKey=""></lyuan-tx-asr>
  90. <u-toast ref="uToast"></u-toast>
  91. <u-modal :show="delShow" title="提示" showCancelButton='true' @cancel="delShow=false" @confirm="delConfirm"
  92. :content='"已选中"+this.checkedList.length+"张名片,确定删除?"'></u-modal>
  93. <u-modal :show="modalShow" @confirm='remarkConfirm' :confirmColor="remark?'#2979ff':'#ccc'"
  94. showCancelButton='true' title="备注">
  95. <view class="slot-content">
  96. <u--textarea v-model="remark" placeholder="输入备注,不超过150个字"></u--textarea>
  97. </view>
  98. </u-modal>
  99. <view v-if='qrcodeShow' class="shade">
  100. <view class='qrCode'>
  101. <view style='text-align:right;'>
  102. <uni-icons @click='qrcodeShow=false' type="close" size="20"></uni-icons>
  103. </view>
  104. <image :src="currectData.qrCode" mode=""></image>
  105. </view>
  106. </view>
  107. <u-popup :show="popupshow" mode="bottom">
  108. <view>
  109. <view class="share-to">
  110. <text>分享到</text>
  111. </view>
  112. <view class="content">
  113. <view class="block" @click="toUrl()">
  114. <button class="moment">
  115. <text class="iconfont icon-weixin"></text>
  116. <!-- <image src="/static/img/moment.png" mode="aspectFill"></image> -->
  117. <text>扫码分享</text>
  118. </button>
  119. </view>
  120. <view class="block">
  121. <button class="shareBtn" type="default" data-name="shareBtn" open-type="share"> 分享</button>
  122. </view>
  123. </view>
  124. <view class="cancel" @click.stop="handleHiddenShare">
  125. <text>取消</text>
  126. </view>
  127. </view>
  128. </u-popup>
  129. <!-- <image :src="poster" style="width: 750rpx;height: 1334rpx;"></image> -->
  130. <!-- 生成图片 -->
  131. <poster :list="canvasData" background-color="#FFF"
  132. :width='750' :height='420'
  133. @on-success="posterSuccess" ref="poster" @on-error="posterError"></poster>
  134. </view>
  135. </template>
  136. <script>
  137. import Poster from '../../components/zhangyuhao-poster/Poster.vue'
  138. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  139. export default {
  140. mixins: [MescrollMixin],
  141. components: {
  142. Poster
  143. },
  144. data() {
  145. return {
  146. poster: '',
  147. canvasData: [],
  148. searchVal: '',
  149. isShowType: false,
  150. loading: true,
  151. typeName: '',
  152. typeColumns: [],
  153. cardHolderList: [],
  154. currectData: [],
  155. type: 1,
  156. popupshow: false,
  157. modalShow: false,
  158. remark: '',
  159. islongPress: false,
  160. checked: false,
  161. checkedList: [],
  162. delShow: false,
  163. qrcodeShow: false,
  164. unread: 0,
  165. noticeList: [],
  166. };
  167. },
  168. onShow() {
  169. if (uni.getStorageSync("userInfo")) {
  170. this.userInfo = uni.getStorageSync("userInfo")
  171. this.init()
  172. } else {
  173. this.login()
  174. }
  175. this.searchVal = uni.getStorageSync("search_val") ? uni.getStorageSync("search_val") : ''
  176. },
  177. mounted() {
  178. },
  179. onLoad: function() {
  180. wx.showShareMenu({
  181. withShareTicket: true,
  182. menus: ["shareAppMessage", "shareTimeline"]
  183. })
  184. },
  185. onShareAppMessage(res) {
  186. console.log(1111)
  187. let that = this;
  188. //生成名片图片
  189. let imageUrl = this.poster
  190. console.log("imageUrl",imageUrl)
  191. if (res.from === 'button') {
  192. let path = `/pages/cardHolder/scanCodeAddCard?id=${that.currectData.id}`
  193. return {
  194. title: `${that.currectData.name}分享的名片~`,
  195. path: path,
  196. imageUrl: imageUrl,
  197. };
  198. }
  199. if (res.from === 'menu') {
  200. return {
  201. title: '商通线上商城',
  202. path: '/pages/tabBarPro/index/index',
  203. imageUrl: imageUrl
  204. };
  205. }
  206. },
  207. // 分享到朋友圈
  208. onShareTimeline() {
  209. return {
  210. title: '商通线上商城',
  211. path: '/pages/index/index',
  212. imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  213. };
  214. },
  215. methods: {
  216. handleHiddenShare(){
  217. this.popupshow=false
  218. },
  219. posterError(err) {
  220. console.log(err)
  221. },
  222. posterSuccess(url) {
  223. console.log("hahahah",url)
  224. // 生成成功,会把临时路径在这里返回
  225. this.poster = url;
  226. this.popupshow=true
  227. console.log(url)
  228. },
  229. toHome(item) {
  230. uni.navigateTo({
  231. url: "/pages/mySet/myHome?id=" + item.personalHomeId
  232. })
  233. },
  234. delSearchVal() {
  235. this.searchVal = ""
  236. uni.removeStorageSync('search_val')
  237. this.mescroll.resetUpScroll()
  238. },
  239. toUrl() {
  240. console.log(this.currectData)
  241. this.popupshow = false
  242. this.qrcodeShow = true
  243. },
  244. share(item) {
  245. this.currectData = item
  246. this.canvasData = [{
  247. type: 'image',
  248. path: item.currentBackground,
  249. use:'bg',
  250. x: -10,
  251. y: 0,
  252. width: 530,
  253. height: 325
  254. },
  255. {
  256. type: 'image',
  257. path: item.headSculpture,
  258. shape: 'circle',
  259. use:'head',
  260. x: 30,
  261. y: 30,
  262. width: 100,
  263. height: 100
  264. },
  265. {
  266. type: 'text',
  267. text:item.name,
  268. use:'name',
  269. x: 150,
  270. y: 50,
  271. size:26,
  272. color:'#000'
  273. },
  274. {
  275. type: 'text',
  276. text:item.post,
  277. use:'post',
  278. x: 240,
  279. y: 55,
  280. size:20,
  281. color:'#666666'
  282. },
  283. {
  284. type: 'text',
  285. text:item.companyName,
  286. use:'companyName',
  287. x: 150,
  288. y: 95,
  289. size:20,
  290. color:'#000'
  291. },
  292. {
  293. type: 'image',
  294. path: '../../static/imgs/card/address2.png',
  295. use:'address-icon',
  296. x: 145,
  297. y: 125,
  298. width: 30,
  299. height: 28
  300. },
  301. {
  302. type: 'textarea',
  303. text:item.province+item.city+item.area+item.detailedAddress,
  304. lineSpace:1,
  305. width:320,
  306. use:'address',
  307. x: 175,
  308. y: 135,
  309. size:14,
  310. color:'#000'
  311. },
  312. {
  313. type: 'image',
  314. path: '../../static/imgs/card/phone.png',
  315. use:'phone-icon',
  316. x: 145,
  317. y: 160,
  318. width: 26,
  319. height: 26
  320. },
  321. {
  322. type: 'text',
  323. text:item.phone,
  324. use:'phone',
  325. x: 175,
  326. y: 167,
  327. size:14,
  328. color:'#000'
  329. },
  330. {
  331. type: 'image',
  332. path: '../../static/imgs/card/remark.png',
  333. use:'remark-icon',
  334. x: 145,
  335. y: 190,
  336. width: 30,
  337. height: 30
  338. },
  339. {
  340. type: 'textarea',
  341. text:item.remark?item.remark:'单击添加备注',
  342. use:'remark',
  343. lineSpace:2,
  344. width:200,
  345. x: 180,
  346. y: 200,
  347. size:13,
  348. color:'#000'
  349. },
  350. {
  351. type: 'image',
  352. path: '../../static/imgs/card/bg3.png',
  353. use:'bg1',
  354. x: 0,
  355. y: 243,
  356. width: 370,
  357. height: 67
  358. },
  359. {
  360. type: 'image',
  361. path: '../../static/imgs/card/bg4.png',
  362. use:'bg2',
  363. x: 355,
  364. y: 243,
  365. width: 150,
  366. height: 67
  367. },
  368. {
  369. type: 'image',
  370. path: '../../static/imgs/card/home.png',
  371. use:'home',
  372. x: 65,
  373. y: 260,
  374. width: 33,
  375. height: 33
  376. },
  377. {
  378. type: 'text',
  379. text:item.classifyName?item.classifyName:'默',
  380. use:'phone',
  381. x: 145,
  382. y: 263,
  383. size:34,
  384. color:'#fff'
  385. },
  386. {
  387. type: 'image',
  388. path: '../../static/imgs/card/share.png',
  389. use:'share',
  390. x: 235,
  391. y: 263,
  392. width: 33,
  393. height: 28
  394. },
  395. ]
  396. // this.popupshow = true
  397. },
  398. async delConfirm() {
  399. uni.showLoading({
  400. title: '数据加载中',
  401. mask: true
  402. })
  403. for (var i = 0; i < this.checkedList.length; i++) {
  404. await this.$request.baseRequest('admin.unimall.cardHolderInfo', 'delete', {
  405. id: this.checkedList[i].data.id,
  406. }, failres => {
  407. console.log('res+++++', failres.errmsg)
  408. this.$refs.uToast.show({
  409. type: 'error',
  410. message: failres.errmsg,
  411. })
  412. }).then(res => {
  413. console.log(i, this.checkedList.length - 1)
  414. if (i == this.checkedList.length - 1) {
  415. uni.hideLoading()
  416. this.$refs.uToast.show({
  417. type: 'success',
  418. message: '删除成功',
  419. })
  420. this.delShow = false
  421. this.islongPress = false
  422. this.mescroll.resetUpScroll()
  423. }
  424. })
  425. }
  426. },
  427. del() {
  428. this.delShow = true
  429. },
  430. longpress() {
  431. console.log("长按事件", 1111111111);
  432. this.islongPress = true;
  433. },
  434. checkboxChange(e, i) {
  435. console.log(e, i, 111111111)
  436. if (i === '') {
  437. console.log(this.checked)
  438. this.checked = !this.checked;
  439. this.cardHolderList.map(item => item.checked = this.checked);
  440. this.$forceUpdate()
  441. var checkList = this.cardHolderList.filter((item) => {
  442. return item.checked == true
  443. })
  444. var data = checkList.map((item, index) => {
  445. return {
  446. index: index,
  447. data: item
  448. }
  449. })
  450. this.checkedList = JSON.parse(JSON.stringify(data))
  451. } else {
  452. if (e[0]) {
  453. this.checkedList.push({
  454. index: i,
  455. data: this.cardHolderList[i]
  456. })
  457. } else {
  458. var index = this.checkedList.findIndex((item) => {
  459. return item.index == i
  460. })
  461. this.checkedList.splice(index, 1)
  462. }
  463. if (this.checkedList.length != this.cardHolderList.length) {
  464. this.checked = false
  465. }
  466. }
  467. // for(var i=0;i<this.cardList.length;i++){
  468. // console.log(this.cardList[i].checked)
  469. // // if(this.cardList[i].checkedList.length>0){
  470. // // this.checkedList.push(i)
  471. // // }
  472. // }
  473. console.log(this.checkedList)
  474. },
  475. remarkConfirm() {
  476. if (this.remark) {
  477. this.currectData.remark = this.remark
  478. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  479. cardHolderInfo: JSON.stringify(this.currectData),
  480. }, failres => {
  481. console.log('res+++++', failres.errmsg)
  482. this.$refs.uToast.show({
  483. type: 'error',
  484. message: failres.errmsg,
  485. })
  486. }).then(res => {
  487. this.$refs.uToast.show({
  488. type: 'success',
  489. message: '修改备注成功',
  490. })
  491. this.modalShow = false
  492. this.mescroll.resetUpScroll()
  493. })
  494. }
  495. },
  496. remarkEdit(item) {
  497. this.currectData = item
  498. this.modalShow = true
  499. },
  500. switchType(item) {
  501. this.type = 2
  502. this.currectData = item
  503. this.isShowType = true
  504. },
  505. typeConfirm(e) {
  506. if (this.type == 2) {
  507. this.currectData.classify = e.value[0].circleName
  508. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'update', {
  509. cardHolderInfo: JSON.stringify(this.currectData),
  510. }, failres => {
  511. console.log('res+++++', failres.errmsg)
  512. this.$refs.uToast.show({
  513. type: 'error',
  514. message: failres.errmsg,
  515. })
  516. }).then(res => {
  517. this.$refs.uToast.show({
  518. type: 'success',
  519. message: '修改分类成功',
  520. })
  521. this.mescroll.resetUpScroll()
  522. })
  523. } else {
  524. this.typeName = e.value[0].circleName
  525. }
  526. this.isShowType = false
  527. },
  528. init() {
  529. this.getList()
  530. this.$request.baseRequest('admin.unimall.cardClassifyInfo', 'list', {
  531. page: 1,
  532. limit: 9999,
  533. commonId: uni.getStorageSync("userInfo").id
  534. }, failres => {
  535. console.log('res+++++', failres.errmsg)
  536. this.$refs.uToast.show({
  537. type: 'error',
  538. message: failres.errmsg,
  539. })
  540. }).then(res => {
  541. this.typeColumns = [res.data.items]
  542. this.mescroll.resetUpScroll()
  543. console.log(this.typeColumns)
  544. })
  545. },
  546. getList() {
  547. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list', {
  548. receiveId: uni.getStorageSync("userInfo").id,
  549. }, failres => {
  550. console.log('res+++++', failres.errmsg)
  551. this.$refs.uToast.show({
  552. type: 'error',
  553. message: failres.errmsg,
  554. })
  555. }).then(res => {
  556. this.noticeList = res.data.items
  557. if (this.noticeList.length > 0) {
  558. var data = this.noticeList.filter((item) => {
  559. return item.newsFlag == 0
  560. })
  561. this.unread = data ? data.length : 0
  562. }
  563. console.log(this.unread)
  564. })
  565. },
  566. upCallback(page) {
  567. var that = this
  568. uni.showLoading({
  569. title: '数据加载中'
  570. })
  571. this.$request.baseRequest('admin.unimall.cardHolderInfo', 'list', {
  572. page: page.num,
  573. limit: page.size,
  574. commonId: uni.getStorageSync("userInfo").id,
  575. searchContent: this.searchVal
  576. }, failres => {
  577. console.log('res+++++', failres.errmsg)
  578. this.$refs.uToast.show({
  579. type: 'error',
  580. message: failres.errmsg,
  581. })
  582. uni.hideLoading()
  583. }).then(res => {
  584. console.log(res)
  585. if (page.num == 1) this.cardHolderList = [];
  586. let curPageLen = res.data.items.length;
  587. let totalPage = res.data.total;
  588. for (var i = 0; i < res.data.items.length; i++) {
  589. res.data.items[i].checked = false
  590. if (res.data.items[i].classify) {
  591. res.data.items[i].classifyName = res.data.items[i].classify[0]
  592. }
  593. }
  594. this.cardHolderList = res.data.items
  595. this.loading = false
  596. // if(res.data.items.length>0){
  597. // for(var i=0;i<res.data.items.length;i++){
  598. // res.data.items[i].name=res.data.items[i].circleName[0]
  599. // }
  600. // var itemIndex=res.data.items.findIndex((item)=>{return item.topMarking==1})
  601. // if(itemIndex!=-1){
  602. // var data=res.data.items.splice(itemIndex,1)
  603. // if(page.num==1){
  604. // data.push({circleName:'默认分类',name:'默'})
  605. // }
  606. // res.data.items=data.concat(res.data.items)
  607. // }else{
  608. // if(page.num==1){
  609. // res.data.items=[{circleName:'默认分类',name:'默'}].concat(res.data.items)
  610. // }
  611. // }
  612. // this.cardTypeList=this.cardTypeList.concat(res.data.items)
  613. // }else{
  614. // if(page.num==1){
  615. // this.cardTypeList=[{circleName:'默认分类',name:'默'}]
  616. // }
  617. // }
  618. this.$nextTick(() => {
  619. console.log(that)
  620. // mescroll.endSuccess(data.result);
  621. that.mescroll.endBySize(curPageLen, totalPage)
  622. });
  623. // if (res.errno == 200) {
  624. uni.hideLoading()
  625. // }
  626. })
  627. },
  628. login() {
  629. let that = this
  630. uni.login({
  631. "provider": "weixin",
  632. success: function(wxres) {
  633. that.$request.baseRequest('commonUserApp', 'commonUserLogin', {
  634. loginType: 1,
  635. raw: JSON.stringify(wxres)
  636. }, failres => {
  637. this.$refs.uToast.show({
  638. type: 'error',
  639. message: failres.errmsg,
  640. })
  641. uni.hideLoading()
  642. }).then(res => {
  643. uni.getUserInfo({
  644. provider: 'weixin',
  645. success: function(info) {
  646. console.log(info)
  647. res.data.nickname = info.userInfo.nickName
  648. res.data.head = info.userInfo.avatarUrl
  649. that.$request.baseRequest('commonUserApp', 'edit', {
  650. commonUserInfo: JSON.stringify(res.data)
  651. }, failres => {
  652. this.$refs.uToast.show({
  653. type: 'error',
  654. message: failres.errmsg,
  655. })
  656. uni.hideLoading()
  657. }).then(res1 => {
  658. uni.setStorageSync("userInfo", res1.data)
  659. })
  660. }
  661. })
  662. })
  663. },
  664. fail: function(err) {
  665. // 登录授权失败
  666. // err.code是错误码
  667. }
  668. })
  669. },
  670. toNotice() {
  671. uni.navigateTo({
  672. url: "/pages/cardHolder/notice"
  673. })
  674. },
  675. micOpen: function() {
  676. this.$refs.asr.show();
  677. },
  678. asrChange: function(res) {
  679. console.log('语音识别确认结果:' + res);
  680. },
  681. fileChange: function({
  682. file,
  683. content
  684. }) {
  685. console.log('录音文件', file);
  686. },
  687. uploadFile: function(tempFilePath) {
  688. return new Promise((resolve, reject) => {
  689. //调用你的接口把音频文件转为文字
  690. this.$minApi.upload('txasr/SentenceRecognition', null, tempFilePath)
  691. .then(res => {
  692. if (res.code == 1) {
  693. resolve(res.data.Result);
  694. } else {
  695. reject(e);
  696. }
  697. })
  698. .catch(e => {
  699. reject(e);
  700. });
  701. });
  702. },
  703. search() {
  704. uni.navigateTo({
  705. url: "/pages/cardHolder/search"
  706. })
  707. },
  708. input(res) {
  709. console.log('----input:', res)
  710. },
  711. clear(res) {
  712. uni.showToast({
  713. title: 'clear事件,清除值为:' + res.value,
  714. icon: 'none'
  715. })
  716. },
  717. blur(res) {
  718. uni.showToast({
  719. title: 'blur事件,输入值为:' + res.value,
  720. icon: 'none'
  721. })
  722. },
  723. focus(e) {
  724. uni.showToast({
  725. title: 'focus事件,输出值为:' + e.value,
  726. icon: 'none'
  727. })
  728. },
  729. cancel(res) {
  730. uni.showToast({
  731. title: '点击取消,输入值为:' + res.value,
  732. icon: 'none'
  733. })
  734. },
  735. selectType() {
  736. this.isShowType = true
  737. this.type = 1
  738. },
  739. scan() {
  740. // console.log(1)
  741. // uni.navigateTo({
  742. // url: "/pages/cardHolder/scancode"
  743. // })
  744. uni.scanCode({
  745. success: function(res) {
  746. console.log('条码类型:' + res.scanType);
  747. console.log('条码内容:' + res.result);
  748. uni.navigateTo({
  749. url: "/pages/cardHolder/scanCodeAddCard?id=" + res.result
  750. })
  751. }
  752. });
  753. },
  754. toMap(item) {
  755. uni.navigateTo({
  756. url: "/pages/cardHolder/map?location=" + item.location
  757. })
  758. },
  759. }
  760. }
  761. </script>
  762. <style lang="scss" scoped>
  763. .content {
  764. padding: 0 20rpx;
  765. }
  766. .u-nav-slot {
  767. /deep/.u-badge {
  768. position: absolute;
  769. top: 0;
  770. right: 6rpx;
  771. }
  772. }
  773. .content1 {
  774. margin-top: 20rpx;
  775. .search {
  776. margin-left: 20rpx;
  777. border: 1px solid #ccc;
  778. border-radius: 50rpx;
  779. width: 100%;
  780. padding: 10rpx 30rpx;
  781. box-sizing: border-box;
  782. .left {
  783. .search-val {
  784. margin-left: 30rpx;
  785. }
  786. }
  787. }
  788. }
  789. .content2 {
  790. .all-type {}
  791. }
  792. .content3 {
  793. border: 1px solid #ccc;
  794. border-radius: 30rpx;
  795. padding: 40rpx;
  796. box-sizing: border-box;
  797. .left {
  798. width: 30%;
  799. .top {
  800. margin-bottom: 20rpx;
  801. }
  802. .img {
  803. width: 80%;
  804. }
  805. .bottom {}
  806. }
  807. .right {
  808. .row1 {
  809. .line {
  810. width: 1px;
  811. height: 20px;
  812. margin: 0 20rpx;
  813. background: black;
  814. }
  815. }
  816. }
  817. }
  818. .slot-content {
  819. width: 100%;
  820. }
  821. .shade {
  822. background: rgba(0, 0, 0, 0.2);
  823. width: 100%;
  824. height: 100vh;
  825. position: fixed;
  826. top: 0;
  827. left: 0;
  828. }
  829. .qrCode {
  830. position: absolute;
  831. top: 50%;
  832. left: 0;
  833. right: 0;
  834. transform: translateY(-50%);
  835. text-align: center;
  836. }
  837. </style>