polyv.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view>
  3. <polyv-player
  4. :vid="保利威的vid 保利威后台里有"
  5. :autoplay="true"
  6. >
  7. </polyv-player>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {
  14. code: '',
  15. form:{
  16. realname:'',
  17. idCard:''
  18. },
  19. codeTips: '',
  20. read:''
  21. };
  22. },
  23. mounted() {},
  24. methods: {
  25. jumpBind(){
  26. let that = this
  27. if(!this.form.realname.trim()){
  28. this.$u.toast('请输入学员姓名');
  29. return
  30. }
  31. if(!this.form.idCard.trim()){
  32. this.$u.toast('请输入身份证卡号');
  33. return
  34. }
  35. let IDRe18 = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
  36. let IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/
  37. if( !IDRe18.test( this.form.idCard ) && !IDre15.test( this.form.idCard ) ) {
  38. this.$u.toast('请输入格式正确的身份证卡号');
  39. console.log(' 验证未通过 ')
  40. return
  41. }
  42. this.$set(this.form,'realname',this.form.realname.trim()) //去除姓名两头空格
  43. that.isUse = true
  44. that.$api.bindId(this.form).then(
  45. res => {
  46. that.isUse = false
  47. if (res.data.code == 200) {
  48. uni.setStorageSync('user_account',uni.getStorageSync('user_account_temp'));
  49. uni.setStorageSync('token',uni.getStorageSync('token_temp'));
  50. uni.removeStorageSync('user_account_temp') //移除临时账号
  51. uni.removeStorageSync('token_temp') //移除临时token
  52. uni.reLaunch({
  53. url:'/pages/index/index'
  54. })
  55. that.$api.getInfo().then(resdata => {
  56. if(resdata.data.code == 200){
  57. that.$store.state.userInfo = resdata.data.data;
  58. }
  59. });
  60. } else {
  61. that.$u.toast(res.data.msg);
  62. }
  63. },
  64. err => {
  65. that.isUse = false
  66. }
  67. );
  68. },
  69. radioGroupChange(e) {
  70. console.log(e);
  71. },
  72. codeChange(text) {
  73. this.codeTips = text;
  74. },
  75. // 获取验证码
  76. getCode() {
  77. if(this.$refs.uCode.canGetCode) {
  78. // 模拟向后端请求验证码
  79. uni.showLoading({
  80. title: '正在获取验证码',
  81. mask: true
  82. })
  83. setTimeout(() => {
  84. uni.hideLoading();
  85. // 这里此提示会被this.start()方法中的提示覆盖
  86. this.$u.toast('验证码已发送');
  87. // 通知验证码组件内部开始倒计时
  88. this.$refs.uCode.start();
  89. }, 2000);
  90. } else {
  91. this.$u.toast('倒计时结束后再发送');
  92. }
  93. },
  94. sectionChange(index) {
  95. this.current = index;
  96. },
  97. getPhoneNumber(e) {
  98. let that = this;
  99. uni.checkSession({
  100. success () {
  101. //session_key 未过期,并且在本生命周期一直有效
  102. that.putInfo(e)
  103. },
  104. fail () {
  105. // session_key 已经失效,需要重新执行登录流程
  106. uni.login({
  107. provider: 'weixin',
  108. success: function(loginRes) {
  109. that.code = loginRes.code;
  110. that.putInfo(e)
  111. }
  112. });
  113. }
  114. })
  115. },
  116. putInfo(e){
  117. let that = this;
  118. if (e.detail.encryptedData) {
  119. let inviteCode = uni.getStorageSync("inviteCode")
  120. //用户同意授权
  121. var datas = {
  122. iv: e.detail.iv,
  123. encryptedData: e.detail.encryptedData,
  124. code: that.code
  125. };
  126. if(inviteCode){
  127. datas.inviteCode = inviteCode
  128. }
  129. that.$api.login(datas).then(
  130. res => {
  131. if (res.data.code == 200) {
  132. uni.setStorageSync('union_id', res.data.data.union_id);
  133. uni.setStorageSync('token', res.data.data.token);
  134. that.$api.getInfo().then(resdata => {
  135. if(resdata.data.code == 200){
  136. uni.navigateBack();
  137. that.$store.state.userInfo = resdata.data.data;
  138. }
  139. });
  140. } else {
  141. uni.showModal({
  142. title: '提示',
  143. content: res.data.msg,
  144. showCancel: false
  145. });
  146. }
  147. },
  148. err => {
  149. console.log(err);
  150. }
  151. );
  152. }
  153. }
  154. },
  155. onLoad(option) {
  156. let that = this;
  157. this.from = option.from;
  158. uni.removeStorageSync('user_account') //移除临时账号
  159. uni.removeStorageSync('token')
  160. uni.login({
  161. provider: 'weixin',
  162. success: function(loginRes) {
  163. that.code = loginRes.code;
  164. }
  165. });
  166. }
  167. };
  168. </script>
  169. <style scoped>
  170. .wxBtn{
  171. position: fixed;
  172. bottom: 10%;
  173. width: 100%;
  174. left: 0;
  175. }
  176. /deep/ .wxBtn button::after{
  177. border: none;
  178. }
  179. .loginBtn{
  180. width: 526rpx;
  181. height: 80rpx;
  182. background: linear-gradient(90deg, #015EEA, #00C0FA);
  183. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  184. opacity: 0.6;
  185. border-radius: 40rpx;
  186. color: #FFFFFF;
  187. text-align: center;
  188. line-height: 80rpx;
  189. margin: 40rpx auto;
  190. }
  191. .wxloginBtn{
  192. background: url("/static/loginBtn.png") no-repeat;
  193. background-size:100% 100%;
  194. border:none;
  195. width: 100rpx;
  196. height: 100rpx;
  197. }
  198. /deep/page {
  199. background-color: #FFFFFF;
  200. height: 100%;
  201. width: 100%;
  202. }
  203. .login_box{
  204. width: 100%;
  205. height: 360rpx;
  206. background: #FFFFFF;
  207. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(1, 99, 235, 0.1);
  208. border-radius: 24rpx;
  209. margin-top: 30rpx;
  210. padding:40rpx 35rpx;
  211. }
  212. /deep/ .u-item-bg{
  213. border-radius: 32px !important;
  214. }
  215. /deep/ .u-subsection{
  216. border-radius: 32px !important;
  217. }
  218. .full_img {
  219. position: absolute;
  220. left: 0;
  221. display: block;
  222. width: 100%;
  223. z-index: -999;
  224. top: 0;
  225. }
  226. .head {
  227. height: 96rpx;
  228. width: 100%;
  229. line-height: 96rpx;
  230. margin-top: 40rpx;
  231. text-align: center;
  232. display: flex;
  233. position: relative;
  234. justify-content: center;
  235. }
  236. .icon {
  237. position: absolute;
  238. left: 30rpx;
  239. }
  240. </style>