register.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view class="m-w partol ">
  3. <!-- logo -->
  4. <view class="logo-back"></view>
  5. <!-- 机房制度弹窗 -->
  6. <u-popup :mask-close-able="false" mode="top" v-model="explain_show" width="650rpx">
  7. <scroll-view scroll-y="true" style="height: 900rpx;">
  8. <view class="content u-p-l-24 u-p-r-24 u-p-t-22">
  9. <view v-html="content">
  10. {{content}}
  11. </view>
  12. <view class="confrim-btn1">
  13. <u-button type="primary" @click="explain_show = false;">已阅读并同意执行
  14. </u-button>
  15. </view>
  16. </view>
  17. </scroll-view>
  18. </u-popup>
  19. <!-- 表单 -->
  20. <view class=" m-w title-font u-p-l-30 u-p-r-30">
  21. <view class=" m-w u-flex u-m-t-30 u-col-center">
  22. <u-image :src="logo" width="70" height="70"></u-image>
  23. <view class="u-m-l-14">
  24. <view class="u-font-32">赣西云出入系统</view>
  25. <view class="u-font-28 u-m-t-14" style="color: rgba(255, 255, 255, .4);">带*号为必填项</view>
  26. </view>
  27. </view>
  28. <scroll-view class="cell-item u-p-l-20 u-p-r-20">
  29. <u-form ref="uForm" label-position="top" :model="form">
  30. <c-form-item :required="true" label="姓名" prop="username">
  31. <u-input placeholder="请输入名字" :border="true" v-model="form.username" />
  32. </c-form-item>
  33. <c-form-item :required="true" label="手机号" prop="userPhone">
  34. <u-input type="number" placeholder="请输入手机号" :border="true" v-model="form.userPhone" />
  35. </c-form-item>
  36. <c-form-item :required="true" label="访客时长(h)" prop="duration">
  37. <u-input type="number" placeholder="请输入访客时长" :border="true" v-model="form.duration" />
  38. </c-form-item>
  39. <c-form-item :required="true" label="访客公司" prop="company">
  40. <u-input placeholder="请输入访客公司" :border="true" v-model="form.company" />
  41. </c-form-item>
  42. <c-form-item :required="true" label="事由" prop="reason">
  43. <u-input placeholder="请选择事由" :border="true" v-model="form.reason" />
  44. </c-form-item>
  45. <c-form-item label="是否高风险" prop="highRiskname">
  46. <u-input placeholder="请选择" @click="highRisktshow = true" type="select" :border="true"
  47. v-model="form.highRiskname" />
  48. <u-select :default-value="[1]" v-model="highRisktshow" :list="actionSheetList"
  49. @confirm="highRisonok"></u-select>
  50. </c-form-item>
  51. <c-form-item label="上传行程码" prop="contactname">
  52. <view>
  53. <view class="u-p-l-20 u-p-r-10 u-m-t-20 u-m-b-20 u-flex ">
  54. <c-img ref="img1" @changeImg="changeImg1($event)"></c-img>
  55. </view>
  56. </view>
  57. </c-form-item>
  58. <c-form-item label="上传健康码" prop="confirmname">
  59. <view>
  60. <view class="u-p-l-20 u-p-r-10 u-m-t-20 u-m-b-20 u-flex ">
  61. <c-img ref="img2" @changeImg="changeImg2($event)"></c-img>
  62. </view>
  63. </view>
  64. </c-form-item>
  65. <c-form-item label="上传相关审核资料" prop="uploadimg">
  66. <view>
  67. <view class="u-p-l-20 u-p-r-10 u-m-t-20 u-m-b-20 u-flex ">
  68. <c-img ref="img3" @changeImg="changeImg3($event)"></c-img>
  69. </view>
  70. </view>
  71. </c-form-item>
  72. </u-form>
  73. <view class="procol u-flex u-row-left u-m-t-20 u-m-b-20">
  74. <u-radio-group v-model="value">
  75. <u-radio label-size="28rpx" shape="square" v-for="(item, index) in fa_list" :key="index"
  76. :name="item.name" :disabled="item.disabled">
  77. 已阅读并同意{{item.name}}
  78. </u-radio>
  79. </u-radio-group>
  80. <view class="detail_procol" @click="show = true">查看</view>
  81. </view>
  82. <view class="sumit u-m-b-32" @click="resbtn()">提交申请</view>
  83. </scroll-view>
  84. </view>
  85. <!-- 隐私协议弹窗 -->
  86. <u-popup border-radius="15" mode="center" v-model="show" width="650rpx">
  87. <view class="content">
  88. <scroll-view scroll-y="true" style="height: 900rpx;">
  89. <view>
  90. <h2 style="text-align: center; margin-top: 20rpx; margin-bottom: 20rpx; font-weight: 700;">
  91. 《运维智慧掌中宝小程序隐私保护指引》</h2>
  92. <p>本指引是运维智慧掌中宝小程序开发者 "江西省邮电建设工程有限公司"(以下简称“开发者”)为处理你的个人信息而制定。</p>
  93. <p>开发者处理的信息</p>
  94. <p>根据法律规定,开发者仅处理实现小程序功能所必要的信息。</p>
  95. <p>为了方便对访问者进行电话回访,开发者将在获取你的明示同意后,收集你的手机号。</p>
  96. <p>你的权益:</p>
  97. <p>关于你的个人信息,你可以通过以下方式与开发者联系,行使查阅、复制、更正、删除等法定权利。</p>
  98. <p>邮箱:3182863831@qq.com</p>
  99. <p>开发者对信息的存储</p>
  100. <p>开发者承诺,除法律法规另有规定外,开发者对你的信息的保存期限应当为实现处理目的所必要的最短时间。</p>
  101. <p>信息的使用规则:</p>
  102. <p>开发者将会在本指引所明示的用途内使用收集的信息</p>
  103. <p>如开发者使用你的信息超出本指引目的或合理范围,开发者必须在变更使用目的或范围前,再次以短信方式告知并征得你的明示同意。</p>
  104. <p>信息对外提供</p>
  105. <p>开发者承诺,不会主动共享或转让你的信息至任何第三方,如存在确需共享或转让时,开发者应当直接征得或确认第三方征得你的单独同意。</p>
  106. <p>开发者承诺,不会对外公开披露你的信息,如必须公开披露时,开发者应当向你告知公开披露的目的、披露信息的类型及可能涉及的信息,并征得你的单独同意。</p>
  107. <p>你认为开发者未遵守上述约定,或有其他的投诉建议、或未成年人个人信息保护相关问题,可通过以下方式与开发者联系;或者向微信进行投诉。</p>
  108. </view>
  109. </scroll-view>
  110. <view class="confrim-btn">
  111. <u-button type="primary" @click="topup1()">已阅读</u-button>
  112. </view>
  113. </view>
  114. </u-popup>
  115. <!-- 消息提示组件 -->
  116. <u-toast ref="regToast" />
  117. </view>
  118. </template>
  119. <script>
  120. import cImg from '@/components/c-img/index.vue'
  121. import logo from '@/static/img/logo.png'
  122. import {
  123. loginWeixin,
  124. visitorsave,
  125. getMachineInstitu
  126. } from '@/api/index.js'
  127. export default {
  128. components: {
  129. cImg,
  130. },
  131. data() {
  132. return {
  133. logo,
  134. show: false, //用户隐私协议弹窗
  135. explain_show: true, //规章制度弹窗
  136. form: {
  137. openid: undefined, //微信openid
  138. username: undefined, //用户名
  139. userPhone: undefined, //手机
  140. company: undefined, //公司
  141. reason: undefined, //事由
  142. duration: undefined, //时长
  143. highRisk: undefined, //高风险
  144. highRiskname: undefined, //高风险文字
  145. itineraryCode: undefined, //行程码
  146. healthCode: undefined, //健康码
  147. information: undefined, //审核资料
  148. },
  149. highRisktshow: false, //高风险选择弹窗
  150. //选择列表
  151. actionSheetList: [{
  152. value: true,
  153. label: '是'
  154. },
  155. {
  156. value: false,
  157. label: '否'
  158. }
  159. ],
  160. //校验规则
  161. rules: {
  162. username: [{
  163. required: true,
  164. message: '请输入名字',
  165. // 可以单个或者同时写两个触发验证方式
  166. trigger: 'blur,change'
  167. }],
  168. userPhone: [{
  169. required: true,
  170. message: '请输入手机号',
  171. trigger: 'change'
  172. },
  173. {
  174. // 自定义验证函数,见上说明
  175. validator: (rule, value, callback) => {
  176. // 上面有说,返回true表示校验通过,返回false表示不通过
  177. // this.$u.test.mobile()就是返回true或者false的
  178. return this.$u.test.mobile(value);
  179. },
  180. message: '手机号码不正确',
  181. // 触发器可以同时用blur和change
  182. trigger: ['change', 'blur'],
  183. }
  184. ],
  185. duration: [{
  186. required: true,
  187. message: '请输入访问时长',
  188. trigger: 'change',
  189. type: 'number'
  190. },
  191. {
  192. // 自定义验证函数,见上说明
  193. validator: (rule, value, callback) => {
  194. // 上面有说,返回true表示校验通过,返回false表示不通过
  195. // this.$u.test.mobile()就是返回true或者false的
  196. return 0 < value && value <= 24;
  197. },
  198. message: '访问时长必须0~24小时以内',
  199. // 触发器可以同时用blur和change
  200. trigger: ['change', 'blur'],
  201. }
  202. ],
  203. company: [{
  204. required: true,
  205. message: '请输入来访公司',
  206. trigger: 'change'
  207. }],
  208. reason: [{
  209. required: true,
  210. message: '请选择事由',
  211. trigger: 'change'
  212. }],
  213. },
  214. //用户协议选择
  215. fa_list: [{
  216. name: '《用户服务协议》及《隐私政策》',
  217. disabled: false
  218. }],
  219. value: '', //用户协议按钮文字
  220. content: '' //机房制度
  221. }
  222. },
  223. onReady() {
  224. this.$refs.uForm.setRules(this.rules);
  225. },
  226. onLoad() {
  227. this.autoWrite(); //缓存访客信息
  228. this.getInstitu(); // 机房制度信息获取
  229. this.init(); //获取openid
  230. },
  231. methods: {
  232. //填写访客信息缓存
  233. autoWrite() {
  234. let visitor = uni.getStorageSync("visitor");
  235. if(visitor) {
  236. this.form.username = visitor.username;
  237. this.form.userPhone = visitor.userPhone;
  238. this.form.company = visitor.company;
  239. this.form.reason = visitor.reason;
  240. this.form.duration = visitor.duration;
  241. } else{
  242. return false
  243. }
  244. },
  245. //获取机房制度
  246. async getInstitu() {
  247. let {
  248. data,
  249. code,
  250. message
  251. } = await getMachineInstitu();
  252. if (code === 200) {
  253. this.content = data.content;
  254. } else {
  255. this.$refs.regToast.show({
  256. title: message,
  257. type: "info",
  258. })
  259. }
  260. },
  261. //用户保护协议弹窗
  262. topup1() {
  263. this.show = !this.show;
  264. this.value = '《用户服务协议》及《隐私政策》';
  265. },
  266. changeImg1(img) {
  267. this.form.itineraryCode = img;
  268. },
  269. changeImg2(img) {
  270. this.form.healthCode = img;
  271. },
  272. changeImg3(img) {
  273. this.form.information = img;
  274. },
  275. //获取openid
  276. init() {
  277. uni.login({
  278. provider: 'weixin',
  279. success: loginRes => {
  280. loginWeixin({
  281. code: loginRes.code
  282. })
  283. .then(({
  284. data,
  285. code,
  286. message
  287. }) => {
  288. if (code == 200) {
  289. uni.setStorageSync('openid', data)
  290. this.form.openid = data
  291. } else {
  292. this.$refs.regToast.show({
  293. title: message,
  294. type: "info",
  295. })
  296. }
  297. })
  298. }
  299. });
  300. },
  301. resbtn() {
  302. //提交访客信息
  303. if (this.value == '') {
  304. this.$refs.regToast.show({
  305. title: "未勾选用户隐私协议",
  306. type: "info",
  307. })
  308. } else {
  309. this.$refs.uForm.validate(valid => {
  310. if (valid) {
  311. visitorsave(
  312. this.form
  313. ).then(({
  314. data,
  315. code,
  316. message
  317. }) => {
  318. this.$refs.regToast.show({
  319. title: code == 200 ? '提交成功' : message,
  320. type: code == 200 ? "success" : "info",
  321. })
  322. if (code == 200) {
  323. this.setWrite();
  324. this.reset();
  325. } else {
  326. console.log('验证失败');
  327. }
  328. })
  329. };
  330. })
  331. }
  332. },
  333. //重置表单
  334. reset() {
  335. this.form = {
  336. username: '',
  337. userPhone: '',
  338. company: '',
  339. reason: '',
  340. duration: '',
  341. highRiskname: '',
  342. highRisk: '',
  343. itineraryCode: [],
  344. healthCode: [],
  345. informationv: [],
  346. }
  347. this.$refs.img1.reset()
  348. this.$refs.img2.reset()
  349. this.$refs.img3.reset()
  350. },
  351. //缓存访客信息
  352. setWrite() {
  353. let visitor = {
  354. username: this.form.username,
  355. userPhone: this.form.userPhone,
  356. company: this.form.company,
  357. reason: this.form.reason,
  358. duration: this.form.duration
  359. }
  360. uni.setStorageSync("visitor", visitor);
  361. },
  362. //是否风险区选择
  363. highRisonok(e) {
  364. this.form.highRisk = e[0].value
  365. this.form.highRiskname = e[0].label
  366. },
  367. }
  368. }
  369. </script>
  370. <style lang="scss">
  371. .partol {
  372. background: #f0f2f5;
  373. overflow: hidden;
  374. .logo-back {
  375. width: 751rpx;
  376. height: 300rpx;
  377. position: relative;
  378. &::after {
  379. content: '';
  380. width: 140%;
  381. height: 300rpx;
  382. position: absolute;
  383. left: -20%;
  384. top: 0;
  385. border-radius: 0 0 45% 45%;
  386. background: #4a8bff !important;
  387. }
  388. }
  389. .title-font {
  390. width: 690rpx;
  391. font-size: 28rpx;
  392. font-weight: 400;
  393. color: #FFFFFF;
  394. position: absolute;
  395. top: 0;
  396. display: flex;
  397. flex-direction: column;
  398. align-items: center;
  399. .cell-item {
  400. width: 690rpx;
  401. background: #FFFFFF;
  402. border-radius: 20rpx 20rpx 0px 0px;
  403. padding: 1rpx;
  404. margin-top: 35rpx;
  405. box-sizing: border-box;
  406. }
  407. .rig-font {
  408. font-size: 28rpx;
  409. font-family: Microsoft YaHei-3970(82674968);
  410. font-weight: 400;
  411. color: #808080;
  412. }
  413. }
  414. view {
  415. line-height: 1;
  416. }
  417. .sumit {
  418. width: 650rpx;
  419. height: 90rpx;
  420. background: #4A8BFF;
  421. border-radius: 4rpx;
  422. font-size: 28rpx;
  423. font-family: Microsoft YaHei-3970(82674968);
  424. font-weight: bold;
  425. color: #FFFFFF;
  426. text-align: center;
  427. line-height: 90rpx;
  428. }
  429. .procol {
  430. width: 690rpx;
  431. height: 90rpx;
  432. text-align: center;
  433. line-height: 90rpx;
  434. }
  435. .detail_procol {
  436. font-size: 28rpx;
  437. color: #4A8BFF;
  438. }
  439. .upload-image {
  440. line-height: 32px !important;
  441. }
  442. .content {
  443. display: flex;
  444. flex-direction: column;
  445. justify-content: flex-start;
  446. align-items: center;
  447. }
  448. .content p {
  449. margin-left: 10rpx;
  450. margin-bottom: 10rpx !important;
  451. font-size: 28rpx;
  452. line-height: 30rpx;
  453. text-align: left;
  454. }
  455. .confrim-btn1 {
  456. width: 620rpx;
  457. height: 100rpx;
  458. font-size: 24rpx;
  459. font-weight: 400;
  460. text-align: center;
  461. margin-bottom: 20rpx;
  462. margin-top: 30rpx;
  463. }
  464. .confrim-btn {
  465. width: 400rpx;
  466. height: 100rpx;
  467. text-align: center;
  468. margin-bottom: 20rpx;
  469. margin-top: 30rpx;
  470. // margin-left: 125rpx;
  471. }
  472. .u-radio__label {
  473. margin-left: 10rpx !important;
  474. margin-right: 0rpx !important;
  475. }
  476. }
  477. </style>