123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <view class="uni-popup-dialog">
- <view class="wx-auth">
- <view class="logo-box">
- <image style="width: 100%;height: 100%;border-radius: 50%;" src="../../static/wx-share.png" mode=""></image>
- </view>
- <view class="close-box">
- <image style="width: 100%;height: 100%;border-radius: 50%;" @click="close" src="../../static/wx-cancel.png" mode=""></image>
- </view>
- <view class="content-box">
- <view class="title">
- 微信授权
- </view>
- <view class="content">
- 获取您的微信头像、昵称信息。
- </view>
- <!-- <button class="auth-btn" @getuserinfo="onOk" open-type="getUserInfo">同意授权</button> -->
- <button class="auth-btn" @click="onOk" >同意授权</button>
- </view>
- </view>
- <!-- <view class="uni-dialog-button-group">
- <view class="uni-dialog-button" @click="close">
- <text class="uni-dialog-button-text">取消</text>
- </view>
- <view class="uni-dialog-button uni-border-left" @click="onOk">
- <text class="uni-dialog-button-text uni-button-color">确定</text>
- </view>
- </view> -->
- </view>
- </template>
- <script>
- /**
- * PopUp 弹出层-对话框样式
- * @description 弹出层-对话框样式
- * @tutorial https://ext.dcloud.net.cn/plugin?id=329
- * @property {String} value input 模式下的默认值
- * @property {String} placeholder input 模式下输入提示
- * @property {String} type = [success|warning|info|error] 主题样式
- * @value success 成功
- * @value warning 提示
- * @value info 消息
- * @value error 错误
- * @property {String} mode = [base|input] 模式、
- * @value base 基础对话框
- * @value input 可输入对话框
- * @property {String} content 对话框内容
- * @property {Boolean} beforeClose 是否拦截取消事件
- * @event {Function} confirm 点击确认按钮触发
- * @event {Function} close 点击取消按钮触发
- */
- export default {
- name: "uniPopupDialog",
- props: {
- value: {
- type: [String, Number],
- default: ''
- },
- placeholder: {
- type: [String, Number],
- default: '请输入内容'
- },
- /**
- * 对话框主题 success/warning/info/error 默认 success
- */
- type: {
- type: String,
- default: 'error'
- },
- /**
- * 对话框模式 base/input
- */
- mode: {
- type: String,
- default: 'base'
- },
- /**
- * 对话框标题
- */
- title: {
- type: String,
- default: '提示'
- },
- /**
- * 对话框内容
- */
- content: {
- type: String,
- default: ''
- },
- /**
- * 拦截取消事件 ,如果拦截取消事件,必须监听close事件,执行 done()
- */
- beforeClose: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- dialogType: 'error',
- focus: false,
- val: ""
- }
- },
- inject: ['popup'],
- watch: {
- type(val) {
- this.dialogType = val
- },
- mode(val) {
- if (val === 'input') {
- this.dialogType = 'info'
- }
- },
- value(val) {
- this.val = val
- }
- },
- created() {
- // 对话框遮罩不可点击
- this.popup.mkclick = false
- if (this.mode === 'input') {
- this.dialogType = 'info'
- this.val = this.value
- } else {
- this.dialogType = this.type
- }
- },
- mounted() {
- this.focus = true
- },
- methods: {
- /**
- * 点击确认按钮
- */
- onOk(e) {
- // console.log('onOk ' + JSON.stringify(e))
- this.$emit('confirm', () => {
- this.popup.close()
- if (this.mode === 'input') this.val = this.value
- }, e)// 注意最后这个参数e要传到前端
- },
- /**
- * 点击取消按钮
- */
- close() {
- if (this.beforeClose) {
- this.$emit('close', () => {
- this.popup.close()
- })
- return
- }
- this.popup.close()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .uni-popup-dialog {
- // width: 300px;
- // border-radius: 15px;
- // background-color: #fff;
- }
- .uni-dialog-title {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: center;
- padding-top: 15px;
- padding-bottom: 5px;
- }
- .uni-dialog-title-text {
- font-size: 16px;
- font-weight: 500;
- }
- .uni-dialog-content {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: center;
- align-items: center;
- padding: 5px 15px 15px 15px;
- font-size: 32rpx;
- }
- .uni-dialog-content-text {
- font-size: 14px;
- color: #6e6e6e;
- }
- .uni-dialog-button-group {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- border-top-color: #f5f5f5;
- border-top-style: solid;
- border-top-width: 1px;
- }
- .uni-dialog-button {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex: 1;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- height: 45px;
- }
- .uni-border-left {
- border-left-color: #f0f0f0;
- border-left-style: solid;
- border-left-width: 1px;
- }
- .uni-dialog-button-text {
- font-size: 14px;
- }
- .uni-button-color {
- color: $uni-color-primary;
- }
- .uni-dialog-input {
- flex: 1;
- font-size: 14px;
- }
- .uni-popup__success {
- color: $uni-color-success;
- }
- .uni-popup__warn {
- color: $uni-color-warning;
- }
- .uni-popup__error {
- color: $uni-color-error;
- }
- .uni-popup__info {
- color: #909399;
- }
- </style>
- <style lang="scss" scoped>
- .wx-auth{
- width: 500rpx;
- height: 300rpx;
- border-radius: 15rpx;
- background-color: #ffffff;
- position: relative;
- padding: 0 40rpx;
- .logo-box{
- width: 100rpx;
- height: 100rpx;
- background-color: #ffffff;
- border: 5rpx solid #dedede;
- border-radius: 50%;
- position: absolute;
- top: -15%;
- left: 50%;
- transform: translateX(-50%);
- }
- .close-box{
- width: 50rpx;
- height: 50rpx;
- position: absolute;
- right:-20rpx;
- top: -20rpx;
- background-color: #FFFFFF;
- border-radius: 50%;
- }
- .content-box{
- padding-top: 70rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .title{
- color: #333333;
- }
- .content{
- color: #999999;
- align-self: center;
- padding-top: 20rpx;
- font-size: 28rpx;
- }
- .auth-btn{
- margin-top: 30rpx;
- background-color: #0284c2;
- width: 50%;
- height: 70rpx;
- line-height: 70rpx;
- text-align: center;
- color: #FFFFFF;
- font-size: 30rpx;
- border-radius: 15rpx;
- }
-
- }
- </style>
|